Skip to content

Commit 3009738

Browse files
shawn1221storulf
authored andcommitted
mmc: sdhci-of-dwcmshc: Prevent illegal clock reduction in HS200/HS400 mode
When operating in HS200 or HS400 timing modes, reducing the clock frequency below 52MHz will lead to link broken as the Rockchip DWC MSHC controller requires maintaining a minimum clock of 52MHz in these modes. Add a check to prevent illegal clock reduction through debugfs: root@debian:/# echo 50000000 > /sys/kernel/debug/mmc0/clock root@debian:/# [ 30.090146] mmc0: running CQE recovery mmc0: cqhci: Failed to halt mmc0: cqhci: spurious TCN for tag 0 WARNING: drivers/mmc/host/cqhci-core.c:797 at cqhci_irq+0x254/0x818, CPU#1: kworker/1:0H/24 Modules linked in: CPU: 1 UID: 0 PID: 24 Comm: kworker/1:0H Not tainted 6.19.0-rc1-00001-g09db0998649d-dirty #204 PREEMPT Hardware name: Rockchip RK3588 EVB1 V10 Board (DT) Workqueue: kblockd blk_mq_run_work_fn pstate: 604000c9 (nZCv daIF +PAN -UAO -TCO -DIT -SSBS BTYPE=--) pc : cqhci_irq+0x254/0x818 lr : cqhci_irq+0x254/0x818 ... Fixes: c6f361c ("mmc: sdhci-of-dwcmshc: add support for rk3588") Cc: Sebastian Reichel <sebastian.reichel@collabora.com> Cc: Yifeng Zhao <yifeng.zhao@rock-chips.com> Signed-off-by: Shawn Lin <shawn.lin@rock-chips.com> Cc: stable@vger.kernel.org Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
1 parent f8f9c1f commit 3009738

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

drivers/mmc/host/sdhci-of-dwcmshc.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -739,6 +739,13 @@ static void dwcmshc_rk3568_set_clock(struct sdhci_host *host, unsigned int clock
739739
sdhci_writel(host, extra, reg);
740740

741741
if (clock <= 52000000) {
742+
if (host->mmc->ios.timing == MMC_TIMING_MMC_HS200 ||
743+
host->mmc->ios.timing == MMC_TIMING_MMC_HS400) {
744+
dev_err(mmc_dev(host->mmc),
745+
"Can't reduce the clock below 52MHz in HS200/HS400 mode");
746+
return;
747+
}
748+
742749
/*
743750
* Disable DLL and reset both of sample and drive clock.
744751
* The bypass bit and start bit need to be set if DLL is not locked.

0 commit comments

Comments
 (0)