aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-mx3
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2009-05-06 06:55:50 -0400
committerSascha Hauer <s.hauer@pengutronix.de>2009-05-07 10:20:52 -0400
commit4f163eb8811e8ea760d9fe654ecc6f17feecb477 (patch)
tree5772ca291eabad6335f52dc0a462761a6140e8ca /arch/arm/mach-mx3
parentef754d635820102ec7719486d40ede3c94ba44c8 (diff)
mx31: calls to gpio_request moved into platform code
In order to use the gpiolib, we now have to call gpio_request in the plaform code since it is not done in iomux code anymore. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'arch/arm/mach-mx3')
-rw-r--r--arch/arm/mach-mx3/mx31ads.c2
-rw-r--r--arch/arm/mach-mx3/mx31lite.c11
-rw-r--r--arch/arm/mach-mx3/mx31moboard-devboard.c28
-rw-r--r--arch/arm/mach-mx3/mx31moboard-marxbot.c28
-rw-r--r--arch/arm/mach-mx3/mx31moboard.c28
-rw-r--r--arch/arm/mach-mx3/pcm037.c45
6 files changed, 129 insertions, 13 deletions
diff --git a/arch/arm/mach-mx3/mx31ads.c b/arch/arm/mach-mx3/mx31ads.c
index db2e06a8123d..30e2767a78ae 100644
--- a/arch/arm/mach-mx3/mx31ads.c
+++ b/arch/arm/mach-mx3/mx31ads.c
@@ -187,7 +187,7 @@ static void __init mx31ads_init_expio(void)
187 /* 187 /*
188 * Configure INT line as GPIO input 188 * Configure INT line as GPIO input
189 */ 189 */
190 mxc_iomux_setup_pin(IOMUX_MODE(MX31_PIN_GPIO1_4, IOMUX_CONFIG_GPIO), "expio"); 190 mxc_iomux_alloc_pin(IOMUX_MODE(MX31_PIN_GPIO1_4, IOMUX_CONFIG_GPIO), "expio");
191 191
192 /* disable the interrupt and clear the status */ 192 /* disable the interrupt and clear the status */
193 __raw_writew(0xFFFF, PBC_INTMASK_CLEAR_REG); 193 __raw_writew(0xFFFF, PBC_INTMASK_CLEAR_REG);
diff --git a/arch/arm/mach-mx3/mx31lite.c b/arch/arm/mach-mx3/mx31lite.c
index 74734e50de24..e70922913164 100644
--- a/arch/arm/mach-mx3/mx31lite.c
+++ b/arch/arm/mach-mx3/mx31lite.c
@@ -118,14 +118,21 @@ void __init mx31lite_map_io(void)
118 */ 118 */
119static void __init mxc_board_init(void) 119static void __init mxc_board_init(void)
120{ 120{
121 int ret;
122
121 mxc_iomux_setup_multiple_pins(mx31lite_pins, ARRAY_SIZE(mx31lite_pins), 123 mxc_iomux_setup_multiple_pins(mx31lite_pins, ARRAY_SIZE(mx31lite_pins),
122 "mx31lite"); 124 "mx31lite");
123 125
124 mxc_register_device(&mxc_uart_device0, &uart_pdata); 126 mxc_register_device(&mxc_uart_device0, &uart_pdata);
125 127
126 /* SMSC9117 IRQ pin */ 128 /* SMSC9117 IRQ pin */
127 gpio_direction_input(IOMUX_TO_GPIO(MX31_PIN_SFS6)); 129 ret = gpio_request(IOMUX_TO_GPIO(MX31_PIN_SFS6), "sms9117-irq");
128 platform_device_register(&smsc911x_device); 130 if (ret)
131 pr_warning("could not get LAN irq gpio\n");
132 else {
133 gpio_direction_input(IOMUX_TO_GPIO(MX31_PIN_SFS6));
134 platform_device_register(&smsc911x_device);
135 }
129} 136}
130 137
131static void __init mx31lite_timer_init(void) 138static void __init mx31lite_timer_init(void)
diff --git a/arch/arm/mach-mx3/mx31moboard-devboard.c b/arch/arm/mach-mx3/mx31moboard-devboard.c
index 0a69a4f212a3..b3e8f251ac79 100644
--- a/arch/arm/mach-mx3/mx31moboard-devboard.c
+++ b/arch/arm/mach-mx3/mx31moboard-devboard.c
@@ -56,14 +56,40 @@ static int devboard_sdhc2_get_ro(struct device *dev)
56static int devboard_sdhc2_init(struct device *dev, irq_handler_t detect_irq, 56static int devboard_sdhc2_init(struct device *dev, irq_handler_t detect_irq,
57 void *data) 57 void *data)
58{ 58{
59 return request_irq(gpio_to_irq(SDHC2_CD), detect_irq, 59 int ret;
60
61 ret = gpio_request(SDHC2_CD, "sdhc-detect");
62 if (ret)
63 return ret;
64
65 gpio_direction_input(SDHC2_CD);
66
67 ret = gpio_request(SDHC2_WP, "sdhc-wp");
68 if (ret)
69 goto err_gpio_free;
70 gpio_direction_input(SDHC2_WP);
71
72 ret = request_irq(gpio_to_irq(SDHC2_CD), detect_irq,
60 IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING, 73 IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING,
61 "sdhc2-card-detect", data); 74 "sdhc2-card-detect", data);
75 if (ret)
76 goto err_gpio_free_2;
77
78 return 0;
79
80err_gpio_free_2:
81 gpio_free(SDHC2_WP);
82err_gpio_free:
83 gpio_free(SDHC2_CD);
84
85 return ret;
62} 86}
63 87
64static void devboard_sdhc2_exit(struct device *dev, void *data) 88static void devboard_sdhc2_exit(struct device *dev, void *data)
65{ 89{
66 free_irq(gpio_to_irq(SDHC2_CD), data); 90 free_irq(gpio_to_irq(SDHC2_CD), data);
91 gpio_free(SDHC2_WP);
92 gpio_free(SDHC2_CD);
67} 93}
68 94
69static struct imxmmc_platform_data sdhc2_pdata = { 95static struct imxmmc_platform_data sdhc2_pdata = {
diff --git a/arch/arm/mach-mx3/mx31moboard-marxbot.c b/arch/arm/mach-mx3/mx31moboard-marxbot.c
index 4fc271145b0c..53ce7ff0637c 100644
--- a/arch/arm/mach-mx3/mx31moboard-marxbot.c
+++ b/arch/arm/mach-mx3/mx31moboard-marxbot.c
@@ -60,14 +60,40 @@ static int marxbot_sdhc2_get_ro(struct device *dev)
60static int marxbot_sdhc2_init(struct device *dev, irq_handler_t detect_irq, 60static int marxbot_sdhc2_init(struct device *dev, irq_handler_t detect_irq,
61 void *data) 61 void *data)
62{ 62{
63 return request_irq(gpio_to_irq(SDHC2_CD), detect_irq, 63 int ret;
64
65 ret = gpio_request(SDHC2_CD, "sdhc-detect");
66 if (ret)
67 return ret;
68
69 gpio_direction_input(SDHC2_CD);
70
71 ret = gpio_request(SDHC2_WP, "sdhc-wp");
72 if (ret)
73 goto err_gpio_free;
74 gpio_direction_input(SDHC2_WP);
75
76 ret = request_irq(gpio_to_irq(SDHC2_CD), detect_irq,
64 IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING, 77 IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING,
65 "sdhc2-card-detect", data); 78 "sdhc2-card-detect", data);
79 if (ret)
80 goto err_gpio_free_2;
81
82 return 0;
83
84err_gpio_free_2:
85 gpio_free(SDHC2_WP);
86err_gpio_free:
87 gpio_free(SDHC2_CD);
88
89 return ret;
66} 90}
67 91
68static void marxbot_sdhc2_exit(struct device *dev, void *data) 92static void marxbot_sdhc2_exit(struct device *dev, void *data)
69{ 93{
70 free_irq(gpio_to_irq(SDHC2_CD), data); 94 free_irq(gpio_to_irq(SDHC2_CD), data);
95 gpio_free(SDHC2_WP);
96 gpio_free(SDHC2_CD);
71} 97}
72 98
73static struct imxmmc_platform_data sdhc2_pdata = { 99static struct imxmmc_platform_data sdhc2_pdata = {
diff --git a/arch/arm/mach-mx3/mx31moboard.c b/arch/arm/mach-mx3/mx31moboard.c
index 2cca3f2e72b9..0df6ac610b65 100644
--- a/arch/arm/mach-mx3/mx31moboard.c
+++ b/arch/arm/mach-mx3/mx31moboard.c
@@ -112,14 +112,40 @@ static int moboard_sdhc1_get_ro(struct device *dev)
112static int moboard_sdhc1_init(struct device *dev, irq_handler_t detect_irq, 112static int moboard_sdhc1_init(struct device *dev, irq_handler_t detect_irq,
113 void *data) 113 void *data)
114{ 114{
115 return request_irq(gpio_to_irq(SDHC1_CD), detect_irq, 115 int ret;
116
117 ret = gpio_request(SDHC1_CD, "sdhc-detect");
118 if (ret)
119 return ret;
120
121 gpio_direction_input(SDHC1_CD);
122
123 ret = gpio_request(SDHC1_WP, "sdhc-wp");
124 if (ret)
125 goto err_gpio_free;
126 gpio_direction_input(SDHC1_WP);
127
128 ret = request_irq(gpio_to_irq(SDHC1_CD), detect_irq,
116 IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING, 129 IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING,
117 "sdhc1-card-detect", data); 130 "sdhc1-card-detect", data);
131 if (ret)
132 goto err_gpio_free_2;
133
134 return 0;
135
136err_gpio_free_2:
137 gpio_free(SDHC1_WP);
138err_gpio_free:
139 gpio_free(SDHC1_CD);
140
141 return ret;
118} 142}
119 143
120static void moboard_sdhc1_exit(struct device *dev, void *data) 144static void moboard_sdhc1_exit(struct device *dev, void *data)
121{ 145{
122 free_irq(gpio_to_irq(SDHC1_CD), data); 146 free_irq(gpio_to_irq(SDHC1_CD), data);
147 gpio_free(SDHC1_WP);
148 gpio_free(SDHC1_CD);
123} 149}
124 150
125static struct imxmmc_platform_data sdhc1_pdata = { 151static struct imxmmc_platform_data sdhc1_pdata = {
diff --git a/arch/arm/mach-mx3/pcm037.c b/arch/arm/mach-mx3/pcm037.c
index 350cff5cc48a..c6f61a1f06c8 100644
--- a/arch/arm/mach-mx3/pcm037.c
+++ b/arch/arm/mach-mx3/pcm037.c
@@ -280,27 +280,50 @@ static int pcm970_sdhc1_get_ro(struct device *dev)
280} 280}
281#endif 281#endif
282 282
283#define SDHC1_GPIO_WP IOMUX_TO_GPIO(MX31_PIN_SFS6)
284#define SDHC1_GPIO_DET IOMUX_TO_GPIO(MX31_PIN_SCK6)
285
283static int pcm970_sdhc1_init(struct device *dev, irq_handler_t detect_irq, 286static int pcm970_sdhc1_init(struct device *dev, irq_handler_t detect_irq,
284 void *data) 287 void *data)
285{ 288{
286 int ret; 289 int ret;
287 int gpio_det, gpio_wp;
288 290
289 gpio_det = IOMUX_TO_GPIO(MX31_PIN_SCK6); 291 ret = gpio_request(SDHC1_GPIO_DET, "sdhc-detect");
290 gpio_wp = IOMUX_TO_GPIO(MX31_PIN_SFS6); 292 if (ret)
293 return ret;
294
295 gpio_direction_input(SDHC1_GPIO_DET);
291 296
292 gpio_direction_input(gpio_det); 297#ifdef PCM970_SDHC_RW_SWITCH
293 gpio_direction_input(gpio_wp); 298 ret = gpio_request(SDHC1_GPIO_WP, "sdhc-wp");
299 if (ret)
300 goto err_gpio_free;
301 gpio_direction_input(SDHC1_GPIO_WP);
302#endif
294 303
295 ret = request_irq(IOMUX_TO_IRQ(MX31_PIN_SCK6), detect_irq, 304 ret = request_irq(IOMUX_TO_IRQ(MX31_PIN_SCK6), detect_irq,
296 IRQF_DISABLED | IRQF_TRIGGER_FALLING, 305 IRQF_DISABLED | IRQF_TRIGGER_FALLING,
297 "sdhc-detect", data); 306 "sdhc-detect", data);
307 if (ret)
308 goto err_gpio_free_2;
309
310 return 0;
311
312err_gpio_free_2:
313#ifdef PCM970_SDHC_RW_SWITCH
314 gpio_free(SDHC1_GPIO_WP);
315err_gpio_free:
316#endif
317 gpio_free(SDHC1_GPIO_DET);
318
298 return ret; 319 return ret;
299} 320}
300 321
301static void pcm970_sdhc1_exit(struct device *dev, void *data) 322static void pcm970_sdhc1_exit(struct device *dev, void *data)
302{ 323{
303 free_irq(IOMUX_TO_IRQ(MX31_PIN_SCK6), data); 324 free_irq(IOMUX_TO_IRQ(MX31_PIN_SCK6), data);
325 gpio_free(SDHC1_GPIO_DET);
326 gpio_free(SDHC1_GPIO_WP);
304} 327}
305 328
306static struct imxmmc_platform_data sdhc_pdata = { 329static struct imxmmc_platform_data sdhc_pdata = {
@@ -313,7 +336,6 @@ static struct imxmmc_platform_data sdhc_pdata = {
313 336
314static struct platform_device *devices[] __initdata = { 337static struct platform_device *devices[] __initdata = {
315 &pcm037_flash, 338 &pcm037_flash,
316 &pcm037_eth,
317 &pcm037_sram_device, 339 &pcm037_sram_device,
318}; 340};
319 341
@@ -370,6 +392,8 @@ static struct mx3fb_platform_data mx3fb_pdata = {
370 */ 392 */
371static void __init mxc_board_init(void) 393static void __init mxc_board_init(void)
372{ 394{
395 int ret;
396
373 mxc_iomux_setup_multiple_pins(pcm037_pins, ARRAY_SIZE(pcm037_pins), 397 mxc_iomux_setup_multiple_pins(pcm037_pins, ARRAY_SIZE(pcm037_pins),
374 "pcm037"); 398 "pcm037");
375 399
@@ -382,7 +406,14 @@ static void __init mxc_board_init(void)
382 mxc_register_device(&mxc_w1_master_device, NULL); 406 mxc_register_device(&mxc_w1_master_device, NULL);
383 407
384 /* LAN9217 IRQ pin */ 408 /* LAN9217 IRQ pin */
385 gpio_direction_input(IOMUX_TO_GPIO(MX31_PIN_GPIO3_1)); 409 ret = gpio_request(IOMUX_TO_GPIO(MX31_PIN_GPIO3_1), "lan9217-irq");
410 if (ret)
411 pr_warning("could not get LAN irq gpio\n");
412 else {
413 gpio_direction_input(IOMUX_TO_GPIO(MX31_PIN_GPIO3_1));
414 platform_device_register(&pcm037_eth);
415 }
416
386 417
387#ifdef CONFIG_I2C_IMX 418#ifdef CONFIG_I2C_IMX
388 i2c_register_board_info(1, pcm037_i2c_devices, 419 i2c_register_board_info(1, pcm037_i2c_devices,