[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAPDyKFpK2Yjj2oDWCUKHpht6PC9uNG-x2rPYO3EBD6GGWg4VZg@mail.gmail.com>
Date: Thu, 7 Dec 2023 14:58:56 +0100
From: Ulf Hansson <ulf.hansson@...aro.org>
To: Wenchao Chen <wenchao.chen@...soc.com>
Cc: zhang.lyra@...il.com, orsonzhai@...il.com,
baolin.wang@...ux.alibaba.com, linux-mmc@...r.kernel.org,
linux-kernel@...r.kernel.org, wenchao.chen666@...il.com,
zhenxiong.lai@...soc.com, yuelin.tang@...soc.com
Subject: Re: [PATCH] mmc: sprd: Fix eMMC init failure after hw reset
On Mon, 4 Dec 2023 at 07:50, Wenchao Chen <wenchao.chen@...soc.com> wrote:
>
> Some eMMC devices that do not close the auto clk gate
> after hw reset will cause eMMC initialization to fail.
>
> Signed-off-by: Wenchao Chen <wenchao.chen@...soc.com>
I assume we want this tagged for stable kernels too, but do we have a
corresponding fixes commit that we can point out?
Kind regards
Uffe
> ---
> drivers/mmc/host/sdhci-sprd.c | 10 +++++++---
> 1 file changed, 7 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/mmc/host/sdhci-sprd.c b/drivers/mmc/host/sdhci-sprd.c
> index 6b8a57e2d20f..bed57a1c64b5 100644
> --- a/drivers/mmc/host/sdhci-sprd.c
> +++ b/drivers/mmc/host/sdhci-sprd.c
> @@ -239,15 +239,19 @@ static inline void _sdhci_sprd_set_clock(struct sdhci_host *host,
> div = ((div & 0x300) >> 2) | ((div & 0xFF) << 8);
> sdhci_enable_clk(host, div);
>
> + 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;
> /* 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;
> if (mask != (val & mask)) {
> val |= mask;
> sdhci_writel(host, val, SDHCI_SPRD_REG_32_BUSY_POSI);
> }
> + } else {
> + if (val & mask) {
> + val &= ~mask;
> + sdhci_writel(host, val, SDHCI_SPRD_REG_32_BUSY_POSI);
> + }
> }
> }
>
> --
> 2.17.1
>
Powered by blists - more mailing lists