Skip to contentSkip to conversation

spacemit: k1: Add support for Banana Pi BPI-CM6 IO board

PATCH Applied Junhui Liu 3 participants 8 messages Jul 12 – Jul 28

Subsystems (3)
lore
Share & tools
lore

Junhui Liu

author
#0 lore raw

v3 cover spacemit: k1: Add support for Banana Pi BPI-CM6 IO board

This adds initial support for the Banana Pi BPI-CM6 IO board. The BPI-CM6 is an industrial-grade RISC-V compute module powered by the SpacemiT K1 SoC, featuring board-to-board connectors similar to the Raspberry Pi CM4 form factor. For evaluation and development, the module is paired with a companion IO carrier board.

During the board bring-up, GPIO45 and GPIO46 were found to be used by the BPI-CM6 hardware as Ethernet PHY reset GPIOs, while the common K1 GMAC pinctrl groups currently mux them as optional GMAC reference clock pins. Since the reference clock pins are not required on all K1 boards, the second patch separates them into independent pinctrl groups so board DTS files can select them only when the signal is actually wired.

---
Changes in v3:
- Remove uncontrolled always-on intermediate fixed regulators to
reduce device tree bloat
- Rebase to v7.2-rc1
- Link to v2: https://lore.kernel.org/r/[email protected]

Changes in v2:
- Keep gmac_clk_ref pinctrl groups referenced on existing boards where
the pins are routed to optional PHY refclk paths
- Remove duplicate vpcie3v3-supply property from pcie1 and pcie2 nodes
- Collect tags
- Link to v1: https://lore.kernel.org/r/[email protected]

---
Junhui Liu (3):
dt-bindings: riscv: spacemit: Add Banana Pi BPI-CM6 compatible
riscv: dts: spacemit: k1: Split gmac_clk_ref into independent pinctrl groups
riscv: dts: spacemit: k1: Add Banana Pi BPI-CM6 IO board

 .../devicetree/bindings/riscv/spacemit.yaml        |   5 +
 arch/riscv/boot/dts/spacemit/Makefile              |   1 +
 .../riscv/boot/dts/spacemit/k1-bananapi-cm6-io.dts | 177 +++++++++++++++++
 arch/riscv/boot/dts/spacemit/k1-bananapi-cm6.dtsi  | 217 +++++++++++++++++++++
 arch/riscv/boot/dts/spacemit/k1-bananapi-f3.dts    |   4 +-
 arch/riscv/boot/dts/spacemit/k1-milkv-jupiter.dts  |   4 +-
 arch/riscv/boot/dts/spacemit/k1-musepi-pro.dts     |   2 +-
 arch/riscv/boot/dts/spacemit/k1-orangepi-r2s.dts   |   4 +-
 arch/riscv/boot/dts/spacemit/k1-pinctrl.dtsi       |  24 ++-
 9 files changed, 427 insertions(+), 11 deletions(-)

---
base-commit: dc59e4fea9d83f03bad6bddf3fa2e52491777482
change-id: 20260522-bpi-cm6-dc38f91e3fec

Best regards,

Signature · 1 line
Junhui Liu <[email protected]>
author
#1 lore raw

PATCH v3 1/3 dt-bindings: riscv: spacemit: Add Banana Pi BPI-CM6 compatible

The Banana Pi BPI-CM6 IO board consists of the BPI-CM6 compute module plugged into an IO carrier board, which is used for evaluation and development.

The core CM6 module is based on the SpacemiT K1 SoC and provides PMIC, DDR, the eth0 PHY and wireless connectivity. The carrier board extends this by adding the eth1 PHY and external interfaces including Ethernet, PCIe M.2, USB, MicroSD, QSPI, and serial console connectivity.

---
 Documentation/devicetree/bindings/riscv/spacemit.yaml | 5 +++++
 1 file changed, 5 insertions(+)
Documentation/devicetree/bindings/riscv/spacemit.yaml +5 -0
index 311bbccba0ba..4ee9c88984b4 100644
@@ -19,6 +19,11 @@ properties:
     const: '/'
   compatible:
     oneOf:
