diff options
author | Stephen Warren <swarren@nvidia.com> | 2012-02-18 03:04:55 -0500 |
---|---|---|
committer | Stephen Warren <swarren@nvidia.com> | 2012-04-18 12:26:38 -0400 |
commit | 3e215d0a19c2a0c389bd9117573b6dd8e46f96a8 (patch) | |
tree | a45a82fc3e26459c8146cbe933229344cefa8b70 | |
parent | c61b3da0aca4cccb1dca757eb94e443faba4e88f (diff) |
gpio: tegra: Hide tegra_gpio_enable/disable()
Recent pinctrl discussions concluded that gpiolib APIs should in fact do
whatever is required to mux a GPIO onto pins, by calling pinctrl APIs if
required. This change implements this for the Tegra GPIO driver, and removes
calls to the Tegra-specific APIs from drivers and board files.
Cc: Chris Ball <cjb@laptop.org>
Cc: linux-mmc@vger.kernel.org
Signed-off-by: Stephen Warren <swarren@nvidia.com>
Acked-by: Chris Ball <cjb@laptop.org> # for sdhci-tegra.c
Acked-by: Linus Walleij <linus.walleij@linaro.org>
Acked-by: Olof Johansson <olof@lixom.net>
-rw-r--r-- | arch/arm/mach-tegra/board-dt-tegra20.c | 1 | ||||
-rw-r--r-- | arch/arm/mach-tegra/board-harmony-pinmux.c | 17 | ||||
-rw-r--r-- | arch/arm/mach-tegra/board-paz00-pinmux.c | 14 | ||||
-rw-r--r-- | arch/arm/mach-tegra/board-pinmux.c | 33 | ||||
-rw-r--r-- | arch/arm/mach-tegra/board-pinmux.h | 5 | ||||
-rw-r--r-- | arch/arm/mach-tegra/board-seaboard-pinmux.c | 32 | ||||
-rw-r--r-- | arch/arm/mach-tegra/board-seaboard.c | 1 | ||||
-rw-r--r-- | arch/arm/mach-tegra/board-trimslice-pinmux.c | 12 | ||||
-rw-r--r-- | arch/arm/mach-tegra/include/mach/gpio-tegra.h | 9 | ||||
-rw-r--r-- | arch/arm/mach-tegra/usb_phy.c | 1 | ||||
-rw-r--r-- | drivers/gpio/gpio-tegra.c | 36 | ||||
-rw-r--r-- | drivers/mmc/host/sdhci-tegra.c | 24 |
12 files changed, 27 insertions, 158 deletions
diff --git a/arch/arm/mach-tegra/board-dt-tegra20.c b/arch/arm/mach-tegra/board-dt-tegra20.c index 0952494f481a..65a5249b3718 100644 --- a/arch/arm/mach-tegra/board-dt-tegra20.c +++ b/arch/arm/mach-tegra/board-dt-tegra20.c | |||
@@ -55,7 +55,6 @@ void ventana_pinmux_init(void); | |||
55 | 55 | ||
56 | struct of_dev_auxdata tegra20_auxdata_lookup[] __initdata = { | 56 | struct of_dev_auxdata tegra20_auxdata_lookup[] __initdata = { |
57 | OF_DEV_AUXDATA("nvidia,tegra20-pinmux", TEGRA_APB_MISC_BASE + 0x14, "tegra-pinmux", NULL), | 57 | OF_DEV_AUXDATA("nvidia,tegra20-pinmux", TEGRA_APB_MISC_BASE + 0x14, "tegra-pinmux", NULL), |
58 | OF_DEV_AUXDATA("nvidia,tegra20-gpio", TEGRA_GPIO_BASE, "tegra-gpio", NULL), | ||
59 | OF_DEV_AUXDATA("nvidia,tegra20-sdhci", TEGRA_SDMMC1_BASE, "sdhci-tegra.0", NULL), | 58 | OF_DEV_AUXDATA("nvidia,tegra20-sdhci", TEGRA_SDMMC1_BASE, "sdhci-tegra.0", NULL), |
60 | OF_DEV_AUXDATA("nvidia,tegra20-sdhci", TEGRA_SDMMC2_BASE, "sdhci-tegra.1", NULL), | 59 | OF_DEV_AUXDATA("nvidia,tegra20-sdhci", TEGRA_SDMMC2_BASE, "sdhci-tegra.1", NULL), |
61 | OF_DEV_AUXDATA("nvidia,tegra20-sdhci", TEGRA_SDMMC3_BASE, "sdhci-tegra.2", NULL), | 60 | OF_DEV_AUXDATA("nvidia,tegra20-sdhci", TEGRA_SDMMC3_BASE, "sdhci-tegra.2", NULL), |
diff --git a/arch/arm/mach-tegra/board-harmony-pinmux.c b/arch/arm/mach-tegra/board-harmony-pinmux.c index 1af85bccc0f1..3ebe2c859a3b 100644 --- a/arch/arm/mach-tegra/board-harmony-pinmux.c +++ b/arch/arm/mach-tegra/board-harmony-pinmux.c | |||
@@ -15,13 +15,11 @@ | |||
15 | */ | 15 | */ |
16 | 16 | ||
17 | #include <linux/kernel.h> | 17 | #include <linux/kernel.h> |
18 | #include <linux/gpio.h> | ||
19 | #include <linux/of.h> | 18 | #include <linux/of.h> |
20 | 19 | ||
21 | #include <mach/pinmux.h> | 20 | #include <mach/pinmux.h> |
22 | #include <mach/pinmux-tegra20.h> | 21 | #include <mach/pinmux-tegra20.h> |
23 | 22 | ||
24 | #include "gpio-names.h" | ||
25 | #include "board-harmony.h" | 23 | #include "board-harmony.h" |
26 | #include "board-pinmux.h" | 24 | #include "board-pinmux.h" |
27 | 25 | ||
@@ -144,24 +142,9 @@ static struct tegra_pingroup_config harmony_pinmux[] = { | |||
144 | {TEGRA_PINGROUP_XM2D, TEGRA_MUX_NONE, TEGRA_PUPD_NORMAL, TEGRA_TRI_NORMAL}, | 142 | {TEGRA_PINGROUP_XM2D, TEGRA_MUX_NONE, TEGRA_PUPD_NORMAL, TEGRA_TRI_NORMAL}, |
145 | }; | 143 | }; |
146 | 144 | ||
147 | static struct tegra_gpio_table gpio_table[] = { | ||
148 | { .gpio = TEGRA_GPIO_SD2_CD, .enable = true }, | ||
149 | { .gpio = TEGRA_GPIO_SD2_WP, .enable = true }, | ||
150 | { .gpio = TEGRA_GPIO_SD2_POWER, .enable = true }, | ||
151 | { .gpio = TEGRA_GPIO_SD4_CD, .enable = true }, | ||
152 | { .gpio = TEGRA_GPIO_SD4_WP, .enable = true }, | ||
153 | { .gpio = TEGRA_GPIO_SD4_POWER, .enable = true }, | ||
154 | { .gpio = TEGRA_GPIO_CDC_IRQ, .enable = true }, | ||
155 | { .gpio = TEGRA_GPIO_HP_DET, .enable = true }, | ||
156 | { .gpio = TEGRA_GPIO_INT_MIC_EN, .enable = true }, | ||
157 | { .gpio = TEGRA_GPIO_EXT_MIC_EN, .enable = true }, | ||
158 | }; | ||
159 | |||
160 | static struct tegra_board_pinmux_conf conf = { | 145 | static struct tegra_board_pinmux_conf conf = { |
161 | .pgs = harmony_pinmux, | 146 | .pgs = harmony_pinmux, |
162 | .pg_count = ARRAY_SIZE(harmony_pinmux), | 147 | .pg_count = ARRAY_SIZE(harmony_pinmux), |
163 | .gpios = gpio_table, | ||
164 | .gpio_count = ARRAY_SIZE(gpio_table), | ||
165 | }; | 148 | }; |
166 | 149 | ||
167 | void harmony_pinmux_init(void) | 150 | void harmony_pinmux_init(void) |
diff --git a/arch/arm/mach-tegra/board-paz00-pinmux.c b/arch/arm/mach-tegra/board-paz00-pinmux.c index c775572dcea4..f0ec46612f52 100644 --- a/arch/arm/mach-tegra/board-paz00-pinmux.c +++ b/arch/arm/mach-tegra/board-paz00-pinmux.c | |||
@@ -15,13 +15,11 @@ | |||
15 | */ | 15 | */ |
16 | 16 | ||
17 | #include <linux/kernel.h> | 17 | #include <linux/kernel.h> |
18 | #include <linux/gpio.h> | ||
19 | #include <linux/of.h> | 18 | #include <linux/of.h> |
20 | 19 | ||
21 | #include <mach/pinmux.h> | 20 | #include <mach/pinmux.h> |
22 | #include <mach/pinmux-tegra20.h> | 21 | #include <mach/pinmux-tegra20.h> |
23 | 22 | ||
24 | #include "gpio-names.h" | ||
25 | #include "board-paz00.h" | 23 | #include "board-paz00.h" |
26 | #include "board-pinmux.h" | 24 | #include "board-pinmux.h" |
27 | 25 | ||
@@ -144,21 +142,9 @@ static struct tegra_pingroup_config paz00_pinmux[] = { | |||
144 | {TEGRA_PINGROUP_XM2D, TEGRA_MUX_NONE, TEGRA_PUPD_NORMAL, TEGRA_TRI_NORMAL}, | 142 | {TEGRA_PINGROUP_XM2D, TEGRA_MUX_NONE, TEGRA_PUPD_NORMAL, TEGRA_TRI_NORMAL}, |
145 | }; | 143 | }; |
146 | 144 | ||
147 | static struct tegra_gpio_table gpio_table[] = { | ||
148 | { .gpio = TEGRA_GPIO_SD1_CD, .enable = true }, | ||
149 | { .gpio = TEGRA_GPIO_SD1_WP, .enable = true }, | ||
150 | { .gpio = TEGRA_GPIO_SD1_POWER, .enable = true }, | ||
151 | { .gpio = TEGRA_ULPI_RST, .enable = true }, | ||
152 | { .gpio = TEGRA_WIFI_PWRN, .enable = true }, | ||
153 | { .gpio = TEGRA_WIFI_RST, .enable = true }, | ||
154 | { .gpio = TEGRA_WIFI_LED, .enable = true }, | ||
155 | }; | ||
156 | |||
157 | static struct tegra_board_pinmux_conf conf = { | 145 | static struct tegra_board_pinmux_conf conf = { |
158 | .pgs = paz00_pinmux, | 146 | .pgs = paz00_pinmux, |
159 | .pg_count = ARRAY_SIZE(paz00_pinmux), | 147 | .pg_count = ARRAY_SIZE(paz00_pinmux), |
160 | .gpios = gpio_table, | ||
161 | .gpio_count = ARRAY_SIZE(gpio_table), | ||
162 | }; | 148 | }; |
163 | 149 | ||
164 | void paz00_pinmux_init(void) | 150 | void paz00_pinmux_init(void) |
diff --git a/arch/arm/mach-tegra/board-pinmux.c b/arch/arm/mach-tegra/board-pinmux.c index adc3efe979b3..3015b5a38936 100644 --- a/arch/arm/mach-tegra/board-pinmux.c +++ b/arch/arm/mach-tegra/board-pinmux.c | |||
@@ -18,7 +18,6 @@ | |||
18 | #include <linux/of.h> | 18 | #include <linux/of.h> |
19 | #include <linux/string.h> | 19 | #include <linux/string.h> |
20 | 20 | ||
21 | #include <mach/gpio-tegra.h> | ||
22 | #include <mach/pinmux.h> | 21 | #include <mach/pinmux.h> |
23 | 22 | ||
24 | #include "board-pinmux.h" | 23 | #include "board-pinmux.h" |
@@ -26,18 +25,6 @@ | |||
26 | 25 | ||
27 | struct tegra_board_pinmux_conf *confs[2]; | 26 | struct tegra_board_pinmux_conf *confs[2]; |
28 | 27 | ||
29 | static void tegra_board_pinmux_setup_gpios(void) | ||
30 | { | ||
31 | int i; | ||
32 | |||
33 | for (i = 0; i < ARRAY_SIZE(confs); i++) { | ||
34 | if (!confs[i]) | ||
35 | continue; | ||
36 | |||
37 | tegra_gpio_config(confs[i]->gpios, confs[i]->gpio_count); | ||
38 | } | ||
39 | } | ||
40 | |||
41 | static void tegra_board_pinmux_setup_pinmux(void) | 28 | static void tegra_board_pinmux_setup_pinmux(void) |
42 | { | 29 | { |
43 | int i; | 30 | int i; |
@@ -57,29 +44,17 @@ static void tegra_board_pinmux_setup_pinmux(void) | |||
57 | static int tegra_board_pinmux_bus_notify(struct notifier_block *nb, | 44 | static int tegra_board_pinmux_bus_notify(struct notifier_block *nb, |
58 | unsigned long event, void *vdev) | 45 | unsigned long event, void *vdev) |
59 | { | 46 | { |
60 | static bool had_gpio; | ||
61 | static bool had_pinmux; | ||
62 | |||
63 | struct device *dev = vdev; | 47 | struct device *dev = vdev; |
64 | const char *devname; | ||
65 | 48 | ||
66 | if (event != BUS_NOTIFY_BOUND_DRIVER) | 49 | if (event != BUS_NOTIFY_BOUND_DRIVER) |
67 | return NOTIFY_DONE; | 50 | return NOTIFY_DONE; |
68 | 51 | ||
69 | devname = dev_name(dev); | 52 | if (strcmp(dev_name(dev), PINMUX_DEV)) |
53 | return NOTIFY_DONE; | ||
70 | 54 | ||
71 | if (!had_gpio && !strcmp(devname, GPIO_DEV)) { | 55 | tegra_board_pinmux_setup_pinmux(); |
72 | tegra_board_pinmux_setup_gpios(); | ||
73 | had_gpio = true; | ||
74 | } else if (!had_pinmux && !strcmp(devname, PINMUX_DEV)) { | ||
75 | tegra_board_pinmux_setup_pinmux(); | ||
76 | had_pinmux = true; | ||
77 | } | ||
78 | 56 | ||
79 | if (had_gpio && had_pinmux) | 57 | return NOTIFY_STOP_MASK; |
80 | return NOTIFY_STOP_MASK; | ||
81 | else | ||
82 | return NOTIFY_DONE; | ||
83 | } | 58 | } |
84 | 59 | ||
85 | static struct notifier_block nb = { | 60 | static struct notifier_block nb = { |
diff --git a/arch/arm/mach-tegra/board-pinmux.h b/arch/arm/mach-tegra/board-pinmux.h index 4aac73546f54..e08214d84bd9 100644 --- a/arch/arm/mach-tegra/board-pinmux.h +++ b/arch/arm/mach-tegra/board-pinmux.h | |||
@@ -15,11 +15,9 @@ | |||
15 | #ifndef __MACH_TEGRA_BOARD_PINMUX_H | 15 | #ifndef __MACH_TEGRA_BOARD_PINMUX_H |
16 | #define __MACH_TEGRA_BOARD_PINMUX_H | 16 | #define __MACH_TEGRA_BOARD_PINMUX_H |
17 | 17 | ||
18 | #define GPIO_DEV "tegra-gpio" | ||
19 | #define PINMUX_DEV "tegra-pinmux" | 18 | #define PINMUX_DEV "tegra-pinmux" |
20 | 19 | ||
21 | struct tegra_pingroup_config; | 20 | struct tegra_pingroup_config; |
22 | struct tegra_gpio_table; | ||
23 | 21 | ||
24 | struct tegra_board_pinmux_conf { | 22 | struct tegra_board_pinmux_conf { |
25 | struct tegra_pingroup_config *pgs; | 23 | struct tegra_pingroup_config *pgs; |
@@ -27,9 +25,6 @@ struct tegra_board_pinmux_conf { | |||
27 | 25 | ||
28 | struct tegra_drive_pingroup_config *drives; | 26 | struct tegra_drive_pingroup_config *drives; |
29 | int drive_count; | 27 | int drive_count; |
30 | |||
31 | struct tegra_gpio_table *gpios; | ||
32 | int gpio_count; | ||
33 | }; | 28 | }; |
34 | 29 | ||
35 | void tegra_board_pinmux_init(struct tegra_board_pinmux_conf *conf_a, | 30 | void tegra_board_pinmux_init(struct tegra_board_pinmux_conf *conf_a, |
diff --git a/arch/arm/mach-tegra/board-seaboard-pinmux.c b/arch/arm/mach-tegra/board-seaboard-pinmux.c index 55e7e43a14ad..3bf7e9705b6a 100644 --- a/arch/arm/mach-tegra/board-seaboard-pinmux.c +++ b/arch/arm/mach-tegra/board-seaboard-pinmux.c | |||
@@ -15,13 +15,11 @@ | |||
15 | 15 | ||
16 | #include <linux/kernel.h> | 16 | #include <linux/kernel.h> |
17 | #include <linux/init.h> | 17 | #include <linux/init.h> |
18 | #include <linux/gpio.h> | ||
19 | #include <linux/of.h> | 18 | #include <linux/of.h> |
20 | 19 | ||
21 | #include <mach/pinmux.h> | 20 | #include <mach/pinmux.h> |
22 | #include <mach/pinmux-tegra20.h> | 21 | #include <mach/pinmux-tegra20.h> |
23 | 22 | ||
24 | #include "gpio-names.h" | ||
25 | #include "board-pinmux.h" | 23 | #include "board-pinmux.h" |
26 | #include "board-seaboard.h" | 24 | #include "board-seaboard.h" |
27 | 25 | ||
@@ -179,35 +177,9 @@ static struct tegra_pingroup_config ventana_pinmux[] = { | |||
179 | {TEGRA_PINGROUP_SPIG, TEGRA_MUX_SPI2_ALT, TEGRA_PUPD_NORMAL, TEGRA_TRI_TRISTATE}, | 177 | {TEGRA_PINGROUP_SPIG, TEGRA_MUX_SPI2_ALT, TEGRA_PUPD_NORMAL, TEGRA_TRI_TRISTATE}, |
180 | }; | 178 | }; |
181 | 179 | ||
182 | static struct tegra_gpio_table common_gpio_table[] = { | ||
183 | { .gpio = TEGRA_GPIO_SD2_CD, .enable = true }, | ||
184 | { .gpio = TEGRA_GPIO_SD2_WP, .enable = true }, | ||
185 | { .gpio = TEGRA_GPIO_SD2_POWER, .enable = true }, | ||
186 | { .gpio = TEGRA_GPIO_CDC_IRQ, .enable = true }, | ||
187 | }; | ||
188 | |||
189 | static struct tegra_gpio_table seaboard_gpio_table[] = { | ||
190 | { .gpio = TEGRA_GPIO_LIDSWITCH, .enable = true }, | ||
191 | { .gpio = TEGRA_GPIO_POWERKEY, .enable = true }, | ||
192 | { .gpio = TEGRA_GPIO_HP_DET, .enable = true }, | ||
193 | { .gpio = TEGRA_GPIO_ISL29018_IRQ, .enable = true }, | ||
194 | { .gpio = TEGRA_GPIO_USB1, .enable = true }, | ||
195 | }; | ||
196 | |||
197 | static struct tegra_gpio_table ventana_gpio_table[] = { | ||
198 | /* hp_det */ | ||
199 | { .gpio = TEGRA_GPIO_PW2, .enable = true }, | ||
200 | /* int_mic_en */ | ||
201 | { .gpio = TEGRA_GPIO_PX0, .enable = true }, | ||
202 | /* ext_mic_en */ | ||
203 | { .gpio = TEGRA_GPIO_PX1, .enable = true }, | ||
204 | }; | ||
205 | |||
206 | static struct tegra_board_pinmux_conf common_conf = { | 180 | static struct tegra_board_pinmux_conf common_conf = { |
207 | .pgs = common_pinmux, | 181 | .pgs = common_pinmux, |
208 | .pg_count = ARRAY_SIZE(common_pinmux), | 182 | .pg_count = ARRAY_SIZE(common_pinmux), |
209 | .gpios = common_gpio_table, | ||
210 | .gpio_count = ARRAY_SIZE(common_gpio_table), | ||
211 | }; | 183 | }; |
212 | 184 | ||
213 | static struct tegra_board_pinmux_conf seaboard_conf = { | 185 | static struct tegra_board_pinmux_conf seaboard_conf = { |
@@ -215,15 +187,11 @@ static struct tegra_board_pinmux_conf seaboard_conf = { | |||
215 | .pg_count = ARRAY_SIZE(seaboard_pinmux), | 187 | .pg_count = ARRAY_SIZE(seaboard_pinmux), |
216 | .drives = seaboard_drive_pinmux, | 188 | .drives = seaboard_drive_pinmux, |
217 | .drive_count = ARRAY_SIZE(seaboard_drive_pinmux), | 189 | .drive_count = ARRAY_SIZE(seaboard_drive_pinmux), |
218 | .gpios = seaboard_gpio_table, | ||
219 | .gpio_count = ARRAY_SIZE(seaboard_gpio_table), | ||
220 | }; | 190 | }; |
221 | 191 | ||
222 | static struct tegra_board_pinmux_conf ventana_conf = { | 192 | static struct tegra_board_pinmux_conf ventana_conf = { |
223 | .pgs = ventana_pinmux, | 193 | .pgs = ventana_pinmux, |
224 | .pg_count = ARRAY_SIZE(ventana_pinmux), | 194 | .pg_count = ARRAY_SIZE(ventana_pinmux), |
225 | .gpios = ventana_gpio_table, | ||
226 | .gpio_count = ARRAY_SIZE(ventana_gpio_table), | ||
227 | }; | 195 | }; |
228 | 196 | ||
229 | void seaboard_pinmux_init(void) | 197 | void seaboard_pinmux_init(void) |
diff --git a/arch/arm/mach-tegra/board-seaboard.c b/arch/arm/mach-tegra/board-seaboard.c index 59987540df19..a0184fb44222 100644 --- a/arch/arm/mach-tegra/board-seaboard.c +++ b/arch/arm/mach-tegra/board-seaboard.c | |||
@@ -249,7 +249,6 @@ static void __init tegra_kaen_init(void) | |||
249 | debug_uart_platform_data[0].irq = INT_UARTB; | 249 | debug_uart_platform_data[0].irq = INT_UARTB; |
250 | 250 | ||
251 | seaboard_audio_pdata.gpio_hp_mute = TEGRA_GPIO_KAEN_HP_MUTE; | 251 | seaboard_audio_pdata.gpio_hp_mute = TEGRA_GPIO_KAEN_HP_MUTE; |
252 | tegra_gpio_enable(TEGRA_GPIO_KAEN_HP_MUTE); | ||
253 | 252 | ||
254 | seaboard_common_init(); | 253 | seaboard_common_init(); |
255 | 254 | ||
diff --git a/arch/arm/mach-tegra/board-trimslice-pinmux.c b/arch/arm/mach-tegra/board-trimslice-pinmux.c index a21a2be57cb6..a1902d4e8e5d 100644 --- a/arch/arm/mach-tegra/board-trimslice-pinmux.c +++ b/arch/arm/mach-tegra/board-trimslice-pinmux.c | |||
@@ -13,7 +13,6 @@ | |||
13 | * GNU General Public License for more details. | 13 | * GNU General Public License for more details. |
14 | * | 14 | * |
15 | */ | 15 | */ |
16 | #include <linux/gpio.h> | ||
17 | #include <linux/kernel.h> | 16 | #include <linux/kernel.h> |
18 | #include <linux/init.h> | 17 | #include <linux/init.h> |
19 | #include <linux/of.h> | 18 | #include <linux/of.h> |
@@ -21,7 +20,6 @@ | |||
21 | #include <mach/pinmux.h> | 20 | #include <mach/pinmux.h> |
22 | #include <mach/pinmux-tegra20.h> | 21 | #include <mach/pinmux-tegra20.h> |
23 | 22 | ||
24 | #include "gpio-names.h" | ||
25 | #include "board-pinmux.h" | 23 | #include "board-pinmux.h" |
26 | #include "board-trimslice.h" | 24 | #include "board-trimslice.h" |
27 | 25 | ||
@@ -144,19 +142,9 @@ static struct tegra_pingroup_config trimslice_pinmux[] = { | |||
144 | {TEGRA_PINGROUP_XM2D, TEGRA_MUX_NONE, TEGRA_PUPD_NORMAL, TEGRA_TRI_NORMAL}, | 142 | {TEGRA_PINGROUP_XM2D, TEGRA_MUX_NONE, TEGRA_PUPD_NORMAL, TEGRA_TRI_NORMAL}, |
145 | }; | 143 | }; |
146 | 144 | ||
147 | static struct tegra_gpio_table gpio_table[] = { | ||
148 | { .gpio = TRIMSLICE_GPIO_SD4_CD, .enable = true }, /* mmc4 cd */ | ||
149 | { .gpio = TRIMSLICE_GPIO_SD4_WP, .enable = true }, /* mmc4 wp */ | ||
150 | |||
151 | { .gpio = TRIMSLICE_GPIO_USB1_MODE, .enable = true }, /* USB1 mode */ | ||
152 | { .gpio = TRIMSLICE_GPIO_USB2_RST, .enable = true }, /* USB2 PHY rst */ | ||
153 | }; | ||
154 | |||
155 | static struct tegra_board_pinmux_conf conf = { | 145 | static struct tegra_board_pinmux_conf conf = { |
156 | .pgs = trimslice_pinmux, | 146 | .pgs = trimslice_pinmux, |
157 | .pg_count = ARRAY_SIZE(trimslice_pinmux), | 147 | .pg_count = ARRAY_SIZE(trimslice_pinmux), |
158 | .gpios = gpio_table, | ||
159 | .gpio_count = ARRAY_SIZE(gpio_table), | ||
160 | }; | 148 | }; |
161 | 149 | ||
162 | void trimslice_pinmux_init(void) | 150 | void trimslice_pinmux_init(void) |
diff --git a/arch/arm/mach-tegra/include/mach/gpio-tegra.h b/arch/arm/mach-tegra/include/mach/gpio-tegra.h index 6140820555e1..a978b3cc3a8d 100644 --- a/arch/arm/mach-tegra/include/mach/gpio-tegra.h +++ b/arch/arm/mach-tegra/include/mach/gpio-tegra.h | |||
@@ -25,13 +25,4 @@ | |||
25 | 25 | ||
26 | #define TEGRA_NR_GPIOS INT_GPIO_NR | 26 | #define TEGRA_NR_GPIOS INT_GPIO_NR |
27 | 27 | ||
28 | struct tegra_gpio_table { | ||
29 | int gpio; /* GPIO number */ | ||
30 | bool enable; /* Enable for GPIO at init? */ | ||
31 | }; | ||
32 | |||
33 | void tegra_gpio_config(struct tegra_gpio_table *table, int num); | ||
34 | void tegra_gpio_enable(int gpio); | ||
35 | void tegra_gpio_disable(int gpio); | ||
36 | |||
37 | #endif | 28 | #endif |
diff --git a/arch/arm/mach-tegra/usb_phy.c b/arch/arm/mach-tegra/usb_phy.c index c5b2ac04e2a0..d71d2fed6721 100644 --- a/arch/arm/mach-tegra/usb_phy.c +++ b/arch/arm/mach-tegra/usb_phy.c | |||
@@ -711,7 +711,6 @@ struct tegra_usb_phy *tegra_usb_phy_open(int instance, void __iomem *regs, | |||
711 | err = -ENXIO; | 711 | err = -ENXIO; |
712 | goto err1; | 712 | goto err1; |
713 | } | 713 | } |
714 | tegra_gpio_enable(ulpi_config->reset_gpio); | ||
715 | gpio_request(ulpi_config->reset_gpio, "ulpi_phy_reset_b"); | 714 | gpio_request(ulpi_config->reset_gpio, "ulpi_phy_reset_b"); |
716 | gpio_direction_output(ulpi_config->reset_gpio, 0); | 715 | gpio_direction_output(ulpi_config->reset_gpio, 0); |
717 | phy->ulpi = otg_ulpi_create(&ulpi_viewport_access_ops, 0); | 716 | phy->ulpi = otg_ulpi_create(&ulpi_viewport_access_ops, 0); |
diff --git a/drivers/gpio/gpio-tegra.c b/drivers/gpio/gpio-tegra.c index 4383a7205349..dc5184d57892 100644 --- a/drivers/gpio/gpio-tegra.c +++ b/drivers/gpio/gpio-tegra.c | |||
@@ -26,10 +26,10 @@ | |||
26 | #include <linux/platform_device.h> | 26 | #include <linux/platform_device.h> |
27 | #include <linux/module.h> | 27 | #include <linux/module.h> |
28 | #include <linux/irqdomain.h> | 28 | #include <linux/irqdomain.h> |
29 | #include <linux/pinctrl/consumer.h> | ||
29 | 30 | ||
30 | #include <asm/mach/irq.h> | 31 | #include <asm/mach/irq.h> |
31 | 32 | ||
32 | #include <mach/gpio-tegra.h> | ||
33 | #include <mach/iomap.h> | 33 | #include <mach/iomap.h> |
34 | #include <mach/suspend.h> | 34 | #include <mach/suspend.h> |
35 | 35 | ||
@@ -108,18 +108,29 @@ static void tegra_gpio_mask_write(u32 reg, int gpio, int value) | |||
108 | tegra_gpio_writel(val, reg); | 108 | tegra_gpio_writel(val, reg); |
109 | } | 109 | } |
110 | 110 | ||
111 | void tegra_gpio_enable(int gpio) | 111 | static void tegra_gpio_enable(int gpio) |
112 | { | 112 | { |
113 | tegra_gpio_mask_write(GPIO_MSK_CNF(gpio), gpio, 1); | 113 | tegra_gpio_mask_write(GPIO_MSK_CNF(gpio), gpio, 1); |
114 | } | 114 | } |
115 | EXPORT_SYMBOL_GPL(tegra_gpio_enable); | 115 | EXPORT_SYMBOL_GPL(tegra_gpio_enable); |
116 | 116 | ||
117 | void tegra_gpio_disable(int gpio) | 117 | static void tegra_gpio_disable(int gpio) |
118 | { | 118 | { |
119 | tegra_gpio_mask_write(GPIO_MSK_CNF(gpio), gpio, 0); | 119 | tegra_gpio_mask_write(GPIO_MSK_CNF(gpio), gpio, 0); |
120 | } | 120 | } |
121 | EXPORT_SYMBOL_GPL(tegra_gpio_disable); | 121 | EXPORT_SYMBOL_GPL(tegra_gpio_disable); |
122 | 122 | ||
123 | int tegra_gpio_request(struct gpio_chip *chip, unsigned offset) | ||
124 | { | ||
125 | return pinctrl_request_gpio(offset); | ||
126 | } | ||
127 | |||
128 | void tegra_gpio_free(struct gpio_chip *chip, unsigned offset) | ||
129 | { | ||
130 | pinctrl_free_gpio(offset); | ||
131 | tegra_gpio_disable(offset); | ||
132 | } | ||
133 | |||
123 | static void tegra_gpio_set(struct gpio_chip *chip, unsigned offset, int value) | 134 | static void tegra_gpio_set(struct gpio_chip *chip, unsigned offset, int value) |
124 | { | 135 | { |
125 | tegra_gpio_mask_write(GPIO_MSK_OUT(offset), offset, value); | 136 | tegra_gpio_mask_write(GPIO_MSK_OUT(offset), offset, value); |
@@ -133,6 +144,7 @@ static int tegra_gpio_get(struct gpio_chip *chip, unsigned offset) | |||
133 | static int tegra_gpio_direction_input(struct gpio_chip *chip, unsigned offset) | 144 | static int tegra_gpio_direction_input(struct gpio_chip *chip, unsigned offset) |
134 | { | 145 | { |
135 | tegra_gpio_mask_write(GPIO_MSK_OE(offset), offset, 0); | 146 | tegra_gpio_mask_write(GPIO_MSK_OE(offset), offset, 0); |
147 | tegra_gpio_enable(offset); | ||
136 | return 0; | 148 | return 0; |
137 | } | 149 | } |
138 | 150 | ||
@@ -141,6 +153,7 @@ static int tegra_gpio_direction_output(struct gpio_chip *chip, unsigned offset, | |||
141 | { | 153 | { |
142 | tegra_gpio_set(chip, offset, value); | 154 | tegra_gpio_set(chip, offset, value); |
143 | tegra_gpio_mask_write(GPIO_MSK_OE(offset), offset, 1); | 155 | tegra_gpio_mask_write(GPIO_MSK_OE(offset), offset, 1); |
156 | tegra_gpio_enable(offset); | ||
144 | return 0; | 157 | return 0; |
145 | } | 158 | } |
146 | 159 | ||
@@ -151,13 +164,14 @@ static int tegra_gpio_to_irq(struct gpio_chip *chip, unsigned offset) | |||
151 | 164 | ||
152 | static struct gpio_chip tegra_gpio_chip = { | 165 | static struct gpio_chip tegra_gpio_chip = { |
153 | .label = "tegra-gpio", | 166 | .label = "tegra-gpio", |
167 | .request = tegra_gpio_request, | ||
168 | .free = tegra_gpio_free, | ||
154 | .direction_input = tegra_gpio_direction_input, | 169 | .direction_input = tegra_gpio_direction_input, |
155 | .get = tegra_gpio_get, | 170 | .get = tegra_gpio_get, |
156 | .direction_output = tegra_gpio_direction_output, | 171 | .direction_output = tegra_gpio_direction_output, |
157 | .set = tegra_gpio_set, | 172 | .set = tegra_gpio_set, |
158 | .to_irq = tegra_gpio_to_irq, | 173 | .to_irq = tegra_gpio_to_irq, |
159 | .base = 0, | 174 | .base = 0, |
160 | .ngpio = TEGRA_NR_GPIOS, | ||
161 | }; | 175 | }; |
162 | 176 | ||
163 | static void tegra_gpio_irq_ack(struct irq_data *d) | 177 | static void tegra_gpio_irq_ack(struct irq_data *d) |
@@ -493,20 +507,6 @@ static int __init tegra_gpio_init(void) | |||
493 | } | 507 | } |
494 | postcore_initcall(tegra_gpio_init); | 508 | postcore_initcall(tegra_gpio_init); |
495 | 509 | ||
496 | void tegra_gpio_config(struct tegra_gpio_table *table, int num) | ||
497 | { | ||
498 | int i; | ||
499 | |||
500 | for (i = 0; i < num; i++) { | ||
501 | int gpio = table[i].gpio; | ||
502 | |||
503 | if (table[i].enable) | ||
504 | tegra_gpio_enable(gpio); | ||
505 | else | ||
506 | tegra_gpio_disable(gpio); | ||
507 | } | ||
508 | } | ||
509 | |||
510 | #ifdef CONFIG_DEBUG_FS | 510 | #ifdef CONFIG_DEBUG_FS |
511 | 511 | ||
512 | #include <linux/debugfs.h> | 512 | #include <linux/debugfs.h> |
diff --git a/drivers/mmc/host/sdhci-tegra.c b/drivers/mmc/host/sdhci-tegra.c index 53b26502f6e2..ff5a16991939 100644 --- a/drivers/mmc/host/sdhci-tegra.c +++ b/drivers/mmc/host/sdhci-tegra.c | |||
@@ -269,7 +269,6 @@ static int __devinit sdhci_tegra_probe(struct platform_device *pdev) | |||
269 | "failed to allocate power gpio\n"); | 269 | "failed to allocate power gpio\n"); |
270 | goto err_power_req; | 270 | goto err_power_req; |
271 | } | 271 | } |
272 | tegra_gpio_enable(plat->power_gpio); | ||
273 | gpio_direction_output(plat->power_gpio, 1); | 272 | gpio_direction_output(plat->power_gpio, 1); |
274 | } | 273 | } |
275 | 274 | ||
@@ -280,7 +279,6 @@ static int __devinit sdhci_tegra_probe(struct platform_device *pdev) | |||
280 | "failed to allocate cd gpio\n"); | 279 | "failed to allocate cd gpio\n"); |
281 | goto err_cd_req; | 280 | goto err_cd_req; |
282 | } | 281 | } |
283 | tegra_gpio_enable(plat->cd_gpio); | ||
284 | gpio_direction_input(plat->cd_gpio); | 282 | gpio_direction_input(plat->cd_gpio); |
285 | 283 | ||
286 | rc = request_irq(gpio_to_irq(plat->cd_gpio), carddetect_irq, | 284 | rc = request_irq(gpio_to_irq(plat->cd_gpio), carddetect_irq, |
@@ -301,7 +299,6 @@ static int __devinit sdhci_tegra_probe(struct platform_device *pdev) | |||
301 | "failed to allocate wp gpio\n"); | 299 | "failed to allocate wp gpio\n"); |
302 | goto err_wp_req; | 300 | goto err_wp_req; |
303 | } | 301 | } |
304 | tegra_gpio_enable(plat->wp_gpio); | ||
305 | gpio_direction_input(plat->wp_gpio); | 302 | gpio_direction_input(plat->wp_gpio); |
306 | } | 303 | } |
307 | 304 | ||
@@ -329,23 +326,17 @@ err_add_host: | |||
329 | clk_disable(pltfm_host->clk); | 326 | clk_disable(pltfm_host->clk); |
330 | clk_put(pltfm_host->clk); | 327 | clk_put(pltfm_host->clk); |
331 | err_clk_get: | 328 | err_clk_get: |
332 | if (gpio_is_valid(plat->wp_gpio)) { | 329 | if (gpio_is_valid(plat->wp_gpio)) |
333 | tegra_gpio_disable(plat->wp_gpio); | ||
334 | gpio_free(plat->wp_gpio); | 330 | gpio_free(plat->wp_gpio); |
335 | } | ||
336 | err_wp_req: | 331 | err_wp_req: |
337 | if (gpio_is_valid(plat->cd_gpio)) | 332 | if (gpio_is_valid(plat->cd_gpio)) |
338 | free_irq(gpio_to_irq(plat->cd_gpio), host); | 333 | free_irq(gpio_to_irq(plat->cd_gpio), host); |
339 | err_cd_irq_req: | 334 | err_cd_irq_req: |
340 | if (gpio_is_valid(plat->cd_gpio)) { | 335 | if (gpio_is_valid(plat->cd_gpio)) |
341 | tegra_gpio_disable(plat->cd_gpio); | ||
342 | gpio_free(plat->cd_gpio); | 336 | gpio_free(plat->cd_gpio); |
343 | } | ||
344 | err_cd_req: | 337 | err_cd_req: |
345 | if (gpio_is_valid(plat->power_gpio)) { | 338 | if (gpio_is_valid(plat->power_gpio)) |
346 | tegra_gpio_disable(plat->power_gpio); | ||
347 | gpio_free(plat->power_gpio); | 339 | gpio_free(plat->power_gpio); |
348 | } | ||
349 | err_power_req: | 340 | err_power_req: |
350 | err_no_plat: | 341 | err_no_plat: |
351 | sdhci_pltfm_free(pdev); | 342 | sdhci_pltfm_free(pdev); |
@@ -362,21 +353,16 @@ static int __devexit sdhci_tegra_remove(struct platform_device *pdev) | |||
362 | 353 | ||
363 | sdhci_remove_host(host, dead); | 354 | sdhci_remove_host(host, dead); |
364 | 355 | ||
365 | if (gpio_is_valid(plat->wp_gpio)) { | 356 | if (gpio_is_valid(plat->wp_gpio)) |
366 | tegra_gpio_disable(plat->wp_gpio); | ||
367 | gpio_free(plat->wp_gpio); | 357 | gpio_free(plat->wp_gpio); |
368 | } | ||
369 | 358 | ||
370 | if (gpio_is_valid(plat->cd_gpio)) { | 359 | if (gpio_is_valid(plat->cd_gpio)) { |
371 | free_irq(gpio_to_irq(plat->cd_gpio), host); | 360 | free_irq(gpio_to_irq(plat->cd_gpio), host); |
372 | tegra_gpio_disable(plat->cd_gpio); | ||
373 | gpio_free(plat->cd_gpio); | 361 | gpio_free(plat->cd_gpio); |
374 | } | 362 | } |
375 | 363 | ||
376 | if (gpio_is_valid(plat->power_gpio)) { | 364 | if (gpio_is_valid(plat->power_gpio)) |
377 | tegra_gpio_disable(plat->power_gpio); | ||
378 | gpio_free(plat->power_gpio); | 365 | gpio_free(plat->power_gpio); |
379 | } | ||
380 | 366 | ||
381 | clk_disable(pltfm_host->clk); | 367 | clk_disable(pltfm_host->clk); |
382 | clk_put(pltfm_host->clk); | 368 | clk_put(pltfm_host->clk); |