From ff538ea7f57cd44800f561d1cdca999f3f995d69 Mon Sep 17 00:00:00 2001 From: Yifeng Zhao Date: Wed, 13 Aug 2025 10:01:51 +0800 Subject: [PATCH] mmc: sdhci-of-dwcmshc: disable internal clock auto gate With CMDQ enabled, issuing a DCMD as the last command before disabling CMDQ causes the eMMC controller to auto-gate its internal clock. The state machine mismatch after exiting CMDQ mode triggers data-timeout errors on all subsequent reads and writes, so the auto-clock-gate function must be disabled whenever CMDQ is enabled. log: mmc2: Timeout waiting for hardware interrupt. mmc2: sdhci: ============ SDHCI REGISTER DUMP =========== mmc2: sdhci: Sys addr: 0x00000001 | Version: 0x00000005 mmc2: sdhci: Blk size: 0x00007200 | Blk cnt: 0x00000000 Signed-off-by: Yifeng Zhao Change-Id: Ibafa74fc2db29b841b5b4df21ef484478f96a44e --- drivers/mmc/host/sdhci-of-dwcmshc.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/mmc/host/sdhci-of-dwcmshc.c b/drivers/mmc/host/sdhci-of-dwcmshc.c index 4d57d977a4c8..c1108ddf3e67 100644 --- a/drivers/mmc/host/sdhci-of-dwcmshc.c +++ b/drivers/mmc/host/sdhci-of-dwcmshc.c @@ -421,10 +421,11 @@ static void dwcmshc_rk3568_set_clock(struct sdhci_host *host, unsigned int clock sdhci_set_clock(host, clock); - /* Disable cmd conflict check */ + /* Disable cmd conflict check and disable internal clock gate */ reg = dwc_priv->vendor_specific_area1 + DWCMSHC_HOST_CTRL3; extra = sdhci_readl(host, reg); extra &= ~BIT(0); + extra |= BIT(4); sdhci_writel(host, extra, reg); /* Disable output clock while config DLL */