+      - items:
+          - enum:
+              - bananapi,bpi-cm6-io
+          - const: bananapi,bpi-cm6
+          - const: spacemit,k1
       - items:
           - enum:
               - bananapi,bpi-f3
Signature · 1 line
2.54.0
author
#2 lore raw

PATCH v3 2/3 riscv: dts: spacemit: k1: Split gmac_clk_ref into independent pinctrl groups

In reply to Junhui Liu

The gmac_clk_ref signal is optional for the GMAC controller and is not strictly required for all hardware designs. The pins for gmac0_clk_ref (GPIO 45) and gmac1_clk_ref (GPIO 46) may also be used as GPIOs for other functions even when the Ethernet controller is active.

Split the refclk pins into independent pinctrl groups so boards can request them only when the reference clock path is actually needed.

Among the already mainlined boards, BPI-F3, Jupiter and MusePi Pro have optional hardware paths for the GMAC refclk pins. BPI-F3 and Jupiter route both GMAC refclk pins to the PHYs through NC/0R option resistors, while MusePi Pro only does so for GMAC0. Keep referencing the new clk-ref pinctrl groups on these boards so the optional hardware paths remain usable if the option resistors are populated.

OrangePi R2S has no publicly available schematic, so also keep the clk-ref groups there to preserve the previous pinmux behavior.

Fixes 60775f28cfb7 ("riscv: dts: spacemit: Add Ethernet support for K1")
---
 arch/riscv/boot/dts/spacemit/k1-bananapi-f3.dts   |  4 ++--
 arch/riscv/boot/dts/spacemit/k1-milkv-jupiter.dts |  4 ++--
 arch/riscv/boot/dts/spacemit/k1-musepi-pro.dts    |  2 +-
 arch/riscv/boot/dts/spacemit/k1-orangepi-r2s.dts  |  4 ++--
 arch/riscv/boot/dts/spacemit/k1-pinctrl.dtsi      | 24 +++++++++++++++++++----
 5 files changed, 27 insertions(+), 11 deletions(-)
