Skip to content

Commit dce46f1

Browse files
author
Paolo Abeni
committed
Merge branch 'add-ethernet-driver-for-starfive-jh7110-soc'
Samin Guo says: ==================== Add Ethernet driver for StarFive JH7110 SoC This series adds ethernet support for the StarFive JH7110 RISC-V SoC, which includes a dwmac-5.20 MAC driver (from Synopsys DesignWare). This series has been tested and works fine on VisionFive-2 v1.2A and v1.3B SBC boards. For more information and support, you can visit RVspace wiki[1]. You can simply review or test the patches at the link [2]. This patchset should be applied after the patchset [3] [4]. [1]: https://wiki.rvspace.org/ [2]: https://github.com/saminGuo/linux/tree/vf2-6.3rc4-gmac-net-next [3]: https://patchwork.kernel.org/project/linux-riscv/cover/[email protected] [4]: https://patchwork.kernel.org/project/linux-riscv/cover/[email protected] ==================== Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Paolo Abeni <[email protected]>
2 parents 6714d47 + b4a5afa commit dce46f1

File tree

7 files changed

+350
-5
lines changed

7 files changed

+350
-5
lines changed

Documentation/devicetree/bindings/net/snps,dwmac.yaml

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ select:
3030
- snps,dwmac-4.10a
3131
- snps,dwmac-4.20a
3232
- snps,dwmac-5.10a
33+
- snps,dwmac-5.20
3334
- snps,dwxgmac
3435
- snps,dwxgmac-2.10
3536

@@ -90,8 +91,10 @@ properties:
9091
- snps,dwmac-4.10a
9192
- snps,dwmac-4.20a
9293
- snps,dwmac-5.10a
94+
- snps,dwmac-5.20
9395
- snps,dwxgmac
9496
- snps,dwxgmac-2.10
97+
- starfive,jh7110-dwmac
9598

9699
reg:
97100
minItems: 1
@@ -134,12 +137,16 @@ properties:
134137
- ptp_ref
135138

136139
resets:
137-
maxItems: 1
138-
description:
139-
MAC Reset signal.
140+
minItems: 1
141+
items:
142+
- description: GMAC stmmaceth reset
143+
- description: AHB reset
140144

141145
reset-names:
142-
const: stmmaceth
146+
minItems: 1
147+
items:
148+
- const: stmmaceth
149+
- const: ahb
143150

144151
power-domains:
145152
maxItems: 1
@@ -579,6 +586,7 @@ allOf:
579586
- snps,dwmac-3.50a
580587
- snps,dwmac-4.10a
581588
- snps,dwmac-4.20a
589+
- snps,dwmac-5.20
582590
- snps,dwxgmac
583591
- snps,dwxgmac-2.10
584592
- st,spear600-gmac
@@ -636,6 +644,7 @@ allOf:
636644
- snps,dwmac-4.10a
637645
- snps,dwmac-4.20a
638646
- snps,dwmac-5.10a
647+
- snps,dwmac-5.20
639648
- snps,dwxgmac
640649
- snps,dwxgmac-2.10
641650
- st,spear600-gmac
Lines changed: 144 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,144 @@
1+
# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
2+
# Copyright (C) 2022 StarFive Technology Co., Ltd.
3+
%YAML 1.2
4+
---
5+
$id: http://devicetree.org/schemas/net/starfive,jh7110-dwmac.yaml#
6+
$schema: http://devicetree.org/meta-schemas/core.yaml#
7+
8+
title: StarFive JH7110 DWMAC glue layer
9+
10+
maintainers:
11+
- Emil Renner Berthing <[email protected]>
12+
- Samin Guo <[email protected]>
13+
14+
select:
15+
properties:
16+
compatible:
17+
contains:
18+
enum:
19+
- starfive,jh7110-dwmac
20+
required:
21+
- compatible
22+
23+
properties:
24+
compatible:
25+
items:
26+
- enum:
27+
- starfive,jh7110-dwmac
28+
- const: snps,dwmac-5.20
29+
30+
reg:
31+
maxItems: 1
32+
33+
clocks:
34+
items:
35+
- description: GMAC main clock
36+
- description: GMAC AHB clock
37+
- description: PTP clock
38+
- description: TX clock
39+
- description: GTX clock
40+
41+
clock-names:
42+
items:
43+
- const: stmmaceth
44+
- const: pclk
45+
- const: ptp_ref
46+
- const: tx
47+
- const: gtx
48+
49+
interrupts:
50+
minItems: 3
51+
maxItems: 3
52+
53+
interrupt-names:
54+
minItems: 3
55+
maxItems: 3
56+
57+
resets:
58+
items:
59+
- description: MAC Reset signal.
60+
- description: AHB Reset signal.
61+
62+
reset-names:
63+
items:
64+
- const: stmmaceth
65+
- const: ahb
66+
67+
starfive,tx-use-rgmii-clk:
68+
description:
69+
Tx clock is provided by external rgmii clock.
70+
type: boolean
71+
72+
starfive,syscon:
73+
$ref: /schemas/types.yaml#/definitions/phandle-array
74+
items:
75+
- items:
76+
- description: phandle to syscon that configures phy mode
77+
- description: Offset of phy mode selection
78+
- description: Shift of phy mode selection
79+
description:
80+
A phandle to syscon with two arguments that configure phy mode.
81+
The argument one is the offset of phy mode selection, the
82+
argument two is the shift of phy mode selection.
83+
84+
required:
85+
- compatible
86+
- reg
87+
- clocks
88+
- clock-names
89+
- interrupts
90+
- interrupt-names
91+
- resets
92+
- reset-names
93+
94+
allOf:
95+
- $ref: snps,dwmac.yaml#
96+
97+
unevaluatedProperties: false
98+
99+
examples:
100+
- |
101+
ethernet@16030000 {
102+
compatible = "starfive,jh7110-dwmac", "snps,dwmac-5.20";
103+
reg = <0x16030000 0x10000>;
104+
clocks = <&clk 3>, <&clk 2>, <&clk 109>,
105+
<&clk 6>, <&clk 111>;
106+
clock-names = "stmmaceth", "pclk", "ptp_ref",
107+
"tx", "gtx";
108+
resets = <&rst 1>, <&rst 2>;
109+
reset-names = "stmmaceth", "ahb";
110+
interrupts = <7>, <6>, <5>;
111+
interrupt-names = "macirq", "eth_wake_irq", "eth_lpi";
112+
phy-mode = "rgmii-id";
113+
snps,multicast-filter-bins = <64>;
114+
snps,perfect-filter-entries = <8>;
115+
rx-fifo-depth = <2048>;
116+
tx-fifo-depth = <2048>;
117+
snps,fixed-burst;
118+
snps,no-pbl-x8;
119+
snps,tso;
120+
snps,force_thresh_dma_mode;
121+
snps,axi-config = <&stmmac_axi_setup>;
122+
snps,en-tx-lpi-clockgating;
123+
snps,txpbl = <16>;
124+
snps,rxpbl = <16>;
125+
starfive,syscon = <&aon_syscon 0xc 0x12>;
126+
phy-handle = <&phy0>;
127+
128+
mdio {
129+
#address-cells = <1>;
130+
#size-cells = <0>;
131+
compatible = "snps,dwmac-mdio";
132+
133+
phy0: ethernet-phy@0 {
134+
reg = <0>;
135+
};
136+
};
137+
138+
stmmac_axi_setup: stmmac-axi-config {
139+
snps,lpi_en;
140+
snps,wr_osr_lmt = <4>;
141+
snps,rd_osr_lmt = <4>;
142+
snps,blen = <256 128 64 32 0 0 0>;
143+
};
144+
};

