summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPavan Kunapuli <pkunapuli@nvidia.com>2011-05-26 16:50:29 +0530
committerRohan Somvanshi <rsomvanshi@nvidia.com>2011-05-27 19:55:24 -0700
commit57710f94c9bb70a2a4265c751729ae579b3adf16 (patch)
tree81b090b0a7a25e1290a5a11ceab4d015f4690598
parent51d5a67434bb892edac6dfb171438eb7c6cd0c3f (diff)
sdhci: tegra: Update card present status
Based on the polarity of the card detect gpio, update the card present status for sd cards to be properly detected and enumerated. Bug 831409 Change-Id: I7d0514ba61a1f418ecf2603e12fa99fb9d748dbe Reviewed-on: http://git-master/r/33124 Reviewed-by: Pavan Kunapuli <pkunapuli@nvidia.com> Tested-by: Pavan Kunapuli <pkunapuli@nvidia.com> Reviewed-by: Sachin Nikam <snikam@nvidia.com> Reviewed-by: Bharat Nihalani <bnihalani@nvidia.com> Reviewed-by: Joseph Lehrer <jlehrer@nvidia.com> Tested-by: Joseph Lehrer <jlehrer@nvidia.com>
-rw-r--r--drivers/mmc/host/sdhci-tegra.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/drivers/mmc/host/sdhci-tegra.c b/drivers/mmc/host/sdhci-tegra.c
index 762b32bb00ac..977b6dde22d7 100644
--- a/drivers/mmc/host/sdhci-tegra.c
+++ b/drivers/mmc/host/sdhci-tegra.c
@@ -42,12 +42,17 @@ struct tegra_sdhci_host {
u32 sdhci_ints;
int wp_gpio;
int card_present;
+ int cd_gpio;
+ int cd_gpio_polarity;
};
static irqreturn_t carddetect_irq(int irq, void *data)
{
struct sdhci_host *sdhost = (struct sdhci_host *)data;
+ struct tegra_sdhci_host *host = sdhci_priv(sdhost);
+ host->card_present =
+ (gpio_get_value(host->cd_gpio) == host->cd_gpio_polarity);
tasklet_schedule(&sdhost->card_tasklet);
return IRQ_HANDLED;
};
@@ -146,6 +151,8 @@ static int __devinit tegra_sdhci_probe(struct platform_device *pdev)
host->sdhci = sdhci;
host->card_always_on = (plat->power_gpio == -1) ? 1 : 0;
host->wp_gpio = plat->wp_gpio;
+ host->cd_gpio = plat->cd_gpio;
+ host->cd_gpio_polarity = plat->cd_gpio_polarity;
host->clk = clk_get(&pdev->dev, plat->clk_id);
if (IS_ERR(host->clk)) {
@@ -200,6 +207,8 @@ static int __devinit tegra_sdhci_probe(struct platform_device *pdev)
if (rc)
goto err_remove_host;
+ host->card_present =
+ (gpio_get_value(plat->cd_gpio) == host->cd_gpio_polarity);
} else if (plat->register_status_notify) {
plat->register_status_notify(
tegra_sdhci_status_notify_cb, sdhci);