diff options
author | Rabin Vincent <rabin.vincent@stericsson.com> | 2010-08-09 07:54:43 -0400 |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2010-08-26 14:54:27 -0400 |
commit | 2971944582ff43b7dedbb460777052243ac9915a (patch) | |
tree | 1f5a05fed4b3f386e6468a2d52ba087e20d6bcd2 | |
parent | d4348c678977c7093438bbbf2067c49396ae941b (diff) |
ARM: 6307/1: mmci: allow the card detect GPIO value not to be inverted
On some platforms, the GPIO value from the gpio_cd pin doesn't need to
be inverted to get it active high. Add a cd_invert platform data
parameter and change existing platforms using GPIO for CD (only
Realview) to enable it.
Acked-by: Linus Walleij <linus.walleij@stericsson.com>
Signed-off-by: Rabin Vincent <rabin.vincent@stericsson.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
-rw-r--r-- | arch/arm/mach-realview/core.c | 2 | ||||
-rw-r--r-- | drivers/mmc/host/mmci.c | 5 | ||||
-rw-r--r-- | include/linux/amba/mmci.h | 2 |
3 files changed, 7 insertions, 2 deletions
diff --git a/arch/arm/mach-realview/core.c b/arch/arm/mach-realview/core.c index 2fa38df28414..07c08151dfe6 100644 --- a/arch/arm/mach-realview/core.c +++ b/arch/arm/mach-realview/core.c | |||
@@ -259,6 +259,7 @@ struct mmci_platform_data realview_mmc0_plat_data = { | |||
259 | .status = realview_mmc_status, | 259 | .status = realview_mmc_status, |
260 | .gpio_wp = 17, | 260 | .gpio_wp = 17, |
261 | .gpio_cd = 16, | 261 | .gpio_cd = 16, |
262 | .cd_invert = true, | ||
262 | }; | 263 | }; |
263 | 264 | ||
264 | struct mmci_platform_data realview_mmc1_plat_data = { | 265 | struct mmci_platform_data realview_mmc1_plat_data = { |
@@ -266,6 +267,7 @@ struct mmci_platform_data realview_mmc1_plat_data = { | |||
266 | .status = realview_mmc_status, | 267 | .status = realview_mmc_status, |
267 | .gpio_wp = 19, | 268 | .gpio_wp = 19, |
268 | .gpio_cd = 18, | 269 | .gpio_cd = 18, |
270 | .cd_invert = true, | ||
269 | }; | 271 | }; |
270 | 272 | ||
271 | /* | 273 | /* |
diff --git a/drivers/mmc/host/mmci.c b/drivers/mmc/host/mmci.c index 840b301b5671..9a9aeac50a6c 100644 --- a/drivers/mmc/host/mmci.c +++ b/drivers/mmc/host/mmci.c | |||
@@ -570,12 +570,13 @@ static int mmci_get_ro(struct mmc_host *mmc) | |||
570 | static int mmci_get_cd(struct mmc_host *mmc) | 570 | static int mmci_get_cd(struct mmc_host *mmc) |
571 | { | 571 | { |
572 | struct mmci_host *host = mmc_priv(mmc); | 572 | struct mmci_host *host = mmc_priv(mmc); |
573 | struct mmci_platform_data *plat = host->plat; | ||
573 | unsigned int status; | 574 | unsigned int status; |
574 | 575 | ||
575 | if (host->gpio_cd == -ENOSYS) | 576 | if (host->gpio_cd == -ENOSYS) |
576 | status = host->plat->status(mmc_dev(host->mmc)); | 577 | status = plat->status(mmc_dev(host->mmc)); |
577 | else | 578 | else |
578 | status = !gpio_get_value(host->gpio_cd); | 579 | status = !!gpio_get_value(host->gpio_cd) ^ plat->cd_invert; |
579 | 580 | ||
580 | /* | 581 | /* |
581 | * Use positive logic throughout - status is zero for no card, | 582 | * Use positive logic throughout - status is zero for no card, |
diff --git a/include/linux/amba/mmci.h b/include/linux/amba/mmci.h index ca84ce70d5d5..f4ee9acc9721 100644 --- a/include/linux/amba/mmci.h +++ b/include/linux/amba/mmci.h | |||
@@ -24,6 +24,7 @@ | |||
24 | * whether a card is present in the MMC slot or not | 24 | * whether a card is present in the MMC slot or not |
25 | * @gpio_wp: read this GPIO pin to see if the card is write protected | 25 | * @gpio_wp: read this GPIO pin to see if the card is write protected |
26 | * @gpio_cd: read this GPIO pin to detect card insertion | 26 | * @gpio_cd: read this GPIO pin to detect card insertion |
27 | * @cd_invert: true if the gpio_cd pin value is active low | ||
27 | * @capabilities: the capabilities of the block as implemented in | 28 | * @capabilities: the capabilities of the block as implemented in |
28 | * this platform, signify anything MMC_CAP_* from mmc/host.h | 29 | * this platform, signify anything MMC_CAP_* from mmc/host.h |
29 | */ | 30 | */ |
@@ -35,6 +36,7 @@ struct mmci_platform_data { | |||
35 | unsigned int (*status)(struct device *); | 36 | unsigned int (*status)(struct device *); |
36 | int gpio_wp; | 37 | int gpio_wp; |
37 | int gpio_cd; | 38 | int gpio_cd; |
39 | bool cd_invert; | ||
38 | unsigned long capabilities; | 40 | unsigned long capabilities; |
39 | }; | 41 | }; |
40 | 42 | ||