From mboxrd@z Thu Jan 1 00:00:00 1970 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 9E8C0CCA473 for ; Fri, 22 Jul 2022 17:56:31 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id DC81383D10; Fri, 22 Jul 2022 19:56:28 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com 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=gmail.com header.i=@gmail.com header.b="XyMdgoMa"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 4160583C51; Fri, 22 Jul 2022 19:56:27 +0200 (CEST) Received: from mail-ed1-x52c.google.com (mail-ed1-x52c.google.com [IPv6:2a00:1450:4864:20::52c]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id C5BEF80C75 for ; Fri, 22 Jul 2022 19:56:24 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=jernej.skrabec@gmail.com Received: by mail-ed1-x52c.google.com with SMTP id r6so6708916edd.7 for ; Fri, 22 Jul 2022 10:56:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=0YQdeyfSsfIFsHpRJFPCAKRHj4GfLTmQQAhtLHGUcfo=; b=XyMdgoMa3PKnIKXNcIMrmeBAVWcmzNBYHBYbOaFMs5zbp2KAhQzkPvOA89byfiGrwZ 8EvVzNkisZQTBLgzkCfgDdOJ/WxJcDqWXXRhG0OfJI5a5qd4czqccMPxG1O5HJs3LZdF syaRoy+ZHESrXmuJEv6U8AaVP2K7M8GmQLrs5Ymw5/m4yJRF6JGyAyv2Pp9CaAmYSBQR SpHgAdYOQuMNl3jNWIQHs9z55/VmYASCvpbt0eHtKclDGBVOwoqEFgVG5DYRIEP84KVk EyUjI6Fct+n+FpUmCD35dSJ4KyhCljQc5Jcbe/qMItD3XoNCPNnjnzDBIAqc/ZNJ5AXO krbg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=0YQdeyfSsfIFsHpRJFPCAKRHj4GfLTmQQAhtLHGUcfo=; b=AQcOTtjQ6Re9+fyfz34C7gzT/6fbKG4FvQgyl3+hDRjRtxC0RsABlt0SZG85qFnASc 4C5OxykvPBW64QGEvWpmbId3HU0jxmoVs9CInT//wNKPLUw5Wv+Pak+DGx9XZFs+UeCF YracEhZNGn/LPG9ilAA/yQHa/sKWR76T7AN71k/jCInO4yvKTgbjcdzIbViaHDlVS2B5 8ZasYQ9jfKInHAbajc7LZEVQdy5WsSx8Ehj301NClcHOZDk1qWrCVs3gkyN7wu7vO/gH e1zIFOvxJ2fAleneP9mUDvuaepehrOrt9Ialvg8hHlMB7Z05D7gFK1d3xweMJgnzUJEb WR+A== X-Gm-Message-State: AJIora/BOc221FDHmNuPRpeWObRaqxdu8usPBQitpPQJGgEq0w/RxmfP 47VECF5XyO8Obpg9QgbP2WA1KNECmH8= X-Google-Smtp-Source: AGRyM1vGQcptykr0T+eR/ZG/zGvRhi9DlZQwCnSG//HQu3HQP+ijZDfR6GZRWMxmLkxHAc1d9wCz5g== X-Received: by 2002:a05:6402:4381:b0:43b:cb55:ae3c with SMTP id o1-20020a056402438100b0043bcb55ae3cmr1002979edc.45.1658512584246; Fri, 22 Jul 2022 10:56:24 -0700 (PDT) Received: from jernej-laptop.localnet (86-58-13-89.dynamic.telemach.net. [86.58.13.89]) by smtp.gmail.com with ESMTPSA id r1-20020a1709061ba100b006f3ef214e13sm2240423ejg.121.2022.07.22.10.56.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Jul 2022 10:56:22 -0700 (PDT) From: Jernej =?utf-8?B?xaBrcmFiZWM=?= To: Da Xue , u-boot@lists.denx.de, Andre Przywara Subject: Re: [PATCH] sunxi-mmc: increase stabilization delay from 1ms to 20ms Date: Fri, 22 Jul 2022 19:56:21 +0200 Message-ID: <2048327.bB369e8A3T@jernej-laptop> In-Reply-To: <6556cee5-c916-4e41-bc42-18b827096f55@arm.com> References: <6556cee5-c916-4e41-bc42-18b827096f55@arm.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" 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 Dne petek, 22. julij 2022 ob 18:55:14 CEST je Andre Przywara napisal(a): > On 21/07/2022 23:08, Da Xue wrote: > > Hi, > > > Some users experienced problems booting u-boot from SPL hanging here: > > > > Trying to boot from MMC1 or Trying to boot from MMC2 > > > > This seems to occur with both MicroSD and eMMC modules on ALL-H3-CC. > > Increasing the delay after mmc reset fixes these boot problems. > > Some MicroSD cards are impacted more than others so it is possible that > > MicroSD internals need time to stabilize. Below is some failure data. > > > > sandisk ultra 64gb 9/20 with 1ms, 20/20 with 10ms > > sandisk ultra 16gb 2/20 with 1ms, 20/20 with 10ms > > sandisk extreme 16gb 6/20 with 10ms, 20/20 with 20ms > > > > A quick comparison of schematics show series resistors for ESD > > protection on the MicroSD GPIOs not present on all H3/H5 boards. > > It is not known if this is related to the issue. > > > > This patch adds a fixed 20ms delay to mmc init to mitigate the problem. > > If boot time optimization is required and the platform does not require > > the delay. The delay can be replaced with: > > > > writel(SUNXI_MMC_GCTRL_RESET, &priv->reg->gctrl); > > if (wait_for_bit_le32( &priv->reg->gctrl, > > SUNXI_MMC_GCTRL_RESET, false, 20, false)) { > > printf("%s: Timeout\n", __func__); > > return -ETIMEDOUT; > > } > > So what about adding this for everyone (we should have it regardless) then? > > And then have an extra Kconfig option to specify an extra delay, and > define this only in your board defconfig? Because IIUC this is specific > to your board? > > And as I mentioned: it looks odd to have this here and have it fixing > your SD card problems: > - The soft reset should reset just the internal controller logic (MMC > state machine and FIFOs), this shouldn't affect cards. IIUC, nothing > should happen on the MMC *pins* because of this operation. > - Why isn't this a problem for U-Boot proper, and Linux, FWIW? As I said before, I have issue only at cold boot in SPL. Once I pass this point, it works all the time, even if rebooted. Why is that so it's unclear. Thinking about this a bit, I have another question. How is it possible that BROM manages to read SD card just fine and loads SPL beforehand? Is it using lower speed? It also couldn't be power issue, since card must have been properly powered up by BROM... Best regards, Jernej > > Cheers, > Andre > > > Signed-off-by: Da Xue > > --- > > > > drivers/mmc/sunxi_mmc.c | 2 +- > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > diff --git a/drivers/mmc/sunxi_mmc.c b/drivers/mmc/sunxi_mmc.c > > index 1bb7b6d0e9..f7942b69ce 100644 > > --- a/drivers/mmc/sunxi_mmc.c > > +++ b/drivers/mmc/sunxi_mmc.c > > @@ -297,7 +297,7 @@ static int sunxi_mmc_core_init(struct mmc *mmc) > > > > /* Reset controller */ > > writel(SUNXI_MMC_GCTRL_RESET, &priv->reg->gctrl); > > > > - udelay(1000); > > + udelay(20000); > > > > return 0; > > > > }