MAINTAINERS

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19928,6 +19928,13 @@ M: Emil Renner Berthing <[email protected]>
1992819928
S: Maintained
1992919929
F: arch/riscv/boot/dts/starfive/
1993019930

19931+
STARFIVE DWMAC GLUE LAYER
19932+
M: Emil Renner Berthing <[email protected]>
19933+
M: Samin Guo <[email protected]>
19934+
S: Maintained
19935+
F: Documentation/devicetree/bindings/net/starfive,jh7110-dwmac.yaml
19936+
F: drivers/net/ethernet/stmicro/stmmac/dwmac-starfive.c
19937+
1993119938
STARFIVE JH7100 CLOCK DRIVERS
1993219939
M: Emil Renner Berthing <[email protected]>
1993319940
S: Maintained

drivers/net/ethernet/stmicro/stmmac/Kconfig

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,18 @@ config DWMAC_SOCFPGA
165165
for the stmmac device driver. This driver is used for
166166
arria5 and cyclone5 FPGA SoCs.
167167

168+
config DWMAC_STARFIVE
169+
tristate "StarFive dwmac support"
170+
depends on OF && (ARCH_STARFIVE || COMPILE_TEST)
171+
select MFD_SYSCON
172+
default m if ARCH_STARFIVE
173+
help
174+
Support for ethernet controllers on StarFive RISC-V SoCs
175+
176+
This selects the StarFive platform specific glue layer support for
177+
the stmmac device driver. This driver is used for StarFive JH7110
178+
ethernet controller.
179+
168180
config DWMAC_STI
169181
tristate "STi GMAC support"
170182
default ARCH_STI

drivers/net/ethernet/stmicro/stmmac/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ obj-$(CONFIG_DWMAC_OXNAS) += dwmac-oxnas.o
2323
obj-$(CONFIG_DWMAC_QCOM_ETHQOS) += dwmac-qcom-ethqos.o
2424
obj-$(CONFIG_DWMAC_ROCKCHIP) += dwmac-rk.o
2525
obj-$(CONFIG_DWMAC_SOCFPGA) += dwmac-altr-socfpga.o
26+
obj-$(CONFIG_DWMAC_STARFIVE) += dwmac-starfive.o
2627
obj-$(CONFIG_DWMAC_STI) += dwmac-sti.o
2728
obj-$(CONFIG_DWMAC_STM32) += dwmac-stm32.o
2829
obj-$(CONFIG_DWMAC_SUNXI) += dwmac-sunxi.o

0 commit comments

Comments
 (0)