1 // SPDX-License-Identifier: GPL-2.0-only
3 * Joshua Henderson <joshua.henderson@microchip.com>
4 * Copyright (C) 2015 Microchip Technology Inc. All rights reserved.
10 #define PPS_BASE 0x1f800000
12 /* Input PPS Registers */
61 #define REFCLKI1R 0x14E8
62 #define REFCLKI3R 0x14F0
63 #define REFCLKI4R 0x14F4
70 { IN_FUNC_INT3
, INT3R
},
71 { IN_FUNC_T2CK
, T2CKR
},
72 { IN_FUNC_T6CK
, T6CKR
},
73 { IN_FUNC_IC3
, IC3R
},
74 { IN_FUNC_IC7
, IC7R
},
75 { IN_FUNC_U1RX
, U1RXR
},
76 { IN_FUNC_U2CTS
, U2CTSR
},
77 { IN_FUNC_U5RX
, U5RXR
},
78 { IN_FUNC_U6CTS
, U6CTSR
},
79 { IN_FUNC_SDI1
, SDI1R
},
80 { IN_FUNC_SDI3
, SDI3R
},
81 { IN_FUNC_SDI5
, SDI5R
},
82 { IN_FUNC_SS6
, SS6R
},
83 { IN_FUNC_REFCLKI1
, REFCLKI1R
},
84 { IN_FUNC_INT4
, INT4R
},
85 { IN_FUNC_T5CK
, T5CKR
},
86 { IN_FUNC_T7CK
, T7CKR
},
87 { IN_FUNC_IC4
, IC4R
},
88 { IN_FUNC_IC8
, IC8R
},
89 { IN_FUNC_U3RX
, U3RXR
},
90 { IN_FUNC_U4CTS
, U4CTSR
},
91 { IN_FUNC_SDI2
, SDI2R
},
92 { IN_FUNC_SDI4
, SDI4R
},
93 { IN_FUNC_C1RX
, C1RXR
},
94 { IN_FUNC_REFCLKI4
, REFCLKI4R
},
95 { IN_FUNC_INT2
, INT2R
},
96 { IN_FUNC_T3CK
, T3CKR
},
97 { IN_FUNC_T8CK
, T8CKR
},
98 { IN_FUNC_IC2
, IC2R
},
99 { IN_FUNC_IC5
, IC5R
},
100 { IN_FUNC_IC9
, IC9R
},
101 { IN_FUNC_U1CTS
, U1CTSR
},
102 { IN_FUNC_U2RX
, U2RXR
},
103 { IN_FUNC_U5CTS
, U5CTSR
},
104 { IN_FUNC_SS1
, SS1R
},
105 { IN_FUNC_SS3
, SS3R
},
106 { IN_FUNC_SS4
, SS4R
},
107 { IN_FUNC_SS5
, SS5R
},
108 { IN_FUNC_C2RX
, C2RXR
},
109 { IN_FUNC_INT1
, INT1R
},
110 { IN_FUNC_T4CK
, T4CKR
},
111 { IN_FUNC_T9CK
, T9CKR
},
112 { IN_FUNC_IC1
, IC1R
},
113 { IN_FUNC_IC6
, IC6R
},
114 { IN_FUNC_U3CTS
, U3CTSR
},
115 { IN_FUNC_U4RX
, U4RXR
},
116 { IN_FUNC_U6RX
, U6RXR
},
117 { IN_FUNC_SS2
, SS2R
},
118 { IN_FUNC_SDI6
, SDI6R
},
119 { IN_FUNC_OCFA
, OCFAR
},
120 { IN_FUNC_REFCLKI3
, REFCLKI3R
},
123 void pic32_pps_input(int function
, int pin
)
125 void __iomem
*pps_base
= ioremap(PPS_BASE
, 0xF4);
128 for (i
= 0; i
< ARRAY_SIZE(input_pin_reg
); i
++) {
129 if (input_pin_reg
[i
].function
== function
) {
130 __raw_writel(pin
, pps_base
+ input_pin_reg
[i
].reg
);
138 /* Output PPS Registers */
139 #define RPA14R 0x1538
140 #define RPA15R 0x153C
150 #define RPB10R 0x1568
151 #define RPB14R 0x1578
152 #define RPB15R 0x157C
157 #define RPC13R 0x15B4
158 #define RPC14R 0x15B8
168 #define RPD10R 0x15E8
169 #define RPD11R 0x15EC
170 #define RPD12R 0x15F0
171 #define RPD14R 0x15F8
172 #define RPD15R 0x15FC
184 #define RPF12R 0x1670
185 #define RPF13R 0x1674
197 } output_pin_reg
[] = {
201 { OUT_RPD10
, RPD10R
},
204 { OUT_RPB10
, RPB10R
},
205 { OUT_RPC14
, RPC14R
},
208 { OUT_RPD14
, RPD14R
},
210 { OUT_RPA14
, RPA14R
},
215 { OUT_RPD11
, RPD11R
},
219 { OUT_RPC13
, RPC13R
},
222 { OUT_RPD15
, RPD15R
},
224 { OUT_RPA15
, RPA15R
},
229 { OUT_RPB15
, RPB15R
},
234 { OUT_RPF12
, RPF12R
},
235 { OUT_RPD12
, RPD12R
},
241 { OUT_RPB14
, RPB14R
},
247 { OUT_RPF13
, RPF13R
},
253 void pic32_pps_output(int function
, int pin
)
255 void __iomem
*pps_base
= ioremap(PPS_BASE
, 0x170);
258 for (i
= 0; i
< ARRAY_SIZE(output_pin_reg
); i
++) {
259 if (output_pin_reg
[i
].pin
== pin
) {
260 __raw_writel(function
,
261 pps_base
+ output_pin_reg
[i
].reg
);