Commit 8d46e04c authored by Ulf Hansson's avatar Ulf Hansson

mmc: Merge branch fixes into next

Merge the mmc fixes for v6.10-rc[n] into the next branch, to allow them to
get tested together with the new mmc changes that are targeted for v6.11.
Signed-off-by: default avatarUlf Hansson <ulf.hansson@linaro.org>
parents 1f140286 ab069ce1
...@@ -2515,26 +2515,29 @@ EXPORT_SYMBOL_GPL(sdhci_get_cd_nogpio); ...@@ -2515,26 +2515,29 @@ EXPORT_SYMBOL_GPL(sdhci_get_cd_nogpio);
static int sdhci_check_ro(struct sdhci_host *host) static int sdhci_check_ro(struct sdhci_host *host)
{ {
unsigned long flags; bool allow_invert = false;
int is_readonly; int is_readonly;
spin_lock_irqsave(&host->lock, flags); if (host->flags & SDHCI_DEVICE_DEAD) {
if (host->flags & SDHCI_DEVICE_DEAD)
is_readonly = 0; is_readonly = 0;
else if (host->ops->get_ro) } else if (host->ops->get_ro) {
is_readonly = host->ops->get_ro(host); is_readonly = host->ops->get_ro(host);
else if (mmc_can_gpio_ro(host->mmc)) } else if (mmc_can_gpio_ro(host->mmc)) {
is_readonly = mmc_gpio_get_ro(host->mmc); is_readonly = mmc_gpio_get_ro(host->mmc);
else /* Do not invert twice */
allow_invert = !(host->mmc->caps2 & MMC_CAP2_RO_ACTIVE_HIGH);
} else {
is_readonly = !(sdhci_readl(host, SDHCI_PRESENT_STATE) is_readonly = !(sdhci_readl(host, SDHCI_PRESENT_STATE)
& SDHCI_WRITE_PROTECT); & SDHCI_WRITE_PROTECT);
allow_invert = true;
}
spin_unlock_irqrestore(&host->lock, flags); if (is_readonly >= 0 &&
allow_invert &&
(host->quirks & SDHCI_QUIRK_INVERTED_WRITE_PROTECT))
is_readonly = !is_readonly;
/* This quirk needs to be replaced by a callback-function later */ return is_readonly;
return host->quirks & SDHCI_QUIRK_INVERTED_WRITE_PROTECT ?
!is_readonly : is_readonly;
} }
#define SAMPLE_COUNT 5 #define SAMPLE_COUNT 5
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment