1 /*
2  * Copyright (c) 2023 Enphase Energy
3  *
4  * SPDX-License-Identifier: Apache-2.0
5  */
6 
7 #ifndef ZEPHYR_INCLUDE_DT_BINDINGS_PINCTRL_TI_K3_PINCTRL_H_
8 #define ZEPHYR_INCLUDE_DT_BINDINGS_PINCTRL_TI_K3_PINCTRL_H_
9 
10 #define PULLUDEN_SHIFT		16
11 #define PULLTYPESEL_SHIFT	17
12 #define RXACTIVE_SHIFT		18
13 
14 #define PULL_DISABLE		(1 << PULLUDEN_SHIFT)
15 #define PULL_ENABLE		(0 << PULLUDEN_SHIFT)
16 
17 #define PULL_UP			((1 << PULLTYPESEL_SHIFT) | PULL_ENABLE)
18 #define PULL_DOWN		((0 << PULLTYPESEL_SHIFT) | PULL_ENABLE)
19 
20 #define INPUT_ENABLE		(1 << RXACTIVE_SHIFT)
21 #define INPUT_DISABLE		(0 << RXACTIVE_SHIFT)
22 
23 /* Only the following macros are intended be used in DTS files */
24 
25 #define PIN_OUTPUT		(INPUT_DISABLE | PULL_DISABLE)
26 #define PIN_OUTPUT_PULLUP	(INPUT_DISABLE | PULL_UP)
27 #define PIN_OUTPUT_PULLDOWN	(INPUT_DISABLE | PULL_DOWN)
28 #define PIN_INPUT		(INPUT_ENABLE | PULL_DISABLE)
29 #define PIN_INPUT_PULLUP	(INPUT_ENABLE | PULL_UP)
30 #define PIN_INPUT_PULLDOWN	(INPUT_ENABLE | PULL_DOWN)
31 
32 #define MUX_MODE_0		0
33 #define MUX_MODE_1		1
34 #define MUX_MODE_2		2
35 #define MUX_MODE_3		3
36 #define MUX_MODE_4		4
37 #define MUX_MODE_5		5
38 #define MUX_MODE_6		6
39 #define MUX_MODE_7		7
40 #define MUX_MODE_8		8
41 #define MUX_MODE_9		9
42 #define MUX_MODE_10		10
43 #define MUX_MODE_11		11
44 #define MUX_MODE_12		12
45 #define MUX_MODE_13		13
46 #define MUX_MODE_14		14
47 
48 #define K3_PINMUX(offset, value, mux_mode)	(((offset) & 0x1fff)) ((value) | (mux_mode))
49 
50 #endif /* ZEPHYR_INCLUDE_DT_BINDINGS_PINCTRL_TI_K3_PINCTRL_H_ */
51