diff options
Diffstat (limited to 'drivers/mmc')
-rw-r--r-- | drivers/mmc/host/sdhci.c | 15 | ||||
-rw-r--r-- | drivers/mmc/host/sdhci.h | 1 |
2 files changed, 10 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 | ||
1244 | static void sdhci_enable_sdio_irq(struct mmc_host *mmc, int enable) | 1247 | static void sdhci_enable_sdio_irq(struct mmc_host *mmc, int enable) |
diff --git a/drivers/mmc/host/sdhci.h b/drivers/mmc/host/sdhci.h index bfcd611d7b77..b7b8a3b28b01 100644 --- a/drivers/mmc/host/sdhci.h +++ b/drivers/mmc/host/sdhci.h | |||
@@ -214,6 +214,7 @@ struct sdhci_ops { | |||
214 | unsigned int (*get_timeout_clock)(struct sdhci_host *host); | 214 | unsigned int (*get_timeout_clock)(struct sdhci_host *host); |
215 | void (*platform_send_init_74_clocks)(struct sdhci_host *host, | 215 | void (*platform_send_init_74_clocks)(struct sdhci_host *host, |
216 | u8 power_mode); | 216 | u8 power_mode); |
217 | unsigned int (*get_ro)(struct sdhci_host *host); | ||
217 | }; | 218 | }; |
218 | 219 | ||
219 | #ifdef CONFIG_MMC_SDHCI_IO_ACCESSORS | 220 | #ifdef CONFIG_MMC_SDHCI_IO_ACCESSORS |