[PATCH v4 0/5] Fix sd card support for RK3576 platform
Shawn Lin
shawn.lin at rock-chips.com
Thu Jan 15 16:55:27 PST 2026
Marco reported a problem[1] for his FriendlyElec NanoPi R76S board. The problem
is becuase after runtime suspend, the associated power domain is powered off, which
resets the registers including power control bit, card detection logic and internal
phase registers. This leads to three problems need to be solved.
1. hot-plug broken:
SD card hot-plug support for RK3576 boards is broken, because sd slot should try to
use slot-gpio(cd-gpios) instead of function IO for supporting runtime PM. In order
to support slot-gpio detection method, we should disable jtag switching for RK3576.
But the rockchip_grf_init fails to handle this because it couldn't handle
multiple grf nodes. In this case, iocgrf is in behind of sysgrf, so only
sysgrf is handled. We should scan all possible nodes.
Moreover, the offset is wrong as well. Per the TRM, the address of
TOP_IOC_IOC_MISC_CON is 0x260440F0, which means the offset if 0x40F0
instead of 0x040F.
2. cards lost power:
When powering off the power domain during runtime suspend, the controller fails to
maintain the power control status as all the registers is cleared. This results in
power lost for cards during runtime suspend and have to reset the card each time
exiting from runtime supended state. Should use gpio-based regulator for vmmc-suppy
for the boards.
3. controller lost internal phases/mem-clock settings
As the same reason mentioned above, should invent rockchip specific runtime PM
callbacks to save and restore internal phase related settings.
Note: An examination of the RK3576 related dts files suggests that several other boards
may also not function correctly, because I noticed signs of copy-pasting, but I don't have
the schematics to confirm it, I've cc'ed the users of these boards. I hope they can verify
their own boards and submit separate patches if fixes are needed.
Please help review and test.
[1] https://lore.kernel.org/all/20260110010715.1610159-1-mschirrmeister@gmail.com/T/#t
Changes in v4
- add fix patches for RK3576 EVB1 and NanoPi R76S
Changes in v3:
- remove of_node_put() (Heiko)
Changes in v2:
- use for_each_matching_node_and_match(Heiko)
Shawn Lin (5):
soc: rockchip: grf: Fix wrong RK3576_IOCGRF_MISC_CON definition
soc: rockchip: grf: Support multiple grf to be handled
mmc: dw_mmc-rockchip: Fix runtime PM support for internal phase
support
arm64: dts: rockchip: Fix SD card support for RK3576 EVB1
arm64: dts: rockchip: Fix SD card support for RK3576 Nanopi R76s
arch/arm64/boot/dts/rockchip/rk3576-evb1-v10.dts | 22 +++++++++
.../arm64/boot/dts/rockchip/rk3576-nanopi-r76s.dts | 23 ++++++++-
drivers/mmc/host/dw_mmc-rockchip.c | 38 ++++++++++++++-
drivers/soc/rockchip/grf.c | 57 +++++++++++-----------
4 files changed, 109 insertions(+), 31 deletions(-)
--
2.7.4
More information about the Linux-rockchip
mailing list