public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Yixun Lan <dlan@kernel.org>
To: Iker Pedrosa <ikerpedrosam@gmail.com>,
	Ulf Hansson <ulf.hansson@linaro.org>,
	Rob Herring <robh@kernel.org>,
	Krzysztof Kozlowski <krzk+dt@kernel.org>,
	Conor Dooley <conor+dt@kernel.org>,
	Adrian Hunter <adrian.hunter@intel.com>,
	Paul Walmsley <pjw@kernel.org>,
	Palmer Dabbelt <palmer@dabbelt.com>,
	Albert Ou <aou@eecs.berkeley.edu>,
	Alexandre Ghiti <alex@ghiti.fr>,
	Michael Opdenacker <michael.opdenacker@rootcommit.com>,
	Javier Martinez Canillas <javierm@redhat.com>,
	linux-mmc@vger.kernel.org, devicetree@vger.kernel.org,
	linux-riscv@lists.infradead.org, spacemit@lists.linux.dev,
	linux-kernel@vger.kernel.org, Anand Moon <linux.amoon@gmail.com>
Subject: Re: [PATCH v3 7/7] riscv: dts: spacemit: k1-bananapi-f3: add SD card support with UHS modes
Date: Thu, 19 Mar 2026 09:53:05 +0800	[thread overview]
Message-ID: <20260319015305-GKA489299@kernel.org> (raw)
In-Reply-To: <absKDGLCw26xr7Z4@aurel32.net>

Hi Aurelien,

