Linux-Amlogic Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Marc Gonzalez <marc.w.gonzalez@free.fr>
To: Heiner Kallweit <hkallweit1@gmail.com>,
	Jerome Brunet <jbrunet@baylibre.com>,
	Ulf Hansson <ulf.hansson@linaro.org>,
	Neil Armstrong <neil.armstrong@linaro.org>,
	Kevin Hilman <khilman@baylibre.com>,
	Martin Blumenstingl <martin.blumenstingl@googlemail.com>,
	Pierre-Hugues Husson <phh@phh.me>,
	Rong Chen <rong.chen@amlogic.com>,
	Yang Yingliang <yangyingliang@huawei.com>
Cc: MMC <linux-mmc@vger.kernel.org>, AML <linux-amlogic@lists.infradead.org>
Subject: Re: [PATCH] mmc: meson-gx: increase power-up delay
Date: Thu, 16 Mar 2023 13:32:04 +0100	[thread overview]
Message-ID: <36feb359-e59b-d28a-8651-3178b37eccf7@free.fr> (raw)
In-Reply-To: <15b12187-abcc-b77f-6538-ffae5988bd2b@gmail.com>

On 15/03/2023 22:14, Heiner Kallweit wrote:

> Let me ask few more questions:
> 
> You said that the issue is with a SDIO card. How about eMMC and sdcard,
> does the issue occur for them too?

