Skip to content

Commit 2fa6175

Browse files
committed
Merge branch 'loongson1-mac'
Keguang Zhang says: ==================== Move Loongson1 MAC arch-code to the driver dir In order to convert Loongson1 MAC platform devices to the devicetree nodes, Loongson1 MAC arch-code should be moved to the driver dir. Add dt-binding document and update MAINTAINERS file accordingly. In other words, this patchset is a preparation for converting Loongson1 platform devices to devicetree. Changelog V4 -> V5: Replace stmmac_probe_config_dt() with devm_stmmac_probe_config_dt() Replace stmmac_pltfr_probe() with devm_stmmac_pltfr_probe() Squash patch 4 into patch 2 and 3 V3 -> V4: Add Acked-by tag from Krzysztof Kozlowski Add "|" to description part Amend "phy-mode" property Drop ls1x_dwmac_syscon definition and its instances Drop three redundant fields from the ls1x_dwmac structure Drop the ls1x_dwmac_init() method. Update the dt-binding document entry of Loongson1 Ethernet Some minor improvements V2 -> V3: Split the DT-schema file into loongson,ls1b-gmac.yaml and loongson,ls1c-emac.yaml (suggested by Serge Semin) Change the compatibles to loongson,ls1b-gmac and loongson,ls1c-emac Rename loongson,dwmac-syscon to loongson,ls1-syscon Amend the title Add description Add Reviewed-by tag from Krzysztof Kozlowski Change compatibles back to loongson,ls1b-syscon and loongson,ls1c-syscon Determine the device ID by physical base address(suggested by Serge Semin) Use regmap instead of regmap fields Use syscon_regmap_lookup_by_phandle() Some minor fixes Update the entries of MAINTAINERS V1 -> V2: Leave the Ethernet platform data for now Make the syscon compatibles more specific Fix "clock-names" and "interrupt-names" property Rename the syscon property to "loongson,dwmac-syscon" Drop "phy-handle" and "phy-mode" requirement Revert adding loongson,ls1b-dwmac/loongson,ls1c-dwmac to snps,dwmac.yaml Fix the build errors due to CONFIG_OF being unset Change struct reg_field definitions to const Rename the syscon property to "loongson,dwmac-syscon" Add MII PHY mode for LS1C Improve the commit message ==================== Signed-off-by: David S. Miller <[email protected]>
2 parents 487e193 + d301c66 commit 2fa6175

File tree

7 files changed

+452
-0
lines changed

7 files changed

+452
-0
lines changed

