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