diff options
author | Pavan Kunapuli <pkunapuli@nvidia.com> | 2011-02-07 00:10:30 -0800 |
---|---|---|
committer | Dan Willemsen <dwillemsen@nvidia.com> | 2011-11-30 21:45:36 -0800 |
commit | fd21107491bdc812696129603a1da4a2e908055b (patch) | |
tree | 275a44148b8a448508193734aca9cce8abaa714f /arch/arm/mach-tegra/board-cardhu-sdhci.c | |
parent | 5730ac496edf297a6e72ccfd0b8fce2dce250a51 (diff) |
sdhci-tegra:Enable Hotplugin and wp support for sd card.
Enabling hot plugin/plugout support for sd card using
a gpio.
Enabling write protect detection support for sd card
using a gpio.
Enabling SDHCI_QUIRK_BROKEN_CARD_DETECTION quirk for
sdmmc on T30.
Bug 784133
Bug 786261
Original-Change-Id: Ie9a49472f4b2337a7e2b0eb52c2cb346b021f768
Reviewed-on: http://git-master/r/18438
Tested-by: Pavan Kunapuli <pkunapuli@nvidia.com>
Reviewed-by: Venkata Nageswara Penumarty <vpenumarty@nvidia.com>
Reviewed-by: Laxman Dewangan <ldewangan@nvidia.com>
Reviewed-by: Scott Williams <scwilliams@nvidia.com>
Original-Change-Id: I5b41730281aa360b2ec29fd94c7644d008e8be28
Rebase-Id: R49ff50b7948a07a4d4faef5dc5678889093d2950
Diffstat (limited to 'arch/arm/mach-tegra/board-cardhu-sdhci.c')
-rw-r--r-- | arch/arm/mach-tegra/board-cardhu-sdhci.c | 47 |
1 files changed, 30 insertions, 17 deletions
diff --git a/arch/arm/mach-tegra/board-cardhu-sdhci.c b/arch/arm/mach-tegra/board-cardhu-sdhci.c index 31c2befb4d38..52ae10fbd3f2 100644 --- a/arch/arm/mach-tegra/board-cardhu-sdhci.c +++ b/arch/arm/mach-tegra/board-cardhu-sdhci.c @@ -30,6 +30,9 @@ #include "gpio-names.h" #include "board.h" +#define CARDHU_SD_CD TEGRA_GPIO_PI5 +#define CARDHU_SD_WP TEGRA_GPIO_PT3 + static struct resource sdhci_resource0[] = { [0] = { .start = INT_SDMMC1, @@ -143,15 +146,19 @@ static int cardhu_sd_cd_gpio_init(void) { unsigned int rc = 0; - rc = gpio_request(TEGRA_GPIO_PI5, "card_detect"); - if (rc) + rc = gpio_request(CARDHU_SD_CD, "card_detect"); + if (rc) { + pr_err("Card detect gpio request failed:%d\n", rc); return rc; + } - tegra_gpio_enable(TEGRA_GPIO_PI5); + tegra_gpio_enable(CARDHU_SD_CD); - rc = gpio_direction_input(TEGRA_GPIO_PI5); - if (rc) + rc = gpio_direction_input(CARDHU_SD_CD); + if (rc) { + pr_err("Unable to configure direction for card detect gpio:%d\n", rc); return rc; + } return 0; } @@ -160,15 +167,19 @@ static int cardhu_sd_wp_gpio_init(void) { unsigned int rc = 0; - rc = gpio_request(TEGRA_GPIO_PT3, "write_protect"); - if (rc) + rc = gpio_request(CARDHU_SD_WP, "write_protect"); + if (rc) { + pr_err("Write protect gpio request failed:%d\n", rc); return rc; + } - tegra_gpio_enable(TEGRA_GPIO_PT3); + tegra_gpio_enable(CARDHU_SD_WP); - rc = gpio_direction_input(TEGRA_GPIO_PT3); - if (rc) + rc = gpio_direction_input(CARDHU_SD_WP); + if (rc) { + pr_err("Unable to configure direction for write protect gpio:%d\n", rc); return rc; + } return 0; } @@ -179,16 +190,18 @@ int __init cardhu_sdhci_init(void) platform_device_register(&tegra_sdhci_device3); platform_device_register(&tegra_sdhci_device2); -#if 0 /* Fix ME: The gpios have to enabled for hot plug support */ rc = cardhu_sd_cd_gpio_init(); - if (!rc) - tegra_sdhci_platform_data0.cd_gpio = TEGRA_GPIO_PI5; - + if (!rc) { + tegra_sdhci_platform_data0.cd_gpio = CARDHU_SD_CD; + tegra_sdhci_platform_data0.cd_gpio_polarity = 0; + } rc = cardhu_sd_wp_gpio_init(); - if (!rc) - tegra_sdhci_platform_data0.cd_gpio = TEGRA_GPIO_PT3; -#endif + if (!rc) { + tegra_sdhci_platform_data0.wp_gpio = CARDHU_SD_WP; + tegra_sdhci_platform_data0.wp_gpio_polarity = 1; + } + platform_device_register(&tegra_sdhci_device0); return 0; } |