xref: /freebsd-src/sys/contrib/device-tree/include/dt-bindings/pinctrl/rzg2l-pinctrl.h (revision b97ee269eae3cbaf35c18f51a459aea581c2a7dc)
1*354d7675SEmmanuel Vadot /* SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) */
2*354d7675SEmmanuel Vadot /*
3*354d7675SEmmanuel Vadot  * This header provides constants for Renesas RZ/G2L family pinctrl bindings.
4*354d7675SEmmanuel Vadot  *
5*354d7675SEmmanuel Vadot  * Copyright (C) 2021 Renesas Electronics Corp.
6*354d7675SEmmanuel Vadot  *
7*354d7675SEmmanuel Vadot  */
8*354d7675SEmmanuel Vadot 
9*354d7675SEmmanuel Vadot #ifndef __DT_BINDINGS_RZG2L_PINCTRL_H
10*354d7675SEmmanuel Vadot #define __DT_BINDINGS_RZG2L_PINCTRL_H
11*354d7675SEmmanuel Vadot 
12*354d7675SEmmanuel Vadot #define RZG2L_PINS_PER_PORT	8
13*354d7675SEmmanuel Vadot 
14*354d7675SEmmanuel Vadot /*
15*354d7675SEmmanuel Vadot  * Create the pin index from its bank and position numbers and store in
16*354d7675SEmmanuel Vadot  * the upper 16 bits the alternate function identifier
17*354d7675SEmmanuel Vadot  */
18*354d7675SEmmanuel Vadot #define RZG2L_PORT_PINMUX(b, p, f)	((b) * RZG2L_PINS_PER_PORT + (p) | ((f) << 16))
19*354d7675SEmmanuel Vadot 
20*354d7675SEmmanuel Vadot /* Convert a port and pin label to its global pin index */
21*354d7675SEmmanuel Vadot #define RZG2L_GPIO(port, pin)	((port) * RZG2L_PINS_PER_PORT + (pin))
22*354d7675SEmmanuel Vadot 
23*354d7675SEmmanuel Vadot #endif /* __DT_BINDINGS_RZG2L_PINCTRL_H */
24