Documentation/devicetree/bindings/mfd/syscon.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,8 @@ properties:
4949
- hisilicon,peri-subctrl
5050
- hpe,gxp-sysreg
5151
- intel,lgm-syscon
52+
- loongson,ls1b-syscon
53+
- loongson,ls1c-syscon
5254
- marvell,armada-3700-usb2-host-misc
5355
- mediatek,mt8135-pctl-a-syscfg
5456
- mediatek,mt8135-pctl-b-syscfg
Lines changed: 114 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,114 @@
1+
# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
2+
%YAML 1.2
3+
---
4+
$id: http://devicetree.org/schemas/net/loongson,ls1b-gmac.yaml#
5+
$schema: http://devicetree.org/meta-schemas/core.yaml#
6+
7+
title: Loongson-1B Gigabit Ethernet MAC Controller
8+
9+
maintainers:
10+
- Keguang Zhang <[email protected]>
11+
12+
description: |
13+
Loongson-1B Gigabit Ethernet MAC Controller is based on
14+
Synopsys DesignWare MAC (version 3.50a).
15+
16+
Main features
17+
- Dual 10/100/1000Mbps GMAC controllers
18+
- Full-duplex operation (IEEE 802.3x flow control automatic transmission)
19+
- Half-duplex operation (CSMA/CD Protocol and back-pressure support)
20+
- RX Checksum Offload
21+
- TX Checksum insertion
22+
- MII interface
23+
- RGMII interface
24+
25+
select:
26+
properties:
27+
compatible:
28+
contains:
29+
enum:
30+
- loongson,ls1b-gmac
31+
required:
32+
- compatible
33+
34+
properties:
35+
compatible:
36+
items:
37+
- enum:
38+
- loongson,ls1b-gmac
39+
- const: snps,dwmac-3.50a
40+
41+
reg:
42+
maxItems: 1
43+
44+
clocks:
45+
maxItems: 1
46+
47+
clock-names:
48+
items:
49+
- const: stmmaceth
50+
51+
interrupts:
52+
maxItems: 1
53+
54+
interrupt-names:
55+
items:
56+
- const: macirq
57+
58+
loongson,ls1-syscon:
59+
$ref: /schemas/types.yaml#/definitions/phandle
60+
description:
61+
Phandle to the syscon containing some extra configurations
62+
including PHY interface mode.
63+
64+
phy-mode:
65+
enum:
66+
- mii
67+
- rgmii-id
68+
69+
required:
70+
- compatible
71+
- reg
72+
- clocks
73+
- clock-names
74+
- interrupts
75+
- interrupt-names
76+
- loongson,ls1-syscon
77+
78+
allOf:
79+
- $ref: snps,dwmac.yaml#
80+
81+
unevaluatedProperties: false
82+
83+
examples:
84+
- |
85+
#include <dt-bindings/clock/loongson,ls1x-clk.h>
86+
#include <dt-bindings/interrupt-controller/irq.h>
87+
88+
gmac0: ethernet@1fe10000 {
89+
compatible = "loongson,ls1b-gmac", "snps,dwmac-3.50a";
90+
reg = <0x1fe10000 0x10000>;
91+
92+
clocks = <&clkc LS1X_CLKID_AHB>;
93+
clock-names = "stmmaceth";
94+
95+
interrupt-parent = <&intc1>;
96+
interrupts = <2 IRQ_TYPE_LEVEL_HIGH>;
97+
interrupt-names = "macirq";
98+
99+
loongson,ls1-syscon = <&syscon>;
100+
101+
phy-handle = <&phy0>;
102+
phy-mode = "mii";
103+
snps,pbl = <1>;
104+
105+
mdio {
106+
#address-cells = <1>;
107+
#size-cells = <0>;
108+
compatible = "snps,dwmac-mdio";
109+
110+
phy0: ethernet-phy@0 {
111+
reg = <0x0>;
112+
};
113+
};
114+
};
Lines changed: 113 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,113 @@
1+
# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
2+
%YAML 1.2
3+
---
4+
$id: http://devicetree.org/schemas/net/loongson,ls1c-emac.yaml#
5+
$schema: http://devicetree.org/meta-schemas/core.yaml#
6+
7+
title: Loongson-1C Ethernet MAC Controller
8+
9+
maintainers:
10+
- Keguang Zhang <[email protected]>
11+
12+
description: |
13+
Loongson-1C Ethernet MAC Controller is based on
14+
Synopsys DesignWare MAC (version 3.50a).
15+
16+
Main features
17+
- 10/100Mbps
18+
- Full-duplex operation (IEEE 802.3x flow control automatic transmission)
19+
- Half-duplex operation (CSMA/CD Protocol and back-pressure support)
20+
- IEEE 802.1Q VLAN tag detection for reception frames
21+
- MII interface
22+
- RMII interface
23+
24+
select:
25+
properties:
26+
compatible:
27+
contains:
28+
enum:
29+
- loongson,ls1c-emac
30+
required:
31+
- compatible
32+
33+
properties:
34+
compatible:
35+
items:
36+
- enum:
37+
- loongson,ls1c-emac
38+
- const: snps,dwmac-3.50a
39+
40+
reg:
41+
maxItems: 1
42+
43+
clocks:
44+
maxItems: 1
45+
46+
clock-names:
47+
items:
48+
- const: stmmaceth
49+
50+
interrupts:
51+
maxItems: 1
52+
53+
interrupt-names:
54+
items:
55+
- const: macirq
56+
57+
loongson,ls1-syscon:
58+
$ref: /schemas/types.yaml#/definitions/phandle
59+
description:
60+
Phandle to the syscon containing some extra configurations
61+
including PHY interface mode.
62+
63+
phy-mode:
64+
enum:
65+
- mii
66+
- rmii
67+
68+
required:
69+
- compatible
70+
- reg
71+
- clocks
72+
- clock-names
73+
- interrupts
74+
- interrupt-names
75+
- loongson,ls1-syscon
76+
77+
allOf:
78+
- $ref: snps,dwmac.yaml#
79+
80+
unevaluatedProperties: false
81+
82+
examples:
83+
- |
84+
#include <dt-bindings/clock/loongson,ls1x-clk.h>
85+
#include <dt-bindings/interrupt-controller/irq.h>
86+
87+
emac: ethernet@1fe10000 {
88+
compatible = "loongson,ls1c-emac", "snps,dwmac-3.50a";
89+
reg = <0x1fe10000 0x10000>;
90+
91+
clocks = <&clkc LS1X_CLKID_AHB>;
92+
clock-names = "stmmaceth";
93+
94+
interrupt-parent = <&intc1>;
95+
interrupts = <2 IRQ_TYPE_LEVEL_HIGH>;
96+
interrupt-names = "macirq";
97+
98+
loongson,ls1-syscon = <&syscon>;
99+
100+
phy-handle = <&phy0>;
101+
phy-mode = "mii";
102+
snps,pbl = <1>;
103+
104+
mdio {
105+
#address-cells = <1>;
106+
#size-cells = <0>;
107+
compatible = "snps,dwmac-mdio";
108+
109+
phy0: ethernet-phy@13 {
110+
reg = <0x13>;
111+
};
112+
};
113+
};

