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 X-Spam-Level: X-Spam-Status: No, score=-18.1 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 76376C433F5 for ; Sat, 4 Sep 2021 10:38:32 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id 6B5A360FD7 for ; Sat, 4 Sep 2021 10:38:31 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 6B5A360FD7 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=lists.denx.de Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 21DDC83327; Sat, 4 Sep 2021 12:38:29 +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="HpqLoJEg"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id DB8AF83330; Sat, 4 Sep 2021 12:38:26 +0200 (CEST) Received: from mail-pf1-x42f.google.com (mail-pf1-x42f.google.com [IPv6:2607:f8b0:4864:20::42f]) (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 8E824832CE for ; Sat, 4 Sep 2021 12:38:23 +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=jh80.chung@gmail.com Received: by mail-pf1-x42f.google.com with SMTP id j16so1548094pfc.2 for ; Sat, 04 Sep 2021 03:38:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-transfer-encoding:content-language; bh=R1xW5dhI5MdMWEzd4wBz2g9T6oS/nscW3i7iz8B4JF4=; b=HpqLoJEgYUbhqc2bFgHHAv1ULMAbKdNHpo6SpdPmUUBATbKEnlMs+yaSVQLt5DT2/5 EKu12Uyy3/y0qrd0KJQe5fC/7LKo8J53JUWXbas8GyI0Gq0vD71CkG8yeXd3r/3GJg9G OLzVdSZpzBi0AmeDbvyGaYQzza5Xu+2Sh49Kal9UsyC2hPl/nkIY+lufeNkijKROKe6k 1Hv2HjfkVX3Iu5uk9cglsBlUNfcjsMtBHvvByrF0+uW3jylO7g9taH/CTug9d+uViNqh k7DfAbNYwH6IVH0Z3TcFhWreAhcNYHeJB8XOoc+jxDy48rHI3l90aoYGdffDWVEeYXRJ ez/A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding :content-language; bh=R1xW5dhI5MdMWEzd4wBz2g9T6oS/nscW3i7iz8B4JF4=; b=btPAnBkcyCZ0Rx5G8OCBTWrKqXYAQcojuWy6YSgG+Se68Ya7cB8z+/xs84dJ5JBhbW pfhmwOZMdZwvrRrCPReY72Yytuv/V4oAZ4S7KZPLs11IHi8bOPo6oqVSG3t54q7YMDTa mBF8BRr3KCuMQEiz4HdOxfjWEm+tLUEcCM8iNwwJvu2G82Q4zbqp0gYukTqVSx/CDfES 8ey4qbFaRt6gAkJ1GAi0zKo8IfG92n9LE7f020FO2QPmJPNJ64Gy/E2Z3DXpJJA8FyeN hZnhp496EqhNxfyrI7sHqT2+DgG37Os4Ii1wSOQgNAF9RxcITDamPn7aAqpttdf+M3Kb SWUA== X-Gm-Message-State: AOAM531kn+hH8iQSNYs6HjhnJ5+TZDJQd5P1tdImRbGbVhyO0sPBUGmz A9u9frgsHkKv8oEH86Ag4Lc= X-Google-Smtp-Source: ABdhPJw4py10hDMDA93ust0NUPG+eBLUsaxvPqJbHkdz6EfAp7jHVCWxkNnhkfvO5kQK5Yd60zVsjA== X-Received: by 2002:a63:111f:: with SMTP id g31mr3147053pgl.80.1630751901812; Sat, 04 Sep 2021 03:38:21 -0700 (PDT) Received: from [172.16.100.12] ([1.235.44.150]) by smtp.gmail.com with ESMTPSA id 66sm2027792pfx.29.2021.09.04.03.38.19 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sat, 04 Sep 2021 03:38:20 -0700 (PDT) Subject: Re: [PATCH] sunxi: mmc: A20: Fix MMC optimisation To: Andre Przywara , Jagan Teki , Tom Rini Cc: Jernej Skrabec , Samuel Holland , u-boot@lists.denx.de, linux-sunxi@lists.linux.dev References: <20210903154916.5264-1-andre.przywara@arm.com> From: Jaehoon Chung Message-ID: <9459f678-17ca-19dc-e5e5-b1e2e1b61a31@gmail.com> Date: Sat, 4 Sep 2021 19:38:17 +0900 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.13.0 MIME-Version: 1.0 In-Reply-To: <20210903154916.5264-1-andre.przywara@arm.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Content-Language: en-US X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 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.2 at phobos.denx.de X-Virus-Status: Clean Andre Przywara wrote on 9/4/21 12:49 AM: > Some SoCs (as seen on A20) seem to misreport the MMC FIFO level if the > FIFO is completely full: the level size reads as zero, but the FIFO_FULL > bit is set. We won't do a single iteration of the read loop in this > case, so will be stuck forever. > > Check for this situation and use a safe minimal FIFO size instead when > we hit this case. > > This fixes MMC boot on A20 devices after the MMC FIFO optimisation > (9faae5457f52). > > Signed-off-by: Andre Przywara Reviewed-by: Jaehoon Chung Best Regards, Jaehoon Chung > --- > drivers/mmc/sunxi_mmc.c | 10 +++++++--- > 1 file changed, 7 insertions(+), 3 deletions(-) > > diff --git a/drivers/mmc/sunxi_mmc.c b/drivers/mmc/sunxi_mmc.c > index 178b8cf106..aaab0cf866 100644 > --- a/drivers/mmc/sunxi_mmc.c > +++ b/drivers/mmc/sunxi_mmc.c > @@ -349,10 +349,14 @@ static int mmc_trans_data_by_cpu(struct sunxi_mmc_priv *priv, struct mmc *mmc, > * register without checking the status register after every > * read. That saves half of the costly MMIO reads, effectively > * doubling the read performance. > + * Some SoCs (A20) report a level of 0 if the FIFO is > + * completely full (value masked out?). Use a safe minimal > + * FIFO size in this case. > */ > - for (in_fifo = SUNXI_MMC_STATUS_FIFO_LEVEL(status); > - in_fifo > 0; > - in_fifo--) > + in_fifo = SUNXI_MMC_STATUS_FIFO_LEVEL(status); > + if (in_fifo == 0 && (status & SUNXI_MMC_STATUS_FIFO_FULL)) > + in_fifo = 32; > + for (; in_fifo > 0; in_fifo--) > buff[i++] = readl_relaxed(&priv->reg->fifo); > dmb(); > }