2 * (C) Copyright 2010-2014
3 * NVIDIA Corporation <www.nvidia.com>
5 * SPDX-License-Identifier: GPL-2.0+
8 #ifndef _TEGRA_PINMUX_H_
9 #define _TEGRA_PINMUX_H_
11 #include <asm/arch/tegra.h>
13 /* The pullup/pulldown state of a pin group */
20 /* Defines whether a pin group is tristated or in normal operation */
23 PMUX_TRI_TRISTATE = 1,
26 #ifdef TEGRA_PMX_PINS_HAVE_E_INPUT
34 #ifdef TEGRA_PMX_PINS_HAVE_LOCK
36 PMUX_PIN_LOCK_DEFAULT = 0,
37 PMUX_PIN_LOCK_DISABLE,
42 #ifdef TEGRA_PMX_PINS_HAVE_OD
44 PMUX_PIN_OD_DEFAULT = 0,
50 #ifdef TEGRA_PMX_PINS_HAVE_IO_RESET
51 enum pmux_pin_ioreset {
52 PMUX_PIN_IO_RESET_DEFAULT = 0,
53 PMUX_PIN_IO_RESET_DISABLE,
54 PMUX_PIN_IO_RESET_ENABLE,
58 #ifdef TEGRA_PMX_PINS_HAVE_RCV_SEL
59 enum pmux_pin_rcv_sel {
60 PMUX_PIN_RCV_SEL_DEFAULT = 0,
61 PMUX_PIN_RCV_SEL_NORMAL,
62 PMUX_PIN_RCV_SEL_HIGH,
66 #ifdef TEGRA_PMX_GRPS_HAVE_LPMD
67 /* Defines a pin group cfg's low-power mode select */
77 #if defined(TEGRA_PMX_PINS_HAVE_SCHMT) || defined(TEGRA_PMX_GRPS_HAVE_SCHMT)
78 /* Defines whether a pin group cfg's schmidt is enabled or not */
80 PMUX_SCHMT_DISABLE = 0,
81 PMUX_SCHMT_ENABLE = 1,
86 #if defined(TEGRA_PMX_PINS_HAVE_HSM) || defined(TEGRA_PMX_GRPS_HAVE_HSM)
87 /* Defines whether a pin group cfg's high-speed mode is enabled or not */
96 * This defines the configuration for a pin, including the function assigned,
97 * pull up/down settings and tristate settings. Having set up one of these
98 * you can call pinmux_config_pingroup() to configure a pin in one step. Also
99 * available is pinmux_config_table() to configure a list of pins.
101 struct pmux_pingrp_config {
102 u32 pingrp:16; /* pin group PMUX_PINGRP_... */
103 u32 func:8; /* function to assign PMUX_FUNC_... */
104 u32 pull:2; /* pull up/down/normal PMUX_PULL_...*/
105 u32 tristate:2; /* tristate or normal PMUX_TRI_... */
106 #ifdef TEGRA_PMX_PINS_HAVE_E_INPUT
107 u32 io:2; /* input or output PMUX_PIN_... */
109 #ifdef TEGRA_PMX_PINS_HAVE_LOCK
110 u32 lock:2; /* lock enable/disable PMUX_PIN... */
112 #ifdef TEGRA_PMX_PINS_HAVE_OD
113 u32 od:2; /* open-drain or push-pull driver */
115 #ifdef TEGRA_PMX_PINS_HAVE_IO_RESET
116 u32 ioreset:2; /* input/output reset PMUX_PIN... */
118 #ifdef TEGRA_PMX_PINS_HAVE_RCV_SEL
119 u32 rcv_sel:2; /* select between High and Normal */
120 /* VIL/VIH receivers */
122 #ifdef TEGRA_PMX_PINS_HAVE_SCHMT
123 u32 schmt:2; /* schmitt enable */
125 #ifdef TEGRA_PMX_PINS_HAVE_HSM
126 u32 hsm:2; /* high-speed mode enable */
130 #ifdef TEGRA_PMX_SOC_HAS_IO_CLAMPING
131 /* Set/clear the pinmux CLAMP_INPUTS_WHEN_TRISTATED bit */
132 void pinmux_set_tristate_input_clamping(void);
133 void pinmux_clear_tristate_input_clamping(void);
136 /* Set the mux function for a pin group */
137 void pinmux_set_func(enum pmux_pingrp pin, enum pmux_func func);
139 /* Set the pull up/down feature for a pin group */
140 void pinmux_set_pullupdown(enum pmux_pingrp pin, enum pmux_pull pupd);
142 /* Set a pin group to tristate */
143 void pinmux_tristate_enable(enum pmux_pingrp pin);
145 /* Set a pin group to normal (non tristate) */
146 void pinmux_tristate_disable(enum pmux_pingrp pin);
148 #ifdef TEGRA_PMX_PINS_HAVE_E_INPUT
149 /* Set a pin group as input or output */
150 void pinmux_set_io(enum pmux_pingrp pin, enum pmux_pin_io io);
154 * Configure a list of pin groups
156 * @param config List of config items
157 * @param len Number of config items in list
159 void pinmux_config_pingrp_table(const struct pmux_pingrp_config *config,
162 #ifdef TEGRA_PMX_SOC_HAS_DRVGRPS
164 #define PMUX_SLWF_MIN 0
165 #define PMUX_SLWF_MAX 3
166 #define PMUX_SLWF_NONE -1
168 #define PMUX_SLWR_MIN 0
169 #define PMUX_SLWR_MAX 3
170 #define PMUX_SLWR_NONE -1
172 #define PMUX_DRVUP_MIN 0
173 #define PMUX_DRVUP_MAX 127
174 #define PMUX_DRVUP_NONE -1
176 #define PMUX_DRVDN_MIN 0
177 #define PMUX_DRVDN_MAX 127
178 #define PMUX_DRVDN_NONE -1
181 * This defines the configuration for a pin group's pad control config
183 struct pmux_drvgrp_config {
184 u32 drvgrp:16; /* pin group PMUX_DRVGRP_x */
185 u32 slwf:3; /* falling edge slew */
186 u32 slwr:3; /* rising edge slew */
187 u32 drvup:8; /* pull-up drive strength */
188 u32 drvdn:8; /* pull-down drive strength */
189 #ifdef TEGRA_PMX_GRPS_HAVE_LPMD
190 u32 lpmd:3; /* low-power mode selection */
192 #ifdef TEGRA_PMX_GRPS_HAVE_SCHMT
193 u32 schmt:2; /* schmidt enable */
195 #ifdef TEGRA_PMX_GRPS_HAVE_HSM
196 u32 hsm:2; /* high-speed mode enable */
201 * Set the GP pad configs
203 * @param config List of config items
204 * @param len Number of config items in list
206 void pinmux_config_drvgrp_table(const struct pmux_drvgrp_config *config,
209 #endif /* TEGRA_PMX_SOC_HAS_DRVGRPS */
211 struct pmux_pingrp_desc {
213 #if defined(CONFIG_TEGRA20)
216 #endif /* CONFIG_TEGRA20 */
219 extern const struct pmux_pingrp_desc *tegra_soc_pingroups;
221 #endif /* _TEGRA_PINMUX_H_ */