On 21:24 Wed 18 Mar     , Aurelien Jarno wrote:
> Hi,
> 
> On 2026-03-16 15:03, Iker Pedrosa wrote:
> > Add complete SD card controller support with UHS high-speed modes.
> > 
> > - Enable sdhci0 controller with 4-bit bus width
> > - Configure card detect GPIO with inversion
> > - Connect vmmc-supply to buck4 for 3.3V card power
> > - Connect vqmmc-supply to aldo1 for 1.8V/3.3V I/O switching
> > - Add dual pinctrl states for voltage-dependent pin configuration
> > - Support UHS-I SDR25, SDR50, and SDR104 modes
> > 
> > This enables full SD card functionality including high-speed UHS modes
> > for improved performance.
> > 
> > Suggested-by: Anand Moon <linux.amoon@gmail.com>
> > Signed-off-by: Iker Pedrosa <ikerpedrosam@gmail.com>
> > ---
> >  arch/riscv/boot/dts/spacemit/k1-bananapi-f3.dts | 23 +++++++++++++++++++++--
> >  1 file changed, 21 insertions(+), 2 deletions(-)
> > 
> > diff --git a/arch/riscv/boot/dts/spacemit/k1-bananapi-f3.dts b/arch/riscv/boot/dts/spacemit/k1-bananapi-f3.dts
> > index 404b69c47b91f8c37d74a3031dbad0d94a28d1b4..a7d480d01ccc0439dbf456ed5a81f467af68056a 100644
> > --- a/arch/riscv/boot/dts/spacemit/k1-bananapi-f3.dts
> > +++ b/arch/riscv/boot/dts/spacemit/k1-bananapi-f3.dts
> > @@ -222,7 +222,7 @@ buck3_1v8: buck3 {
> >  				regulator-always-on;
> >  			};
> >  
> > -			buck4 {
> > +			buck4: buck4 {
> >  				regulator-min-microvolt = <500000>;
> >  				regulator-max-microvolt = <3300000>;
> >  				regulator-ramp-delay = <5000>;
> > @@ -243,7 +243,7 @@ buck6 {
> >  				regulator-always-on;
> >  			};
> >  
> > -			aldo1 {
> > +			aldo1: aldo1 {
> >  				regulator-min-microvolt = <500000>;
> >  				regulator-max-microvolt = <3400000>;
> >  				regulator-boot-on;
> > @@ -369,3 +369,22 @@ hub_3_0: hub@2 {
> >  		reset-gpios = <&gpio K1_GPIO(124) GPIO_ACTIVE_LOW>;
> >  	};
> >  };
> > +
> > +&sdhci0 {
> > +	pinctrl-names = "default", "state_uhs";
> > +	pinctrl-0 = <&mmc1_cfg>;
> > +	pinctrl-1 = <&mmc1_uhs_cfg>;
> > +	bus-width = <4>;
> > +	cd-gpios = <&gpio K1_GPIO(80) GPIO_ACTIVE_HIGH>;
> > +	cd-inverted;
> 
> Thanks for this driver. Unfortunately, this is not correct for the 
> Banana PI F3. The OrangePi RV2 buffers the signal from the SD card 
> connector through a transistor, inverting the signal. On the Banana PI 
> F3, the signal goes directly to the GPIO, and does not even have a 
> pull-up.
> 
> With the following change, I have been able to get the patchset working 
> as expected:
> 
> diff --git a/arch/riscv/boot/dts/spacemit/k1-bananapi-f3.dts b/arch/riscv/boot/dts/spacemit/k1-bananapi-f3.dts
> index a7d480d01ccc0..72b0f75f936aa 100644
> --- a/arch/riscv/boot/dts/spacemit/k1-bananapi-f3.dts
> +++ b/arch/riscv/boot/dts/spacemit/k1-bananapi-f3.dts
> @@ -375,8 +375,7 @@ &sdhci0 {
>  	pinctrl-0 = <&mmc1_cfg>;
>  	pinctrl-1 = <&mmc1_uhs_cfg>;
>  	bus-width = <4>;
> -	cd-gpios = <&gpio K1_GPIO(80) GPIO_ACTIVE_HIGH>;
> -	cd-inverted;
> +	cd-gpios = <&gpio K1_GPIO(80) (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>;
Have to mention, to use the pull-up, the patch to support gpio config should be applied
https://lore.kernel.org/r/20260312-k1-gpio-set-config-v1-0-8c3541da16b1@pigmoral.tech

if you don't want to introduce the dependency, add "broken-cd" property
should also workaround this..
>  	no-mmc;
>  	no-sdio;
>  	disable-wp;
> 
> Regards
> Aurelien
> 
> -- 
> Aurelien Jarno                          GPG: 4096R/1DDD8C9B
> aurelien@aurel32.net                     http://aurel32.net

-- 
Yixun Lan (dlan)

  reply	other threads:[~2026-03-19  1:53 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-16 14:03 [PATCH v3 0/7] riscv: spacemit: enable SD card support with UHS modes for OrangePi RV2 Iker Pedrosa
2026-03-16 14:03 ` [PATCH v3 1/7] mmc: sdhci-of-k1: enable essential clock infrastructure for SD operation Iker Pedrosa
2026-03-17 11:32   ` Adrian Hunter
2026-03-16 14:03 ` [PATCH v3 2/7] mmc: sdhci-of-k1: add regulator and pinctrl voltage switching support Iker Pedrosa
2026-03-17 11:28   ` Adrian Hunter
2026-03-20  9:17     ` Iker Pedrosa
2026-03-20 11:31       ` Adrian Hunter
2026-03-16 14:03 ` [PATCH v3 3/7] mmc: sdhci-of-k1: add comprehensive SDR tuning support Iker Pedrosa
2026-03-17 11:33   ` Adrian Hunter
2026-03-16 14:03 ` [PATCH v3 4/7] riscv: dts: spacemit: k1: add SD card controller and pinctrl support Iker Pedrosa
2026-03-16 14:03 ` [PATCH v3 5/7] riscv: dts: spacemit: k1-orangepi-rv2: add PMIC and power infrastructure Iker Pedrosa
2026-03-17 20:24   ` Trevor Gamblin
2026-03-16 14:03 ` [PATCH v3 6/7] riscv: dts: spacemit: k1-orangepi-rv2: add SD card support with UHS modes Iker Pedrosa
2026-03-17 15:54   ` Michael Opdenacker
2026-03-16 14:03 ` [PATCH v3 7/7] riscv: dts: spacemit: k1-bananapi-f3: " Iker Pedrosa
2026-03-18 20:24   ` Aurelien Jarno
2026-03-19  1:53     ` Yixun Lan [this message]
2026-03-17 20:23 ` [PATCH v3 0/7] riscv: spacemit: enable SD card support with UHS modes for OrangePi RV2 Trevor Gamblin

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=20260319015305-GKA489299@kernel.org \
    --to=dlan@kernel.org \
    --cc=adrian.hunter@intel.com \
    --cc=alex@ghiti.fr \
    --cc=aou@eecs.berkeley.edu \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=ikerpedrosam@gmail.com \
    --cc=javierm@redhat.com \
    --cc=krzk+dt@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mmc@vger.kernel.org \
    --cc=linux-riscv@lists.infradead.org \
    --cc=linux.amoon@gmail.com \
    --cc=michael.opdenacker@rootcommit.com \
    --cc=palmer@dabbelt.com \
    --cc=pjw@kernel.org \
    --cc=robh@kernel.org \
    --cc=spacemit@lists.linux.dev \
    --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