18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */
28c2ecf20Sopenharmony_ci/*
38c2ecf20Sopenharmony_ci * Defines macros and constants for Renesas RZ/A2 pin controller pin
48c2ecf20Sopenharmony_ci * muxing functions.
58c2ecf20Sopenharmony_ci */
68c2ecf20Sopenharmony_ci#ifndef __DT_BINDINGS_PINCTRL_RENESAS_RZA2_H
78c2ecf20Sopenharmony_ci#define __DT_BINDINGS_PINCTRL_RENESAS_RZA2_H
88c2ecf20Sopenharmony_ci
98c2ecf20Sopenharmony_ci#define RZA2_PINS_PER_PORT	8
108c2ecf20Sopenharmony_ci
118c2ecf20Sopenharmony_ci/* Port names as labeled in the Hardware Manual */
128c2ecf20Sopenharmony_ci#define PORT0 0
138c2ecf20Sopenharmony_ci#define PORT1 1
148c2ecf20Sopenharmony_ci#define PORT2 2
158c2ecf20Sopenharmony_ci#define PORT3 3
168c2ecf20Sopenharmony_ci#define PORT4 4
178c2ecf20Sopenharmony_ci#define PORT5 5
188c2ecf20Sopenharmony_ci#define PORT6 6
198c2ecf20Sopenharmony_ci#define PORT7 7
208c2ecf20Sopenharmony_ci#define PORT8 8
218c2ecf20Sopenharmony_ci#define PORT9 9
228c2ecf20Sopenharmony_ci#define PORTA 10
238c2ecf20Sopenharmony_ci#define PORTB 11
248c2ecf20Sopenharmony_ci#define PORTC 12
258c2ecf20Sopenharmony_ci#define PORTD 13
268c2ecf20Sopenharmony_ci#define PORTE 14
278c2ecf20Sopenharmony_ci#define PORTF 15
288c2ecf20Sopenharmony_ci#define PORTG 16
298c2ecf20Sopenharmony_ci#define PORTH 17
308c2ecf20Sopenharmony_ci/* No I */
318c2ecf20Sopenharmony_ci#define PORTJ 18
328c2ecf20Sopenharmony_ci#define PORTK 19
338c2ecf20Sopenharmony_ci#define PORTL 20
348c2ecf20Sopenharmony_ci#define PORTM 21	/* Pins PM_0/1 are labeled JP_0/1 in HW manual */
358c2ecf20Sopenharmony_ci
368c2ecf20Sopenharmony_ci/*
378c2ecf20Sopenharmony_ci * Create the pin index from its bank and position numbers and store in
388c2ecf20Sopenharmony_ci * the upper 16 bits the alternate function identifier
398c2ecf20Sopenharmony_ci */
408c2ecf20Sopenharmony_ci#define RZA2_PINMUX(b, p, f)	((b) * RZA2_PINS_PER_PORT + (p) | (f << 16))
418c2ecf20Sopenharmony_ci
428c2ecf20Sopenharmony_ci/*
438c2ecf20Sopenharmony_ci * Convert a port and pin label to its global pin index
448c2ecf20Sopenharmony_ci */
458c2ecf20Sopenharmony_ci #define RZA2_PIN(port, pin)	((port) * RZA2_PINS_PER_PORT + (pin))
468c2ecf20Sopenharmony_ci
478c2ecf20Sopenharmony_ci#endif /* __DT_BINDINGS_PINCTRL_RENESAS_RZA2_H */
48