Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 40383C433EF for ; Thu, 23 Jun 2022 16:11:48 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id C194284362; Thu, 23 Jun 2022 18:11:45 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=kernel.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.b="HWEqS3Cf"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id E9E738437A; Thu, 23 Jun 2022 18:11:44 +0200 (CEST) Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 9C48784343 for ; Thu, 23 Jun 2022 18:11:42 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=kernel.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=pali@kernel.org Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 3A505B8229C; Thu, 23 Jun 2022 16:11:42 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C1780C3411B; Thu, 23 Jun 2022 16:11:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1656000700; bh=vxETO6mkuQ32w5EXVhXZe+wLHPwpkcqLgzwtRJ/JkBs=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=HWEqS3CfBNISv8Zk9MP0MDkTzUJAIORlv07d7BptVyRQ46qQyvo/sJnlRcTpuNCM0 lzvMkgmmnhy3yiWTwfQlyMf9w6w/jdtT5UFHmzO5W8AbC+jznrZIzqWZWRnuOYu9xj +WnN+kaQbLzpvnRe8ho19HSB/NqLu0g901u73euymx+wOtD3gEaOAayWZPZXg5xoaA ahAem6HDSb1tHeHB90C6llt/4+UHIW/faC1VOVC3hc2xjaN4e6V1/E+XeE8bMmVZPx m6PXyDJkgmDz+u1iwXi9N4R3gntZraO1tpH8/7ozrk5PEwZpERKDQ13yejZMBXF+M8 sPlMgSMUDM/KA== Received: by pali.im (Postfix) id 083D679F; Thu, 23 Jun 2022 18:11:37 +0200 (CEST) Date: Thu, 23 Jun 2022 18:11:37 +0200 From: Pali =?utf-8?B?Um9ow6Fy?= To: Jaehoon Chung Cc: Peng Fan , Priyanka Jain , Sinan Akman , u-boot@lists.denx.de Subject: Re: [PATCH] mmc: fsl_esdhc: Fix 'Internal clock never stabilised.' error Message-ID: <20220623161137.3324l22shsqeqetz@pali> References: <20220429182734.4281-1-pali@kernel.org> <20220612091241.iaewmyf3srf52wcx@pali> <211e835d-ca7d-5e13-e041-68bb785be11e@samsung.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <211e835d-ca7d-5e13-e041-68bb785be11e@samsung.com> User-Agent: NeoMutt/20180716 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.6 at phobos.denx.de X-Virus-Status: Clean On Tuesday 14 June 2022 11:25:18 Jaehoon Chung wrote: > Hi, > > On 6/12/22 18:12, Pali Rohár wrote: > > PING? > > Sorry for too late. When will be this fix patch processed and merged? > > > > On Friday 29 April 2022 20:27:34 Pali Rohár wrote: > >> Only newer eSDHC controllers set PRSSTAT_SDSTB flag. So do not wait until > >> flag PRSSTAT_SDSTB is set on old pre-2.2 controllers. Instead sleep for > >> fixed amount of time like it was before commit 6f883e501b65 ("mmc: > >> fsl_esdhc: Add emmc hs200 support"). > >> > >> This change fixes error 'Internal clock never stabilised.' which is printed > >> on P2020 board at every access to SD card. > >> > >> Fixes: 6f883e501b65 ("mmc: fsl_esdhc: Add emmc hs200 support") > >> Signed-off-by: Pali Rohár > > Reviewed-by: Jaehoon Chung > > Best Regards, > Jaehoon Chung > > >> --- > >> drivers/mmc/fsl_esdhc.c | 17 +++++++++++++++++ > >> 1 file changed, 17 insertions(+) > >> > >> diff --git a/drivers/mmc/fsl_esdhc.c b/drivers/mmc/fsl_esdhc.c > >> index fdf2cc290e06..3b3587bd8d72 100644 > >> --- a/drivers/mmc/fsl_esdhc.c > >> +++ b/drivers/mmc/fsl_esdhc.c > >> @@ -503,6 +503,7 @@ static void set_sysctl(struct fsl_esdhc_priv *priv, struct mmc *mmc, uint clock) > >> u32 time_out; > >> u32 value; > >> uint clk; > >> + u32 hostver; > >> > >> if (clock < mmc->cfg->f_min) > >> clock = mmc->cfg->f_min; > >> @@ -543,6 +544,14 @@ static void set_sysctl(struct fsl_esdhc_priv *priv, struct mmc *mmc, uint clock) > >> > >> esdhc_clrsetbits32(®s->sysctl, SYSCTL_CLOCK_MASK, clk); > >> > >> + /* Only newer eSDHC controllers set PRSSTAT_SDSTB flag */ > >> + hostver = esdhc_read32(&priv->esdhc_regs->hostver); > >> + if (HOSTVER_VENDOR(hostver) <= VENDOR_V_22) { > >> + udelay(10000); > >> + esdhc_setbits32(®s->sysctl, SYSCTL_PEREN | SYSCTL_CKEN); > >> + return; > >> + } > >> + > >> time_out = 20; > >> value = PRSSTAT_SDSTB; > >> while (!(esdhc_read32(®s->prsstat) & value)) { > >> @@ -562,6 +571,7 @@ static void esdhc_clock_control(struct fsl_esdhc_priv *priv, bool enable) > >> struct fsl_esdhc *regs = priv->esdhc_regs; > >> u32 value; > >> u32 time_out; > >> + u32 hostver; > >> > >> value = esdhc_read32(®s->sysctl); > >> > >> @@ -572,6 +582,13 @@ static void esdhc_clock_control(struct fsl_esdhc_priv *priv, bool enable) > >> > >> esdhc_write32(®s->sysctl, value); > >> > >> + /* Only newer eSDHC controllers set PRSSTAT_SDSTB flag */ > >> + hostver = esdhc_read32(&priv->esdhc_regs->hostver); > >> + if (HOSTVER_VENDOR(hostver) <= VENDOR_V_22) { > >> + udelay(10000); > >> + return; > >> + } > >> + > >> time_out = 20; > >> value = PRSSTAT_SDSTB; > >> while (!(esdhc_read32(®s->prsstat) & value)) { > >> -- > >> 2.20.1 > >> > > >