arch/riscv/boot/dts/spacemit/k1-bananapi-f3.dts +2 -2
index 72f77e9edd63..e6ab43be301a 100644
@@ -101,7 +101,7 @@ &eth0 {
 	phy-handle = <&rgmii0>;
 	phy-mode = "rgmii-id";
 	pinctrl-names = "default";
-	pinctrl-0 = <&gmac0_cfg>;
+	pinctrl-0 = <&gmac0_cfg>, <&gmac0_clk_ref_cfg>;
 	rx-internal-delay-ps = <0>;
 	tx-internal-delay-ps = <0>;
 	status = "okay";
@@ -124,7 +124,7 @@ &eth1 {
 	phy-handle = <&rgmii1>;
 	phy-mode = "rgmii-id";
 	pinctrl-names = "default";
-	pinctrl-0 = <&gmac1_cfg>;
+	pinctrl-0 = <&gmac1_cfg>, <&gmac1_clk_ref_cfg>;
 	rx-internal-delay-ps = <0>;
 	tx-internal-delay-ps = <250>;
 	status = "okay";
arch/riscv/boot/dts/spacemit/k1-milkv-jupiter.dts +2 -2
index 2fc8d6533786..b61f5995ec77 100644
@@ -121,7 +121,7 @@ &eth0 {
 	phy-handle = <&rgmii0>;
 	phy-mode = "rgmii-id";
 	pinctrl-names = "default";
-	pinctrl-0 = <&gmac0_cfg>;
+	pinctrl-0 = <&gmac0_cfg>, <&gmac0_clk_ref_cfg>;
 	rx-internal-delay-ps = <0>;
 	tx-internal-delay-ps = <0>;
 	status = "okay";
@@ -144,7 +144,7 @@ &eth1 {
 	phy-handle = <&rgmii1>;
 	phy-mode = "rgmii-id";
 	pinctrl-names = "default";
-	pinctrl-0 = <&gmac1_cfg>;
+	pinctrl-0 = <&gmac1_cfg>, <&gmac1_clk_ref_cfg>;
 	rx-internal-delay-ps = <0>;
 	tx-internal-delay-ps = <250>;
 	status = "okay";
arch/riscv/boot/dts/spacemit/k1-musepi-pro.dts +1 -1
index 0d809e4ad3b1..3078ffb5cb87 100644
@@ -102,7 +102,7 @@ &combo_phy {
 &eth0 {
 	phy-handle = <&rgmii0>;
 	phy-mode = "rgmii-id";
-	pinctrl-0 = <&gmac0_cfg>;
+	pinctrl-0 = <&gmac0_cfg>, <&gmac0_clk_ref_cfg>;
 	pinctrl-names = "default";
 	rx-internal-delay-ps = <0>;
 	tx-internal-delay-ps = <0>;
arch/riscv/boot/dts/spacemit/k1-orangepi-r2s.dts +2 -2
index b13a8d6a2670..dd72c33bd54c 100644
@@ -60,7 +60,7 @@ &eth0 {
 	phy-handle = <&rgmii0>;
 	phy-mode = "rgmii-id";
 	pinctrl-names = "default";
-	pinctrl-0 = <&gmac0_cfg>;
+	pinctrl-0 = <&gmac0_cfg>, <&gmac0_clk_ref_cfg>;
 	rx-internal-delay-ps = <0>;
 	tx-internal-delay-ps = <0>;
 	status = "okay";
@@ -84,7 +84,7 @@ &eth1 {
 	phy-handle = <&rgmii1>;
 	phy-mode = "rgmii-id";
 	pinctrl-names = "default";
-	pinctrl-0 = <&gmac1_cfg>;
+	pinctrl-0 = <&gmac1_cfg>, <&gmac1_clk_ref_cfg>;
 	rx-internal-delay-ps = <0>;
 	tx-internal-delay-ps = <250>;
 	status = "okay";
arch/riscv/boot/dts/spacemit/k1-pinctrl.dtsi +20 -4
index 4e9a62d0e85b..8c57ca05dabd 100644
@@ -27,8 +27,16 @@ gmac0-pins {
 				 <K1_PADCONF(11, 1)>,	/* gmac0_tx_en */
 				 <K1_PADCONF(12, 1)>,	/* gmac0_mdc */
 				 <K1_PADCONF(13, 1)>,	/* gmac0_mdio */
-				 <K1_PADCONF(14, 1)>,	/* gmac0_int_n */
-				 <K1_PADCONF(45, 1)>;	/* gmac0_clk_ref */
+				 <K1_PADCONF(14, 1)>;	/* gmac0_int_n */
+
+			bias-pull-up = <0>;
+			drive-strength = <21>;
+		};
+	};
+
+	gmac0_clk_ref_cfg: gmac0-clk-ref-cfg {
+		gmac0-clk-ref-pins {
+			pinmux = <K1_PADCONF(45, 1)>;	/* gmac0_clk_ref */
 
 			bias-pull-up = <0>;
 			drive-strength = <21>;
@@ -51,8 +59,16 @@ gmac1-pins {
 				 <K1_PADCONF(40, 1)>,	/* gmac1_tx_en */
 				 <K1_PADCONF(41, 1)>,	/* gmac1_mdc */
 				 <K1_PADCONF(42, 1)>,	/* gmac1_mdio */
-				 <K1_PADCONF(43, 1)>,	/* gmac1_int_n */
-				 <K1_PADCONF(46, 1)>;	/* gmac1_clk_ref */
+				 <K1_PADCONF(43, 1)>;	/* gmac1_int_n */
+
+			bias-pull-up = <0>;
+			drive-strength = <21>;
+		};
+	};
+
+	gmac1_clk_ref_cfg: gmac1-clk-ref-cfg {
+		gmac1-clk-ref-pins {
+			pinmux = <K1_PADCONF(46, 1)>;	/* gmac1_clk_ref */
 
 			bias-pull-up = <0>;
 			drive-strength = <21>;
Signature · 1 line
2.54.0
#3 lore raw

Re: [PATCH v3 2/3] riscv: dts: spacemit: k1: Split gmac_clk_ref into independent pinctrl groups

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider: - [Medium] The patch splits the `gmacX_clk_ref` pins into independent pinctrl groups but fails to update…

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] The patch splits the gmacX_clk_ref pins into independent pinctrl groups but fails to update k1-orangepi-rv2.dts, silently breaking its Ethernet pinmux configuration. --

--- Patch [2]: [PATCH v3 2/3] riscv: dts: spacemit: k1: Split gmac_clk_ref into independent pinctrl groups --- commit 093c0ef49e1b8bcf37cbcb0a97a5e5bcd2242b3c
Author: Junhui Liu <[email protected]>

riscv: dts: spacemit: k1: Split gmac_clk_ref into independent pinctrl groups

The gmac_clk_ref signal is optional for the GMAC controller and is not strictly required for all hardware designs. Split the refclk pins into independent pinctrl groups so boards can request them only when needed.

Quoted 13 lines
arch/riscv/boot/dts/spacemit/k1-bananapi-f3.dts +1 -1
index 72f77e9edd63d..e6ab43be301a3 100644
@@ -101,7 +101,7 @@ &eth0 {
 	phy-handle = <&rgmii0>;
 	phy-mode = "rgmii-id";
 	pinctrl-names = "default";
-	pinctrl-0 = <&gmac0_cfg>;
+	pinctrl-0 = <&gmac0_cfg>, <&gmac0_clk_ref_cfg>;
 	rx-internal-delay-ps = <0>;
 	tx-internal-delay-ps = <0>;
 	status = "okay";

[ ... ]

arch/riscv/boot/dts/spacemit/k1-pinctrl.dtsi gmac0-pins { · line 30

Quoted 11 lines
arch/riscv/boot/dts/spacemit/k1-pinctrl.dtsi +1 -2
index 4e9a62d0e85b5..8c57ca05dabdb 100644
@@ -27,8 +27,16 @@ gmac0-pins {
 				 <K1_PADCONF(11, 1)>,	/* gmac0_tx_en */
 				 <K1_PADCONF(12, 1)>,	/* gmac0_mdc */
 				 <K1_PADCONF(13, 1)>,	/* gmac0_mdio */
-				 <K1_PADCONF(14, 1)>,	/* gmac0_int_n */
-				 <K1_PADCONF(45, 1)>;	/* gmac0_clk_ref */
+				 <K1_PADCONF(14, 1)>;	/* gmac0_int_n */

[Severity: Medium]
Will this change break networking on the OrangePi RV2 board?

The eth0 and eth1 nodes in arch/riscv/boot/dts/spacemit/k1-orangepi-rv2.dts request gmac0_cfg and gmac1_cfg respectively, but this file was not updated to include the newly separated refclk pinmux configuration:

arch/riscv/boot/dts/spacemit/k1-orangepi-rv2.dts:&eth0 {
    ...
	phy-mode = "rgmii-id";
	pinctrl-names = "default";
	pinctrl-0 = <&gmac0_cfg>;
    ...
}

If the OrangePi RV2 hardware relies on these external clock reference pins for its physical Ethernet interfaces, removing them from the default group might leave the pinmux incomplete. Should k1-orangepi-rv2.dts also be updated to include gmac0_clk_ref_cfg and gmac1_clk_ref_cfg?

Quoted 5 lines
arch/riscv/boot/dts/spacemit/k1-pinctrl.dtsi +5 -0
+
+			bias-pull-up = <0>;
+			drive-strength = <21>;
+		};
+	};
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=2
author
#4 lore raw

PATCH v3 3/3 riscv: dts: spacemit: k1: Add Banana Pi BPI-CM6 IO board

In reply to Junhui Liu

The Banana Pi BPI-CM6 IO board combines the BPI-CM6 compute module with an IO carrier board. The core module integrates the SpacemiT K1 SoC, PMIC, DDR, eMMC, the eth0 PHY, and wireless connectivity. The companion IO carrier board extends it by providing the eth1 PHY and exposing standard interfaces, including dual Gigabit Ethernet, MicroSD, two USB-A ports, a USB Type-C port, two PCIe M.2 slots, and a serial console.

The board also has two I2C EEPROMs. One is on the core module, which stores factory manufacturing data and is marked read-only. The other is on the carrier board, which is shipped unprogrammed and left writable for evaluation purposes.

Add initial support for UART console, eMMC, SD card, I2C, EEPROMs, PCIe, USB, and dual Ethernet interfaces.

---
 arch/riscv/boot/dts/spacemit/Makefile              |   1 +
 .../riscv/boot/dts/spacemit/k1-bananapi-cm6-io.dts | 177 +++++++++++++++++
 arch/riscv/boot/dts/spacemit/k1-bananapi-cm6.dtsi  | 217 +++++++++++++++++++++
 3 files changed, 395 insertions(+)
arch/riscv/boot/dts/spacemit/Makefile +1 -0
index 28ec9e1e0a62..851b701e5da4 100644
@@ -1,4 +1,5 @@
 # SPDX-License-Identifier: GPL-2.0
+dtb-$(CONFIG_ARCH_SPACEMIT) += k1-bananapi-cm6-io.dtb
 dtb-$(CONFIG_ARCH_SPACEMIT) += k1-bananapi-f3.dtb
 dtb-$(CONFIG_ARCH_SPACEMIT) += k1-milkv-jupiter.dtb
 dtb-$(CONFIG_ARCH_SPACEMIT) += k1-musepi-pro.dtb
arch/riscv/boot/dts/spacemit/k1-bananapi-cm6-io.dts new file +177 -0

177 lines not on this page · raw message

arch/riscv/boot/dts/spacemit/k1-bananapi-cm6.dtsi new file +217 -0

217 lines not on this page · raw message

Signature · 1 line
2.54.0
#5 lore raw

Re: [PATCH v3 3/3] riscv: dts: spacemit: k1: Add Banana Pi BPI-CM6 IO board

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider: - [Low] The LED nodes omit the `function` property, preventing standard sysfs naming. --

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Low] The LED nodes omit the function property, preventing standard sysfs naming. --

--- Patch [3]: [PATCH v3 3/3] riscv: dts: spacemit: k1: Add Banana Pi BPI-CM6 IO board --- commit eca00d20544419594bdbc975c29f6586b94b4fd3
Author: Junhui Liu <[email protected]>

riscv: dts: spacemit: k1: Add Banana Pi BPI-CM6 IO board

The Banana Pi BPI-CM6 IO board combines the BPI-CM6 compute module with an IO carrier board. The core module integrates the SpacemiT K1 SoC, PMIC, DDR, eMMC, the eth0 PHY, and wireless connectivity. The companion IO carrier board extends it by providing the eth1 PHY and exposing standard interfaces, including dual Gigabit Ethernet, MicroSD, two USB-A ports, a USB Type-C port, two PCIe M.2 slots, and a serial console.

Quoted 6 lines
arch/riscv/boot/dts/spacemit/k1-bananapi-cm6-io.dts new file +0 -0
new file mode 100644
index 0000000000000..2c2d78aee98aa
@@ -0,0 +1,177 @@

[ ... ]

arch/riscv/boot/dts/spacemit/k1-bananapi-cm6-io.dts line 30

Quoted 7 lines
arch/riscv/boot/dts/spacemit/k1-bananapi-cm6-io.dts new file +7 -0
+	leds {
+		compatible = "gpio-leds";
+
+		led0 {
+			color = <LED_COLOR_ID_RED>;
+			gpios = <&gpio K1_GPIO(96) GPIO_ACTIVE_LOW>;
+		};

[Severity: Low]
This isn't a bug, but should the led0 node in k1-bananapi-cm6-io.dts include a function property to indicate its hardware role?

Without it, the LED subsystem cannot construct the standard color:function sysfs name (e.g., red:status) during the gpio-leds driver probe, and will fall back to legacy or incomplete naming.

arch/riscv/boot/dts/spacemit/k1-bananapi-cm6-io.dts line 35

Quoted 5 lines
arch/riscv/boot/dts/spacemit/k1-bananapi-cm6-io.dts new file +5 -0
+
+		led1 {
+			color = <LED_COLOR_ID_BLUE>;
+			gpios = <&gpio K1_GPIO(97) GPIO_ACTIVE_LOW>;
+		};

[Severity: Low]
This isn't a bug, but should the led1 node also include a function property?

Like led0, omitting it prevents the LED subsystem from generating standard user-space sysfs paths for this LED during device tree parsing.

Quoted 1 line
arch/riscv/boot/dts/spacemit/k1-bananapi-cm6-io.dts new file +1 -0
+	};
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=3
maintainer Reviewed-by on the v3 series
#6 lore raw
In reply to Junhui Liu

Hi Junhui,

Quoted 13 lines · Junhui Liu

This adds initial support for the Banana Pi BPI-CM6 IO board. The BPI-CM6 is an industrial-grade RISC-V compute module powered by the SpacemiT K1 SoC, featuring board-to-board connectors similar to the Raspberry Pi CM4 form factor. For evaluation and development, the module is paired with a companion IO carrier board.

During the board bring-up, GPIO45 and GPIO46 were found to be used by the BPI-CM6 hardware as Ethernet PHY reset GPIOs, while the common K1 GMAC pinctrl groups currently mux them as optional GMAC reference clock pins. Since the reference clock pins are not required on all K1 boards, the second patch separates them into independent pinctrl groups so board DTS files can select them only when the signal is actually wired.

Quoted 2 lines

For the series, looks good to me

Quoted 7 lines

---
Changes in v3:
- Remove uncontrolled always-on intermediate fixed regulators to
reduce device tree bloat
- Rebase to v7.2-rc1
- Link to v2: https://lore.kernel.org/r/[email protected]

Signature · 1 line
Yixun Lan (dlan)
maintainer Applied
#7 lore raw
In reply to Junhui Liu
Quoted 6 lines · Junhui Liu

This adds initial support for the Banana Pi BPI-CM6 IO board. The BPI-CM6 is an industrial-grade RISC-V compute module powered by the SpacemiT K1 SoC, featuring board-to-board connectors similar to the Raspberry Pi CM4 form factor. For evaluation and development, the module is paired with a companion IO carrier board.

Quoted 8 lines

During the board bring-up, GPIO45 and GPIO46 were found to be used by the BPI-CM6 hardware as Ethernet PHY reset GPIOs, while the common K1 GMAC pinctrl groups currently mux them as optional GMAC reference clock pins. Since the reference clock pins are not required on all K1 boards, the second patch separates them into independent pinctrl groups so board DTS files can select them only when the signal is actually wired.

[...]

Applied, thanks!

[1/3] dt-bindings: riscv: spacemit: Add Banana Pi BPI-CM6 compatible

      https://git.kernel.org/pub/scm/linux/kernel/git/spacemit/linux.git/commit/?id=c5b108626dc5f21c34cf5119c6f5e0cd7561daa8
[2/3] riscv: dts: spacemit: k1: Split gmac_clk_ref into independent pinctrl groups
      https://git.kernel.org/pub/scm/linux/kernel/git/spacemit/linux.git/commit/?id=8270311d70fdf36bc8aab1e52b554e654a8839ff
[3/3] riscv: dts: spacemit: k1: Add Banana Pi BPI-CM6 IO board
      https://git.kernel.org/pub/scm/linux/kernel/git/spacemit/linux.git/commit/?id=46a8c01700ac21e1b83385df00aa0baa5d287b44

Best regards,

Signature · 1 line
Yixun Lan <[email protected]>