Issue with mmc_power_on() and reference counter of regulator

Kenta Sato tosainu.maple at gmail.com
Sat Sep 2 13:35:06 CEST 2023


Hi,

I am using the FriendlyElec NanoPi R4S board.
When I updated U-Boot to a recent version (0fe0395922), it failed to
boot from MMC. Here is the log:

================================
U-Boot TPL 2023.10-rc3 (Sep 02 2023 - 08:21:08)
lpddr4_set_rate: change freq to 400MHz 0, 1
Channel 0: LPDDR4, 400MHz
BW=32 Col=10 Bk=8 CS0 Row=15 CS1 Row=15 CS=2 Die BW=16 Size=2048MB
Channel 1: LPDDR4, 400MHz
BW=32 Col=10 Bk=8 CS0 Row=15 CS1 Row=15 CS=2 Die BW=16 Size=2048MB
256B stride
lpddr4_set_rate: change freq to 800MHz 1, 0
Trying to boot from BOOTROM
Returning to boot ROM...

U-Boot SPL 2023.10-rc3 (Sep 02 2023 - 08:21:08 +0000)
Trying to boot from MMC1
spl_load_fit_image: Skip load 'atf-5': image size is 0!
NOTICE:  BL31: v2.9(release):
NOTICE:  BL31: Built : 08:19:59, Sep  2 2023


U-Boot 2023.10-rc3 (Sep 02 2023 - 08:21:08 +0000)

SoC: Rockchip rk3399
Reset cause: POR
Model: FriendlyElec NanoPi R4S
DRAM:  4 GiB (effective 3.9 GiB)
PMIC:  RK808
Core:  264 devices, 23 uclasses, devicetree: separate
MMC:   mmc at fe320000: 1
Loading Environment from nowhere... OK
In:    serial,usbkbd
Out:   serial,vidconsole
Err:   serial,vidconsole
Model: FriendlyElec NanoPi R4S
Net:
Error: ethernet at fe300000 address not set.
No ethernet found.

Hit any key to stop autoboot:  0
Error enabling VMMC supply : -114
Error enabling VMMC supply : -114
Error enabling VMMC supply : -114
Error enabling VMMC supply : -114
Error enabling VMMC supply : -114
Error enabling VMMC supply : -114
================================

Does anyone know how to fix the issue?

I looked into commit logs and the mailing list so far, and I found the
below commit that adds the reference counter to the regulator. I could
remove the above error by reverting this change. Of course, it should
not be the proper way.
Maybe we could replace regulator_set_enable() in mmc_power_on() by
regulator_set_enable_if_allowed(). However, I have no confidence about
it as I'm not familiar with the U-Boot source code.

================================
commit 4fcba5d556b4224ad65a249801e4c9594d1054e8
Author: Eugen Hristev <eugen.hristev at collabora.com>
Date:   Wed Apr 19 16:45:24 2023 +0300

    regulator: implement basic reference counter

    Some devices share a regulator supply, when the first one will request
    regulator disable, the second device will have it's supply cut off before
    graciously shutting down. Hence there will be timeouts and other failed
    operations.
    Implement a reference counter mechanism similar with what is done in
    Linux, to keep track of enable and disable requests, and only disable the
    regulator when the last of the consumers has requested shutdown.

    Signed-off-by: Eugen Hristev <eugen.hristev at collabora.com>
    Reviewed-by: Simon Glass <sjg at chromium.org>
    Reviewed-by: Patrice Chotard <patrice.chotard at foss.st.com>
================================

Any help would be greatly appreciated.
Thank you!

Kenta Sato


More information about the U-Boot mailing list