From patchwork Thu Jul 21 22:08:21 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Da Xue X-Patchwork-Id: 1659316 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=libre-computer.20210112.gappssmtp.com header.i=@libre-computer.20210112.gappssmtp.com header.a=rsa-sha256 header.s=20210112 header.b=QVHq9OVT; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4LpmtY1xqGz9s1l for ; Fri, 22 Jul 2022 08:08:51 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 48E0581424; Fri, 22 Jul 2022 00:08:37 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=libre.computer 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=libre-computer.20210112.gappssmtp.com header.i=@libre-computer.20210112.gappssmtp.com header.b="QVHq9OVT"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id A6FC38171B; Fri, 22 Jul 2022 00:08:35 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-1.6 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,SPF_HELO_NONE,SPF_NONE autolearn=no autolearn_force=no version=3.4.2 Received: from mail-yw1-x112e.google.com (mail-yw1-x112e.google.com [IPv6:2607:f8b0:4864:20::112e]) (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 12ED9810E8 for ; Fri, 22 Jul 2022 00:08:33 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=libre.computer Authentication-Results: phobos.denx.de; spf=none smtp.mailfrom=da.xue@libretech.co Received: by mail-yw1-x112e.google.com with SMTP id 00721157ae682-31e7ca45091so31506397b3.3 for ; Thu, 21 Jul 2022 15:08:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=libre-computer.20210112.gappssmtp.com; s=20210112; h=mime-version:from:date:message-id:subject:to; bh=z+MyYO88FGV5OCErnY1PJoQcKxOy6qpzqHIzzKPPQjU=; b=QVHq9OVTSqUpSbzj6x0mikO6MNdbqD3XynnQduvDO3Wa/OwcBP0zyvHrqX77XDSGr1 3kNnsCZfHXHtQOu3s85SJtF+ZUJq90crS8uyIya6CSTo9du6IURSo2hMmQMWXf6GD+g0 3/thw/5W0VDVQvnlXKv7H6ykIPCoCzm16qZRdgtCZ+GCxuR5czwFux3SUc+EV6cnUfFB RcVvCWC0KKoUlJPFRDy5lz+wOPIU18WJp4TW6rX85XZo1D6EDe6B6wppT8PPN3Kkl++C fm3xK4KcWYgnzeFjUwVprr+mKGJiz32efd+knRmknXQN/2LSwfUgf6gjo95+5Aa240Fb mgag== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=z+MyYO88FGV5OCErnY1PJoQcKxOy6qpzqHIzzKPPQjU=; b=4xXyOy8S3tk1+oBmIF9rdb7nzCaE1QZ1RH/q+jpW1Sk36s81VVqNIPg5GsSL2XqGBt skmE/ImZFW6gRa+u7JllsfDfZE+o9QCfpYJQHojukClC1eT5Dh1vmID+/NJS9AR/tM92 wgXK6VmSGRYGk2g+m1kIaB7gD5Md+Z1GqjSKsCjB/OcY0hiUWps+RJpSX9lesy+YjBrv 45xu0/OuRc8URaq3Z5pWj2G0RfSHWpj41jq4jtfKZ+rLvlOOmqd8FU+QwYVlw3G4yWMS ghoQRHrxuQfzgnpZsENUtReLDcIEgyi6vMN3N9I4OUmcxOnjpFKRcL+b0OYbtQK/VSdv hPBA== X-Gm-Message-State: AJIora9Bb1IE4I3ykHTJfZQEhCwe3FojIfXscSgNWA7kMXN/3Absx9CW rKKW9Kmh+D4s4KmzTGObE9H2LuIZiqDWZZudDgGuVkVTWTTQ8sI= X-Google-Smtp-Source: AGRyM1t65mKhuyJeMrReZSTm+gUoIQoGFDxl/lXlGLZq8Am1mvfDM1pMgzA+alBDHp00Zlshf5YOFc6v4+7+4EPdQV8= X-Received: by 2002:a0d:d7d0:0:b0:31e:7a85:c3bc with SMTP id z199-20020a0dd7d0000000b0031e7a85c3bcmr596643ywd.97.1658441311540; Thu, 21 Jul 2022 15:08:31 -0700 (PDT) MIME-Version: 1.0 From: Da Xue Date: Thu, 21 Jul 2022 18:08:21 -0400 Message-ID: Subject: [PATCH] sunxi-mmc: increase stabilization delay from 1ms to 20ms To: u-boot@lists.denx.de, =?utf-8?q?Jernej_=C5=A0krabec?= , Andre Przywara 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 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; } 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; }