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