diff options
Diffstat (limited to 'drivers/mmc/host/atmel-mci.c')
-rw-r--r-- | drivers/mmc/host/atmel-mci.c | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/drivers/mmc/host/atmel-mci.c b/drivers/mmc/host/atmel-mci.c index b68381f7bfdd..992b4beb757c 100644 --- a/drivers/mmc/host/atmel-mci.c +++ b/drivers/mmc/host/atmel-mci.c | |||
@@ -11,6 +11,8 @@ | |||
11 | #include <linux/clk.h> | 11 | #include <linux/clk.h> |
12 | #include <linux/debugfs.h> | 12 | #include <linux/debugfs.h> |
13 | #include <linux/device.h> | 13 | #include <linux/device.h> |
14 | #include <linux/err.h> | ||
15 | #include <linux/gpio.h> | ||
14 | #include <linux/init.h> | 16 | #include <linux/init.h> |
15 | #include <linux/interrupt.h> | 17 | #include <linux/interrupt.h> |
16 | #include <linux/ioport.h> | 18 | #include <linux/ioport.h> |
@@ -27,7 +29,6 @@ | |||
27 | #include <asm/unaligned.h> | 29 | #include <asm/unaligned.h> |
28 | 30 | ||
29 | #include <asm/arch/board.h> | 31 | #include <asm/arch/board.h> |
30 | #include <asm/arch/gpio.h> | ||
31 | 32 | ||
32 | #include "atmel-mci-regs.h" | 33 | #include "atmel-mci-regs.h" |
33 | 34 | ||
@@ -573,7 +574,7 @@ static int atmci_get_ro(struct mmc_host *mmc) | |||
573 | int read_only = 0; | 574 | int read_only = 0; |
574 | struct atmel_mci *host = mmc_priv(mmc); | 575 | struct atmel_mci *host = mmc_priv(mmc); |
575 | 576 | ||
576 | if (host->wp_pin >= 0) { | 577 | if (gpio_is_valid(host->wp_pin)) { |
577 | read_only = gpio_get_value(host->wp_pin); | 578 | read_only = gpio_get_value(host->wp_pin); |
578 | dev_dbg(&mmc->class_dev, "card is %s\n", | 579 | dev_dbg(&mmc->class_dev, "card is %s\n", |
579 | read_only ? "read-only" : "read-write"); | 580 | read_only ? "read-only" : "read-write"); |
@@ -635,7 +636,7 @@ static void atmci_detect_change(unsigned long data) | |||
635 | * been freed. | 636 | * been freed. |
636 | */ | 637 | */ |
637 | smp_rmb(); | 638 | smp_rmb(); |
638 | if (host->detect_pin < 0) | 639 | if (!gpio_is_valid(host->detect_pin)) |
639 | return; | 640 | return; |
640 | 641 | ||
641 | enable_irq(gpio_to_irq(host->detect_pin)); | 642 | enable_irq(gpio_to_irq(host->detect_pin)); |
@@ -1050,7 +1051,7 @@ static int __init atmci_probe(struct platform_device *pdev) | |||
1050 | 1051 | ||
1051 | /* Assume card is present if we don't have a detect pin */ | 1052 | /* Assume card is present if we don't have a detect pin */ |
1052 | host->present = 1; | 1053 | host->present = 1; |
1053 | if (host->detect_pin >= 0) { | 1054 | if (gpio_is_valid(host->detect_pin)) { |
1054 | if (gpio_request(host->detect_pin, "mmc_detect")) { | 1055 | if (gpio_request(host->detect_pin, "mmc_detect")) { |
1055 | dev_dbg(&mmc->class_dev, "no detect pin available\n"); | 1056 | dev_dbg(&mmc->class_dev, "no detect pin available\n"); |
1056 | host->detect_pin = -1; | 1057 | host->detect_pin = -1; |
@@ -1058,7 +1059,7 @@ static int __init atmci_probe(struct platform_device *pdev) | |||
1058 | host->present = !gpio_get_value(host->detect_pin); | 1059 | host->present = !gpio_get_value(host->detect_pin); |
1059 | } | 1060 | } |
1060 | } | 1061 | } |
1061 | if (host->wp_pin >= 0) { | 1062 | if (gpio_is_valid(host->wp_pin)) { |
1062 | if (gpio_request(host->wp_pin, "mmc_wp")) { | 1063 | if (gpio_request(host->wp_pin, "mmc_wp")) { |
1063 | dev_dbg(&mmc->class_dev, "no WP pin available\n"); | 1064 | dev_dbg(&mmc->class_dev, "no WP pin available\n"); |
1064 | host->wp_pin = -1; | 1065 | host->wp_pin = -1; |
@@ -1069,7 +1070,7 @@ static int __init atmci_probe(struct platform_device *pdev) | |||
1069 | 1070 | ||
1070 | mmc_add_host(mmc); | 1071 | mmc_add_host(mmc); |
1071 | 1072 | ||
1072 | if (host->detect_pin >= 0) { | 1073 | if (gpio_is_valid(host->detect_pin)) { |
1073 | setup_timer(&host->detect_timer, atmci_detect_change, | 1074 | setup_timer(&host->detect_timer, atmci_detect_change, |
1074 | (unsigned long)host); | 1075 | (unsigned long)host); |
1075 | 1076 | ||
@@ -1112,7 +1113,7 @@ static int __exit atmci_remove(struct platform_device *pdev) | |||
1112 | if (host) { | 1113 | if (host) { |
1113 | /* Debugfs stuff is cleaned up by mmc core */ | 1114 | /* Debugfs stuff is cleaned up by mmc core */ |
1114 | 1115 | ||
1115 | if (host->detect_pin >= 0) { | 1116 | if (gpio_is_valid(host->detect_pin)) { |
1116 | int pin = host->detect_pin; | 1117 | int pin = host->detect_pin; |
1117 | 1118 | ||
1118 | /* Make sure the timer doesn't enable the interrupt */ | 1119 | /* Make sure the timer doesn't enable the interrupt */ |
@@ -1132,7 +1133,7 @@ static int __exit atmci_remove(struct platform_device *pdev) | |||
1132 | mci_readl(host, SR); | 1133 | mci_readl(host, SR); |
1133 | clk_disable(host->mck); | 1134 | clk_disable(host->mck); |
1134 | 1135 | ||
1135 | if (host->wp_pin >= 0) | 1136 | if (gpio_is_valid(host->wp_pin)) |
1136 | gpio_free(host->wp_pin); | 1137 | gpio_free(host->wp_pin); |
1137 | 1138 | ||
1138 | free_irq(platform_get_irq(pdev, 0), host->mmc); | 1139 | free_irq(platform_get_irq(pdev, 0), host->mmc); |