提交 a5f2819c 编写于 作者: E Eugen Hristev 提交者: Zheng Zengkai

mmc: sdhci-of-at91: fix set_uhs_signaling rewriting of MC1R

stable inclusion
from stable-v5.10.137
commit 2985acdaf27da191a1ca2e42a605ca9baeb9fd20
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/I60PLB

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=2985acdaf27da191a1ca2e42a605ca9baeb9fd20

--------------------------------

[ Upstream commit 5987e6de ]

In set_uhs_signaling, the DDR bit is being set by fully writing the MC1R
register.
This can lead to accidental erase of certain bits in this register.
Avoid this by doing a read-modify-write operation.

Fixes: d0918764 ("mmc: sdhci-of-at91: fix MMC_DDR_52 timing selection")
Signed-off-by: NEugen Hristev <eugen.hristev@microchip.com>
Tested-by: NKarl Olsen <karl@micro-technic.com>
Acked-by: NAdrian Hunter <adrian.hunter@intel.com>
Link: https://lore.kernel.org/r/20220630090926.15061-1-eugen.hristev@microchip.comSigned-off-by: NUlf Hansson <ulf.hansson@linaro.org>
Signed-off-by: NSasha Levin <sashal@kernel.org>
Signed-off-by: NZheng Zengkai <zhengzengkai@huawei.com>
Reviewed-by: NWei Li <liwei391@huawei.com>
上级 97c79c6b
...@@ -100,8 +100,13 @@ static void sdhci_at91_set_clock(struct sdhci_host *host, unsigned int clock) ...@@ -100,8 +100,13 @@ static void sdhci_at91_set_clock(struct sdhci_host *host, unsigned int clock)
static void sdhci_at91_set_uhs_signaling(struct sdhci_host *host, static void sdhci_at91_set_uhs_signaling(struct sdhci_host *host,
unsigned int timing) unsigned int timing)
{ {
if (timing == MMC_TIMING_MMC_DDR52) u8 mc1r;
sdhci_writeb(host, SDMMC_MC1R_DDR, SDMMC_MC1R);
if (timing == MMC_TIMING_MMC_DDR52) {
mc1r = sdhci_readb(host, SDMMC_MC1R);
mc1r |= SDMMC_MC1R_DDR;
sdhci_writeb(host, mc1r, SDMMC_MC1R);
}
sdhci_set_uhs_signaling(host, timing); sdhci_set_uhs_signaling(host, timing);
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册