aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mmc/host/sdhci.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/mmc/host/sdhci.c')
-rw-r--r--drivers/mmc/host/sdhci.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
index 9cb60bac1950..782c0ee3c925 100644
--- a/drivers/mmc/host/sdhci.c
+++ b/drivers/mmc/host/sdhci.c
@@ -1223,22 +1223,25 @@ static int sdhci_get_ro(struct mmc_host *mmc)
1223{ 1223{
1224 struct sdhci_host *host; 1224 struct sdhci_host *host;
1225 unsigned long flags; 1225 unsigned long flags;
1226 int present; 1226 int is_readonly;
1227 1227
1228 host = mmc_priv(mmc); 1228 host = mmc_priv(mmc);
1229 1229
1230 spin_lock_irqsave(&host->lock, flags); 1230 spin_lock_irqsave(&host->lock, flags);
1231 1231
1232 if (host->flags & SDHCI_DEVICE_DEAD) 1232 if (host->flags & SDHCI_DEVICE_DEAD)
1233 present = 0; 1233 is_readonly = 0;
1234 else if (host->ops->get_ro)
1235 is_readonly = host->ops->get_ro(host);
1234 else 1236 else
1235 present = sdhci_readl(host, SDHCI_PRESENT_STATE); 1237 is_readonly = !(sdhci_readl(host, SDHCI_PRESENT_STATE)
1238 & SDHCI_WRITE_PROTECT);
1236 1239
1237 spin_unlock_irqrestore(&host->lock, flags); 1240 spin_unlock_irqrestore(&host->lock, flags);
1238 1241
1239 if (host->quirks & SDHCI_QUIRK_INVERTED_WRITE_PROTECT) 1242 /* This quirk needs to be replaced by a callback-function later */
1240 return !!(present & SDHCI_WRITE_PROTECT); 1243 return host->quirks & SDHCI_QUIRK_INVERTED_WRITE_PROTECT ?
1241 return !(present & SDHCI_WRITE_PROTECT); 1244 !is_readonly : is_readonly;
1242} 1245}
1243 1246
1244static void sdhci_enable_sdio_irq(struct mmc_host *mmc, int enable) 1247static void sdhci_enable_sdio_irq(struct mmc_host *mmc, int enable)