aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm
diff options
context:
space:
mode:
authorStephen Warren <swarren@nvidia.com>2012-02-18 03:04:55 -0500
committerStephen Warren <swarren@nvidia.com>2012-04-18 12:26:38 -0400
commit3e215d0a19c2a0c389bd9117573b6dd8e46f96a8 (patch)
treea45a82fc3e26459c8146cbe933229344cefa8b70 /arch/arm
parentc61b3da0aca4cccb1dca757eb94e443faba4e88f (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>
Diffstat (limited to 'arch/arm')
-rw-r--r--arch/arm/mach-tegra/board-dt-tegra20.c1
-rw-r--r--arch/arm/mach-tegra/board-harmony-pinmux.c17
-rw-r--r--arch/arm/mach-tegra/board-paz00-pinmux.c14
-rw-r--r--arch/arm/mach-tegra/board-pinmux.c33
-rw-r--r--arch/arm/mach-tegra/board-pinmux.h5
-rw-r--r--arch/arm/mach-tegra/board-seaboard-pinmux.c32
-rw-r--r--arch/arm/mach-tegra/board-seaboard.c1
-rw-r--r--arch/arm/mach-tegra/board-trimslice-pinmux.c12
-rw-r--r--arch/arm/mach-tegra/include/mach/gpio-tegra.h9
-rw-r--r--arch/arm/mach-tegra/usb_phy.c1
10 files changed, 4 insertions, 121 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
56struct of_dev_auxdata tegra20_auxdata_lookup[] __initdata = { 56struct 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
147static 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
160static struct tegra_board_pinmux_conf conf = { 145static 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
167void harmony_pinmux_init(void) 150void 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
147static 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
157static struct tegra_board_pinmux_conf conf = { 145static 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
164void paz00_pinmux_init(void) 150void 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
27struct tegra_board_pinmux_conf *confs[2]; 26struct tegra_board_pinmux_conf *confs[2];
28 27
29static 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
41static void tegra_board_pinmux_setup_pinmux(void) 28static 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)
57static int tegra_board_pinmux_bus_notify(struct notifier_block *nb, 44static 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
85static struct notifier_block nb = { 60static 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
21struct tegra_pingroup_config; 20struct tegra_pingroup_config;
22struct tegra_gpio_table;
23 21
24struct tegra_board_pinmux_conf { 22struct 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
35void tegra_board_pinmux_init(struct tegra_board_pinmux_conf *conf_a, 30void 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
182static 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
189static 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
197static 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
206static struct tegra_board_pinmux_conf common_conf = { 180static 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
213static struct tegra_board_pinmux_conf seaboard_conf = { 185static 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
222static struct tegra_board_pinmux_conf ventana_conf = { 192static 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
229void seaboard_pinmux_init(void) 197void 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
147static 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
155static struct tegra_board_pinmux_conf conf = { 145static 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
162void trimslice_pinmux_init(void) 150void 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
28struct tegra_gpio_table {
29 int gpio; /* GPIO number */
30 bool enable; /* Enable for GPIO at init? */
31};
32
33void tegra_gpio_config(struct tegra_gpio_table *table, int num);
34void tegra_gpio_enable(int gpio);
35void 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);