Devicetree
 help / color / mirror / Atom feed
From: Quentin Schulz <quentin.schulz@cherry.de>
To: Dang Huynh <dang.huynh@mainlining.org>
Cc: Rob Herring <robh@kernel.org>,
	Krzysztof Kozlowski <krzk+dt@kernel.org>,
	Conor Dooley <conor+dt@kernel.org>,
	Heiko Stuebner <heiko@sntech.de>,
	devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
	linux-rockchip@lists.infradead.org
Subject: Re: [PATCH] arm64: dts: rockchip: Add CD GPIO to Orange Pi 5/5B/5Pro
Date: Wed, 2 Dec 2026 11:40:55 +0100	[thread overview]
Message-ID: <bb709032-e4b8-4bfe-ac08-899439d550b6@cherry.de> (raw)
In-Reply-To: <awpxYCW9N_tqAhiX@melt-pi5>

Hi Dang,

On 11/28/26 7:18 AM, Dang Huynh wrote:
> Hi Quentin,
> 
> On Thu, Nov 26, 2026 at 10:56:12AM +0100, Quentin Schulz wrote:
>> Hi Dang,
>>
>> On 11/21/26 8:03 AM, Dang Huynh wrote:
>>> CD GPIO is currently not defined in Orange Pi 5, this breaks
>>> SD card hotplugging.
>>
>> That's not the issue. The issue is that the card detect signal is muxed in
>> the SDMMC_DET function (c.f. sdmmc_det in rk3588-base.dtsi) and that relies
>> on the SDMMC controller being powered on to detect such an event. This
>> cannot work when the controller is in runtime suspend, so we have a chicken
>> and the egg problem. The card detect should resume the controller, but it
>> can only work when the controller is running. Hence why we now go for the
>> gpio function (via cd-gpios) instead. See
>> c7a9549ce46e ("arm64: dts: rockchip: Switch microSD card detect to gpio on
>> Radxa ROCK 5 ITX/5C") for an example.
> Interesting, I didn't know that the controller could do that. You learn
> something new every day I guess.
> 
>>> diff --git a/arch/arm64/boot/dts/rockchip/rk3588s-orangepi-5.dtsi b/arch/arm64/boot/dts/rockchip/rk3588s-orangepi-5.dtsi
>>> index 2db6ee95e504..8fbb0ba19b74 100644
>>> --- a/arch/arm64/boot/dts/rockchip/rk3588s-orangepi-5.dtsi
>>> +++ b/arch/arm64/boot/dts/rockchip/rk3588s-orangepi-5.dtsi
>>> @@ -282,6 +282,7 @@ &sdhci {
>>>    &sdmmc {
>>>    	bus-width = <4>;
>>>    	cap-sd-highspeed;
>>> +	cd-gpios = <&gpio0 RK_PA4 GPIO_ACTIVE_LOW>;
>>
>> issue: missing pinmuxing
>>
>> You need to configure the pinmux and pinconf for this pin (via pinctrl-0 and
>> we require repeating pinctrl-names wherever pinctrl-0 is modified).
> pinmux/pinconf is already defined in rk3588-base-pinctrl.dtsi for this
> exact GPIO. I guess this is in case when controller's card detect works?
> 

The default pinconf is incorrect as it muxes the pin in function 1 
instead of RK_FUNC_GPIO (function 0). What you need is something along 
the lines of:

&sdmmc {
     pinctrl-0 = <&sdmmc_clk &sdmmc_cmd &sdmmc_det_gpio &sdmmc_bus4>;
     pinctrl-names = "default";
     cd-gpios = <&gpio0 RK_PA4 GPIO_ACTIVE_LOW>;
};

&pinctrl {
     sdmmc {
         sdmmc_det_gpio: sdmmc-det-gpio-pin {
             rockchip,pins = <0 RK_PA4 RK_FUNC_GPIO &pcfg_pull_up>;
         };
     };
};

Cheers,
Quentin

  reply	other threads:[~2026-12-02 10:41 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-21  7:03 [PATCH] arm64: dts: rockchip: Add CD GPIO to Orange Pi 5/5B/5Pro Dang Huynh
2026-11-26  9:56 ` Quentin Schulz
2026-11-28  6:18   ` Dang Huynh
2026-12-02 10:40     ` Quentin Schulz [this message]
2026-12-01 11:32   ` Alexey Charkov

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=bb709032-e4b8-4bfe-ac08-899439d550b6@cherry.de \
    --to=quentin.schulz@cherry.de \
    --cc=conor+dt@kernel.org \
    --cc=dang.huynh@mainlining.org \
    --cc=devicetree@vger.kernel.org \
    --cc=heiko@sntech.de \
    --cc=krzk+dt@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-rockchip@lists.infradead.org \
    --cc=robh@kernel.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