* Re: [PATCH v8 8/9] riscv: dts: spacemit: k1-bananapi-f3: add SD card support with UHS modes
[not found] ` <20260413-orangepi-sd-card-uhs-v8-8-c21c40ec16d0@gmail.com>
@ 2026-05-07 8:20 ` Margherita Milani
2026-05-07 9:53 ` Iker Pedrosa
2026-05-07 18:28 ` Aurelien Jarno
1 sibling, 1 reply; 9+ messages in thread
From: Margherita Milani @ 2026-05-07 8:20 UTC (permalink / raw)
To: Iker Pedrosa
Cc: Ulf Hansson, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
Adrian Hunter, Paul Walmsley, Palmer Dabbelt, Albert Ou,
Alexandre Ghiti, Yixun Lan, Troy Mitchell, Michael Opdenacker,
Javier Martinez Canillas, linux-mmc, devicetree, linux-riscv,
spacemit, linux-kernel, Anand Moon
Good morning Iker,
> 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
Tested-by: Margherita Milani <margherita.milani@amarulasolutions.com>
However I noticed it only works when CONFIG_I2C_K1 is enabled.
Michael Opdenacker told me it's necessary to enable the regulators
used by the mmc controller.
Should we add the dependency between CONFIG_MMC_SDHCI_OF_K1 and
CONFIG_I2C_K1? (Unless some boards don't have these dependency?)
Thank you for your patchset which was really nice!
--
Margherita Milani
Embedded Software Engineer
M. +39 334 758 9111
margherita.milani@amarulasolutions.com
__________________________________
Amarula Solutions SRL
Via le Canevare 30, 31100, Treviso, Veneto, IT
T. +39 (0)42 243 5310
info@amarulasolutions.com
www.amarulasolutions.com
On Mon, Apr 13, 2026 at 10:05 AM Iker Pedrosa <ikerpedrosam@gmail.com> 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>
> Tested-by: Anand Moon <linux.amoon@gmail.com>
> Signed-off-by: Iker Pedrosa <ikerpedrosam@gmail.com>
> ---
> arch/riscv/boot/dts/spacemit/k1-bananapi-f3.dts | 24 ++++++++++++++++++++++--
> 1 file changed, 22 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 5790d927b93d..a7d88564630f 100644
> --- a/arch/riscv/boot/dts/spacemit/k1-bananapi-f3.dts
> +++ b/arch/riscv/boot/dts/spacemit/k1-bananapi-f3.dts
> @@ -220,7 +220,7 @@ buck3_1v8: buck3 {
> regulator-always-on;
> };
>
> - buck4 {
> + buck4: buck4 {
> regulator-min-microvolt = <500000>;
> regulator-max-microvolt = <3300000>;
> regulator-ramp-delay = <5000>;
> @@ -241,7 +241,7 @@ buck6 {
> regulator-always-on;
> };
>
> - aldo1 {
> + aldo1: aldo1 {
> regulator-min-microvolt = <500000>;
> regulator-max-microvolt = <3400000>;
> regulator-boot-on;
> @@ -367,3 +367,23 @@ hub_3_0: hub@2 {
> reset-gpios = <&gpio K1_GPIO(124) GPIO_ACTIVE_LOW>;
> };
> };
> +
> +&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;
> + broken-cd;
> + no-mmc;
> + no-sdio;
> + disable-wp;
> + cap-sd-highspeed;
> + vmmc-supply = <&buck4>;
> + vqmmc-supply = <&aldo1>;
> + sd-uhs-sdr25;
> + sd-uhs-sdr50;
> + sd-uhs-sdr104;
> + status = "okay";
> +};
>
> --
> 2.53.0
>
>
--
Margherita Milani
Embedded Software Engineer
M. +39 334 758 9111
margherita.milani@amarulasolutions.com
__________________________________
Amarula Solutions SRL
Via le Canevare 30, 31100, Treviso, Veneto, IT
T. +39 (0)42 243 5310
info@amarulasolutions.com
www.amarulasolutions.com
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH v8 8/9] riscv: dts: spacemit: k1-bananapi-f3: add SD card support with UHS modes
2026-05-07 8:20 ` [PATCH v8 8/9] riscv: dts: spacemit: k1-bananapi-f3: add SD card support with UHS modes Margherita Milani
@ 2026-05-07 9:53 ` Iker Pedrosa
2026-05-07 10:45 ` Troy Mitchell
0 siblings, 1 reply; 9+ messages in thread
From: Iker Pedrosa @ 2026-05-07 9:53 UTC (permalink / raw)
To: Margherita Milani
Cc: Ulf Hansson, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
Adrian Hunter, Paul Walmsley, Palmer Dabbelt, Albert Ou,
Alexandre Ghiti, Yixun Lan, Troy Mitchell, Michael Opdenacker,
Javier Martinez Canillas, linux-mmc, devicetree, linux-riscv,
spacemit, linux-kernel, Anand Moon
Hi,
El jue, 7 may 2026 a las 10:20, Margherita Milani
(<margherita.milani@amarulasolutions.com>) escribió:
>
> Good morning Iker,
>
> > 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
>
>
> Tested-by: Margherita Milani <margherita.milani@amarulasolutions.com>
>
> However I noticed it only works when CONFIG_I2C_K1 is enabled.
> Michael Opdenacker told me it's necessary to enable the regulators
> used by the mmc controller.
> Should we add the dependency between CONFIG_MMC_SDHCI_OF_K1 and
> CONFIG_I2C_K1? (Unless some boards don't have these dependency?)
> Thank you for your patchset which was really nice!
Thank you for catching this! You're absolutely right about the dependency.
From what I can see, all current SpacemiT K1 boards follow this design
pattern where the SD card power is provided by an I2C-controlled PMIC.
However, before adding a hard dependency, I'd like to get input from
the community, does anyone know of K1-based boards that provide SD
card power through fixed regulators or other means that don't require
I2C?
>
> --
> Margherita Milani
> Embedded Software Engineer
> M. +39 334 758 9111
> margherita.milani@amarulasolutions.com
> __________________________________
>
> Amarula Solutions SRL
> Via le Canevare 30, 31100, Treviso, Veneto, IT
> T. +39 (0)42 243 5310
> info@amarulasolutions.com
> www.amarulasolutions.com
>
> On Mon, Apr 13, 2026 at 10:05 AM Iker Pedrosa <ikerpedrosam@gmail.com> 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>
> > Tested-by: Anand Moon <linux.amoon@gmail.com>
> > Signed-off-by: Iker Pedrosa <ikerpedrosam@gmail.com>
> > ---
> > arch/riscv/boot/dts/spacemit/k1-bananapi-f3.dts | 24 ++++++++++++++++++++++--
> > 1 file changed, 22 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 5790d927b93d..a7d88564630f 100644
> > --- a/arch/riscv/boot/dts/spacemit/k1-bananapi-f3.dts
> > +++ b/arch/riscv/boot/dts/spacemit/k1-bananapi-f3.dts
> > @@ -220,7 +220,7 @@ buck3_1v8: buck3 {
> > regulator-always-on;
> > };
> >
> > - buck4 {
> > + buck4: buck4 {
> > regulator-min-microvolt = <500000>;
> > regulator-max-microvolt = <3300000>;
> > regulator-ramp-delay = <5000>;
> > @@ -241,7 +241,7 @@ buck6 {
> > regulator-always-on;
> > };
> >
> > - aldo1 {
> > + aldo1: aldo1 {
> > regulator-min-microvolt = <500000>;
> > regulator-max-microvolt = <3400000>;
> > regulator-boot-on;
> > @@ -367,3 +367,23 @@ hub_3_0: hub@2 {
> > reset-gpios = <&gpio K1_GPIO(124) GPIO_ACTIVE_LOW>;
> > };
> > };
> > +
> > +&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;
> > + broken-cd;
> > + no-mmc;
> > + no-sdio;
> > + disable-wp;
> > + cap-sd-highspeed;
> > + vmmc-supply = <&buck4>;
> > + vqmmc-supply = <&aldo1>;
> > + sd-uhs-sdr25;
> > + sd-uhs-sdr50;
> > + sd-uhs-sdr104;
> > + status = "okay";
> > +};
> >
> > --
> > 2.53.0
> >
> >
>
>
> --
> Margherita Milani
> Embedded Software Engineer
> M. +39 334 758 9111
> margherita.milani@amarulasolutions.com
> __________________________________
>
> Amarula Solutions SRL
> Via le Canevare 30, 31100, Treviso, Veneto, IT
> T. +39 (0)42 243 5310
> info@amarulasolutions.com
> www.amarulasolutions.com
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH v8 0/9] riscv: spacemit: enable SD card support with UHS modes for OrangePi RV2
[not found] ` <CANAwSgRNrs4C4B2o5KBpr29QWowTzpqVcQktAbFigiagxaFZAA@mail.gmail.com>
@ 2026-05-07 9:57 ` Iker Pedrosa
0 siblings, 0 replies; 9+ messages in thread
From: Iker Pedrosa @ 2026-05-07 9:57 UTC (permalink / raw)
To: Anand Moon
Cc: Ulf Hansson, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
Adrian Hunter, Paul Walmsley, Palmer Dabbelt, Albert Ou,
Alexandre Ghiti, Yixun Lan, Troy Mitchell, Michael Opdenacker,
Javier Martinez Canillas, linux-mmc, devicetree, linux-riscv,
spacemit, linux-kernel, Trevor Gamblin, Vincent Legoll
Hi everyone,
Now that the merge window has settled, I’d like to bring this series
back to your attention.
The series has been stable and tested across the OrangePi RV2, Banana
Pi F3, and Muse Pi Pro. Is there anything else needed on my end to get
this ready?
El jue, 23 abr 2026 a las 14:42, Anand Moon (<linux.amoon@gmail.com>) escribió:
>
> Hi All,
>
> On Mon, 13 Apr 2026 at 13:32, Iker Pedrosa <ikerpedrosam@gmail.com> wrote:
> >
> > This series enables complete SD card support for the Spacemit K1-based
> > OrangePi RV2 board, including UHS (Ultra High Speed) modes for
> > high-performance SD card operation.
> >
> > Background
> >
> > The Spacemit K1 SoC includes an SDHCI controller capable of supporting
> > SD cards up to UHS-I speeds (SDR104 at 208MHz). However, mainline
> > currently lacks basic SD controller configuration, SDHCI driver
> > enhancements for voltage switching and tuning, and power management
> > infrastructure.
> >
> > Implementation
> >
> > The series enables SD card support through coordinated layers:
> >
> > - Hardware infrastructure (patches 1-2): Device tree bindings for voltage
> > switching hardware and essential clock infrastructure.
> > - SDHCI driver enhancements (patches 3-7): Regulator framework
> > integration, pinctrl state switching for voltage domains, AIB register
> > programming, and comprehensive SDR tuning support for reliable UHS
> > operation.
> > - SoC and board integration (patches 8-10): Complete K1 SoC controller
> > definitions, PMIC power infrastructure, and OrangePi RV2 board enablement
> > with full UHS support.
> >
> > This transforms the OrangePi RV2 from having no SD card support to full
> > UHS-I capability, enabling high-performance storage up to 208MHz.
> >
> > Tested-by: Michael Opdenacker <michael.opdenacker@rootcommit.com>
> > Signed-off-by: Iker Pedrosa <ikerpedrosam@gmail.com>
>
> I'm just checking the status of this series. Since it hasn't been
> applied to linux-next,
> Will it be included in the next kernel release cycle?
>
> Thanks
> -Anand
> > ---
> > Changes in v8:
> > - Resending the series as v8. The v7 submission failed due to an SMTP
> > error during transit, which resulted in a broken thread on the mailing
> > list.
> > - No functional changes from v7.
> > - Link to v7: https://lore.kernel.org/r/20260413-orangepi-sd-card-uhs-v7-1-16650f49c022@gmail.com
> >
> > Changes in v7:
> > - Remove sdhci-common.yaml reference from DT binding.
> > - Link to v6: https://lore.kernel.org/r/20260407-orangepi-sd-card-uhs-v6-0-b5b8a1b2bfc8@gmail.com
> >
> > Changes in v6:
> > - Add pinctrl support for voltage switching. Document optional
> > pinctrl-names property supporting "default" and "uhs" pinctrl states
> > for coordinating pin configuration changes during UHS-I voltage
> > switching.
> > - Update pinctrl state naming from "state_uhs" to "uhs" to match DT
> > binding naming convention.
> > - Fix MMC drive strength values based on vendor kernel investigation.
> > Correct 3.3V operation from 7mA to 19mA and 1.8V UHS operation from
> > 13mA to 42mA to match proven vendor implementation.
> > - Link to v5: https://lore.kernel.org/r/20260330-orangepi-sd-card-uhs-v5-0-bd853604322d@gmail.com
> >
> > Changes in v5:
> > - Document optional pinctrl-names property supporting "default" and
> > "state_uhs" pinctrl states for coordinating pin configuration changes
> > during UHS-I voltage switching.
> > - Link to v4: https://lore.kernel.org/r/20260323-orangepi-sd-card-uhs-v4-0-567c9775fd0e@gmail.com
> >
> > Changes in v4:
> > - Revert to start_signal_voltage_switch() approach for bidirectional
> > voltage switching: replace voltage_switch() callback with
> > start_signal_voltage_switch() to properly handle both 3.3V and 1.8V
> > signal voltage directions.
> > - Fix DC input voltage specification: corrected the main power supply
> > from 12V to 5V to match the OrangePi RV2 board specifications. The
> > board uses a 5V USB-C input connector, not a 12V rail as previously
> > specified in the device tree.
> > - k1-bananapi-f3.dts: add `broken-cd` property to work around card
> > detection. Using `broken-cd` disables hotplug detection but keeps SD
> > card functionality working without additional dependencies.
> > - Add SD card support for Muse Pi Pro board (contributed by Trevor
> > Gamblin): enable SD card support with UHS-I capabilities following the
> > same pattern as OrangePi RV2, including dual pinctrl states, PMIC
> > power supplies, and card detection.
> > - Link to v3: https://lore.kernel.org/r/20260316-orangepi-sd-card-uhs-v3-0-aefd3b7832df@gmail.com
> >
> > Changes in v3:
> > - Rebase on mmc.git/next to resolve conflicts with "mmc: sdhci-of-k1:
> > add reset support" patch.
> > - Squash tuning infrastructure and implementation patches (3 and 4)
> > together to form complete functionality and avoid unused function
> > warnings.
> > - Reduce code nesting: implemented an early return sanity check in
> > spacemit_sdhci_voltage_switch() to reduce indentation and improve
> > logic flow.
> > - Refactor pinctrl initialization: moved pinctrl resource acquisition
> > and state lookup into a dedicated helper function,
> > spacemit_sdhci_get_pins().
> > - Use generic regulator node names (buck4, aldo1) instead of
> > device-specific aliases (sd_vmmc, sd_vqmmc) to better reflect that
> > these PMIC outputs serve multiple devices.
> > - Remove dead code handling 3.3V voltage switching from
> > spacemit_sdhci_voltage_switch().
> > - Optimize tuning algorithm to use single-pass window detection instead
> > of storing results in array, reducing memory usage and complexity.
> > - Remove unnecessary card detect check in execute_tuning() - rely on MMC
> > core.
> > - Clarify commit message to mention both SD (UHS-I) and eMMC (HS200)
> > tuning support.
> > - Add SD card support for Banana Pi BPI-F3 board with UHS-I capabilities
> > following the same pattern as OrangePi RV2.
> > - Link to v2: https://lore.kernel.org/r/20260309-orangepi-sd-card-uhs-v2-0-5bb2b574df5d@gmail.com
> >
> > Changes in v2:
> > - Removed custom AIB voltage switching code per maintainer feedback. The
> > existing pinctrl driver already handles AIB voltage switching
> > automatically via power-source property changes during UHS mode
> > transitions. This eliminates code duplication.
> > - Squashed regulator and pinctrl commits into single voltage switching
> > implementation.
> > - Moved voltage switching callback from dynamic probe assignment to
> > static sdhci_ops declaration. Removed redundant SDHCI core call since
> > the framework handles standard voltage switching automatically.
> > - Made clock override (SDHC_OVRRD_CLK_OEN | SDHC_FORCE_CLK_ON)
> > conditional for SD/SDIO cards only. This follows vendor driver pattern
> > of differentiating SD and eMMC card handling.
> > - Include no-mmc property for SD card.
> > - Link to v1: https://lore.kernel.org/r/20260302-orangepi-sd-card-uhs-v1-0-89c219973c0c@gmail.com
> >
> > ---
> > Iker Pedrosa (8):
> > dt-bindings: mmc: spacemit,sdhci: add pinctrl support for voltage switching
> > mmc: sdhci-of-k1: enable essential clock infrastructure for SD operation
> > mmc: sdhci-of-k1: add regulator and pinctrl voltage switching support
> > mmc: sdhci-of-k1: add comprehensive SDR tuning support
> > riscv: dts: spacemit: k1: add SD card controller and pinctrl support
> > riscv: dts: spacemit: k1-orangepi-rv2: add PMIC and power infrastructure
> > riscv: dts: spacemit: k1-orangepi-rv2: add SD card support with UHS modes
> > riscv: dts: spacemit: k1-bananapi-f3: add SD card support with UHS modes
> >
> > Trevor Gamblin (1):
> > riscv: dts: spacemit: k1-musepi-pro: add SD card support with UHS modes
> >
> > .../devicetree/bindings/mmc/spacemit,sdhci.yaml | 15 ++
> > arch/riscv/boot/dts/spacemit/k1-bananapi-f3.dts | 24 +-
> > arch/riscv/boot/dts/spacemit/k1-musepi-pro.dts | 66 ++++++
> > arch/riscv/boot/dts/spacemit/k1-orangepi-rv2.dts | 67 ++++++
> > arch/riscv/boot/dts/spacemit/k1-pinctrl.dtsi | 40 ++++
> > arch/riscv/boot/dts/spacemit/k1.dtsi | 13 ++
> > drivers/mmc/host/sdhci-of-k1.c | 257 +++++++++++++++++++++
> > 7 files changed, 480 insertions(+), 2 deletions(-)
> > ---
> > base-commit: 4c3b07bf68391122266dfb01126484daf352cf70
> > change-id: 20260226-orangepi-sd-card-uhs-0ecb05839b0c
> >
> > Best regards,
> > --
> > Iker Pedrosa <ikerpedrosam@gmail.com>
> >
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH v8 8/9] riscv: dts: spacemit: k1-bananapi-f3: add SD card support with UHS modes
2026-05-07 9:53 ` Iker Pedrosa
@ 2026-05-07 10:45 ` Troy Mitchell
2026-05-08 22:53 ` Yixun Lan
0 siblings, 1 reply; 9+ messages in thread
From: Troy Mitchell @ 2026-05-07 10:45 UTC (permalink / raw)
To: Iker Pedrosa, Margherita Milani
Cc: Ulf Hansson, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
Adrian Hunter, Paul Walmsley, Palmer Dabbelt, Albert Ou,
Alexandre Ghiti, Yixun Lan, Troy Mitchell, Michael Opdenacker,
Javier Martinez Canillas, linux-mmc, devicetree, linux-riscv,
spacemit, linux-kernel, Anand Moon
On Thu May 7, 2026 at 5:53 PM CST, Iker Pedrosa wrote:
> Hi,
>
> El jue, 7 may 2026 a las 10:20, Margherita Milani
> (<margherita.milani@amarulasolutions.com>) escribió:
>>
>> Good morning Iker,
>>
>> > 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
>>
>>
>> Tested-by: Margherita Milani <margherita.milani@amarulasolutions.com>
>>
>> However I noticed it only works when CONFIG_I2C_K1 is enabled.
>> Michael Opdenacker told me it's necessary to enable the regulators
>> used by the mmc controller.
>> Should we add the dependency between CONFIG_MMC_SDHCI_OF_K1 and
>> CONFIG_I2C_K1? (Unless some boards don't have these dependency?)
>> Thank you for your patchset which was really nice!
>
> Thank you for catching this! You're absolutely right about the dependency.
>
> From what I can see, all current SpacemiT K1 boards follow this design
> pattern where the SD card power is provided by an I2C-controlled PMIC.
> However, before adding a hard dependency, I'd like to get input from
> the community, does anyone know of K1-based boards that provide SD
> card power through fixed regulators or other means that don't require
> I2C?
if K1 needs to switch between standard and high-speed (UHS) modes,
I believe the I2C-controlled PMIC is mandatory to handle the voltage
switching (typically 3.3V to 1.8V).
I don't think any board would want to be stuck in standard mode permanently.
If high-speed mode is an option, why not use it? I think adding this
dependency is a good idea, but keep in mind it also needs to depend on P1.
- Troy
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH v8 8/9] riscv: dts: spacemit: k1-bananapi-f3: add SD card support with UHS modes
[not found] ` <20260413-orangepi-sd-card-uhs-v8-8-c21c40ec16d0@gmail.com>
2026-05-07 8:20 ` [PATCH v8 8/9] riscv: dts: spacemit: k1-bananapi-f3: add SD card support with UHS modes Margherita Milani
@ 2026-05-07 18:28 ` Aurelien Jarno
2026-05-08 22:27 ` Yixun Lan
1 sibling, 1 reply; 9+ messages in thread
From: Aurelien Jarno @ 2026-05-07 18:28 UTC (permalink / raw)
To: Iker Pedrosa
Cc: Ulf Hansson, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
Adrian Hunter, Paul Walmsley, Palmer Dabbelt, Albert Ou,
Alexandre Ghiti, Yixun Lan, Troy Mitchell, Michael Opdenacker,
Javier Martinez Canillas, linux-mmc, devicetree, linux-riscv,
spacemit, linux-kernel, Anand Moon
Hi,
On 2026-04-13 10:02, 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>
> Tested-by: Anand Moon <linux.amoon@gmail.com>
> Signed-off-by: Iker Pedrosa <ikerpedrosam@gmail.com>
> ---
> arch/riscv/boot/dts/spacemit/k1-bananapi-f3.dts | 24 ++++++++++++++++++++++--
> 1 file changed, 22 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 5790d927b93d..a7d88564630f 100644
> --- a/arch/riscv/boot/dts/spacemit/k1-bananapi-f3.dts
> +++ b/arch/riscv/boot/dts/spacemit/k1-bananapi-f3.dts
> @@ -220,7 +220,7 @@ buck3_1v8: buck3 {
> regulator-always-on;
> };
>
> - buck4 {
> + buck4: buck4 {
> regulator-min-microvolt = <500000>;
> regulator-max-microvolt = <3300000>;
> regulator-ramp-delay = <5000>;
> @@ -241,7 +241,7 @@ buck6 {
> regulator-always-on;
> };
>
> - aldo1 {
> + aldo1: aldo1 {
> regulator-min-microvolt = <500000>;
> regulator-max-microvolt = <3400000>;
> regulator-boot-on;
> @@ -367,3 +367,23 @@ hub_3_0: hub@2 {
> reset-gpios = <&gpio K1_GPIO(124) GPIO_ACTIVE_LOW>;
> };
> };
> +
> +&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;
> + broken-cd;
Card detect is marked as broken as a proper definition requires pull-up
support in pinctrl. Support for that went into 7.1, so I guess it's not
safe to use the proper definition. That means using the following
changes on to of this patch:
--- a/arch/riscv/boot/dts/spacemit/k1-bananapi-f3.dts
+++ b/arch/riscv/boot/dts/spacemit/k1-bananapi-f3.dts
@@ -406,9 +406,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;
- broken-cd;
+ cd-gpios = <&gpio K1_GPIO(80) (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>;
no-mmc;
no-sdio;
disable-wp;
Regards
Aurelien
--
Aurelien Jarno GPG: 4096R/1DDD8C9B
aurelien@aurel32.net http://aurel32.net
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH v8 8/9] riscv: dts: spacemit: k1-bananapi-f3: add SD card support with UHS modes
2026-05-07 18:28 ` Aurelien Jarno
@ 2026-05-08 22:27 ` Yixun Lan
0 siblings, 0 replies; 9+ messages in thread
From: Yixun Lan @ 2026-05-08 22:27 UTC (permalink / raw)
To: Iker Pedrosa, Ulf Hansson, Rob Herring, Krzysztof Kozlowski,
Conor Dooley, Adrian Hunter, Paul Walmsley, Palmer Dabbelt,
Albert Ou, Alexandre Ghiti, Troy Mitchell, Michael Opdenacker,
Javier Martinez Canillas, linux-mmc, devicetree, linux-riscv,
spacemit, linux-kernel, Anand Moon
Hi Iker, Aurelien
On 20:28 Thu 07 May , Aurelien Jarno wrote:
> Hi,
..
> > +&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;
> > + broken-cd;
>
> Card detect is marked as broken as a proper definition requires pull-up
> support in pinctrl. Support for that went into 7.1, so I guess it's not
> safe to use the proper definition. That means using the following
> changes on to of this patch:
>
> --- a/arch/riscv/boot/dts/spacemit/k1-bananapi-f3.dts
> +++ b/arch/riscv/boot/dts/spacemit/k1-bananapi-f3.dts
> @@ -406,9 +406,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;
> - broken-cd;
> + cd-gpios = <&gpio K1_GPIO(80) (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>;
I agree, please see this patch which was merged
https://lore.kernel.org/all/20260312-k1-gpio-set-config-v1-0-8c3541da16b1@pigmoral.tech/
--
Yixun Lan (dlan)
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH v8 8/9] riscv: dts: spacemit: k1-bananapi-f3: add SD card support with UHS modes
2026-05-07 10:45 ` Troy Mitchell
@ 2026-05-08 22:53 ` Yixun Lan
2026-05-08 23:10 ` Yixun Lan
0 siblings, 1 reply; 9+ messages in thread
From: Yixun Lan @ 2026-05-08 22:53 UTC (permalink / raw)
To: Iker Pedrosa, Troy Mitchell
Cc: Margherita Milani, Ulf Hansson, Rob Herring, Krzysztof Kozlowski,
Conor Dooley, Adrian Hunter, Paul Walmsley, Palmer Dabbelt,
Albert Ou, Alexandre Ghiti, Michael Opdenacker,
Javier Martinez Canillas, linux-mmc, devicetree, linux-riscv,
spacemit, linux-kernel, Anand Moon
Hi Iker, Troy,
On 18:45 Thu 07 May , Troy Mitchell wrote:
> On Thu May 7, 2026 at 5:53 PM CST, Iker Pedrosa wrote:
> > Hi,
> >
> > El jue, 7 may 2026 a las 10:20, Margherita Milani
> > (<margherita.milani@amarulasolutions.com>) escribió:
> >>
> >> Good morning Iker,
> >>
> >> > 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
> >>
> >>
> >> Tested-by: Margherita Milani <margherita.milani@amarulasolutions.com>
> >>
> >> However I noticed it only works when CONFIG_I2C_K1 is enabled.
> >> Michael Opdenacker told me it's necessary to enable the regulators
> >> used by the mmc controller.
> >> Should we add the dependency between CONFIG_MMC_SDHCI_OF_K1 and
> >> CONFIG_I2C_K1? (Unless some boards don't have these dependency?)
> >> Thank you for your patchset which was really nice!
> >
> > Thank you for catching this! You're absolutely right about the dependency.
> >
> > From what I can see, all current SpacemiT K1 boards follow this design
> > pattern where the SD card power is provided by an I2C-controlled PMIC.
> > However, before adding a hard dependency, I'd like to get input from
> > the community, does anyone know of K1-based boards that provide SD
> > card power through fixed regulators or other means that don't require
> > I2C?
I would object to add CONFIG_I2C_K1 as hard dependency, the reason is
that the spacemit sdhci driver (sdhci-of-k1.c) has no used i2c
api/function, it's just need I2C function via an indirect requirement,
which sdhci -> regulator(p1) -> i2c, besides, from the hardware design
perspective, it just happens that K1 use P1(via I2C) as PMIC, it's
totally possible(even in theory) to use other PMIC as power supply
control which may not be I2C interface (maybe use SPI, for example)
If we want to solve this more gracefully, I'm in favor to add explict
option enabled in defconfig..
> if K1 needs to switch between standard and high-speed (UHS) modes,
> I believe the I2C-controlled PMIC is mandatory to handle the voltage
> switching (typically 3.3V to 1.8V).
>
> I don't think any board would want to be stuck in standard mode permanently.
> If high-speed mode is an option, why not use it? I think adding this
> dependency is a good idea, but keep in mind it also needs to depend on P1.
>
No, as above
> - Troy
>
--
Yixun Lan (dlan)
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH v8 8/9] riscv: dts: spacemit: k1-bananapi-f3: add SD card support with UHS modes
2026-05-08 22:53 ` Yixun Lan
@ 2026-05-08 23:10 ` Yixun Lan
2026-05-11 8:01 ` Iker Pedrosa
0 siblings, 1 reply; 9+ messages in thread
From: Yixun Lan @ 2026-05-08 23:10 UTC (permalink / raw)
To: Iker Pedrosa, Troy Mitchell
Cc: Margherita Milani, Ulf Hansson, Rob Herring, Krzysztof Kozlowski,
Conor Dooley, Adrian Hunter, Paul Walmsley, Palmer Dabbelt,
Albert Ou, Alexandre Ghiti, Michael Opdenacker,
Javier Martinez Canillas, linux-mmc, devicetree, linux-riscv,
spacemit, linux-kernel, Anand Moon
On 22:53 Fri 08 May , Yixun Lan wrote:
> Hi Iker, Troy,
>
..
> I would object to add CONFIG_I2C_K1 as hard dependency, the reason is
> that the spacemit sdhci driver (sdhci-of-k1.c) has no used i2c
> api/function, it's just need I2C function via an indirect requirement,
> which sdhci -> regulator(p1) -> i2c, besides, from the hardware design
> perspective, it just happens that K1 use P1(via I2C) as PMIC, it's
> totally possible(even in theory) to use other PMIC as power supply
> control which may not be I2C interface (maybe use SPI, for example)
>
> If we want to solve this more gracefully, I'm in favor to add explict
> option enabled in defconfig..
>
or I think it's better we do this way..
+++ b/drivers/i2c/busses/Kconfig
@@ -794,6 +794,7 @@ config I2C_K1
tristate "SpacemiT K1 I2C adapter"
depends on ARCH_SPACEMIT || COMPILE_TEST
depends on OF
+ default ARCH_SPACEMIT
--
Yixun Lan (dlan)
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH v8 8/9] riscv: dts: spacemit: k1-bananapi-f3: add SD card support with UHS modes
2026-05-08 23:10 ` Yixun Lan
@ 2026-05-11 8:01 ` Iker Pedrosa
0 siblings, 0 replies; 9+ messages in thread
From: Iker Pedrosa @ 2026-05-11 8:01 UTC (permalink / raw)
To: Yixun Lan
Cc: Troy Mitchell, Margherita Milani, Ulf Hansson, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, Adrian Hunter, Paul Walmsley,
Palmer Dabbelt, Albert Ou, Alexandre Ghiti, Michael Opdenacker,
Javier Martinez Canillas, linux-mmc, devicetree, linux-riscv,
spacemit, linux-kernel, Anand Moon
El sáb, 9 may 2026 a las 1:10, Yixun Lan (<dlan@kernel.org>) escribió:
>
>
> On 22:53 Fri 08 May , Yixun Lan wrote:
> > Hi Iker, Troy,
> >
> ..
> > I would object to add CONFIG_I2C_K1 as hard dependency, the reason is
> > that the spacemit sdhci driver (sdhci-of-k1.c) has no used i2c
> > api/function, it's just need I2C function via an indirect requirement,
> > which sdhci -> regulator(p1) -> i2c, besides, from the hardware design
> > perspective, it just happens that K1 use P1(via I2C) as PMIC, it's
> > totally possible(even in theory) to use other PMIC as power supply
> > control which may not be I2C interface (maybe use SPI, for example)
> >
> > If we want to solve this more gracefully, I'm in favor to add explict
> > option enabled in defconfig..
> >
> or I think it's better we do this way..
>
> +++ b/drivers/i2c/busses/Kconfig
> @@ -794,6 +794,7 @@ config I2C_K1
> tristate "SpacemiT K1 I2C adapter"
> depends on ARCH_SPACEMIT || COMPILE_TEST
> depends on OF
> + default ARCH_SPACEMIT
Thank you all for the feedback! I agree that enabling I2C_K1 by
default makes sense for the user experience.
To keep this patchset focused and avoid cross-subsystem complexity,
I'll send the I2C default configuration change as a separate patch to
the I2C maintainers after this series lands.
This way we can get the SD card support merged without delays while
still solving the dependency issue properly.
>
>
> --
> Yixun Lan (dlan)
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2026-05-11 8:02 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <20260413-orangepi-sd-card-uhs-v8-0-c21c40ec16d0@gmail.com>
[not found] ` <20260413-orangepi-sd-card-uhs-v8-8-c21c40ec16d0@gmail.com>
2026-05-07 8:20 ` [PATCH v8 8/9] riscv: dts: spacemit: k1-bananapi-f3: add SD card support with UHS modes Margherita Milani
2026-05-07 9:53 ` Iker Pedrosa
2026-05-07 10:45 ` Troy Mitchell
2026-05-08 22:53 ` Yixun Lan
2026-05-08 23:10 ` Yixun Lan
2026-05-11 8:01 ` Iker Pedrosa
2026-05-07 18:28 ` Aurelien Jarno
2026-05-08 22:27 ` Yixun Lan
[not found] ` <CANAwSgRNrs4C4B2o5KBpr29QWowTzpqVcQktAbFigiagxaFZAA@mail.gmail.com>
2026-05-07 9:57 ` [PATCH v8 0/9] riscv: spacemit: enable SD card support with UHS modes for OrangePi RV2 Iker Pedrosa
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox