Skip to content

Commit 74657a3

Browse files
inochisaYixun Lan
authored andcommitted
riscv: dts: spacemit: Add ethernet device for K3
Add all ethernet device nodes for K3 SoC. Signed-off-by: Inochi Amaoto <inochiama@gmail.com> Reviewed-by: Yixun Lan <dlan@kernel.org> Link: https://lore.kernel.org/r/20260326014617.1011732-1-inochiama@gmail.com Signed-off-by: Yixun Lan <dlan@kernel.org>
1 parent c68360c commit 74657a3

3 files changed

Lines changed: 171 additions & 0 deletions

File tree

arch/riscv/boot/dts/spacemit/k3-pico-itx.dts

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
* Copyright (c) 2026 SpacemiT (Hangzhou) Technology Co. Ltd
44
* Copyright (c) 2026 Guodong Xu <guodong@riscstar.com>
55
*/
6+
#include <dt-bindings/gpio/gpio.h>
67

78
#include "k3.dtsi"
89
#include "k3-pinctrl.dtsi"
@@ -12,6 +13,7 @@
1213
compatible = "spacemit,k3-pico-itx", "spacemit,k3";
1314

1415
aliases {
16+
ethernet0 = &eth0;
1517
serial0 = &uart0;
1618
};
1719

@@ -25,6 +27,24 @@
2527
};
2628
};
2729

