ARM Sunxi Platform Development
 help / color / mirror / Atom feed
From: Andre Przywara <andre.przywara@arm.com>
To: Da Xue <da@libre.computer>, linux-sunxi@lists.linux.dev
Cc: u-boot@lists.denx.de
Subject: Re: Increasing stabilization time in sunxi_mmc_core_init
Date: Thu, 21 Jul 2022 12:28:59 +0100	[thread overview]
Message-ID: <1d28ba1c-3fa1-a8fb-849d-b3f4d77c6054@arm.com> (raw)
In-Reply-To: <CACqvRUZ=3CJOOmX_5Tk=ZR9JhnL-aYpeshJLySEQ_-p6EqgARA@mail.gmail.com>

On 21/07/2022 12:03, Da Xue wrote:

Hi Da,

> Users were reporting non-boot on our H5 boards (ALL-H3-CC-H5). u-boot
> gets stuck in SPL with this message for SD/eMMC respectively.
> 
> Trying to boot from MMC1 or Trying to boot from MMC2
> 
> I tested about 20 MicroSD cards from different brands and some were
> happy and some were not. Increasing the udelay to 8-10ms in
> drivers/mmc/sunxi_mmc.c sunxi_mmc_core_init after reset seems to fix
> the issue for the MicroSD cards.

That's interesting, thanks for the report. I don't remember hearing of 
issues with MMC before, at least not in the SPL.
It's a bit odd that waiting after the *controller* reset should affect 
SD cards, and 1ms seems plenty for just the reset.
I just checked and at least the SOFT_RESET and FIFO_RESET bits are self 
clearing. Can you try to use wait_for_bit_le32() to wait for those parts 
to finish? See sun8i_emac_eth_start() for an example.

And since you mentioned it's card related: can you check whether the 
delay is actually needed somewhere else, later? At some point where we 
wait to the card to response, for instance?

I am not against taking this patch, if it fixes problems for you, but 
just want to avoid that it papers over other issues.

Cheers,
Andre

> 
> Author: Da Xue <da@libre.computer>
> Date:   Wed Jul 20 19:11:55 2022 -0400
> 
>      sunxi: raise stabilization time for mmc from 1ms to 8ms
> 
> diff --git a/drivers/mmc/sunxi_mmc.c b/drivers/mmc/sunxi_mmc.c
> index 1bb7b6d0e9..499e057725 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(8000);
> 
>          return 0;
>   }
> 
> I don't know the implications of this change so I am seeking feedback.
> Are other boards having this issue as well or is it specific to our
> hardware?
> 
> Best,
> Da
> 


  reply	other threads:[~2022-07-21 11:29 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-21 11:03 Increasing stabilization time in sunxi_mmc_core_init Da Xue
2022-07-21 11:28 ` Andre Przywara [this message]
2022-07-21 15:14   ` Jernej Škrabec
2022-07-21 19:56     ` Da Xue
2022-07-21 20:05       ` Jernej Škrabec
2022-07-21 20:33         ` Da Xue
2022-07-21 20:49           ` Jernej Škrabec
2022-07-21 20:58             ` Da Xue
2022-07-21 21:23               ` Da Xue
2022-07-21 21:30                 ` Jernej Škrabec

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=1d28ba1c-3fa1-a8fb-849d-b3f4d77c6054@arm.com \
    --to=andre.przywara@arm.com \
    --cc=da@libre.computer \
    --cc=linux-sunxi@lists.linux.dev \
    --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