From 3bbead1710a643704350ea4d86caa4104a7b7d56 Mon Sep 17 00:00:00 2001 From: Pavan Kunapuli Date: Mon, 5 Mar 2012 19:19:16 +0530 Subject: mmc: tegra: Enable SDHCI_QUIRK_BROKEN_CARD_DETECTION Enable quirk SDHCI_QUIRK_BROKEN_CARD_DETECTION. Also, implemented tegra_sdhci_get_cd() to return the card presence status. Bug 948943 Change-Id: I42eed23f951304e331a235f5a9199b70ba5e96b5 Signed-off-by: Pavan Kunapuli Reviewed-on: http://git-master/r/87766 Reviewed-by: Simone Willett Tested-by: Simone Willett --- drivers/mmc/host/sdhci-tegra.c | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/drivers/mmc/host/sdhci-tegra.c b/drivers/mmc/host/sdhci-tegra.c index fb728291ffe8..2276fdeec50f 100644 --- a/drivers/mmc/host/sdhci-tegra.c +++ b/drivers/mmc/host/sdhci-tegra.c @@ -162,6 +162,14 @@ static void tegra_sdhci_writel(struct sdhci_host *host, u32 val, int reg) #endif } +static unsigned int tegra_sdhci_get_cd(struct sdhci_host *sdhci) +{ + struct sdhci_pltfm_host *pltfm_host = sdhci_priv(sdhci); + struct tegra_sdhci_host *tegra_host = pltfm_host->priv; + + return tegra_host->card_present; +} + static unsigned int tegra_sdhci_get_ro(struct sdhci_host *sdhci) { struct platform_device *pdev = to_platform_device(mmc_dev(sdhci->mmc)); @@ -861,6 +869,7 @@ static int tegra_sdhci_resume(struct sdhci_host *sdhci) static struct sdhci_ops tegra_sdhci_ops = { .get_ro = tegra_sdhci_get_ro, + .get_cd = tegra_sdhci_get_cd, .read_l = tegra_sdhci_readl, .read_w = tegra_sdhci_readw, .write_l = tegra_sdhci_writel, @@ -887,7 +896,8 @@ static struct sdhci_pltfm_data sdhci_tegra_pdata = { SDHCI_QUIRK_SINGLE_POWER_WRITE | SDHCI_QUIRK_NO_HISPD_BIT | SDHCI_QUIRK_BROKEN_ADMA_ZEROLEN_DESC | - SDHCI_QUIRK_NO_CALC_MAX_DISCARD_TO, + SDHCI_QUIRK_NO_CALC_MAX_DISCARD_TO | + SDHCI_QUIRK_BROKEN_CARD_DETECTION, .ops = &tegra_sdhci_ops, }; @@ -987,6 +997,12 @@ static int __devinit sdhci_tegra_probe(struct platform_device *pdev) gpio_direction_input(plat->wp_gpio); } + /* + * If there is no card detect gpio, assume that the + * card is always present. + */ + if (!gpio_is_valid(plat->cd_gpio)) + tegra_host->card_present = 1; if (!plat->mmc_data.built_in) { if (plat->mmc_data.ocr_mask & SDHOST_1V8_OCR_MASK) { -- cgit v1.2.3