diff options
author | Sascha Hauer <s.hauer@pengutronix.de> | 2009-05-06 06:55:50 -0400 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2009-05-07 10:20:52 -0400 |
commit | 4f163eb8811e8ea760d9fe654ecc6f17feecb477 (patch) | |
tree | 5772ca291eabad6335f52dc0a462761a6140e8ca /arch/arm/mach-mx3/pcm037.c | |
parent | ef754d635820102ec7719486d40ede3c94ba44c8 (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/pcm037.c')
-rw-r--r-- | arch/arm/mach-mx3/pcm037.c | 45 |
1 files changed, 38 insertions, 7 deletions
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 | |||
283 | static int pcm970_sdhc1_init(struct device *dev, irq_handler_t detect_irq, | 286 | static 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 | |||
312 | err_gpio_free_2: | ||
313 | #ifdef PCM970_SDHC_RW_SWITCH | ||
314 | gpio_free(SDHC1_GPIO_WP); | ||
315 | err_gpio_free: | ||
316 | #endif | ||
317 | gpio_free(SDHC1_GPIO_DET); | ||
318 | |||
298 | return ret; | 319 | return ret; |
299 | } | 320 | } |
300 | 321 | ||
301 | static void pcm970_sdhc1_exit(struct device *dev, void *data) | 322 | static 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 | ||
306 | static struct imxmmc_platform_data sdhc_pdata = { | 329 | static struct imxmmc_platform_data sdhc_pdata = { |
@@ -313,7 +336,6 @@ static struct imxmmc_platform_data sdhc_pdata = { | |||
313 | 336 | ||
314 | static struct platform_device *devices[] __initdata = { | 337 | static 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 | */ |
371 | static void __init mxc_board_init(void) | 393 | static 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, |