xref: /freebsd-src/sys/contrib/device-tree/include/dt-bindings/pinctrl/sppctl.h (revision c9ccf3a32da427475985b85d7df023ccfb138c27)
1*c9ccf3a3SEmmanuel Vadot /* SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) */
2*c9ccf3a3SEmmanuel Vadot /*
3*c9ccf3a3SEmmanuel Vadot  * Sunplus dt-bindings Pinctrl header file
4*c9ccf3a3SEmmanuel Vadot  * Copyright (C) Sunplus Tech / Tibbo Tech.
5*c9ccf3a3SEmmanuel Vadot  * Author: Dvorkin Dmitry <dvorkin@tibbo.com>
6*c9ccf3a3SEmmanuel Vadot  */
7*c9ccf3a3SEmmanuel Vadot 
8*c9ccf3a3SEmmanuel Vadot #ifndef __DT_BINDINGS_PINCTRL_SPPCTL_H__
9*c9ccf3a3SEmmanuel Vadot #define __DT_BINDINGS_PINCTRL_SPPCTL_H__
10*c9ccf3a3SEmmanuel Vadot 
11*c9ccf3a3SEmmanuel Vadot #define IOP_G_MASTE		(0x01 << 0)
12*c9ccf3a3SEmmanuel Vadot #define IOP_G_FIRST		(0x01 << 1)
13*c9ccf3a3SEmmanuel Vadot 
14*c9ccf3a3SEmmanuel Vadot #define SPPCTL_PCTL_G_PMUX	(0x00        | IOP_G_MASTE)
15*c9ccf3a3SEmmanuel Vadot #define SPPCTL_PCTL_G_GPIO	(IOP_G_FIRST | IOP_G_MASTE)
16*c9ccf3a3SEmmanuel Vadot #define SPPCTL_PCTL_G_IOPP	(IOP_G_FIRST | 0x00)
17*c9ccf3a3SEmmanuel Vadot 
18*c9ccf3a3SEmmanuel Vadot #define SPPCTL_PCTL_L_OUT	(0x01 << 0)	/* Output LOW        */
19*c9ccf3a3SEmmanuel Vadot #define SPPCTL_PCTL_L_OU1	(0x01 << 1)	/* Output HIGH       */
20*c9ccf3a3SEmmanuel Vadot #define SPPCTL_PCTL_L_INV	(0x01 << 2)	/* Input Invert      */
21*c9ccf3a3SEmmanuel Vadot #define SPPCTL_PCTL_L_ONV	(0x01 << 3)	/* Output Invert     */
22*c9ccf3a3SEmmanuel Vadot #define SPPCTL_PCTL_L_ODR	(0x01 << 4)	/* Output Open Drain */
23*c9ccf3a3SEmmanuel Vadot 
24*c9ccf3a3SEmmanuel Vadot /*
25*c9ccf3a3SEmmanuel Vadot  * pack into 32-bit value:
26*c9ccf3a3SEmmanuel Vadot  * pin# (8bit), typ (8bit), function (8bit), flag (8bit)
27*c9ccf3a3SEmmanuel Vadot  */
28*c9ccf3a3SEmmanuel Vadot #define SPPCTL_IOPAD(pin, typ, fun, flg)	(((pin) << 24) | ((typ) << 16) | \
29*c9ccf3a3SEmmanuel Vadot 						((fun) << 8) | (flg))
30*c9ccf3a3SEmmanuel Vadot 
31*c9ccf3a3SEmmanuel Vadot #endif
32