Lines Matching full:pin
3 * Combined GPIO and pin controller support for Renesas RZ/A1 (r7s72100) SoC
9 * This pin controller/gpio combined driver supports Renesas devices of RZ/A1
57 * Use 16 lower bits [15:0] for pin identifier
58 * Use 16 higher bits [31:16] for pin mux function
70 /* Pin mux flags */
80 * rza1_bidir_pin - describe a single pin that needs bidir flag applied.
83 u8 pin: 4; member
97 * rza1_swio_pin - describe a single pin that needs swio flag applied.
100 u16 pin: 4; member
127 { .pin = 0, .func = 1 },
128 { .pin = 1, .func = 1 },
129 { .pin = 2, .func = 1 },
130 { .pin = 3, .func = 1 },
131 { .pin = 4, .func = 1 },
132 { .pin = 5, .func = 1 },
133 { .pin = 6, .func = 1 },
134 { .pin = 7, .func = 1 },
138 { .pin = 0, .func = 1 },
139 { .pin = 1, .func = 1 },
140 { .pin = 2, .func = 1 },
141 { .pin = 3, .func = 1 },
142 { .pin = 4, .func = 1 },
143 { .pin = 0, .func = 4 },
144 { .pin = 1, .func = 4 },
145 { .pin = 2, .func = 4 },
146 { .pin = 3, .func = 4 },
147 { .pin = 5, .func = 1 },
148 { .pin = 6, .func = 1 },
149 { .pin = 7, .func = 1 },
150 { .pin = 8, .func = 1 },
151 { .pin = 9, .func = 1 },
152 { .pin = 10, .func = 1 },
153 { .pin = 11, .func = 1 },
154 { .pin = 12, .func = 1 },
155 { .pin = 13, .func = 1 },
156 { .pin = 14, .func = 1 },
157 { .pin = 15, .func = 1 },
158 { .pin = 12, .func = 4 },
159 { .pin = 13, .func = 4 },
160 { .pin = 14, .func = 4 },
161 { .pin = 15, .func = 4 },
165 { .pin = 3, .func = 2 },
166 { .pin = 10, .func = 7 },
167 { .pin = 11, .func = 7 },
168 { .pin = 13, .func = 7 },
169 { .pin = 14, .func = 7 },
170 { .pin = 15, .func = 7 },
171 { .pin = 10, .func = 8 },
172 { .pin = 11, .func = 8 },
173 { .pin = 13, .func = 8 },
174 { .pin = 14, .func = 8 },
175 { .pin = 15, .func = 8 },
179 { .pin = 0, .func = 8 },
180 { .pin = 1, .func = 8 },
181 { .pin = 2, .func = 8 },
182 { .pin = 3, .func = 8 },
183 { .pin = 10, .func = 3 },
184 { .pin = 11, .func = 3 },
185 { .pin = 13, .func = 3 },
186 { .pin = 14, .func = 3 },
187 { .pin = 15, .func = 3 },
188 { .pin = 10, .func = 4 },
189 { .pin = 11, .func = 4 },
190 { .pin = 13, .func = 4 },
191 { .pin = 14, .func = 4 },
192 { .pin = 15, .func = 4 },
193 { .pin = 12, .func = 5 },
194 { .pin = 13, .func = 5 },
195 { .pin = 14, .func = 5 },
196 { .pin = 15, .func = 5 },
200 { .pin = 0, .func = 1 },
201 { .pin = 1, .func = 1 },
202 { .pin = 2, .func = 1 },
203 { .pin = 3, .func = 1 },
204 { .pin = 4, .func = 1 },
205 { .pin = 5, .func = 1 },
206 { .pin = 6, .func = 1 },
207 { .pin = 7, .func = 1 },
208 { .pin = 8, .func = 1 },
209 { .pin = 9, .func = 1 },
210 { .pin = 10, .func = 1 },
211 { .pin = 11, .func = 1 },
212 { .pin = 12, .func = 1 },
213 { .pin = 13, .func = 1 },
214 { .pin = 14, .func = 1 },
215 { .pin = 15, .func = 1 },
219 { .pin = 13, .func = 3 },
223 { .pin = 8, .func = 3 },
224 { .pin = 9, .func = 3 },
225 { .pin = 10, .func = 3 },
226 { .pin = 11, .func = 3 },
227 { .pin = 14, .func = 2 },
228 { .pin = 15, .func = 2 },
229 { .pin = 14, .func = 3 },
230 { .pin = 15, .func = 3 },
234 { .pin = 0, .func = 2 },
235 { .pin = 1, .func = 2 },
236 { .pin = 4, .func = 2 },
237 { .pin = 5, .func = 2 },
238 { .pin = 6, .func = 2 },
239 { .pin = 7, .func = 2 },
243 { .pin = 6, .func = 2 },
244 { .pin = 7, .func = 2 },
245 { .pin = 9, .func = 2 },
246 { .pin = 6, .func = 4 },
247 { .pin = 7, .func = 4 },
248 { .pin = 9, .func = 4 },
249 { .pin = 10, .func = 2 },
250 { .pin = 11, .func = 2 },
251 { .pin = 10, .func = 4 },
252 { .pin = 11, .func = 4 },
253 { .pin = 12, .func = 4 },
254 { .pin = 13, .func = 4 },
255 { .pin = 14, .func = 4 },
256 { .pin = 15, .func = 4 },
260 { .port = 2, .pin = 7, .func = 4, .input = 0 },
261 { .port = 2, .pin = 11, .func = 4, .input = 0 },
262 { .port = 3, .pin = 7, .func = 3, .input = 0 },
263 { .port = 3, .pin = 7, .func = 8, .input = 0 },
264 { .port = 4, .pin = 7, .func = 5, .input = 0 },
265 { .port = 4, .pin = 7, .func = 11, .input = 0 },
266 { .port = 4, .pin = 15, .func = 6, .input = 0 },
267 { .port = 5, .pin = 0, .func = 1, .input = 1 },
268 { .port = 5, .pin = 1, .func = 1, .input = 1 },
269 { .port = 5, .pin = 2, .func = 1, .input = 1 },
270 { .port = 5, .pin = 3, .func = 1, .input = 1 },
271 { .port = 5, .pin = 4, .func = 1, .input = 1 },
272 { .port = 5, .pin = 5, .func = 1, .input = 1 },
273 { .port = 5, .pin = 6, .func = 1, .input = 1 },
274 { .port = 5, .pin = 7, .func = 1, .input = 1 },
275 { .port = 7, .pin = 4, .func = 6, .input = 0 },
276 { .port = 7, .pin = 11, .func = 2, .input = 0 },
277 { .port = 8, .pin = 10, .func = 8, .input = 0 },
278 { .port = 10, .pin = 15, .func = 2, .input = 0 },
308 { .pin = 0, .func = 1 },
309 { .pin = 1, .func = 1 },
310 { .pin = 2, .func = 1 },
311 { .pin = 3, .func = 1 },
312 { .pin = 4, .func = 1 },
313 { .pin = 5, .func = 1 },
314 { .pin = 6, .func = 1 },
315 { .pin = 7, .func = 1 },
319 { .pin = 0, .func = 2 },
320 { .pin = 1, .func = 2 },
321 { .pin = 2, .func = 2 },
322 { .pin = 4, .func = 2 },
323 { .pin = 5, .func = 2 },
324 { .pin = 10, .func = 2 },
325 { .pin = 11, .func = 2 },
326 { .pin = 12, .func = 2 },
327 { .pin = 13, .func = 2 },
331 { .pin = 1, .func = 4 },
332 { .pin = 2, .func = 2 },
333 { .pin = 3, .func = 2 },
334 { .pin = 6, .func = 2 },
335 { .pin = 7, .func = 2 },
339 { .pin = 0, .func = 1 },
340 { .pin = 1, .func = 1 },
341 { .pin = 2, .func = 1 },
342 { .pin = 3, .func = 1 },
343 { .pin = 4, .func = 1 },
344 { .pin = 5, .func = 1 },
345 { .pin = 6, .func = 1 },
346 { .pin = 7, .func = 1 },
347 { .pin = 8, .func = 1 },
348 { .pin = 9, .func = 1 },
349 { .pin = 10, .func = 1 },
350 { .pin = 11, .func = 1 },
351 { .pin = 12, .func = 1 },
352 { .pin = 13, .func = 1 },
353 { .pin = 14, .func = 1 },
354 { .pin = 15, .func = 1 },
355 { .pin = 0, .func = 2 },
356 { .pin = 1, .func = 2 },
357 { .pin = 2, .func = 2 },
358 { .pin = 3, .func = 2 },
362 { .pin = 0, .func = 1 },
363 { .pin = 1, .func = 1 },
364 { .pin = 2, .func = 1 },
365 { .pin = 3, .func = 1 },
366 { .pin = 4, .func = 1 },
367 { .pin = 5, .func = 1 },
368 { .pin = 6, .func = 1 },
369 { .pin = 7, .func = 1 },
370 { .pin = 8, .func = 1 },
371 { .pin = 9, .func = 1 },
372 { .pin = 10, .func = 1 },
373 { .pin = 11, .func = 1 },
374 { .pin = 12, .func = 1 },
375 { .pin = 13, .func = 1 },
376 { .pin = 14, .func = 1 },
377 { .pin = 15, .func = 1 },
381 { .pin = 2, .func = 2 },
382 { .pin = 3, .func = 2 },
383 { .pin = 5, .func = 2 },
384 { .pin = 6, .func = 2 },
385 { .pin = 7, .func = 2 },
386 { .pin = 2, .func = 3 },
387 { .pin = 3, .func = 3 },
388 { .pin = 5, .func = 3 },
389 { .pin = 6, .func = 3 },
390 { .pin = 7, .func = 3 },
394 { .pin = 1, .func = 2 },
395 { .pin = 0, .func = 3 },
396 { .pin = 1, .func = 3 },
397 { .pin = 3, .func = 3 },
398 { .pin = 4, .func = 3 },
399 { .pin = 5, .func = 3 },
403 { .port = 2, .pin = 8, .func = 2, .input = 0 },
404 { .port = 5, .pin = 6, .func = 3, .input = 0 },
405 { .port = 6, .pin = 6, .func = 3, .input = 0 },
406 { .port = 6, .pin = 10, .func = 3, .input = 0 },
407 { .port = 7, .pin = 10, .func = 2, .input = 0 },
408 { .port = 8, .pin = 2, .func = 3, .input = 0 },
435 * struct rza1_mux_conf - describes a pin multiplexing operation
437 * @id: the pin identifier from 0 to RZA1_NPINS
438 * @port: the port where pin sits on
439 * @pin: pin id
442 * @value: output value to set the pin to
447 u8 pin; member
454 * struct rza1_port - describes a pin port
476 * @nport: number of pin controller ports
477 * @ports: pin controller banks
478 * @pins: pin array for pinctrl core
504 unsigned int pin, in rza1_pinmux_get_bidir() argument
514 if (bidir_pin->pin == pin && bidir_pin->func == func) in rza1_pinmux_get_bidir()
522 unsigned int pin, in rza1_pinmux_get_swio() argument
532 if (swio_pin->port == port && swio_pin->pin == pin && in rza1_pinmux_get_swio()
541 * rza1_pinmux_get_flags() - return pinmux flags associated to a pin
543 static unsigned int rza1_pinmux_get_flags(unsigned int port, unsigned int pin, in rza1_pinmux_get_flags() argument
554 if (rza1_pinmux_get_bidir(port, pin, func, bidir_entries)) in rza1_pinmux_get_flags()
557 ret = rza1_pinmux_get_swio(port, pin, func, swio_entries); in rza1_pinmux_get_flags()
571 * rza1_set_bit() - un-locked set/clear a single bit in pin configuration
597 * rza1_pin_reset() - reset a pin to default initial state
599 * Reset pin state disabling input buffer and bi-directional control,
601 * Note that pin is now configured with direction as input but with input
602 * buffer disabled. This implies the pin value cannot be read in this state.
604 * @port: port where pin sits on
605 * @pin: pin offset
607 static void rza1_pin_reset(struct rza1_port *port, unsigned int pin) in rza1_pin_reset() argument
612 rza1_set_bit(port, RZA1_PIBC_REG, pin, 0); in rza1_pin_reset()
613 rza1_set_bit(port, RZA1_PBDC_REG, pin, 0); in rza1_pin_reset()
615 rza1_set_bit(port, RZA1_PM_REG, pin, 1); in rza1_pin_reset()
616 rza1_set_bit(port, RZA1_PMC_REG, pin, 0); in rza1_pin_reset()
617 rza1_set_bit(port, RZA1_PIPC_REG, pin, 0); in rza1_pin_reset()
622 * rza1_pin_set_direction() - set I/O direction on a pin in port mode
625 * pin value from PPR.
627 * @port: port where pin sits on
628 * @pin: pin offset
632 unsigned int pin, bool input) in rza1_pin_set_direction() argument
638 rza1_set_bit(port, RZA1_PIBC_REG, pin, 1); in rza1_pin_set_direction()
640 rza1_set_bit(port, RZA1_PM_REG, pin, 1); in rza1_pin_set_direction()
641 rza1_set_bit(port, RZA1_PBDC_REG, pin, 0); in rza1_pin_set_direction()
643 rza1_set_bit(port, RZA1_PM_REG, pin, 0); in rza1_pin_set_direction()
644 rza1_set_bit(port, RZA1_PBDC_REG, pin, 1); in rza1_pin_set_direction()
650 static inline void rza1_pin_set(struct rza1_port *port, unsigned int pin, in rza1_pin_set() argument
656 rza1_set_bit(port, RZA1_P_REG, pin, !!value); in rza1_pin_set()
660 static inline int rza1_pin_get(struct rza1_port *port, unsigned int pin) in rza1_pin_get() argument
662 return rza1_get_bit(port, RZA1_PPR_REG, pin); in rza1_pin_get()
666 * rza1_pin_mux_single() - configure pin multiplexing on a single pin
668 * @rza1_pctl: RZ/A1 pin controller device
669 * @mux_conf: pin multiplexing descriptor
675 unsigned int pin = mux_conf->pin; in rza1_pin_mux_single() local
680 rza1_pin_reset(port, pin); in rza1_pin_mux_single()
683 mux_flags_from_table = rza1_pinmux_get_flags(port->id, pin, mux_func, in rza1_pin_mux_single()
691 rza1_set_bit(port, RZA1_PBDC_REG, pin, 1); in rza1_pin_mux_single()
696 * Be careful here: the pin mux sub-nodes in device tree in rza1_pin_mux_single()
716 rza1_set_bit(port, RZA1_PFC_REG, pin, mux_func & MUX_FUNC_PFC_MASK); in rza1_pin_mux_single()
717 rza1_set_bit(port, RZA1_PFCE_REG, pin, mux_func & MUX_FUNC_PFCE_MASK); in rza1_pin_mux_single()
718 rza1_set_bit(port, RZA1_PFCEA_REG, pin, mux_func & MUX_FUNC_PFCEA_MASK); in rza1_pin_mux_single()
723 * to I/O direction specified by pin configuration -after- PMC has been in rza1_pin_mux_single()
727 rza1_set_bit(port, RZA1_PM_REG, pin, in rza1_pin_mux_single()
730 rza1_set_bit(port, RZA1_PIPC_REG, pin, 1); in rza1_pin_mux_single()
732 rza1_set_bit(port, RZA1_PMC_REG, pin, 1); in rza1_pin_mux_single()
742 * rza1_gpio_request() - configure pin in port mode
744 * Configure a pin as gpio (port mode).
745 * After reset, the pin is in input mode with input buffer disabled.
746 * To use the pin as input or output, set_direction shall be called first
761 * rza1_gpio_free() - reset a pin
764 * Reset pin to port mode, with input buffer disabled. This overwrites all
803 /* Set value before driving pin direction */ in rza1_gpio_direction_output()
811 * rza1_gpio_get() - read a gpio pin value
813 * Read gpio pin value through PPR register.
814 * Requires bi-directional mode to work when reading the value of a pin
879 * rza1_parse_pinmux_node() - parse a pin mux sub-node
881 * @rza1_pctl: RZ/A1 pin controller device
883 * @mux_confs: array of pin mux configurations to fill with parsed info
884 * @grpins: array of pin ids to mux
909 * Collect pin configuration properties: they apply to all pins in in rza1_parse_pinmux_node()
916 "Unable to parse pin configuration options for %pOFn\n", in rza1_parse_pinmux_node()
922 * Create a mask with pinmux flags from pin configuration; in rza1_parse_pinmux_node()
943 /* Collect pin positions and their mux settings. */ in rza1_parse_pinmux_node()
954 mux_conf->pin = RZA1_PIN_ID_TO_PIN(mux_conf->id); in rza1_parse_pinmux_node()
959 mux_conf->pin >= RZA1_PINS_PER_PORT) { in rza1_parse_pinmux_node()
961 "Wrong port %u pin %u for %s property\n", in rza1_parse_pinmux_node()
962 mux_conf->port, mux_conf->pin, prop_name); in rza1_parse_pinmux_node()
973 * rza1_dt_node_to_map() - map a pin mux node to a function/group
975 * Parse and register a pin mux function.
977 * @pctldev: pin controller device
979 * @map: pointer to pin map (output)
1004 * in fact, functions and groups are identical for this pin controller in rza1_dt_node_to_map()
1005 * except that functions carry an array of per-pin mux configuration in rza1_dt_node_to_map()
1041 /* Register pin group and function name to pinctrl_generic */ in rza1_dt_node_to_map()
1113 * @pctldev: pin controller device
1155 * RZ/A1 pin controller driver operations
1159 * rza1_parse_gpiochip() - parse and register a gpio chip and pin range
1164 * @rza1_pctl: RZ/A1 pin controller device
1167 * @range: pin range to register to pinctrl core
1231 * @rza1_pctl: RZ/A1 pin controller device
1276 * @rza1_pctl: RZ/A1 pin controller device
1298 unsigned int pin = RZA1_PIN_ID_TO_PIN(i); in rza1_pinctrl_register() local
1303 "P%u-%u", port, pin); in rza1_pinctrl_register()
1325 "RZ/A1 pin controller registration failed\n"); in rza1_pinctrl_register()
1332 "RZ/A1 pin controller failed to start\n"); in rza1_pinctrl_register()
1375 "RZ/A1 pin controller and gpio successfully registered\n"); in rza1_pinctrl_probe()
1409 MODULE_DESCRIPTION("Pin and gpio controller driver for Reneas RZ/A1 SoC");