public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Jaehoon Chung <jh80.chung@gmail.com>
To: Andre Przywara <andre.przywara@arm.com>,
	Jagan Teki <jagan@amarulasolutions.com>,
	Tom Rini <trini@konsulko.com>
Cc: Jernej Skrabec <jernej.skrabec@gmail.com>,
	Samuel Holland <samuel@sholland.org>,
	u-boot@lists.denx.de, linux-sunxi@lists.linux.dev
Subject: Re: [PATCH] sunxi: mmc: A20: Fix MMC optimisation
Date: Sat, 4 Sep 2021 19:38:17 +0900	[thread overview]
Message-ID: <9459f678-17ca-19dc-e5e5-b1e2e1b61a31@gmail.com> (raw)
In-Reply-To: <20210903154916.5264-1-andre.przywara@arm.com>



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 <andre.przywara@arm.com>

Reviewed-by: Jaehoon Chung <jh80.chung@samsung.com>

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();
>  	}


      reply	other threads:[~2021-09-04 10:38 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-03 15:49 [PATCH] sunxi: mmc: A20: Fix MMC optimisation Andre Przywara
2021-09-04 10:38 ` Jaehoon Chung [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=9459f678-17ca-19dc-e5e5-b1e2e1b61a31@gmail.com \
    --to=jh80.chung@gmail.com \
    --cc=andre.przywara@arm.com \
    --cc=jagan@amarulasolutions.com \
    --cc=jernej.skrabec@gmail.com \
    --cc=linux-sunxi@lists.linux.dev \
    --cc=samuel@sholland.org \
    --cc=trini@konsulko.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox