Linux-RISC-V Archive on lore.kernel.org
 help / color / mirror / Atom feed
* spacemit: P1 PMIC support on Banana pi F3 testing
@ 2025-07-24  9:56 Anand Moon
  2025-07-25  1:56 ` Alex Elder
  2025-07-26  0:27 ` Yixun Lan
  0 siblings, 2 replies; 5+ messages in thread
From: Anand Moon @ 2025-07-24  9:56 UTC (permalink / raw)
  To: Alex Elder, Yixun Lan; +Cc: open list:RISC-V MISC SOC SUPPORT, spacemit

Hi Alex,

Thank you for your work on the P1 PMIC patch for Spacemit K1 SoC - Banana Pi F3.

I've been testing your patch series for the Banana Pi F3 [0] to enable SD card
and eMMC functionality,

[0] https://patchew.org/linux/20250710175107.1280221-1-elder@riscstar.com/

While debugging, I cross-referenced the patch with the BPI-F3-V3 board
schematic [1]
and noticed several discrepancies in the power configuration:

[1] https://drive.google.com/file/d/19iLJ5xnCB_oK8VeQjkPGjzAn39WYyylv/view

Incorrect Voltage Ranges: The minimum and maximum voltage values for
multiple regulators
(including BUCKs, ALDOs, and DLDOs) In the patch, do not match the
specifications in
the schematic's power tree.

Missing/Incorrect Labels: Many regulators are missing accurate labels and names,
which makes mapping them to the hardware difficult.

Device Tree Mapping: To configure the power sources correctly, the k1
user names from
the schematic needs to be properly mapped to its corresponding device
tree nodes.

I’ve put together a set of local changes to better align the regulator
definitions with the board schematic.
These adjustments help improve the hardware mapping to the PMIC
regulators, though some details
may still need refinement. If you find the changes helpful, please
consider incorporating them into
the next revision of the patch.

I’d be grateful if you could Cc me on any future communication
regarding testing.
as I didn’t receive this patch series in my inbox.

Thanks
-Anand

Here is the boot log [2] https://pastebin.com/cXybbVar

It's not working on my end., Neither the eMMC nor the SD card is
getting detected.
Please let me know if I missed any more driver changes.

:: Triggering uevents...
[   13.671598][    C3] sched: DL replenish lagged too much
[   19.061738][   T76] platform d4280000.sdh: deferred probe pending:
platform: wait for supplier /soc/i2c@d401d800/pmic@41/regulators/aldo1
[   19.072163][   T76] platform d4281000.mmc: deferred probe pending:
platform: wait for supplier /soc/i2c@d401d800/pmic@41/regulators/buck3
:: running hook

Would you like help reviewing the patch or double-checking the
schematic mappings?

-----8<----------8<----------8<----------8<----------8<----------8<-----
amoon@amoon-t440s:~/mainline/linux-next-6.y-devel$ git diff
diff --git a/arch/riscv/boot/dts/spacemit/k1-bananapi-f3.dts
b/arch/riscv/boot/dts/spacemit/k1-bananapi-f3.dts
index 83907cc1d5cc..5a24a224f331 100644
--- a/arch/riscv/boot/dts/spacemit/k1-bananapi-f3.dts
+++ b/arch/riscv/boot/dts/spacemit/k1-bananapi-f3.dts
@@ -50,12 +50,28 @@ reg_vcc_4v: vcc-4v {
 };

 &emmc {
+       pinctrl-names = "default";
+       pinctrl-0 = <&emmc_cfg>;
        bus-width = <8>;
        mmc-hs400-1_8v;
        mmc-hs400-enhanced-strobe;
        non-removable;
        no-sd;
        no-sdio;
+       vmmc-supply = <&buck4>;
+       vqmmc-supply = <&buck3>;
+       status = "okay";
+};
+
+&sdcard {
+       pinctrl-names = "default";
+       pinctrl-0 = <&sdmmc_cfg>;
+       bus-width = <4>;
+       cd-gpios = <&gpio K1_GPIO(80) GPIO_ACTIVE_HIGH>;
+       cd-inverted;
+       vmmc-supply = <&ald01>;
+       no-mmc;
+       no-sdio;
        status = "okay";
 };

@@ -74,105 +90,123 @@ pmic@41 {
                status = "okay";

                regulators {
-                       buck1 {
-                               regulator-min-microvolt = <500000>;
-                               regulator-max-microvolt = <3450000>;
+                       buck1: buck1 {
+                               regulator-name = "buck1";
+                               regulator-min-microvolt = <900000>;
+                               regulator-max-microvolt = <900000>;
                                regulator-ramp-delay = <5000>;
                                regulator-always-on;
                        };

-                       buck2 {
-                               regulator-min-microvolt = <500000>;
-                               regulator-max-microvolt = <3450000>;
+                       buck2: buck2 {
+                               regulator-name = "buck2";
+                               regulator-min-microvolt = <900000>;
+                               regulator-max-microvolt = <900000>;
                                regulator-ramp-delay = <5000>;
                                regulator-always-on;
                        };

-                       buck3 {
-                               regulator-min-microvolt = <500000>;
+                       buck3: buck3 {
+                               regulator-name = "buck3";
+                               regulator-min-microvolt = <1800000>;
                                regulator-max-microvolt = <1800000>;
                                regulator-ramp-delay = <5000>;
                                regulator-always-on;
                        };

-                       buck4 {
-                               regulator-min-microvolt = <500000>;
+                       buck4: buck4 {
+                               regulator-name = "buck4";
+                               regulator-min-microvolt = <3300000>;
                                regulator-max-microvolt = <3300000>;
                                regulator-ramp-delay = <5000>;
                                regulator-always-on;
                        };

-                       buck5 {
-                               regulator-min-microvolt = <500000>;
-                               regulator-max-microvolt = <3450000>;
+                       buck5: buck5 {
+                               regulator-name = "buck5";
+                               regulator-min-microvolt = <2100000>;
+                               regulator-max-microvolt = <2100000>;
                                regulator-ramp-delay = <5000>;
                                regulator-always-on;
                        };

-                       buck6 {
-                               regulator-min-microvolt = <500000>;
-                               regulator-max-microvolt = <3450000>;
+                       buck6: buck6 {
+                               regulator-name = "buck6";
+                               regulator-min-microvolt = <1100000>;
+                               regulator-max-microvolt = <1100000>;
                                regulator-ramp-delay = <5000>;
                                regulator-always-on;
                        };

-                       aldo1 {
-                               regulator-min-microvolt = <500000>;
-                               regulator-max-microvolt = <3400000>;
+                       ald01: aldo1 {
+                               regulator-name = "aldo1";
+                               regulator-min-microvolt = <1800000>;
+                               regulator-max-microvolt = <3300000>;
                                regulator-boot-on;
+                               regulator-always-on;
                        };

-                       aldo2 {
-                               regulator-min-microvolt = <500000>;
-                               regulator-max-microvolt = <3400000>;
+                       ald02: aldo2 {
+                               regulator-name = "aldo2";
+                               regulator-min-microvolt = <2800000>;
+                               regulator-max-microvolt = <2800000>;
                        };

-                       aldo3 {
-                               regulator-min-microvolt = <500000>;
-                               regulator-max-microvolt = <3400000>;
+                       ald03: aldo3 {
+                               regulator-name = "aldo3";
+                               regulator-min-microvolt = <2800000>;
+                               regulator-max-microvolt = <2800000>;
                        };

-                       aldo4 {
-                               regulator-min-microvolt = <500000>;
-                               regulator-max-microvolt = <3400000>;
+                       ald04: aldo4 {
+                               regulator-name = "aldo4";
+                               regulator-min-microvolt = <2800000>;
+                               regulator-max-microvolt = <2800000>;
                        };

-                       dldo1 {
-                               regulator-min-microvolt = <500000>;
-                               regulator-max-microvolt = <3400000>;
+                       d1d01: dldo1 {
+                               regulator-name = "dldo1";
+                               regulator-min-microvolt = <1200000>;
+                               regulator-max-microvolt = <1200000>;
                                regulator-boot-on;
                        };

-                       dldo2 {
-                               regulator-min-microvolt = <500000>;
-                               regulator-max-microvolt = <3400000>;
+                       d1d02: dldo2 {
+                               regulator-name = "dldo2";
+                               regulator-min-microvolt = <1200000>;
+                               regulator-max-microvolt = <1200000>;
                        };

-                       dldo3 {
-                               regulator-min-microvolt = <500000>;
-                               regulator-max-microvolt = <3400000>;
+                       d1d03: dldo3 {
+                               regulator-name = "dld03";
+                               regulator-min-microvolt = <1800000>;
+                               regulator-max-microvolt = <1800000>;
                        };

-                       dldo4 {
-                               regulator-min-microvolt = <500000>;
-                               regulator-max-microvolt = <3400000>;
+                       d1d04: dldo4 {
+                               regulator-name = "d1d04";
+                               regulator-min-microvolt = <1800000>;
+                               regulator-max-microvolt = <1800000>;
                                regulator-always-on;
                        };

-                       dldo5 {
-                               regulator-min-microvolt = <500000>;
-                               regulator-max-microvolt = <3400000>;
+                       d1d05: d1d05 {
+                               regulator-name = "d1d05";
+                               regulator-min-microvolt = <1800000>;
+                               regulator-max-microvolt = <1800000>;
                        };

-                       dldo6 {
-                               regulator-min-microvolt = <500000>;
-                               regulator-max-microvolt = <3400000>;
+                       d1d06: dldo6 {
+                               regulator-name = "d1d06";
+                               regulator-min-microvolt = <1800000>;
+                               regulator-max-microvolt = <1800000>;
                                regulator-always-on;
                        };

-                       dldo7 {
-                               regulator-min-microvolt = <500000>;
-                               regulator-max-microvolt = <3400000>;
+                       d1d07: dldo7 {
+                               regulator-name = "d1d07";
+                               regulator-min-microvolt = <1800000>;
+                               regulator-max-microvolt = <1800000>;
                        };
                };
        };
diff --git a/arch/riscv/boot/dts/spacemit/k1-pinctrl.dtsi
b/arch/riscv/boot/dts/spacemit/k1-pinctrl.dtsi
index 96d7a46d4bf7..8f5b6c7c34ea 100644
--- a/arch/riscv/boot/dts/spacemit/k1-pinctrl.dtsi
+++ b/arch/riscv/boot/dts/spacemit/k1-pinctrl.dtsi
@@ -18,6 +18,33 @@ i2c8-0-pins {
                };
        };

+       emmc_cfg: mmc-2-cfg {
+               mmc-2-pins {
+                       pinmux = <K1_PADCONF(93, 0)>,   /* EMMC_DAT0 */
+                               <K1_PADCONF(94, 0)>,    /* EMMC_DAT1 */
+                               <K1_PADCONF(95, 0)>,    /* EMMC_DAT2 */
+                               <K1_PADCONF(96, 0)>,    /* EMMC_DAT3 */
+                               <K1_PADCONF(97, 0)>,    /* EMMC_DAT4 */
+                               <K1_PADCONF(98, 0)>,    /* EMMC_DAT5 */
+                               <K1_PADCONF(99, 0)>,    /* EMMC_DAT6 */
+                               <K1_PADCONF(100, 0)>,   /* EMMC_DAT7 */
+                               <K1_PADCONF(101, 0)>,   /* EMMC_DS */
+                               <K1_PADCONF(102, 0)>,   /* EMMC_CLK */
+                               <K1_PADCONF(103, 0)>;   /* EMMC_CMD */
+               };
+       };
+
+       sdmmc_cfg: mmc-1-cfg {
+               mmc-1-pins {
+                       pinmux = <K1_PADCONF(15, 0)>,   /* MMC1_DAT3 */
+                       <K1_PADCONF(16, 0)>,    /* MMC1_DAT2 */
+                       <K1_PADCONF(17, 0)>,    /* MMC1_DAT1 */
+                       <K1_PADCONF(18, 0)>,    /* MMC1_DAT0 */
+                       <K1_PADCONF(19, 0)>,    /* MMC1_CMD */
+                       <K1_PADCONF(20, 0)>;    /* MMC1_CLK */
+               };
+       };
+
        uart0_2_cfg: uart0-2-cfg {
                uart0-2-pins {
                        pinmux = <K1_PADCONF(68, 2)>,
diff --git a/arch/riscv/boot/dts/spacemit/k1.dtsi
b/arch/riscv/boot/dts/spacemit/k1.dtsi
index 2a5a132d5a77..4a11c733f4e4 100644
--- a/arch/riscv/boot/dts/spacemit/k1.dtsi
+++ b/arch/riscv/boot/dts/spacemit/k1.dtsi
@@ -834,6 +834,16 @@ storage-bus {
                        #size-cells = <2>;
                        dma-ranges = <0x0 0x00000000 0x0 0x00000000
0x0 0x80000000>;

+                       sdcard: sdh@d4280000 {
+                               compatible = "spacemit,k1-sdhci";
+                               reg = <0x0 0xd4280000 0x0 0x200>;
+                               clocks = <&syscon_apmu CLK_SDH_AXI>,
+                                       <&syscon_apmu CLK_SDH0>;
+                               clock-names = "core", "io";
+                               interrupts = <99>;
+                               status = "disabled";
+                       };
+
                        emmc: mmc@d4281000 {
                                compatible = "spacemit,k1-sdhci";
                                reg = <0x0 0xd4281000 0x0 0x200>;

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

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: spacemit: P1 PMIC support on Banana pi F3 testing
  2025-07-24  9:56 spacemit: P1 PMIC support on Banana pi F3 testing Anand Moon
@ 2025-07-25  1:56 ` Alex Elder
  2025-07-25  9:49   ` Anand Moon
  2025-07-26  0:27 ` Yixun Lan
  1 sibling, 1 reply; 5+ messages in thread
From: Alex Elder @ 2025-07-25  1:56 UTC (permalink / raw)
  To: Anand Moon, Yixun Lan; +Cc: open list:RISC-V MISC SOC SUPPORT, spacemit

On 7/24/25 4:56 AM, Anand Moon wrote:
> Hi Alex,
> 
> Thank you for your work on the P1 PMIC patch for Spacemit K1 SoC - Banana Pi F3.
> 
> I've been testing your patch series for the Banana Pi F3 [0] to enable SD card
> and eMMC functionality,
> 
> [0] https://patchew.org/linux/20250710175107.1280221-1-elder@riscstar.com/
> 
> While debugging, I cross-referenced the patch with the BPI-F3-V3 board
> schematic [1]
> and noticed several discrepancies in the power configuration:
> 
> [1] https://drive.google.com/file/d/19iLJ5xnCB_oK8VeQjkPGjzAn39WYyylv/view
> 
> Incorrect Voltage Ranges: The minimum and maximum voltage values for
> multiple regulators
> (including BUCKs, ALDOs, and DLDOs) In the patch, do not match the
> specifications in
> the schematic's power tree.

I really appreciate you checking this.

The values I used were derived from the vendor code that I
started with.  I was assured that this baseline worked on
the Banana Pi BPI-F3.

For the record, I *do* have a functioning SD card and eMMC.
I'm not sure just now what you are using differs from what
I am using.

I would like to understand and reconcile the differences you
point out but I'm not able to do that at this time; maybe
next week.

You say the names don't match.  From what I can tell, your
names are like "d1d0" (D one D zero) rather than "dldo"
(D L D O), and what I see in the document you link to uses
all letters.  If I'm misunderstanding, please explain.

Thanks.

					-Alex


> Missing/Incorrect Labels: Many regulators are missing accurate labels and names,
> which makes mapping them to the hardware difficult.
> 
> Device Tree Mapping: To configure the power sources correctly, the k1
> user names from
> the schematic needs to be properly mapped to its corresponding device
> tree nodes.
> 
> I’ve put together a set of local changes to better align the regulator
> definitions with the board schematic.
> These adjustments help improve the hardware mapping to the PMIC
> regulators, though some details
> may still need refinement. If you find the changes helpful, please
> consider incorporating them into
> the next revision of the patch.
> 
> I’d be grateful if you could Cc me on any future communication
> regarding testing.
> as I didn’t receive this patch series in my inbox.
> 
> Thanks
> -Anand
> 
> Here is the boot log [2] https://pastebin.com/cXybbVar
> 
> It's not working on my end., Neither the eMMC nor the SD card is
> getting detected.
> Please let me know if I missed any more driver changes.
> 
> :: Triggering uevents...
> [   13.671598][    C3] sched: DL replenish lagged too much
> [   19.061738][   T76] platform d4280000.sdh: deferred probe pending:
> platform: wait for supplier /soc/i2c@d401d800/pmic@41/regulators/aldo1
> [   19.072163][   T76] platform d4281000.mmc: deferred probe pending:
> platform: wait for supplier /soc/i2c@d401d800/pmic@41/regulators/buck3
> :: running hook
> 
> Would you like help reviewing the patch or double-checking the
> schematic mappings?
> 
> -----8<----------8<----------8<----------8<----------8<----------8<-----
> amoon@amoon-t440s:~/mainline/linux-next-6.y-devel$ git diff
> diff --git a/arch/riscv/boot/dts/spacemit/k1-bananapi-f3.dts
> b/arch/riscv/boot/dts/spacemit/k1-bananapi-f3.dts
> index 83907cc1d5cc..5a24a224f331 100644
> --- a/arch/riscv/boot/dts/spacemit/k1-bananapi-f3.dts
> +++ b/arch/riscv/boot/dts/spacemit/k1-bananapi-f3.dts
> @@ -50,12 +50,28 @@ reg_vcc_4v: vcc-4v {
>   };
> 
>   &emmc {
> +       pinctrl-names = "default";
> +       pinctrl-0 = <&emmc_cfg>;
>          bus-width = <8>;
>          mmc-hs400-1_8v;
>          mmc-hs400-enhanced-strobe;
>          non-removable;
>          no-sd;
>          no-sdio;
> +       vmmc-supply = <&buck4>;
> +       vqmmc-supply = <&buck3>;
> +       status = "okay";
> +};
> +
> +&sdcard {
> +       pinctrl-names = "default";
> +       pinctrl-0 = <&sdmmc_cfg>;
> +       bus-width = <4>;
> +       cd-gpios = <&gpio K1_GPIO(80) GPIO_ACTIVE_HIGH>;
> +       cd-inverted;
> +       vmmc-supply = <&ald01>;
> +       no-mmc;
> +       no-sdio;
>          status = "okay";
>   };
> 
> @@ -74,105 +90,123 @@ pmic@41 {
>                  status = "okay";
> 
>                  regulators {
> -                       buck1 {
> -                               regulator-min-microvolt = <500000>;
> -                               regulator-max-microvolt = <3450000>;
> +                       buck1: buck1 {
> +                               regulator-name = "buck1";
> +                               regulator-min-microvolt = <900000>;
> +                               regulator-max-microvolt = <900000>;
>                                  regulator-ramp-delay = <5000>;
>                                  regulator-always-on;
>                          };
> 
> -                       buck2 {
> -                               regulator-min-microvolt = <500000>;
> -                               regulator-max-microvolt = <3450000>;
> +                       buck2: buck2 {
> +                               regulator-name = "buck2";
> +                               regulator-min-microvolt = <900000>;
> +                               regulator-max-microvolt = <900000>;
>                                  regulator-ramp-delay = <5000>;
>                                  regulator-always-on;
>                          };
> 
> -                       buck3 {
> -                               regulator-min-microvolt = <500000>;
> +                       buck3: buck3 {
> +                               regulator-name = "buck3";
> +                               regulator-min-microvolt = <1800000>;
>                                  regulator-max-microvolt = <1800000>;
>                                  regulator-ramp-delay = <5000>;
>                                  regulator-always-on;
>                          };
> 
> -                       buck4 {
> -                               regulator-min-microvolt = <500000>;
> +                       buck4: buck4 {
> +                               regulator-name = "buck4";
> +                               regulator-min-microvolt = <3300000>;
>                                  regulator-max-microvolt = <3300000>;
>                                  regulator-ramp-delay = <5000>;
>                                  regulator-always-on;
>                          };
> 
> -                       buck5 {
> -                               regulator-min-microvolt = <500000>;
> -                               regulator-max-microvolt = <3450000>;
> +                       buck5: buck5 {
> +                               regulator-name = "buck5";
> +                               regulator-min-microvolt = <2100000>;
> +                               regulator-max-microvolt = <2100000>;
>                                  regulator-ramp-delay = <5000>;
>                                  regulator-always-on;
>                          };
> 
> -                       buck6 {
> -                               regulator-min-microvolt = <500000>;
> -                               regulator-max-microvolt = <3450000>;
> +                       buck6: buck6 {
> +                               regulator-name = "buck6";
> +                               regulator-min-microvolt = <1100000>;
> +                               regulator-max-microvolt = <1100000>;
>                                  regulator-ramp-delay = <5000>;
>                                  regulator-always-on;
>                          };
> 
> -                       aldo1 {
> -                               regulator-min-microvolt = <500000>;
> -                               regulator-max-microvolt = <3400000>;
> +                       ald01: aldo1 {
> +                               regulator-name = "aldo1";
> +                               regulator-min-microvolt = <1800000>;
> +                               regulator-max-microvolt = <3300000>;
>                                  regulator-boot-on;
> +                               regulator-always-on;
>                          };
> 
> -                       aldo2 {
> -                               regulator-min-microvolt = <500000>;
> -                               regulator-max-microvolt = <3400000>;
> +                       ald02: aldo2 {
> +                               regulator-name = "aldo2";
> +                               regulator-min-microvolt = <2800000>;
> +                               regulator-max-microvolt = <2800000>;
>                          };
> 
> -                       aldo3 {
> -                               regulator-min-microvolt = <500000>;
> -                               regulator-max-microvolt = <3400000>;
> +                       ald03: aldo3 {
> +                               regulator-name = "aldo3";
> +                               regulator-min-microvolt = <2800000>;
> +                               regulator-max-microvolt = <2800000>;
>                          };
> 
> -                       aldo4 {
> -                               regulator-min-microvolt = <500000>;
> -                               regulator-max-microvolt = <3400000>;
> +                       ald04: aldo4 {
> +                               regulator-name = "aldo4";
> +                               regulator-min-microvolt = <2800000>;
> +                               regulator-max-microvolt = <2800000>;
>                          };
> 
> -                       dldo1 {
> -                               regulator-min-microvolt = <500000>;
> -                               regulator-max-microvolt = <3400000>;
> +                       d1d01: dldo1 {
> +                               regulator-name = "dldo1";
> +                               regulator-min-microvolt = <1200000>;
> +                               regulator-max-microvolt = <1200000>;
>                                  regulator-boot-on;
>                          };
> 
> -                       dldo2 {
> -                               regulator-min-microvolt = <500000>;
> -                               regulator-max-microvolt = <3400000>;
> +                       d1d02: dldo2 {
> +                               regulator-name = "dldo2";
> +                               regulator-min-microvolt = <1200000>;
> +                               regulator-max-microvolt = <1200000>;
>                          };
> 
> -                       dldo3 {
> -                               regulator-min-microvolt = <500000>;
> -                               regulator-max-microvolt = <3400000>;
> +                       d1d03: dldo3 {
> +                               regulator-name = "dld03";
> +                               regulator-min-microvolt = <1800000>;
> +                               regulator-max-microvolt = <1800000>;
>                          };
> 
> -                       dldo4 {
> -                               regulator-min-microvolt = <500000>;
> -                               regulator-max-microvolt = <3400000>;
> +                       d1d04: dldo4 {
> +                               regulator-name = "d1d04";
> +                               regulator-min-microvolt = <1800000>;
> +                               regulator-max-microvolt = <1800000>;
>                                  regulator-always-on;
>                          };
> 
> -                       dldo5 {
> -                               regulator-min-microvolt = <500000>;
> -                               regulator-max-microvolt = <3400000>;
> +                       d1d05: d1d05 {
> +                               regulator-name = "d1d05";
> +                               regulator-min-microvolt = <1800000>;
> +                               regulator-max-microvolt = <1800000>;
>                          };
> 
> -                       dldo6 {
> -                               regulator-min-microvolt = <500000>;
> -                               regulator-max-microvolt = <3400000>;
> +                       d1d06: dldo6 {
> +                               regulator-name = "d1d06";
> +                               regulator-min-microvolt = <1800000>;
> +                               regulator-max-microvolt = <1800000>;
>                                  regulator-always-on;
>                          };
> 
> -                       dldo7 {
> -                               regulator-min-microvolt = <500000>;
> -                               regulator-max-microvolt = <3400000>;
> +                       d1d07: dldo7 {
> +                               regulator-name = "d1d07";
> +                               regulator-min-microvolt = <1800000>;
> +                               regulator-max-microvolt = <1800000>;
>                          };
>                  };
>          };
> diff --git a/arch/riscv/boot/dts/spacemit/k1-pinctrl.dtsi
> b/arch/riscv/boot/dts/spacemit/k1-pinctrl.dtsi
> index 96d7a46d4bf7..8f5b6c7c34ea 100644
> --- a/arch/riscv/boot/dts/spacemit/k1-pinctrl.dtsi
> +++ b/arch/riscv/boot/dts/spacemit/k1-pinctrl.dtsi
> @@ -18,6 +18,33 @@ i2c8-0-pins {
>                  };
>          };
> 
> +       emmc_cfg: mmc-2-cfg {
> +               mmc-2-pins {
> +                       pinmux = <K1_PADCONF(93, 0)>,   /* EMMC_DAT0 */
> +                               <K1_PADCONF(94, 0)>,    /* EMMC_DAT1 */
> +                               <K1_PADCONF(95, 0)>,    /* EMMC_DAT2 */
> +                               <K1_PADCONF(96, 0)>,    /* EMMC_DAT3 */
> +                               <K1_PADCONF(97, 0)>,    /* EMMC_DAT4 */
> +                               <K1_PADCONF(98, 0)>,    /* EMMC_DAT5 */
> +                               <K1_PADCONF(99, 0)>,    /* EMMC_DAT6 */
> +                               <K1_PADCONF(100, 0)>,   /* EMMC_DAT7 */
> +                               <K1_PADCONF(101, 0)>,   /* EMMC_DS */
> +                               <K1_PADCONF(102, 0)>,   /* EMMC_CLK */
> +                               <K1_PADCONF(103, 0)>;   /* EMMC_CMD */
> +               };
> +       };
> +
> +       sdmmc_cfg: mmc-1-cfg {
> +               mmc-1-pins {
> +                       pinmux = <K1_PADCONF(15, 0)>,   /* MMC1_DAT3 */
> +                       <K1_PADCONF(16, 0)>,    /* MMC1_DAT2 */
> +                       <K1_PADCONF(17, 0)>,    /* MMC1_DAT1 */
> +                       <K1_PADCONF(18, 0)>,    /* MMC1_DAT0 */
> +                       <K1_PADCONF(19, 0)>,    /* MMC1_CMD */
> +                       <K1_PADCONF(20, 0)>;    /* MMC1_CLK */
> +               };
> +       };
> +
>          uart0_2_cfg: uart0-2-cfg {
>                  uart0-2-pins {
>                          pinmux = <K1_PADCONF(68, 2)>,
> diff --git a/arch/riscv/boot/dts/spacemit/k1.dtsi
> b/arch/riscv/boot/dts/spacemit/k1.dtsi
> index 2a5a132d5a77..4a11c733f4e4 100644
> --- a/arch/riscv/boot/dts/spacemit/k1.dtsi
> +++ b/arch/riscv/boot/dts/spacemit/k1.dtsi
> @@ -834,6 +834,16 @@ storage-bus {
>                          #size-cells = <2>;
>                          dma-ranges = <0x0 0x00000000 0x0 0x00000000
> 0x0 0x80000000>;
> 
> +                       sdcard: sdh@d4280000 {
> +                               compatible = "spacemit,k1-sdhci";
> +                               reg = <0x0 0xd4280000 0x0 0x200>;
> +                               clocks = <&syscon_apmu CLK_SDH_AXI>,
> +                                       <&syscon_apmu CLK_SDH0>;
> +                               clock-names = "core", "io";
> +                               interrupts = <99>;
> +                               status = "disabled";
> +                       };
> +
>                          emmc: mmc@d4281000 {
>                                  compatible = "spacemit,k1-sdhci";
>                                  reg = <0x0 0xd4281000 0x0 0x200>;


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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: spacemit: P1 PMIC support on Banana pi F3 testing
  2025-07-25  1:56 ` Alex Elder
@ 2025-07-25  9:49   ` Anand Moon
  2025-07-25 15:03     ` Anand Moon
  0 siblings, 1 reply; 5+ messages in thread
From: Anand Moon @ 2025-07-25  9:49 UTC (permalink / raw)
  To: Alex Elder; +Cc: Yixun Lan, open list:RISC-V MISC SOC SUPPORT, spacemit

Hi Alex,

On Fri, 25 Jul 2025 at 07:26, Alex Elder <elder@riscstar.com> wrote:
>
> On 7/24/25 4:56 AM, Anand Moon wrote:
> > Hi Alex,
> >
> > Thank you for your work on the P1 PMIC patch for Spacemit K1 SoC - Banana Pi F3.
> >
> > I've been testing your patch series for the Banana Pi F3 [0] to enable SD card
> > and eMMC functionality,
> >
> > [0] https://patchew.org/linux/20250710175107.1280221-1-elder@riscstar.com/
> >
> > While debugging, I cross-referenced the patch with the BPI-F3-V3 board
> > schematic [1]
> > and noticed several discrepancies in the power configuration:
> >
> > [1] https://drive.google.com/file/d/19iLJ5xnCB_oK8VeQjkPGjzAn39WYyylv/view
> >
> > Incorrect Voltage Ranges: The minimum and maximum voltage values for
> > multiple regulators
> > (including BUCKs, ALDOs, and DLDOs) In the patch, do not match the
> > specifications in
> > the schematic's power tree.
>
> I really appreciate you checking this.
>
> The values I used were derived from the vendor code that I
> started with.  I was assured that this baseline worked on
> the Banana Pi BPI-F3.
>
I am just following examples from SoC like Rockchip and Samsung.

> For the record, I *do* have a functioning SD card and eMMC.
> I'm not sure just now what you are using differs from what
> I am using.
>
> I would like to understand and reconcile the differences you
> point out but I'm not able to do that at this time; maybe
> next week.

You are using the default  ranges  0.5~3.4V@3.5A.
But in the schematic's power tree, components such as P1 (U1401) and K1 (Uxxx)
specify precise voltage ranges, for example:
0.9 V ± 1%
1.8 V ± 1%
3.3 V ± 1%

These same voltage values must be accurately reflected in the device tree node
definitions to ensure that all regulators supply the correct voltage
levels to downstream
components. Labels are used to map each regulator to its corresponding
internal node
in the device tree. Using appropriate and consistent names allows
these regulators to be
easily tracked. This mapping helps in validating configurations using
the regulator_summary,
which displays the active regulator states.

For example
$ sudo cat /sys/kernel/debug/regulator/regulator_summary
 regulator                      use open bypass  opmode voltage
current     min     max
---------------------------------------------------------------------------------------
 regulator-dummy                  6    5      0 unknown     0mV
0mA     0mV     0mV
    12500000.phy-vbus-boost       2
0mA     0mV     0mV
    12500000.phy-vbus             2
0mA     0mV     0mV
    12100000.phy-vbus-boost       2
0mA     0mV     0mV
    12100000.phy-vbus             2
0mA     0mV     0mV
    12130000.phy-vbus             1
0mA     0mV     0mV
 vdd_ldo1                         1    0      0 unknown  1000mV
0mA  1000mV  1000mV
 vdd_ldo2                         1    0      0 unknown  1800mV
0mA  1800mV  1800mV
 vddq_mmc0                        0    0      0 unknown  1800mV
0mA  1800mV  1800mV
 vdd_adc                          1    1      0 unknown  1800mV
0mA  1800mV  1800mV

>
> You say the names don't match.  From what I can tell, your
> names are like "d1d0" (D one D zero) rather than "dldo"
> (D L D O), and what I see in the document you link to uses
> all letters.  If I'm misunderstanding, please explain.
>
I might have used an incorrect name due to a typo earlier.
Based on the schematic, the correct regulator names are BUCK1, ALDO1, and DLDO1.
you can use it accordingly.

> Thanks.
>
>                                         -Alex
Thanks
-Anand

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: spacemit: P1 PMIC support on Banana pi F3 testing
  2025-07-25  9:49   ` Anand Moon
@ 2025-07-25 15:03     ` Anand Moon
  0 siblings, 0 replies; 5+ messages in thread
From: Anand Moon @ 2025-07-25 15:03 UTC (permalink / raw)
  To: Alex Elder; +Cc: Yixun Lan, open list:RISC-V MISC SOC SUPPORT, spacemit

Hi Alex

On Fri, 25 Jul 2025 at 15:19, Anand Moon <linux.amoon@gmail.com> wrote:
>
> Hi Alex,
>
> On Fri, 25 Jul 2025 at 07:26, Alex Elder <elder@riscstar.com> wrote:
> >
> > On 7/24/25 4:56 AM, Anand Moon wrote:
> > > Hi Alex,
> > >
> > > Thank you for your work on the P1 PMIC patch for Spacemit K1 SoC - Banana Pi F3.
> > >
> > > I've been testing your patch series for the Banana Pi F3 [0] to enable SD card
> > > and eMMC functionality,
> > >
> > > [0] https://patchew.org/linux/20250710175107.1280221-1-elder@riscstar.com/
> > >
> > > While debugging, I cross-referenced the patch with the BPI-F3-V3 board
> > > schematic [1]
> > > and noticed several discrepancies in the power configuration:
> > >
> > > [1] https://drive.google.com/file/d/19iLJ5xnCB_oK8VeQjkPGjzAn39WYyylv/view
> > >
> > > Incorrect Voltage Ranges: The minimum and maximum voltage values for
> > > multiple regulators
> > > (including BUCKs, ALDOs, and DLDOs) In the patch, do not match the
> > > specifications in
> > > the schematic's power tree.
> >
> > I really appreciate you checking this.
> >
> > The values I used were derived from the vendor code that I
> > started with.  I was assured that this baseline worked on
> > the Banana Pi BPI-F3.
> >
> I am just following examples from SoC like Rockchip and Samsung.
>
> > For the record, I *do* have a functioning SD card and eMMC.
> > I'm not sure just now what you are using differs from what
> > I am using.
> >
> > I would like to understand and reconcile the differences you
> > point out but I'm not able to do that at this time; maybe
> > next week.
>
> You are using the default  ranges  0.5~3.4V@3.5A.
> But in the schematic's power tree, components such as P1 (U1401) and K1 (Uxxx)
> specify precise voltage ranges, for example:
> 0.9 V ± 1%
> 1.8 V ± 1%
> 3.3 V ± 1%
>

I might be mistaken, but I came across what seems to be the SpacemiT
P1 datasheet [0].
Unfortunately, I’m not able to understand Chinese.

[0] https://developer.spacemit.com/documentation?token=Q4uNwF9a6idIo5k9U0AcK4iXn3b&type=pdf

I suspect the driver configuration might still be incomplete, as there appear
to be certain register bits that need to be set for proper functionality.
That said, I could be mistaken.

If you have access to this document plz share.

Thanks
-Anand

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: spacemit: P1 PMIC support on Banana pi F3 testing
  2025-07-24  9:56 spacemit: P1 PMIC support on Banana pi F3 testing Anand Moon
  2025-07-25  1:56 ` Alex Elder
@ 2025-07-26  0:27 ` Yixun Lan
  1 sibling, 0 replies; 5+ messages in thread
From: Yixun Lan @ 2025-07-26  0:27 UTC (permalink / raw)
  To: Anand Moon; +Cc: Alex Elder, open list:RISC-V MISC SOC SUPPORT, spacemit

Hi Anand,

On 15:26 Thu 24 Jul     , Anand Moon wrote:
> Hi Alex,
> 
> Thank you for your work on the P1 PMIC patch for Spacemit K1 SoC - Banana Pi F3.
> 
> I've been testing your patch series for the Banana Pi F3 [0] to enable SD card
> and eMMC functionality,
> 
> [0] https://patchew.org/linux/20250710175107.1280221-1-elder@riscstar.com/
> 
> While debugging, I cross-referenced the patch with the BPI-F3-V3 board
> schematic [1]
> and noticed several discrepancies in the power configuration:
> 
> [1] https://drive.google.com/file/d/19iLJ5xnCB_oK8VeQjkPGjzAn39WYyylv/view
> 
> Incorrect Voltage Ranges: The minimum and maximum voltage values for
> multiple regulators
> (including BUCKs, ALDOs, and DLDOs) In the patch, do not match the
> specifications in
> the schematic's power tree.
> 
> Missing/Incorrect Labels: Many regulators are missing accurate labels and names,
> which makes mapping them to the hardware difficult.
> 
> Device Tree Mapping: To configure the power sources correctly, the k1
> user names from
> the schematic needs to be properly mapped to its corresponding device
> tree nodes.
> 
> I’ve put together a set of local changes to better align the regulator
> definitions with the board schematic.
> These adjustments help improve the hardware mapping to the PMIC
> regulators, though some details
> may still need refinement. If you find the changes helpful, please
> consider incorporating them into
> the next revision of the patch.
> 
> I’d be grateful if you could Cc me on any future communication
> regarding testing.
> as I didn’t receive this patch series in my inbox.
> 
> Thanks
> -Anand
> 
> Here is the boot log [2] https://pastebin.com/cXybbVar
> 
> It's not working on my end., Neither the eMMC nor the SD card is
> getting detected.
the mainline driver in tree has no SD card support, but eMMC
so, you could only test eMMC for now.

-- 
Yixun Lan (dlan)

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2025-07-26  0:29 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-07-24  9:56 spacemit: P1 PMIC support on Banana pi F3 testing Anand Moon
2025-07-25  1:56 ` Alex Elder
2025-07-25  9:49   ` Anand Moon
2025-07-25 15:03     ` Anand Moon
2025-07-26  0:27 ` Yixun Lan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox