Skip to contentSkip to conversation

riscv: dts: spacemit: Add ethernet device for K3

PATCH Applied Inochi Amaoto 2 participants 3 messages Mar 26 – Mar 27

Subsystems (5)
lore
Share & tools
lore
#0 lore raw

PATCH v6 1/1 riscv: dts: spacemit: Add ethernet device for K3

Add all ethernet device nodes for K3 SoC.

---
Require the following patch series:
1. Basic DT device patch
https://lore.kernel.org/spacemit/[email protected]
2. Ethernet driver patch
https://lore.kernel.org/spacemit/[email protected]

Changed from v5:
1. Fix DT warning cause by stmmac-axi-config.

Changed from v4:
1. Fix pinctrl pin name
2. Remove alias for disabled node

Changed from v3:
1. Separate the pin as RGMII pin and INT pin.
2. Add comment for pin usage.
3. Rename the ethernet pinctrl node to address it is RGMII node.

Changed from v2:
1. keep aliases in alphabetical order.

Changed from v1:
1. remove interrupt-parents property
2. add aliases for ethernet node

---
 arch/riscv/boot/dts/spacemit/k3-pico-itx.dts |  20 ++++
 arch/riscv/boot/dts/spacemit/k3-pinctrl.dtsi |  34 ++++++
 arch/riscv/boot/dts/spacemit/k3.dtsi         | 117 +++++++++++++++++++
 3 files changed, 171 insertions(+)
arch/riscv/boot/dts/spacemit/k3-pico-itx.dts +20 -0
index b098dbd0e7a1..504fe6bd46b2 100644
@@ -3,6 +3,7 @@
  * Copyright (c) 2026 SpacemiT (Hangzhou) Technology Co. Ltd
  * Copyright (c) 2026 Guodong Xu <[email protected]>
  */
+#include <dt-bindings/gpio/gpio.h>
 
 #include "k3.dtsi"
 #include "k3-pinctrl.dtsi"
@@ -12,6 +13,7 @@ / {
 	compatible = "spacemit,k3-pico-itx", "spacemit,k3";
 
 	aliases {
+		ethernet0 = &eth0;
 		serial0 = &uart0;
 	};
 
@@ -25,6 +27,24 @@ memory@100000000 {
 	};
 };
 
+&eth0 {
+	pinctrl-names = "default";
+	pinctrl-0 = <&gmac0_rgmii_0_cfg>, <&gmac0_phy_0_cfg>;
+	phy-mode = "rgmii-id";
+	phy-handle = <&phy0>;
+	status = "okay";
+
+	mdio {
+		phy0: phy@1 {
+			compatible = "ethernet-phy-ieee802.3-c22";
+			reg = <1>;
+			reset-gpios = <&gpio 0 15 GPIO_ACTIVE_LOW>;
+			reset-assert-us = <10000>;
+			reset-deassert-us = <10000>;
+		};
+	};
+};
+
 &uart0 {
 	pinctrl-names = "default";
 	pinctrl-0 = <&uart0_0_cfg>;
arch/riscv/boot/dts/spacemit/k3-pinctrl.dtsi +34 -0
index efb0f1572188..a7b5d10c332e 100644
@@ -11,6 +11,40 @@
 #define K3_GPIO(x)	(x / 32) (x % 32)
 
 &pinctrl {
+	gmac0_rgmii_0_cfg: gmac0-rgmii-0-cfg {
+		gmac0-rgmii-0-pins {
+			pinmux = <K3_PADCONF(0, 1)>,	/* gmac0_rxdv */
+				 <K3_PADCONF(1, 1)>,	/* gmac0_rx_d0 */
+				 <K3_PADCONF(2, 1)>,	/* gmac0_rx_d1 */
+				 <K3_PADCONF(3, 1)>,	/* gmac0_rx_clk */
+				 <K3_PADCONF(4, 1)>,	/* gmac0_rx_d2 */
+				 <K3_PADCONF(5, 1)>,	/* gmac0_rx_d3 */
+				 <K3_PADCONF(6, 1)>,	/* gmac0_tx_d0 */
+				 <K3_PADCONF(7, 1)>,	/* gmac0_tx_d1 */
+				 <K3_PADCONF(8, 1)>,	/* gmac0_tx_clk */
+				 <K3_PADCONF(9, 1)>,	/* gmac0_tx_d2 */
+				 <K3_PADCONF(10, 1)>,	/* gmac0_tx_d3 */
+				 <K3_PADCONF(11, 1)>,	/* gmac0_tx_en */
+				 <K3_PADCONF(12, 1)>,	/* gmac0_mdc */
+				 <K3_PADCONF(13, 1)>;	/* gmac0_mdio */
+
+			bias-disable;
+			drive-strength = <25>;
+			power-source = <1800>;
+		};
+
+	};
+
+	gmac0_phy_0_cfg: gmac0-phy-0-cfg {
+		gmac0-phy-0-pins {
+			pinmux = <K3_PADCONF(14, 1)>;   /* gmac0_int */
+
+			bias-disable;
+			drive-strength = <25>;
+			power-source = <1800>;
+		};
+	};
+
 	/omit-if-no-ref/
 	uart0_0_cfg: uart0-0-cfg {
 		uart0-0-pins {
arch/riscv/boot/dts/spacemit/k3.dtsi +117 -0

123 lines not on this page · raw message

--
2.53.0

maintainer Reviewed-by on v6 1/1
#1 lore raw

Hi Inochi,

Quoted 10 lines · Inochi Amaoto

Add all ethernet device nodes for K3 SoC.

---
Require the following patch series:
1. Basic DT device patch
https://lore.kernel.org/spacemit/[email protected]
2. Ethernet driver patch
https://lore.kernel.org/spacemit/[email protected]

Quoted 3 lines

Changed from v5:
1. Fix DT warning cause by stmmac-axi-config.

It would be great to let people know explicitly that you dropped the tag they gave, but I can understand you wanna be cautious here, so again

Signature · 1 line
Yixun Lan (dlan)