30+
&eth0 {
31+
pinctrl-names = "default";
32+
pinctrl-0 = <&gmac0_rgmii_0_cfg>, <&gmac0_phy_0_cfg>;
33+
phy-mode = "rgmii-id";
34+
phy-handle = <&phy0>;
35+
status = "okay";
36+
37+
mdio {
38+
phy0: phy@1 {
39+
compatible = "ethernet-phy-ieee802.3-c22";
40+
reg = <1>;
41+
reset-gpios = <&gpio 0 15 GPIO_ACTIVE_LOW>;
42+
reset-assert-us = <10000>;
43+
reset-deassert-us = <10000>;
44+
};
45+
};
46+
};
47+
2848
&uart0 {
2949
pinctrl-names = "default";
3050
pinctrl-0 = <&uart0_0_cfg>;

arch/riscv/boot/dts/spacemit/k3-pinctrl.dtsi

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,40 @@
1111
#define K3_GPIO(x) (x / 32) (x % 32)
1212

1313
&pinctrl {
14+
gmac0_rgmii_0_cfg: gmac0-rgmii-0-cfg {
15+
gmac0-rgmii-0-pins {
16+
pinmux = <K3_PADCONF(0, 1)>, /* gmac0_rxdv */
17+
<K3_PADCONF(1, 1)>, /* gmac0_rx_d0 */
18+
<K3_PADCONF(2, 1)>, /* gmac0_rx_d1 */
19+
<K3_PADCONF(3, 1)>, /* gmac0_rx_clk */
20+
<K3_PADCONF(4, 1)>, /* gmac0_rx_d2 */
21+
<K3_PADCONF(5, 1)>, /* gmac0_rx_d3 */
22+
<K3_PADCONF(6, 1)>, /* gmac0_tx_d0 */
23+
<K3_PADCONF(7, 1)>, /* gmac0_tx_d1 */
24+
<K3_PADCONF(8, 1)>, /* gmac0_tx_clk */
25+
<K3_PADCONF(9, 1)>, /* gmac0_tx_d2 */
26+
<K3_PADCONF(10, 1)>, /* gmac0_tx_d3 */
27+
<K3_PADCONF(11, 1)>, /* gmac0_tx_en */
28+
<K3_PADCONF(12, 1)>, /* gmac0_mdc */
29+
<K3_PADCONF(13, 1)>; /* gmac0_mdio */
30+
31+
bias-disable;
32+
drive-strength = <25>;
33+
power-source = <1800>;
34+
};
35+
36+
};
37+
38+
gmac0_phy_0_cfg: gmac0-phy-0-cfg {
39+
gmac0-phy-0-pins {
40+
pinmux = <K3_PADCONF(14, 1)>; /* gmac0_int */
41+
42+
bias-disable;
43+
drive-strength = <25>;
44+
power-source = <1800>;
45+
};
46+
};
47+
1448
/omit-if-no-ref/
1549
uart0_0_cfg: uart0-0-cfg {
1650
uart0-0-pins {

arch/riscv/boot/dts/spacemit/k3.dtsi

Lines changed: 117 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -438,6 +438,123 @@
438438
dma-noncoherent;
439439
ranges;
440440

441+
eth0: ethernet@cac80000 {
442+
compatible = "spacemit,k3-dwmac", "snps,dwmac-5.40a";
443+
reg = <0x0 0xcac80000 0x0 0x2000>;
444+
clocks = <&syscon_apmu CLK_APMU_EMAC0_BUS>,
445+
<&syscon_apmu CLK_APMU_EMAC0_1588>,
446+
<&syscon_apmu CLK_APMU_EMAC0_RGMII_TX>;
447+
clock-names = "stmmaceth", "ptp_ref", "tx";
448+
interrupts = <131 IRQ_TYPE_LEVEL_HIGH>,
449+
<276 IRQ_TYPE_LEVEL_HIGH>;
450+
interrupt-names = "macirq", "eth_wake_irq";
451+
resets = <&syscon_apmu RESET_APMU_EMAC0>;
452+
reset-names = "stmmaceth";
453+
rx-fifo-depth = <8192>;
454+
tx-fifo-depth = <8192>;
455+
snps,multicast-filter-bins = <64>;
456+
snps,perfect-filter-entries = <32>;
457+
snps,aal;
458+
snps,tso;
459+
snps,txpbl = <8>;
460+
snps,rxpbl = <8>;
461+
snps,force_sf_dma_mode;
462+
snps,axi-config = <&gmac0_axi_setup>;
463+
spacemit,apmu = <&syscon_apmu 0x3e4 0x3e8>;
464+
status = "disabled";
465+
466+
mdio {
467+
compatible = "snps,dwmac-mdio";
468+
#address-cells = <1>;
469+
#size-cells = <0>;
470+
};
471+
472+
gmac0_axi_setup: stmmac-axi-config {
473+
snps,wr_osr_lmt = <0xf>;
474+
snps,rd_osr_lmt = <0xf>;
475+
/* max axi burst len is 256 */
476+
snps,blen = <256 128 64 32 16 0 0>;
477+
};
478+
};
479+
480+
eth1: ethernet@cac82000 {
481+
compatible = "spacemit,k3-dwmac", "snps,dwmac-5.40a";
482+
reg = <0x0 0xcac82000 0x0 0x2000>;
483+
clocks = <&syscon_apmu CLK_APMU_EMAC1_BUS>,
484+
<&syscon_apmu CLK_APMU_EMAC1_1588>,
485+
<&syscon_apmu CLK_APMU_EMAC1_RGMII_TX>;
486+
clock-names = "stmmaceth", "ptp_ref", "tx";
487+
interrupts = <133 IRQ_TYPE_LEVEL_HIGH>,
488+
<277 IRQ_TYPE_LEVEL_HIGH>;
489+
interrupt-names = "macirq", "eth_wake_irq";
490+
resets = <&syscon_apmu RESET_APMU_EMAC1>;
491+
reset-names = "stmmaceth";
492+
rx-fifo-depth = <8192>;
493+
tx-fifo-depth = <8192>;
494+
snps,multicast-filter-bins = <64>;
495+
snps,perfect-filter-entries = <32>;
496+
snps,aal;
497+
snps,tso;
498+
snps,txpbl = <8>;
499+
snps,rxpbl = <8>;
500+
snps,force_sf_dma_mode;
501+
snps,axi-config = <&gmac1_axi_setup>;
502+
spacemit,apmu = <&syscon_apmu 0x3ec 0x3f0>;
503+
status = "disabled";
504+
505+
mdio {
506+
compatible = "snps,dwmac-mdio";
507+
#address-cells = <1>;
508+
#size-cells = <0>;
509+
};
510+
511+
gmac1_axi_setup: stmmac-axi-config {
512+
snps,wr_osr_lmt = <0xf>;
513+
snps,rd_osr_lmt = <0xf>;
514+
/* max axi burst len is 256 */
515+
snps,blen = <256 128 64 32 16 0 0>;
516+
};
517+
};
518+
519+
eth2: ethernet@cac8e000 {
520+
compatible = "spacemit,k3-dwmac", "snps,dwmac-5.40a";
521+
reg = <0x0 0xcac8e000 0x0 0x2000>;
522+
clocks = <&syscon_apmu CLK_APMU_EMAC2_BUS>,
523+
<&syscon_apmu CLK_APMU_EMAC2_1588>,
524+
<&syscon_apmu CLK_APMU_EMAC2_RGMII_TX>;
525+
clock-names = "stmmaceth", "ptp_ref", "tx";
526+
interrupts = <130 IRQ_TYPE_LEVEL_HIGH>,
527+
<278 IRQ_TYPE_LEVEL_HIGH>;
528+
interrupt-names = "macirq", "eth_wake_irq";
529+
resets = <&syscon_apmu RESET_APMU_EMAC2>;
530+
reset-names = "stmmaceth";
531+
rx-fifo-depth = <4096>;
532+
tx-fifo-depth = <4096>;
533+
snps,multicast-filter-bins = <64>;
534+
snps,perfect-filter-entries = <32>;
535+
snps,aal;
536+
snps,tso;
537+
snps,txpbl = <8>;
538+
snps,rxpbl = <8>;
539+
snps,force_sf_dma_mode;
540+
snps,axi-config = <&gmac2_axi_setup>;
541+
spacemit,apmu = <&syscon_apmu 0x248 0x24c>;
542+
status = "disabled";
543+
544+
mdio {
545+
compatible = "snps,dwmac-mdio";
546+
#address-cells = <1>;
547+
#size-cells = <0>;
548+
};
549+
550+
gmac2_axi_setup: stmmac-axi-config {
551+
snps,wr_osr_lmt = <0xf>;
552+
snps,rd_osr_lmt = <0xf>;
553+
/* max axi burst len is 256 */
554+
snps,blen = <256 128 64 32 16 0 0>;
555+
};
556+
};
557+
441558
syscon_apbc: system-controller@d4015000 {
442559
compatible = "spacemit,k3-syscon-apbc";
443560
reg = <0x0 0xd4015000 0x0 0x1000>;

0 commit comments

Comments
 (0)