Linux-Rockchip Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Shawn Lin <shawn.lin@rock-chips.com>
To: Heiko Stuebner <heiko@sntech.de>, Ulf Hansson <ulf.hansson@linaro.org>
Cc: linux-rockchip@lists.infradead.org, linux-mmc@vger.kernel.org,
	devicetree@vger.kernel.org, FUKAUMI Naoki <naoki@radxa.com>,
	Marco Schirrmeister <mschirrmeister@gmail.com>,
	John Clark <inindev@gmail.com>, Tianling Shen <cnsztl@gmail.com>,
	Detlev Casanova <detlev.casanova@collabora.com>,
	Shawn Lin <shawn.lin@rock-chips.com>
Subject: [PATCH v4 0/5] Fix sd card support for RK3576 platform
Date: Fri, 16 Jan 2026 08:55:27 +0800	[thread overview]
Message-ID: <1768524932-163929-1-git-send-email-shawn.lin@rock-chips.com> (raw)


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


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

             reply	other threads:[~2026-01-16  1:00 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-01-16  0:55 Shawn Lin [this message]
2026-01-16  0:55 ` [PATCH v4 1/5] soc: rockchip: grf: Fix wrong RK3576_IOCGRF_MISC_CON definition Shawn Lin
2026-01-16  0:55 ` [PATCH v4 2/5] soc: rockchip: grf: Support multiple grf to be handled Shawn Lin
2026-01-16  0:55 ` [PATCH v4 3/5] mmc: dw_mmc-rockchip: Fix runtime PM support for internal phase support Shawn Lin
2026-01-16 10:28   ` Heiko Stübner
2026-01-21 14:54   ` Ulf Hansson
2026-01-16  0:55 ` [PATCH v4 4/5] arm64: dts: rockchip: Fix SD card support for RK3576 EVB1 Shawn Lin
2026-01-16  0:55 ` [PATCH v4 5/5] arm64: dts: rockchip: Fix SD card support for RK3576 Nanopi R76s Shawn Lin
2026-01-16 14:04 ` (subset) [PATCH v4 0/5] Fix sd card support for RK3576 platform Heiko Stuebner
2026-01-16 14:24   ` Shawn Lin

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=1768524932-163929-1-git-send-email-shawn.lin@rock-chips.com \
    --to=shawn.lin@rock-chips.com \
    --cc=cnsztl@gmail.com \
    --cc=detlev.casanova@collabora.com \
    --cc=devicetree@vger.kernel.org \
    --cc=heiko@sntech.de \
    --cc=inindev@gmail.com \
    --cc=linux-mmc@vger.kernel.org \
    --cc=linux-rockchip@lists.infradead.org \
    --cc=mschirrmeister@gmail.com \
    --cc=naoki@radxa.com \
    --cc=ulf.hansson@linaro.org \
    /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