MAINTAINERS

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14344,9 +14344,11 @@ MIPS/LOONGSON1 ARCHITECTURE
1434414344
M: Keguang Zhang <[email protected]>
1434514345
1434614346
S: Maintained
14347+
F: Documentation/devicetree/bindings/*/loongson,ls1*.yaml
1434714348
F: arch/mips/include/asm/mach-loongson32/
1434814349
F: arch/mips/loongson32/
1434914350
F: drivers/*/*loongson1*
14351+
F: drivers/net/ethernet/stmicro/stmmac/dwmac-loongson1.c
1435014352

1435114353
MIPS/LOONGSON2EF ARCHITECTURE
1435214354
M: Jiaxun Yang <[email protected]>

drivers/net/ethernet/stmicro/stmmac/Kconfig

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -239,6 +239,17 @@ config DWMAC_INTEL_PLAT
239239
the stmmac device driver. This driver is used for the Intel Keem Bay
240240
SoC.
241241

242+
config DWMAC_LOONGSON1
243+
tristate "Loongson1 GMAC support"
244+
default MACH_LOONGSON32
245+
depends on OF && (MACH_LOONGSON32 || COMPILE_TEST)
246+
help
247+
Support for ethernet controller on Loongson1 SoC.
248+
249+
This selects Loongson1 SoC glue layer support for the stmmac
250+
device driver. This driver is used for Loongson1-based boards
251+
like Loongson LS1B/LS1C.
252+
242253
config DWMAC_TEGRA
243254
tristate "NVIDIA Tegra MGBE support"
244255
depends on ARCH_TEGRA || COMPILE_TEST

drivers/net/ethernet/stmicro/stmmac/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ obj-$(CONFIG_DWMAC_SUNXI) += dwmac-sunxi.o
2929
obj-$(CONFIG_DWMAC_SUN8I) += dwmac-sun8i.o
3030
obj-$(CONFIG_DWMAC_DWC_QOS_ETH) += dwmac-dwc-qos-eth.o
3131
obj-$(CONFIG_DWMAC_INTEL_PLAT) += dwmac-intel-plat.o
32+
obj-$(CONFIG_DWMAC_LOONGSON1) += dwmac-loongson1.o
3233
obj-$(CONFIG_DWMAC_GENERIC) += dwmac-generic.o
3334
obj-$(CONFIG_DWMAC_IMX8) += dwmac-imx.o
3435
obj-$(CONFIG_DWMAC_TEGRA) += dwmac-tegra.o

0 commit comments

Comments
 (0)