Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e63e1c67 authored by Wenchao Chen's avatar Wenchao Chen Committed by Greg Kroah-Hartman
Browse files

mmc: sdhci-sprd: Disable CLK_AUTO when the clock is less than 400K



commit ff874dbc4f868af128b412a9bd92637103cf11d7 upstream.

When the clock is less than 400K, some SD cards fail to initialize
because CLK_AUTO is enabled.

Fixes: fb8bd90f ("mmc: sdhci-sprd: Add Spreadtrum's initial host controller")
Signed-off-by: default avatarWenchao Chen <wenchao.chen@unisoc.com>
Cc: stable@vger.kernel.org
Link: https://lore.kernel.org/r/20221207051909.32126-1-wenchao.chen@unisoc.com


Signed-off-by: default avatarUlf Hansson <ulf.hansson@linaro.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 3de2c362
Loading
Loading
Loading
Loading
+9 −7
Original line number Diff line number Diff line
@@ -223,7 +223,8 @@ static inline void _sdhci_sprd_set_clock(struct sdhci_host *host,
	div = ((div & 0x300) >> 2) | ((div & 0xFF) << 8);
	sdhci_enable_clk(host, div);

	/* enable auto gate sdhc_enable_auto_gate */
	/* Enable CLK_AUTO when the clock is greater than 400K. */
	if (clk > 400000) {
		val = sdhci_readl(host, SDHCI_SPRD_REG_32_BUSY_POSI);
		mask = SDHCI_SPRD_BIT_OUTR_CLK_AUTO_EN |
			SDHCI_SPRD_BIT_INNR_CLK_AUTO_EN;
@@ -232,6 +233,7 @@ static inline void _sdhci_sprd_set_clock(struct sdhci_host *host,
			sdhci_writel(host, val, SDHCI_SPRD_REG_32_BUSY_POSI);
		}
	}
}

static void sdhci_sprd_enable_phy_dll(struct sdhci_host *host)
{