1c66ec88fSEmmanuel Vadot /* SPDX-License-Identifier: GPL-2.0 */
2c66ec88fSEmmanuel Vadot /*
3c66ec88fSEmmanuel Vadot  * This header provides constants for OMAP pinctrl bindings.
4c66ec88fSEmmanuel Vadot  *
5c66ec88fSEmmanuel Vadot  * Copyright (C) 2009 Nokia
6c66ec88fSEmmanuel Vadot  * Copyright (C) 2009-2010 Texas Instruments
7c66ec88fSEmmanuel Vadot  */
8c66ec88fSEmmanuel Vadot 
9c66ec88fSEmmanuel Vadot #ifndef _DT_BINDINGS_PINCTRL_OMAP_H
10c66ec88fSEmmanuel Vadot #define _DT_BINDINGS_PINCTRL_OMAP_H
11c66ec88fSEmmanuel Vadot 
12c66ec88fSEmmanuel Vadot /* 34xx mux mode options for each pin. See TRM for options */
13c66ec88fSEmmanuel Vadot #define MUX_MODE0	0
14c66ec88fSEmmanuel Vadot #define MUX_MODE1	1
15c66ec88fSEmmanuel Vadot #define MUX_MODE2	2
16c66ec88fSEmmanuel Vadot #define MUX_MODE3	3
17c66ec88fSEmmanuel Vadot #define MUX_MODE4	4
18c66ec88fSEmmanuel Vadot #define MUX_MODE5	5
19c66ec88fSEmmanuel Vadot #define MUX_MODE6	6
20c66ec88fSEmmanuel Vadot #define MUX_MODE7	7
21c66ec88fSEmmanuel Vadot 
22c66ec88fSEmmanuel Vadot /* 24xx/34xx mux bit defines */
23c66ec88fSEmmanuel Vadot #define PULL_ENA		(1 << 3)
24c66ec88fSEmmanuel Vadot #define PULL_UP			(1 << 4)
25c66ec88fSEmmanuel Vadot #define ALTELECTRICALSEL	(1 << 5)
26c66ec88fSEmmanuel Vadot 
27c66ec88fSEmmanuel Vadot /* omap3/4/5 specific mux bit defines */
28c66ec88fSEmmanuel Vadot #define INPUT_EN		(1 << 8)
29c66ec88fSEmmanuel Vadot #define OFF_EN			(1 << 9)
30c66ec88fSEmmanuel Vadot #define OFFOUT_EN		(1 << 10)
31c66ec88fSEmmanuel Vadot #define OFFOUT_VAL		(1 << 11)
32c66ec88fSEmmanuel Vadot #define OFF_PULL_EN		(1 << 12)
33c66ec88fSEmmanuel Vadot #define OFF_PULL_UP		(1 << 13)
34c66ec88fSEmmanuel Vadot #define WAKEUP_EN		(1 << 14)
35c66ec88fSEmmanuel Vadot #define WAKEUP_EVENT		(1 << 15)
36c66ec88fSEmmanuel Vadot 
37c66ec88fSEmmanuel Vadot /* Active pin states */
38c66ec88fSEmmanuel Vadot #define PIN_OUTPUT		0
39c66ec88fSEmmanuel Vadot #define PIN_OUTPUT_PULLUP	(PIN_OUTPUT | PULL_ENA | PULL_UP)
40c66ec88fSEmmanuel Vadot #define PIN_OUTPUT_PULLDOWN	(PIN_OUTPUT | PULL_ENA)
41c66ec88fSEmmanuel Vadot #define PIN_INPUT		INPUT_EN
42c66ec88fSEmmanuel Vadot #define PIN_INPUT_PULLUP	(PULL_ENA | INPUT_EN | PULL_UP)
43c66ec88fSEmmanuel Vadot #define PIN_INPUT_PULLDOWN	(PULL_ENA | INPUT_EN)
44c66ec88fSEmmanuel Vadot 
45c66ec88fSEmmanuel Vadot /* Off mode states */
46c66ec88fSEmmanuel Vadot #define PIN_OFF_NONE		0
47c66ec88fSEmmanuel Vadot #define PIN_OFF_OUTPUT_HIGH	(OFF_EN | OFFOUT_EN | OFFOUT_VAL)
48c66ec88fSEmmanuel Vadot #define PIN_OFF_OUTPUT_LOW	(OFF_EN | OFFOUT_EN)
49c66ec88fSEmmanuel Vadot #define PIN_OFF_INPUT_PULLUP	(OFF_EN | OFFOUT_EN | OFF_PULL_EN | OFF_PULL_UP)
50c66ec88fSEmmanuel Vadot #define PIN_OFF_INPUT_PULLDOWN	(OFF_EN | OFFOUT_EN | OFF_PULL_EN)
51c66ec88fSEmmanuel Vadot #define PIN_OFF_WAKEUPENABLE	WAKEUP_EN
52c66ec88fSEmmanuel Vadot 
53c66ec88fSEmmanuel Vadot /*
54c66ec88fSEmmanuel Vadot  * Macros to allow using the absolute physical address instead of the
55c66ec88fSEmmanuel Vadot  * padconf registers instead of the offset from padconf base.
56c66ec88fSEmmanuel Vadot  */
57c66ec88fSEmmanuel Vadot #define OMAP_IOPAD_OFFSET(pa, offset)	(((pa) & 0xffff) - (offset))
58c66ec88fSEmmanuel Vadot 
59c66ec88fSEmmanuel Vadot #define OMAP2420_CORE_IOPAD(pa, val)	OMAP_IOPAD_OFFSET((pa), 0x0030) (val)
60c66ec88fSEmmanuel Vadot #define OMAP2430_CORE_IOPAD(pa, val)	OMAP_IOPAD_OFFSET((pa), 0x2030) (val)
61c66ec88fSEmmanuel Vadot #define OMAP3_CORE1_IOPAD(pa, val)	OMAP_IOPAD_OFFSET((pa), 0x2030) (val)
62c66ec88fSEmmanuel Vadot #define OMAP3430_CORE2_IOPAD(pa, val)	OMAP_IOPAD_OFFSET((pa), 0x25d8) (val)
63c66ec88fSEmmanuel Vadot #define OMAP3630_CORE2_IOPAD(pa, val)	OMAP_IOPAD_OFFSET((pa), 0x25a0) (val)
64c66ec88fSEmmanuel Vadot #define OMAP3_WKUP_IOPAD(pa, val)	OMAP_IOPAD_OFFSET((pa), 0x2a00) (val)
65c66ec88fSEmmanuel Vadot #define DM814X_IOPAD(pa, val)		OMAP_IOPAD_OFFSET((pa), 0x0800) (val)
66c66ec88fSEmmanuel Vadot #define DM816X_IOPAD(pa, val)		OMAP_IOPAD_OFFSET((pa), 0x0800) (val)
67c66ec88fSEmmanuel Vadot #define AM33XX_IOPAD(pa, val)		OMAP_IOPAD_OFFSET((pa), 0x0800) (val)
6878abc9e2SEmmanuel Vadot #define AM33XX_PADCONF(pa, dir, mux)	OMAP_IOPAD_OFFSET((pa), 0x0800) ((dir) | (mux))
69c66ec88fSEmmanuel Vadot 
70c66ec88fSEmmanuel Vadot /*
71c66ec88fSEmmanuel Vadot  * Macros to allow using the offset from the padconf physical address
72c66ec88fSEmmanuel Vadot  * instead  of the offset from padconf base.
73c66ec88fSEmmanuel Vadot  */
74c66ec88fSEmmanuel Vadot #define OMAP_PADCONF_OFFSET(offset, base_offset)	((offset) - (base_offset))
75c66ec88fSEmmanuel Vadot 
76c66ec88fSEmmanuel Vadot #define OMAP4_IOPAD(offset, val)	OMAP_PADCONF_OFFSET((offset), 0x0040) (val)
77c66ec88fSEmmanuel Vadot #define OMAP5_IOPAD(offset, val)	OMAP_PADCONF_OFFSET((offset), 0x0040) (val)
78c66ec88fSEmmanuel Vadot 
79c66ec88fSEmmanuel Vadot /*
80c66ec88fSEmmanuel Vadot  * Define some commonly used pins configured by the boards.
81c66ec88fSEmmanuel Vadot  * Note that some boards use alternative pins, so check
82c66ec88fSEmmanuel Vadot  * the schematics before using these.
83c66ec88fSEmmanuel Vadot  */
84c66ec88fSEmmanuel Vadot #define OMAP3_UART1_RX		0x152
85c66ec88fSEmmanuel Vadot #define OMAP3_UART2_RX		0x14a
86c66ec88fSEmmanuel Vadot #define OMAP3_UART3_RX		0x16e
87c66ec88fSEmmanuel Vadot #define OMAP4_UART2_RX		0xdc
88c66ec88fSEmmanuel Vadot #define OMAP4_UART3_RX		0x104
89c66ec88fSEmmanuel Vadot #define OMAP4_UART4_RX		0x11c
90c66ec88fSEmmanuel Vadot 
91c66ec88fSEmmanuel Vadot #endif
92c66ec88fSEmmanuel Vadot 
93