mirror of
https://github.com/torvalds/linux.git
synced 2026-06-07 05:55:44 +02:00
mmc: mmci: stm32: Check when the voltage switch procedure should be done
[ Upstream commitd8e193f13b] If the card has not been power cycled, it may still be using 1.8V signaling. This situation is detected in mmc_sd_init_card function and should be handled in mmci stm32 variant. The host->pwr_reg variable is also correctly protected with spin locks. Fixes:94b94a93e3("mmc: mmci_sdmmc: Implement signal voltage callbacks") Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com> Signed-off-by: Yann Gautier <yann.gautier@foss.st.com> Cc: stable@vger.kernel.org Link: https://lore.kernel.org/r/20210701143353.13188-1-yann.gautier@foss.st.com Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
parent
f8dac276a9
commit
8f499a90e7
|
|
@ -479,8 +479,9 @@ static int sdmmc_post_sig_volt_switch(struct mmci_host *host,
|
||||||
u32 status;
|
u32 status;
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
|
|
||||||
if (ios->signal_voltage == MMC_SIGNAL_VOLTAGE_180) {
|
|
||||||
spin_lock_irqsave(&host->lock, flags);
|
spin_lock_irqsave(&host->lock, flags);
|
||||||
|
if (ios->signal_voltage == MMC_SIGNAL_VOLTAGE_180 &&
|
||||||
|
host->pwr_reg & MCI_STM32_VSWITCHEN) {
|
||||||
mmci_write_pwrreg(host, host->pwr_reg | MCI_STM32_VSWITCH);
|
mmci_write_pwrreg(host, host->pwr_reg | MCI_STM32_VSWITCH);
|
||||||
spin_unlock_irqrestore(&host->lock, flags);
|
spin_unlock_irqrestore(&host->lock, flags);
|
||||||
|
|
||||||
|
|
@ -492,9 +493,11 @@ static int sdmmc_post_sig_volt_switch(struct mmci_host *host,
|
||||||
|
|
||||||
writel_relaxed(MCI_STM32_VSWENDC | MCI_STM32_CKSTOPC,
|
writel_relaxed(MCI_STM32_VSWENDC | MCI_STM32_CKSTOPC,
|
||||||
host->base + MMCICLEAR);
|
host->base + MMCICLEAR);
|
||||||
|
spin_lock_irqsave(&host->lock, flags);
|
||||||
mmci_write_pwrreg(host, host->pwr_reg &
|
mmci_write_pwrreg(host, host->pwr_reg &
|
||||||
~(MCI_STM32_VSWITCHEN | MCI_STM32_VSWITCH));
|
~(MCI_STM32_VSWITCHEN | MCI_STM32_VSWITCH));
|
||||||
}
|
}
|
||||||
|
spin_unlock_irqrestore(&host->lock, flags);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user