194693b7bSChris Brandt /* SPDX-License-Identifier: GPL-2.0 */
294693b7bSChris Brandt /*
394693b7bSChris Brandt  * Defines macros and constants for Renesas RZ/A2 pin controller pin
494693b7bSChris Brandt  * muxing functions.
594693b7bSChris Brandt  */
694693b7bSChris Brandt #ifndef __DT_BINDINGS_PINCTRL_RENESAS_RZA2_H
794693b7bSChris Brandt #define __DT_BINDINGS_PINCTRL_RENESAS_RZA2_H
894693b7bSChris Brandt 
994693b7bSChris Brandt #define RZA2_PINS_PER_PORT	8
1094693b7bSChris Brandt 
1194693b7bSChris Brandt /* Port names as labeled in the Hardware Manual */
1294693b7bSChris Brandt #define PORT0 0
1394693b7bSChris Brandt #define PORT1 1
1494693b7bSChris Brandt #define PORT2 2
1594693b7bSChris Brandt #define PORT3 3
1694693b7bSChris Brandt #define PORT4 4
1794693b7bSChris Brandt #define PORT5 5
1894693b7bSChris Brandt #define PORT6 6
1994693b7bSChris Brandt #define PORT7 7
2094693b7bSChris Brandt #define PORT8 8
2194693b7bSChris Brandt #define PORT9 9
2294693b7bSChris Brandt #define PORTA 10
2394693b7bSChris Brandt #define PORTB 11
2494693b7bSChris Brandt #define PORTC 12
2594693b7bSChris Brandt #define PORTD 13
2694693b7bSChris Brandt #define PORTE 14
2794693b7bSChris Brandt #define PORTF 15
2894693b7bSChris Brandt #define PORTG 16
2994693b7bSChris Brandt #define PORTH 17
3094693b7bSChris Brandt /* No I */
3194693b7bSChris Brandt #define PORTJ 18
3294693b7bSChris Brandt #define PORTK 19
3394693b7bSChris Brandt #define PORTL 20
3494693b7bSChris Brandt #define PORTM 21	/* Pins PM_0/1 are labeled JP_0/1 in HW manual */
3594693b7bSChris Brandt 
3694693b7bSChris Brandt /*
3794693b7bSChris Brandt  * Create the pin index from its bank and position numbers and store in
3894693b7bSChris Brandt  * the upper 16 bits the alternate function identifier
3994693b7bSChris Brandt  */
4094693b7bSChris Brandt #define RZA2_PINMUX(b, p, f)	((b) * RZA2_PINS_PER_PORT + (p) | (f << 16))
4194693b7bSChris Brandt 
4294693b7bSChris Brandt /*
4394693b7bSChris Brandt  * Convert a port and pin label to its global pin index
4494693b7bSChris Brandt  */
4594693b7bSChris Brandt #define RZA2_PIN(port, pin)	((port) * RZA2_PINS_PER_PORT + (pin))
4694693b7bSChris Brandt 
4794693b7bSChris Brandt #endif /* __DT_BINDINGS_PINCTRL_RENESAS_RZA2_H */
48