162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */
262306a36Sopenharmony_ci/*
362306a36Sopenharmony_ci * Defines macros and constants for Renesas RZ/A2 pin controller pin
462306a36Sopenharmony_ci * muxing functions.
562306a36Sopenharmony_ci */
662306a36Sopenharmony_ci#ifndef __DT_BINDINGS_PINCTRL_RENESAS_RZA2_H
762306a36Sopenharmony_ci#define __DT_BINDINGS_PINCTRL_RENESAS_RZA2_H
862306a36Sopenharmony_ci
962306a36Sopenharmony_ci#define RZA2_PINS_PER_PORT	8
1062306a36Sopenharmony_ci
1162306a36Sopenharmony_ci/* Port names as labeled in the Hardware Manual */
1262306a36Sopenharmony_ci#define PORT0 0
1362306a36Sopenharmony_ci#define PORT1 1
1462306a36Sopenharmony_ci#define PORT2 2
1562306a36Sopenharmony_ci#define PORT3 3
1662306a36Sopenharmony_ci#define PORT4 4
1762306a36Sopenharmony_ci#define PORT5 5
1862306a36Sopenharmony_ci#define PORT6 6
1962306a36Sopenharmony_ci#define PORT7 7
2062306a36Sopenharmony_ci#define PORT8 8
2162306a36Sopenharmony_ci#define PORT9 9
2262306a36Sopenharmony_ci#define PORTA 10
2362306a36Sopenharmony_ci#define PORTB 11
2462306a36Sopenharmony_ci#define PORTC 12
2562306a36Sopenharmony_ci#define PORTD 13
2662306a36Sopenharmony_ci#define PORTE 14
2762306a36Sopenharmony_ci#define PORTF 15
2862306a36Sopenharmony_ci#define PORTG 16
2962306a36Sopenharmony_ci#define PORTH 17
3062306a36Sopenharmony_ci/* No I */
3162306a36Sopenharmony_ci#define PORTJ 18
3262306a36Sopenharmony_ci#define PORTK 19
3362306a36Sopenharmony_ci#define PORTL 20
3462306a36Sopenharmony_ci#define PORTM 21	/* Pins PM_0/1 are labeled JP_0/1 in HW manual */
3562306a36Sopenharmony_ci
3662306a36Sopenharmony_ci/*
3762306a36Sopenharmony_ci * Create the pin index from its bank and position numbers and store in
3862306a36Sopenharmony_ci * the upper 16 bits the alternate function identifier
3962306a36Sopenharmony_ci */
4062306a36Sopenharmony_ci#define RZA2_PINMUX(b, p, f)	((b) * RZA2_PINS_PER_PORT + (p) | (f << 16))
4162306a36Sopenharmony_ci
4262306a36Sopenharmony_ci/*
4362306a36Sopenharmony_ci * Convert a port and pin label to its global pin index
4462306a36Sopenharmony_ci */
4562306a36Sopenharmony_ci#define RZA2_PIN(port, pin)	((port) * RZA2_PINS_PER_PORT + (pin))
4662306a36Sopenharmony_ci
4762306a36Sopenharmony_ci#endif /* __DT_BINDINGS_PINCTRL_RENESAS_RZA2_H */
48