I have never seen an issue with eMMC not probing on this board.
(I have not tested the SD card slot, as I'm using it for serial.)

I did a (probably silly) test by setting mmc->ios.power_delay_ms = 0
in the driver, and logging relevant events (for timing).


Here's a boot log where both mmc1 & mmc2 probe correctly:

[    0.879968] >ffe03000.sd
[    0.880320] meson-gx-mmc ffe03000.sd: allocated mmc-pwrseq
[    0.891604] +mmc2
[    0.895179] -mmc2
[    0.896873] +mmc2
[    0.898829] <ffe03000.sd
[    0.951755] Q
[    1.049162] >ffe07000.mmc
[    1.049602] meson-gx-mmc ffe07000.mmc: allocated mmc-pwrseq
[    1.061378] +mmc1
[    1.061666] -mmc1
[    1.062841] +mmc1
[    1.063532] <ffe07000.mmc
[    1.072056] Q
[    1.079669] R
[    1.123210] mmc2: new ultra high speed SDR50 SDIO card at address 0001
[    1.193650] mmc1: new HS200 MMC card at address 0001
[    1.198553] mmcblk1: mmc1:0001 SCA16G 14.7 GiB 
[    1.205777] brcmf_sdio_probe_attach:  AFTER
[    1.209853] mmcblk1boot0: mmc1:0001 SCA16G 4.00 MiB 
[    1.211218] mmcblk1boot1: mmc1:0001 SCA16G 4.00 MiB 
[    1.212254] mmcblk1rpmb: mmc1:0001 SCA16G 4.00 MiB, chardev (246:0)


Analysis for mmc2

[    0.879968] ENTER meson_mmc_probe()
[    0.880320] meson-gx-mmc ffe03000.sd: allocated mmc-pwrseq
[    0.891604] ENTER mmc_power_up()
[    0.895179]  EXIT mmc_power_up()
[    0.896873] ENTER mmc_power_up() => premature exit
[    0.898829]  EXIT meson_mmc_probe()
[    0.951755] ENTER mmc_attach_sdio()
[    1.123210] mmc2: new ultra high speed SDR50 SDIO card at address 0001

mmc_attach_sdio() is called 60 ms after entering mmc_power_up()


Analysis for mmc1

[    1.049162] ENTER meson_mmc_probe()
[    1.049602] meson-gx-mmc ffe07000.mmc: allocated mmc-pwrseq
[    1.061378] ENTER mmc_power_up()
[    1.061666]  EXIT mmc_power_up()
[    1.062841] ENTER mmc_power_up()
[    1.063532]  EXIT meson_mmc_probe() => premature exit
[    1.072056] ENTER mmc_attach_sdio()
[    1.079669] ENTER mmc_attach_mmc()
[    1.193650] mmc1: new HS200 MMC card at address 0001

mmc_attach_mmc() is called 18 ms after entering mmc_power_up()



Here's a boot log where mmc2 *DOES NOT* probe correctly:

[    0.875868] >ffe03000.sd
[    0.876196] meson-gx-mmc ffe03000.sd: allocated mmc-pwrseq
[    0.881407] +mmc2
[    0.886832] -mmc2
[    0.888544] +mmc2
[    0.894688] <ffe03000.sd
[    0.901587] Q
[    0.908937] R
[    0.913466] mmc2: YO no device WTF
[    1.042609] >ffe07000.mmc
[    1.042910] meson-gx-mmc ffe07000.mmc: allocated mmc-pwrseq
[    1.053460] +mmc1
[    1.053694] -mmc1
[    1.055039] +mmc1
[    1.056956] <ffe07000.mmc
[    1.064126] Q
[    1.075205] R
[    1.197676] mmc1: new HS200 MMC card at address 0001
[    1.198337] mmcblk1: mmc1:0001 SCA16G 14.7 GiB 
[    1.203947] mmcblk1boot0: mmc1:0001 SCA16G 4.00 MiB 
[    1.207858] mmcblk1boot1: mmc1:0001 SCA16G 4.00 MiB 
[    1.212593] mmcblk1rpmb: mmc1:0001 SCA16G 4.00 MiB, chardev (246:0)

In this instance, for mmc2, mmc_attach_sdio() is called 20 ms after
entering mmc_power_up() and CMD5 times out (probe failure).


> Then you mention "too soon after reset", but add a delay to power-up.
> If the delay would be needed after reset, then shouldn't it be in
> meson_mmc_probe() after the call to device_reset_optional()?


The first mmc_power_up() is called from:

[    0.916446]  mmc_power_up+0x2c/0xe4
[    0.926186]  mmc_start_host+0x94/0xa0
[    0.926197]  mmc_add_host+0x84/0xf0
[    0.926205]  meson_mmc_probe+0x374/0x3f4
[    0.933086]  platform_probe+0x68/0xe0
[    0.940159]  really_probe+0xbc/0x2f0
[    0.948008]  __driver_probe_device+0x78/0xe0
[    0.955080]  driver_probe_device+0xd8/0x160
[    0.955087]  __driver_attach_async_helper+0x4c/0xc0
[    0.965689]  async_run_entry_fn+0x34/0xe0
[    0.965699]  process_one_work+0x1cc/0x320
[    0.972847]  worker_thread+0x14c/0x450
[    0.972855]  kthread+0x10c/0x110
[    1.018906]  ret_from_fork+0x10/0x20


The second mmc_power_up() (prematurely exited) is called from:

[    1.061686]  mmc_power_up+0x2c/0xe4
[    1.065136]  mmc_rescan+0x18c/0x310
[    1.068586]  process_one_work+0x1cc/0x320
[    1.072553]  worker_thread+0x14c/0x450
[    1.076262]  kthread+0x10c/0x110
[    1.086528]  ret_from_fork+0x10/0x20


I'm confused about device_reset_optional() vs mmc_power_up().
Do they both reset the controller?

Regards


_______________________________________________
linux-amlogic mailing list
linux-amlogic@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-amlogic

  reply	other threads:[~2023-03-16 13:46 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-14 17:24 [PATCH] mmc: meson-gx: increase power-up delay Marc Gonzalez
2023-03-14 19:45 ` Heiner Kallweit
2023-03-15 10:20   ` Marc Gonzalez
2023-03-15 15:27     ` Jerome Brunet
2023-03-15 21:14       ` Heiner Kallweit
2023-03-16 12:32         ` Marc Gonzalez [this message]
2023-03-16 13:02           ` Marc Gonzalez
2023-03-16 11:59       ` Ulf Hansson
2023-03-16 16:32         ` Marc Gonzalez

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=36feb359-e59b-d28a-8651-3178b37eccf7@free.fr \
    --to=marc.w.gonzalez@free.fr \
    --cc=hkallweit1@gmail.com \
    --cc=jbrunet@baylibre.com \
    --cc=khilman@baylibre.com \
    --cc=linux-amlogic@lists.infradead.org \
    --cc=linux-mmc@vger.kernel.org \
    --cc=martin.blumenstingl@googlemail.com \
    --cc=neil.armstrong@linaro.org \
    --cc=phh@phh.me \
    --cc=rong.chen@amlogic.com \
    --cc=ulf.hansson@linaro.org \
    --cc=yangyingliang@huawei.com \
    /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