1c66ec88fSEmmanuel Vadot /* SPDX-License-Identifier: GPL-2.0 */
2c66ec88fSEmmanuel Vadot /*
3c66ec88fSEmmanuel Vadot  * This header provides constants for pinctrl bindings for TI's K3 SoC
4c66ec88fSEmmanuel Vadot  * family.
5c66ec88fSEmmanuel Vadot  *
62eb4d8dcSEmmanuel Vadot  * Copyright (C) 2018-2021 Texas Instruments Incorporated - https://www.ti.com/
7c66ec88fSEmmanuel Vadot  */
8c66ec88fSEmmanuel Vadot #ifndef _DT_BINDINGS_PINCTRL_TI_K3_H
9c66ec88fSEmmanuel Vadot #define _DT_BINDINGS_PINCTRL_TI_K3_H
10c66ec88fSEmmanuel Vadot 
11*fac71e4eSEmmanuel Vadot /*
12*fac71e4eSEmmanuel Vadot  * These bindings are deprecated, because they do not match the actual
13*fac71e4eSEmmanuel Vadot  * concept of bindings but rather contain pure register values.
14*fac71e4eSEmmanuel Vadot  * Instead include the header in the DTS source directory.
15*fac71e4eSEmmanuel Vadot  */
16*fac71e4eSEmmanuel Vadot #warning "These bindings are deprecated. Instead, use the header in the DTS source directory."
17*fac71e4eSEmmanuel Vadot 
18c66ec88fSEmmanuel Vadot #define PULLUDEN_SHIFT		(16)
19c66ec88fSEmmanuel Vadot #define PULLTYPESEL_SHIFT	(17)
20c66ec88fSEmmanuel Vadot #define RXACTIVE_SHIFT		(18)
21c66ec88fSEmmanuel Vadot 
22c66ec88fSEmmanuel Vadot #define PULL_DISABLE		(1 << PULLUDEN_SHIFT)
23c66ec88fSEmmanuel Vadot #define PULL_ENABLE		(0 << PULLUDEN_SHIFT)
24c66ec88fSEmmanuel Vadot 
25c66ec88fSEmmanuel Vadot #define PULL_UP			(1 << PULLTYPESEL_SHIFT | PULL_ENABLE)
26c66ec88fSEmmanuel Vadot #define PULL_DOWN		(0 << PULLTYPESEL_SHIFT | PULL_ENABLE)
27c66ec88fSEmmanuel Vadot 
28c66ec88fSEmmanuel Vadot #define INPUT_EN		(1 << RXACTIVE_SHIFT)
29c66ec88fSEmmanuel Vadot #define INPUT_DISABLE		(0 << RXACTIVE_SHIFT)
30c66ec88fSEmmanuel Vadot 
31c66ec88fSEmmanuel Vadot /* Only these macros are expected be used directly in device tree files */
32c66ec88fSEmmanuel Vadot #define PIN_OUTPUT		(INPUT_DISABLE | PULL_DISABLE)
33c66ec88fSEmmanuel Vadot #define PIN_OUTPUT_PULLUP	(INPUT_DISABLE | PULL_UP)
34c66ec88fSEmmanuel Vadot #define PIN_OUTPUT_PULLDOWN	(INPUT_DISABLE | PULL_DOWN)
35c66ec88fSEmmanuel Vadot #define PIN_INPUT		(INPUT_EN | PULL_DISABLE)
36c66ec88fSEmmanuel Vadot #define PIN_INPUT_PULLUP	(INPUT_EN | PULL_UP)
37c66ec88fSEmmanuel Vadot #define PIN_INPUT_PULLDOWN	(INPUT_EN | PULL_DOWN)
38c66ec88fSEmmanuel Vadot 
397ef62cebSEmmanuel Vadot #define AM62AX_IOPAD(pa, val, muxmode)		(((pa) & 0x1fff)) ((val) | (muxmode))
407ef62cebSEmmanuel Vadot #define AM62AX_MCU_IOPAD(pa, val, muxmode)	(((pa) & 0x1fff)) ((val) | (muxmode))
417ef62cebSEmmanuel Vadot 
427ef62cebSEmmanuel Vadot #define AM62X_IOPAD(pa, val, muxmode)		(((pa) & 0x1fff)) ((val) | (muxmode))
437ef62cebSEmmanuel Vadot #define AM62X_MCU_IOPAD(pa, val, muxmode)	(((pa) & 0x1fff)) ((val) | (muxmode))
447ef62cebSEmmanuel Vadot 
457ef62cebSEmmanuel Vadot #define AM64X_IOPAD(pa, val, muxmode)		(((pa) & 0x1fff)) ((val) | (muxmode))
467ef62cebSEmmanuel Vadot #define AM64X_MCU_IOPAD(pa, val, muxmode)	(((pa) & 0x1fff)) ((val) | (muxmode))
477ef62cebSEmmanuel Vadot 
48c66ec88fSEmmanuel Vadot #define AM65X_IOPAD(pa, val, muxmode)		(((pa) & 0x1fff)) ((val) | (muxmode))
49c66ec88fSEmmanuel Vadot #define AM65X_WKUP_IOPAD(pa, val, muxmode)	(((pa) & 0x1fff)) ((val) | (muxmode))
50c66ec88fSEmmanuel Vadot 
51c66ec88fSEmmanuel Vadot #define J721E_IOPAD(pa, val, muxmode)		(((pa) & 0x1fff)) ((val) | (muxmode))
52c66ec88fSEmmanuel Vadot #define J721E_WKUP_IOPAD(pa, val, muxmode)	(((pa) & 0x1fff)) ((val) | (muxmode))
53c66ec88fSEmmanuel Vadot 
54e67e8565SEmmanuel Vadot #define J721S2_IOPAD(pa, val, muxmode)		(((pa) & 0x1fff)) ((val) | (muxmode))
55e67e8565SEmmanuel Vadot #define J721S2_WKUP_IOPAD(pa, val, muxmode)	(((pa) & 0x1fff)) ((val) | (muxmode))
56e67e8565SEmmanuel Vadot 
57cb7aa33aSEmmanuel Vadot #define J784S4_IOPAD(pa, val, muxmode)		(((pa) & 0x1fff)) ((val) | (muxmode))
58cb7aa33aSEmmanuel Vadot #define J784S4_WKUP_IOPAD(pa, val, muxmode)	(((pa) & 0x1fff)) ((val) | (muxmode))
59cb7aa33aSEmmanuel Vadot 
60c66ec88fSEmmanuel Vadot #endif
61