1262569Simp/*
2262569Simp * This header provides constants for OMAP pinctrl bindings.
3262569Simp *
4262569Simp * Copyright (C) 2009 Nokia
5262569Simp * Copyright (C) 2009-2010 Texas Instruments
6262569Simp */
7262569Simp
8262569Simp#ifndef _DT_BINDINGS_PINCTRL_OMAP_H
9262569Simp#define _DT_BINDINGS_PINCTRL_OMAP_H
10262569Simp
11262569Simp/* 34xx mux mode options for each pin. See TRM for options */
12262569Simp#define MUX_MODE0	0
13262569Simp#define MUX_MODE1	1
14262569Simp#define MUX_MODE2	2
15262569Simp#define MUX_MODE3	3
16262569Simp#define MUX_MODE4	4
17262569Simp#define MUX_MODE5	5
18262569Simp#define MUX_MODE6	6
19262569Simp#define MUX_MODE7	7
20262569Simp
21262569Simp/* 24xx/34xx mux bit defines */
22262569Simp#define PULL_ENA		(1 << 3)
23262569Simp#define PULL_UP			(1 << 4)
24262569Simp#define ALTELECTRICALSEL	(1 << 5)
25262569Simp
26262569Simp/* omap3/4/5 specific mux bit defines */
27262569Simp#define INPUT_EN		(1 << 8)
28262569Simp#define OFF_EN			(1 << 9)
29262569Simp#define OFFOUT_EN		(1 << 10)
30262569Simp#define OFFOUT_VAL		(1 << 11)
31262569Simp#define OFF_PULL_EN		(1 << 12)
32262569Simp#define OFF_PULL_UP		(1 << 13)
33262569Simp#define WAKEUP_EN		(1 << 14)
34262569Simp#define WAKEUP_EVENT		(1 << 15)
35262569Simp
36262569Simp/* Active pin states */
37262569Simp#define PIN_OUTPUT		0
38262569Simp#define PIN_OUTPUT_PULLUP	(PIN_OUTPUT | PULL_ENA | PULL_UP)
39262569Simp#define PIN_OUTPUT_PULLDOWN	(PIN_OUTPUT | PULL_ENA)
40262569Simp#define PIN_INPUT		INPUT_EN
41262569Simp#define PIN_INPUT_PULLUP	(PULL_ENA | INPUT_EN | PULL_UP)
42262569Simp#define PIN_INPUT_PULLDOWN	(PULL_ENA | INPUT_EN)
43262569Simp
44262569Simp/* Off mode states */
45262569Simp#define PIN_OFF_NONE		0
46262569Simp#define PIN_OFF_OUTPUT_HIGH	(OFF_EN | OFFOUT_EN | OFFOUT_VAL)
47262569Simp#define PIN_OFF_OUTPUT_LOW	(OFF_EN | OFFOUT_EN)
48262569Simp#define PIN_OFF_INPUT_PULLUP	(OFF_EN | OFF_PULL_EN | OFF_PULL_UP)
49262569Simp#define PIN_OFF_INPUT_PULLDOWN	(OFF_EN | OFF_PULL_EN)
50262569Simp#define PIN_OFF_WAKEUPENABLE	WAKEUP_EN
51262569Simp
52262569Simp/*
53262569Simp * Macros to allow using the absolute physical address instead of the
54262569Simp * padconf registers instead of the offset from padconf base.
55262569Simp */
56262569Simp#define OMAP_IOPAD_OFFSET(pa, offset)	(((pa) & 0xffff) - (offset))
57262569Simp
58262569Simp#define OMAP2420_CORE_IOPAD(pa, val)	OMAP_IOPAD_OFFSET((pa), 0x0030) (val)
59262569Simp#define OMAP2430_CORE_IOPAD(pa, val)	OMAP_IOPAD_OFFSET((pa), 0x2030) (val)
60262569Simp#define OMAP3_CORE1_IOPAD(pa, val)	OMAP_IOPAD_OFFSET((pa), 0x2030) (val)
61262569Simp#define OMAP3430_CORE2_IOPAD(pa, val)	OMAP_IOPAD_OFFSET((pa), 0x25d8) (val)
62262569Simp#define OMAP3630_CORE2_IOPAD(pa, val)	OMAP_IOPAD_OFFSET((pa), 0x25a0) (val)
63262569Simp#define OMAP3_WKUP_IOPAD(pa, val)	OMAP_IOPAD_OFFSET((pa), 0x2a00) (val)
64295436Sandrew#define DM814X_IOPAD(pa, val)		OMAP_IOPAD_OFFSET((pa), 0x0800) (val)
65279385Simp#define DM816X_IOPAD(pa, val)		OMAP_IOPAD_OFFSET((pa), 0x0800) (val)
66262569Simp#define AM33XX_IOPAD(pa, val)		OMAP_IOPAD_OFFSET((pa), 0x0800) (val)
67262569Simp
68271133Simp/*
69271133Simp * Macros to allow using the offset from the padconf physical address
70271133Simp * instead  of the offset from padconf base.
71271133Simp */
72271133Simp#define OMAP_PADCONF_OFFSET(offset, base_offset)	((offset) - (base_offset))
73271133Simp
74271133Simp#define OMAP4_IOPAD(offset, val)	OMAP_PADCONF_OFFSET((offset), 0x0040) (val)
75271133Simp#define OMAP5_IOPAD(offset, val)	OMAP_PADCONF_OFFSET((offset), 0x0040) (val)
76271133Simp
77271133Simp/*
78271133Simp * Define some commonly used pins configured by the boards.
79271133Simp * Note that some boards use alternative pins, so check
80271133Simp * the schematics before using these.
81271133Simp */
82271133Simp#define OMAP3_UART1_RX		0x152
83271133Simp#define OMAP3_UART2_RX		0x14a
84271133Simp#define OMAP3_UART3_RX		0x16e
85271133Simp#define OMAP4_UART2_RX		0xdc
86271133Simp#define OMAP4_UART3_RX		0x104
87271133Simp#define OMAP4_UART4_RX		0x11c
88271133Simp
89262569Simp#endif
90262569Simp
91