[PATCH] mmc: meson-gx: increase power-up delay

Marc Gonzalez marc.w.gonzalez at free.fr
Thu Mar 16 05:32:04 PDT 2023


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




More information about the linux-amlogic mailing list