aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mmc/host/mxs-mmc.c
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2013-12-05 08:34:49 -0500
committerChris Ball <chris@printf.net>2014-01-13 12:48:19 -0500
commit6c3331d3ace7989688fa59f541f5e722e44ac373 (patch)
tree0e511e4f65f503ccef96f4c9ca98a34d629dbf0c /drivers/mmc/host/mxs-mmc.c
parenta91fe279ae750d67d65039bb4ac2cc6ef51e7a2a (diff)
mmc: mxs: use standard flag for cd inverted
We have a MMC_CAP2_CD_ACTIVE_HIGH flag, so use it rather than a custom driver specific flag. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> Signed-off-by: Chris Ball <cjb@laptop.org>
Diffstat (limited to 'drivers/mmc/host/mxs-mmc.c')
-rw-r--r--drivers/mmc/host/mxs-mmc.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/drivers/mmc/host/mxs-mmc.c b/drivers/mmc/host/mxs-mmc.c
index 02210ce8025e..3dd2f4c867e6 100644
--- a/drivers/mmc/host/mxs-mmc.c
+++ b/drivers/mmc/host/mxs-mmc.c
@@ -71,7 +71,6 @@ struct mxs_mmc_host {
71 int sdio_irq_en; 71 int sdio_irq_en;
72 int wp_gpio; 72 int wp_gpio;
73 bool wp_inverted; 73 bool wp_inverted;
74 bool cd_inverted;
75}; 74};
76 75
77static int mxs_mmc_get_ro(struct mmc_host *mmc) 76static int mxs_mmc_get_ro(struct mmc_host *mmc)
@@ -94,9 +93,15 @@ static int mxs_mmc_get_cd(struct mmc_host *mmc)
94{ 93{
95 struct mxs_mmc_host *host = mmc_priv(mmc); 94 struct mxs_mmc_host *host = mmc_priv(mmc);
96 struct mxs_ssp *ssp = &host->ssp; 95 struct mxs_ssp *ssp = &host->ssp;
96 int present;
97 97
98 return !(readl(ssp->base + HW_SSP_STATUS(ssp)) & 98 present = !(readl(ssp->base + HW_SSP_STATUS(ssp)) &
99 BM_SSP_STATUS_CARD_DETECT) ^ host->cd_inverted; 99 BM_SSP_STATUS_CARD_DETECT);
100
101 if (mmc->caps2 & MMC_CAP2_CD_ACTIVE_HIGH)
102 present = !present;
103
104 return present;
100} 105}
101 106
102static int mxs_mmc_reset(struct mxs_mmc_host *host) 107static int mxs_mmc_reset(struct mxs_mmc_host *host)
@@ -658,7 +663,8 @@ static int mxs_mmc_probe(struct platform_device *pdev)
658 if (flags & OF_GPIO_ACTIVE_LOW) 663 if (flags & OF_GPIO_ACTIVE_LOW)
659 host->wp_inverted = 1; 664 host->wp_inverted = 1;
660 665
661 host->cd_inverted = of_property_read_bool(np, "cd-inverted"); 666 if (of_property_read_bool(np, "cd-inverted"))
667 mmc->caps2 |= MMC_CAP2_CD_ACTIVE_HIGH;
662 668
663 mmc->f_min = 400000; 669 mmc->f_min = 400000;
664 mmc->f_max = 288000000; 670 mmc->f_max = 288000000;