Devicetree
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Iker Pedrosa" <ikerpedrosam@gmail.com>
Cc: conor+dt@kernel.org, devicetree@vger.kernel.org, robh@kernel.org,
	krzk+dt@kernel.org
Subject: Re: [PATCH v9 6/8] riscv: dts: spacemit: k1-orangepi-rv2: add SD card support with UHS modes
Date: Tue, 12 May 2026 03:20:18 +0000	[thread overview]
Message-ID: <20260512032018.B9A14C2BCB0@smtp.kernel.org> (raw)
In-Reply-To: <20260511-orangepi-sd-card-uhs-v9-6-ae48c0b2b2cf@gmail.com>

Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [High] `vmmc-supply` is mapped to an always-on regulator (`buck4_3v3`) while enabling UHS modes (`sd-uhs-sdr*`), which will break SD card initialization after a warm reboot or driver reset.
- [Low] The device tree specifies `cd-gpios = <&gpio K1_GPIO(80) GPIO_ACTIVE_HIGH>;` alongside the `cd-inverted;` property, creating an ambiguous double-inversion.
--

commit b95f288bf0d85d42bac4ccd6d594e14cf818a232
Author: Iker Pedrosa <ikerpedrosam@gmail.com>

riscv: dts: spacemit: k1-orangepi-rv2: add SD card support with UHS modes

Add complete SD card controller support with UHS high-speed modes,
including configuring the card detect GPIO and connecting the vmmc and
vqmmc supplies.

> diff --git a/arch/riscv/boot/dts/spacemit/k1-orangepi-rv2.dts b/arch/riscv/boot/dts/spacemit/k1-orangepi-rv2.dts
> index c95ca38e3d4a1..1ed76e0ff8064 100644
> --- a/arch/riscv/boot/dts/spacemit/k1-orangepi-rv2.dts
> +++ b/arch/riscv/boot/dts/spacemit/k1-orangepi-rv2.dts
[ ... ]
> +&sdhci0 {
> +	pinctrl-names = "default", "uhs";
> +	pinctrl-0 = <&mmc1_cfg>;
> +	pinctrl-1 = <&mmc1_uhs_cfg>;
> +	bus-width = <4>;
> +	cd-gpios = <&gpio K1_GPIO(80) GPIO_ACTIVE_HIGH>;
> +	cd-inverted;

This isn't a bug, but does this create a confusing double-inversion?

According to the MMC bindings, if a GPIO is used for card detect, its
polarity should be natively described in the phandle flag (e.g.,
GPIO_ACTIVE_LOW) and cd-inverted should be omitted. Combining
GPIO_ACTIVE_HIGH with cd-inverted forces the MMC core to perform an XOR
logic.

Would it be better to just use GPIO_ACTIVE_LOW and drop cd-inverted?

> +	no-mmc;
> +	no-sdio;
> +	disable-wp;
> +	cap-sd-highspeed;
> +	vmmc-supply = <&buck4_3v3>;

Will this cause SD card initialization to fail after a warm reboot?

UHS modes require switching the SD card's signaling voltage from 3.3V to
1.8V. Since there is no software command to revert a card from 1.8V back
to 3.3V, it strictly requires a full physical power cycle.

However, if buck4_3v3 is configured with regulator-always-on elsewhere
in the device tree, mmc_power_cycle() will silently fail to cut the
physical power. After a warm reboot or driver error recovery, the host
controller will reset to 3.3V while the card remains stuck expecting
1.8V signaling.

If the hardware lacks a load switch to toggle the SD slot power, should
the UHS modes be disabled to prevent this?

> +	vqmmc-supply = <&aldo1>;
> +	sd-uhs-sdr25;
> +	sd-uhs-sdr50;
> +	sd-uhs-sdr104;
> +	status = "okay";
> +};

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260511-orangepi-sd-card-uhs-v9-0-ae48c0b2b2cf@gmail.com?part=6

  reply	other threads:[~2026-05-12  3:20 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-11  8:53 [PATCH v9 0/8] riscv: spacemit: enable SD card support with UHS modes for OrangePi RV2 Iker Pedrosa
2026-05-11  8:53 ` [PATCH v9 1/8] dt-bindings: mmc: spacemit,sdhci: add pinctrl support for voltage switching Iker Pedrosa
2026-05-12  1:01   ` sashiko-bot
2026-05-11  8:53 ` [PATCH v9 2/8] mmc: sdhci-of-k1: enable essential clock infrastructure for SD operation Iker Pedrosa
2026-05-12  1:13   ` sashiko-bot
2026-05-11  8:53 ` [PATCH v9 3/8] mmc: sdhci-of-k1: add regulator and pinctrl voltage switching support Iker Pedrosa
2026-05-12  2:01   ` sashiko-bot
2026-05-11  8:53 ` [PATCH v9 4/8] mmc: sdhci-of-k1: add comprehensive SDR tuning support Iker Pedrosa
2026-05-11  8:54 ` [PATCH v9 5/8] riscv: dts: spacemit: k1: add SD card controller and pinctrl support Iker Pedrosa
2026-05-12  2:47   ` sashiko-bot
2026-05-11  8:54 ` [PATCH v9 6/8] riscv: dts: spacemit: k1-orangepi-rv2: add SD card support with UHS modes Iker Pedrosa
2026-05-12  3:20   ` sashiko-bot [this message]
2026-05-11  8:54 ` [PATCH v9 7/8] riscv: dts: spacemit: k1-bananapi-f3: " Iker Pedrosa
2026-05-11 16:55   ` Aurelien Jarno
2026-05-12  3:32   ` sashiko-bot
2026-05-12  5:43   ` Yixun Lan
2026-05-12 17:03     ` Aurelien Jarno
2026-05-11  8:54 ` [PATCH v9 8/8] riscv: dts: spacemit: k1-musepi-pro: " Iker Pedrosa
2026-05-11 11:43   ` Andre Heider
2026-05-12  3:48   ` sashiko-bot
2026-05-12  5:20   ` Yixun Lan
2026-05-11 15:40 ` [PATCH v9 0/8] riscv: spacemit: enable SD card support with UHS modes for OrangePi RV2 Ulf Hansson

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=20260512032018.B9A14C2BCB0@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=ikerpedrosam@gmail.com \
    --cc=krzk+dt@kernel.org \
    --cc=robh@kernel.org \
    --cc=sashiko@lists.linux.dev \
    /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