Skip to contentSkip to conversation

Move Loongson1 MAC arch-code to the driver dir

PATCH Superseded Keguang Zhang 4 participants 15 messages Aug 30, 2023 – Sep 14, 2023

Subsystems (8)

v4 of 5 Superseded Latest is v5 →

lore
Share & tools
lore

Keguang Zhang

author maintainer
#0 lore raw

v4 cover 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
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

Keguang Zhang (4):
dt-bindings: mfd: syscon: Add compatibles for Loongson-1 syscon
dt-bindings: net: Add Loongson-1 Ethernet Controller
net: stmmac: Add glue layer for Loongson-1 SoC
MAINTAINERS: Update MIPS/LOONGSON1 entry

 .../devicetree/bindings/mfd/syscon.yaml       |   2 +
 .../bindings/net/loongson,ls1b-gmac.yaml      | 114 +++++++++
 .../bindings/net/loongson,ls1c-emac.yaml      | 113 +++++++++
 MAINTAINERS                                   |   3 +
 drivers/net/ethernet/stmicro/stmmac/Kconfig   |  11 +
 drivers/net/ethernet/stmicro/stmmac/Makefile  |   1 +
 .../ethernet/stmicro/stmmac/dwmac-loongson1.c | 219 ++++++++++++++++++
 7 files changed, 463 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/net/loongson,ls1b-gmac.yaml
 create mode 100644 Documentation/devicetree/bindings/net/loongson,ls1c-emac.yaml
 create mode 100644 drivers/net/ethernet/stmicro/stmmac/dwmac-loongson1.c

base-commit: 56585460cc2ec44fc5d66924f0a116f57080f0dc

Signature · 1 line
2.39.2
author maintainer
#1 lore raw

PATCH v4 1/4 dt-bindings: mfd: syscon: Add compatibles for Loongson-1 syscon

Add Loongson LS1B and LS1C compatibles for system controller.

---
V3 -> V4: Add Acked-by tag from Krzysztof Kozlowski V2 -> V3: Change compatibles back to loongson,ls1b-syscon
and loongson,ls1c-syscon
V1 -> V2: Make the syscon compatibles more specific

 Documentation/devicetree/bindings/mfd/syscon.yaml | 2 ++
 1 file changed, 2 insertions(+)
Documentation/devicetree/bindings/mfd/syscon.yaml +2 -0
index 8103154bbb52..c77d7b155a4c 100644
@@ -49,6 +49,8 @@ properties:
               - hisilicon,peri-subctrl
               - hpe,gxp-sysreg
               - intel,lgm-syscon
+              - loongson,ls1b-syscon
+              - loongson,ls1c-syscon
               - marvell,armada-3700-usb2-host-misc
               - mediatek,mt8135-pctl-a-syscfg
               - mediatek,mt8135-pctl-b-syscfg
Signature · 1 line
2.39.2
author maintainer
#2 lore raw

PATCH v4 2/4 dt-bindings: net: Add Loongson-1 Ethernet Controller

In reply to Keguang Zhang

Add devicetree binding document for Loongson-1 Ethernet controller.

---
V3 -> V4: Add "|" to description part
Amend "phy-mode" property
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(Sorry! I'm not sure)
V1 -> V2: 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

 .../bindings/net/loongson,ls1b-gmac.yaml      | 114 ++++++++++++++++++
 .../bindings/net/loongson,ls1c-emac.yaml      | 113 +++++++++++++++++
 2 files changed, 227 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/net/loongson,ls1b-gmac.yaml
 create mode 100644 Documentation/devicetree/bindings/net/loongson,ls1c-emac.yaml
Documentation/devicetree/bindings/net/loongson,ls1b-gmac.yaml new file +114 -0
new file mode 100644
index 000000000000..c4f3224bad38
@@ -0,0 +1,114 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/net/loongson,ls1b-gmac.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Loongson-1B Gigabit Ethernet MAC Controller
+
+maintainers:
+  - Keguang Zhang <[email protected]>
+
+description: |
+  Loongson-1B Gigabit Ethernet MAC Controller is based on
+  Synopsys DesignWare MAC (version 3.50a).
+
+  Main features
+  - Dual 10/100/1000Mbps GMAC controllers
+  - Full-duplex operation (IEEE 802.3x flow control automatic transmission)
+  - Half-duplex operation (CSMA/CD Protocol and back-pressure support)
+  - RX Checksum Offload
+  - TX Checksum insertion
+  - MII interface
+  - RGMII interface
+
+select:
+  properties:
+    compatible:
+      contains:
+        enum:
+          - loongson,ls1b-gmac
+  required:
+    - compatible
+
+properties:
+  compatible:
+    items:
+      - enum:
+          - loongson,ls1b-gmac
+      - const: snps,dwmac-3.50a
+
+  reg:
+    maxItems: 1
+
+  clocks:
+    maxItems: 1
+
+  clock-names:
+    items:
+      - const: stmmaceth
+
+  interrupts:
+    maxItems: 1
+
+  interrupt-names:
+    items:
+      - const: macirq
+
+  loongson,ls1-syscon:
+    $ref: /schemas/types.yaml#/definitions/phandle
+    description:
+      Phandle to the syscon containing some extra configurations
+      including PHY interface mode.
+
+  phy-mode:
+    enum:
+      - mii
+      - rgmii-id
+
+required:
+  - compatible
+  - reg
+  - clocks
+  - clock-names
+  - interrupts
+  - interrupt-names
+  - loongson,ls1-syscon
+
+allOf:
+  - $ref: snps,dwmac.yaml#
+
+unevaluatedProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/clock/loongson,ls1x-clk.h>
+    #include <dt-bindings/interrupt-controller/irq.h>
+
+    gmac0: ethernet@1fe10000 {
+        compatible = "loongson,ls1b-gmac", "snps,dwmac-3.50a";
+        reg = <0x1fe10000 0x10000>;
+
+        clocks = <&clkc LS1X_CLKID_AHB>;
+        clock-names = "stmmaceth";
+
+        interrupt-parent = <&intc1>;
+        interrupts = <2 IRQ_TYPE_LEVEL_HIGH>;
+        interrupt-names = "macirq";
+
+        loongson,ls1-syscon = <&syscon>;
+
+        phy-handle = <&phy0>;
+        phy-mode = "mii";
+        snps,pbl = <1>;
+
+        mdio {
+            #address-cells = <1>;
+            #size-cells = <0>;
+            compatible = "snps,dwmac-mdio";
+
+            phy0: ethernet-phy@0 {
+                reg = <0x0>;
+            };
+        };
+    };
Documentation/devicetree/bindings/net/loongson,ls1c-emac.yaml new file +113 -0

113 lines not on this page · raw message

Signature · 1 line
2.39.2
#3 lore raw

Re: [PATCH v4 2/4] dt-bindings: net: Add Loongson-1 Ethernet Controller

Quoted 20 lines · Keguang Zhang

Add devicetree binding document for Loongson-1 Ethernet controller.

---
V3 -> V4: Add "|" to description part
Amend "phy-mode" property
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(Sorry! I'm not sure)
V1 -> V2: 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

Quoted 5 lines
  .../bindings/net/loongson,ls1b-gmac.yaml      | 114 ++++++++++++++++++
  .../bindings/net/loongson,ls1c-emac.yaml      | 113 +++++++++++++++++
  2 files changed, 227 insertions(+)

create mode 100644 Documentation/devicetree/bindings/net/loongson,ls1b-gmac.yaml create mode 100644 Documentation/devicetree/bindings/net/loongson,ls1c-emac.yaml

Squash:

-- >8 --

MAINTAINERS +2 -1
index ff1f273b4f36..2519d06b5aab 100644
@@ -14344,9 +14344,12 @@ MIPS/LOONGSON1 ARCHITECTURE
 M:	Keguang Zhang <[email protected]>
 L:	[email protected]
 S:	Maintained
+F:	Documentation/devicetree/bindings/*/loongson,ls1x-*.yaml
+F:	Documentation/devicetree/bindings/net/loongson,ls1*.yaml
 F:	arch/mips/include/asm/mach-loongson32/
 F:	arch/mips/loongson32/
 F:	drivers/*/*loongson1*
---
author maintainer
#4 lore raw

Re: [PATCH v4 2/4] dt-bindings: net: Add Loongson-1 Ethernet Controller

Quoted 36 lines · Philippe Mathieu-Daudé
Quoted 20 lines · Keguang Zhang

Add devicetree binding document for Loongson-1 Ethernet controller.

---
V3 -> V4: Add "|" to description part
Amend "phy-mode" property
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(Sorry! I'm not sure)
V1 -> V2: 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

Quoted 5 lines
  .../bindings/net/loongson,ls1b-gmac.yaml      | 114 ++++++++++++++++++
  .../bindings/net/loongson,ls1c-emac.yaml      | 113 +++++++++++++++++
  2 files changed, 227 insertions(+)

create mode 100644 Documentation/devicetree/bindings/net/loongson,ls1b-gmac.yaml create mode 100644 Documentation/devicetree/bindings/net/loongson,ls1c-emac.yaml

Squash:

-- >8 --

MAINTAINERS +0 -0
index ff1f273b4f36..2519d06b5aab 100644

MAINTAINERS MIPS/LOONGSON1 ARCHITECTURE · line 14350

Quoted 9 lines
MAINTAINERS +2 -1
@@ -14344,9 +14344,12 @@ MIPS/LOONGSON1 ARCHITECTURE
  M:    Keguang Zhang <[email protected]>
  L:    [email protected]
  S:    Maintained
+F:     Documentation/devicetree/bindings/*/loongson,ls1x-*.yaml
+F:     Documentation/devicetree/bindings/net/loongson,ls1*.yaml
  F:    arch/mips/include/asm/mach-loongson32/
  F:    arch/mips/loongson32/
  F:    drivers/*/*loongson1*
---

Will do.
Thanks!

Signature · 3 lines
Best regards,

Keguang Zhang
author maintainer
#5 lore raw

PATCH v4 3/4 net: stmmac: Add glue layer for Loongson-1 SoC

In reply to Keguang Zhang

This glue driver is created based on the arch-code implemented earlier with the platform-specific settings.

Use syscon for SYSCON register access.

Partially based on the previous work by Serge Semin.

---
V3 -> V4: Drop ls1x_dwmac_syscon definition and its instances
Drop three redundant fields from the ls1x_dwmac structure Drop the ls1x_dwmac_init() method.
Some minor improvements
V2 -> V3: 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
V1 -> V2: 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

 drivers/net/ethernet/stmicro/stmmac/Kconfig   |  11 +
 drivers/net/ethernet/stmicro/stmmac/Makefile  |   1 +
 .../ethernet/stmicro/stmmac/dwmac-loongson1.c | 219 ++++++++++++++++++
 3 files changed, 231 insertions(+)
 create mode 100644 drivers/net/ethernet/stmicro/stmmac/dwmac-loongson1.c
drivers/net/ethernet/stmicro/stmmac/Kconfig +11 -0
index 06c6871f8788..a2b9e289aa36 100644
@@ -239,6 +239,17 @@ config DWMAC_INTEL_PLAT
 	  the stmmac device driver. This driver is used for the Intel Keem Bay
 	  SoC.
 
+config DWMAC_LOONGSON1
+	tristate "Loongson1 GMAC support"
+	default MACH_LOONGSON32
+	depends on OF && (MACH_LOONGSON32 || COMPILE_TEST)
+	help
+	  Support for ethernet controller on Loongson1 SoC.
+
+	  This selects Loongson1 SoC glue layer support for the stmmac
+	  device driver. This driver is used for Loongson1-based boards
+	  like Loongson LS1B/LS1C.
+
 config DWMAC_TEGRA
 	tristate "NVIDIA Tegra MGBE support"
 	depends on ARCH_TEGRA || COMPILE_TEST
drivers/net/ethernet/stmicro/stmmac/Makefile +1 -0
index 5b57aee19267..80e598bd4255 100644
@@ -29,6 +29,7 @@ obj-$(CONFIG_DWMAC_SUNXI)	+= dwmac-sunxi.o
 obj-$(CONFIG_DWMAC_SUN8I)	+= dwmac-sun8i.o
 obj-$(CONFIG_DWMAC_DWC_QOS_ETH)	+= dwmac-dwc-qos-eth.o
 obj-$(CONFIG_DWMAC_INTEL_PLAT)	+= dwmac-intel-plat.o
+obj-$(CONFIG_DWMAC_LOONGSON1)	+= dwmac-loongson1.o
 obj-$(CONFIG_DWMAC_GENERIC)	+= dwmac-generic.o
 obj-$(CONFIG_DWMAC_IMX8)	+= dwmac-imx.o
 obj-$(CONFIG_DWMAC_TEGRA)	+= dwmac-tegra.o
drivers/net/ethernet/stmicro/stmmac/dwmac-loongson1.c new file +219 -0

219 lines not on this page · raw message

Signature · 1 line
2.39.2
#6 lore raw

Re: [PATCH v4 3/4] net: stmmac: Add glue layer for Loongson-1 SoC

Quoted 23 lines · Keguang Zhang

This glue driver is created based on the arch-code implemented earlier with the platform-specific settings.

Use syscon for SYSCON register access.

Partially based on the previous work by Serge Semin.

---
V3 -> V4: Drop ls1x_dwmac_syscon definition and its instances
Drop three redundant fields from the ls1x_dwmac structure Drop the ls1x_dwmac_init() method.
Some minor improvements
V2 -> V3: 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
V1 -> V2: 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

Quoted 5 lines
  drivers/net/ethernet/stmicro/stmmac/Kconfig   |  11 +
  drivers/net/ethernet/stmicro/stmmac/Makefile  |   1 +
  .../ethernet/stmicro/stmmac/dwmac-loongson1.c | 219 ++++++++++++++++++
  3 files changed, 231 insertions(+)

create mode 100644 drivers/net/ethernet/stmicro/stmmac/dwmac-loongson1.c

Squash:

-- >8 --

MAINTAINERS +1 -1
index ff1f273b4f36..2519d06b5aab 100644
@@ -14344,9 +14344,12 @@ MIPS/LOONGSON1 ARCHITECTURE
 M:	Keguang Zhang <[email protected]>
 L:	[email protected]
 S:	Maintained
 F:	Documentation/devicetree/bindings/*/loongson,ls1x-*.yaml
 F:	Documentation/devicetree/bindings/net/loongson,ls1*.yaml
 F:	arch/mips/include/asm/mach-loongson32/
 F:	arch/mips/loongson32/
 F:	drivers/*/*loongson1*
+F:	drivers/net/ethernet/stmicro/stmmac/dwmac-loongson1.c
---
author maintainer
#7 lore raw

Re: [PATCH v4 3/4] net: stmmac: Add glue layer for Loongson-1 SoC

Quoted 39 lines · Philippe Mathieu-Daudé
Quoted 23 lines · Keguang Zhang

This glue driver is created based on the arch-code implemented earlier with the platform-specific settings.

Use syscon for SYSCON register access.

Partially based on the previous work by Serge Semin.

---
V3 -> V4: Drop ls1x_dwmac_syscon definition and its instances
Drop three redundant fields from the ls1x_dwmac structure Drop the ls1x_dwmac_init() method.
Some minor improvements
V2 -> V3: 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
V1 -> V2: 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

Quoted 5 lines
  drivers/net/ethernet/stmicro/stmmac/Kconfig   |  11 +
  drivers/net/ethernet/stmicro/stmmac/Makefile  |   1 +
  .../ethernet/stmicro/stmmac/dwmac-loongson1.c | 219 ++++++++++++++++++
  3 files changed, 231 insertions(+)

create mode 100644 drivers/net/ethernet/stmicro/stmmac/dwmac-loongson1.c

Squash:

-- >8 --

MAINTAINERS +0 -0
index ff1f273b4f36..2519d06b5aab 100644

MAINTAINERS MIPS/LOONGSON1 ARCHITECTURE · line 14352

Quoted 10 lines
MAINTAINERS +1 -1
@@ -14344,9 +14344,12 @@ MIPS/LOONGSON1 ARCHITECTURE
  M:    Keguang Zhang <[email protected]>
  L:    [email protected]
  S:    Maintained
  F:    Documentation/devicetree/bindings/*/loongson,ls1x-*.yaml
  F:    Documentation/devicetree/bindings/net/loongson,ls1*.yaml
  F:    arch/mips/include/asm/mach-loongson32/
  F:    arch/mips/loongson32/
  F:    drivers/*/*loongson1*
+F:     drivers/net/ethernet/stmicro/stmmac/dwmac-loongson1.c
---

Will do.
Thanks!

Signature · 3 lines
Best regards,

Keguang Zhang
#8 lore raw

Re: [PATCH v4 3/4] net: stmmac: Add glue layer for Loongson-1 SoC

In reply to Keguang Zhang
Quoted 78 lines · Keguang Zhang

This glue driver is created based on the arch-code implemented earlier with the platform-specific settings.

Use syscon for SYSCON register access.

Partially based on the previous work by Serge Semin.

---
V3 -> V4: Drop ls1x_dwmac_syscon definition and its instances
Drop three redundant fields from the ls1x_dwmac structure Drop the ls1x_dwmac_init() method.
Some minor improvements
V2 -> V3: 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
V1 -> V2: 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

 drivers/net/ethernet/stmicro/stmmac/Kconfig   |  11 +
 drivers/net/ethernet/stmicro/stmmac/Makefile  |   1 +
 .../ethernet/stmicro/stmmac/dwmac-loongson1.c | 219 ++++++++++++++++++
 3 files changed, 231 insertions(+)
 create mode 100644 drivers/net/ethernet/stmicro/stmmac/dwmac-loongson1.c
drivers/net/ethernet/stmicro/stmmac/Kconfig +11 -0
index 06c6871f8788..a2b9e289aa36 100644
@@ -239,6 +239,17 @@ config DWMAC_INTEL_PLAT
 	  the stmmac device driver. This driver is used for the Intel Keem Bay
 	  SoC.
 
+config DWMAC_LOONGSON1
+	tristate "Loongson1 GMAC support"
+	default MACH_LOONGSON32
+	depends on OF && (MACH_LOONGSON32 || COMPILE_TEST)
+	help
+	  Support for ethernet controller on Loongson1 SoC.
+
+	  This selects Loongson1 SoC glue layer support for the stmmac
+	  device driver. This driver is used for Loongson1-based boards
+	  like Loongson LS1B/LS1C.
+
 config DWMAC_TEGRA
 	tristate "NVIDIA Tegra MGBE support"
 	depends on ARCH_TEGRA || COMPILE_TEST
drivers/net/ethernet/stmicro/stmmac/Makefile +1 -0
index 5b57aee19267..80e598bd4255 100644
@@ -29,6 +29,7 @@ obj-$(CONFIG_DWMAC_SUNXI)	+= dwmac-sunxi.o
 obj-$(CONFIG_DWMAC_SUN8I)	+= dwmac-sun8i.o
 obj-$(CONFIG_DWMAC_DWC_QOS_ETH)	+= dwmac-dwc-qos-eth.o
 obj-$(CONFIG_DWMAC_INTEL_PLAT)	+= dwmac-intel-plat.o
+obj-$(CONFIG_DWMAC_LOONGSON1)	+= dwmac-loongson1.o
 obj-$(CONFIG_DWMAC_GENERIC)	+= dwmac-generic.o
 obj-$(CONFIG_DWMAC_IMX8)	+= dwmac-imx.o
 obj-$(CONFIG_DWMAC_TEGRA)	+= dwmac-tegra.o
drivers/net/ethernet/stmicro/stmmac/dwmac-loongson1.c new file +9 -0
new file mode 100644
index 000000000000..f1732f15ff87
@@ -0,0 +1,219 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+/*
+ * Loongson-1 DWMAC glue layer
+ *
+ * Copyright (C) 2011-2023 Keguang Zhang <[email protected]>
+ */
+
+#include <linux/mfd/syscon.h>
+#include <linux/module.h>

drivers/net/ethernet/stmicro/stmmac/dwmac-loongson1.c line 18

Quoted 10 lines
drivers/net/ethernet/stmicro/stmmac/dwmac-loongson1.c new file +9 -0
+#include <linux/of.h>
+#include <linux/phy.h>
+#include <linux/platform_device.h>
+#include <linux/regmap.h>
+
+#include "stmmac.h"
+#include "stmmac_platform.h"
+
 
+#define LS1B_GMAC0_BASE		(0x1fe10000)

I was talking about the LS1B_GMAC1_BASE macro only. Since both LS1B and LS1C have GMAC0 at the same base address I would preserve LS1X_GMAC0_BASE name here. But seeing it's unused for the LS1C anyway it's not that a big deal.

Quoted 145 lines
drivers/net/ethernet/stmicro/stmmac/dwmac-loongson1.c new file +145 -0
+#define LS1B_GMAC1_BASE		(0x1fe20000)
+
+/* Loongson-1 SYSCON Registers */
+#define LS1X_SYSCON0		(0x0)
+#define LS1X_SYSCON1		(0x4)
+
+/* Loongson-1B SYSCON Register Bits */
+#define GMAC1_USE_UART1		BIT(4)
+#define GMAC1_USE_UART0		BIT(3)
+
+#define GMAC1_SHUT		BIT(13)
+#define GMAC0_SHUT		BIT(12)
+
+#define GMAC1_USE_TXCLK		BIT(3)
+#define GMAC0_USE_TXCLK		BIT(2)
+#define GMAC1_USE_PWM23		BIT(1)
+#define GMAC0_USE_PWM01		BIT(0)
+
+/* Loongson-1C SYSCON Register Bits */
+#define GMAC_SHUT		BIT(6)
+
+#define PHY_INTF_SELI		GENMASK(30, 28)
+#define PHY_INTF_MII		FIELD_PREP(PHY_INTF_SELI, 0)
+#define PHY_INTF_RMII		FIELD_PREP(PHY_INTF_SELI, 4)
+
+struct ls1x_dwmac {
+	struct plat_stmmacenet_data *plat_dat;
+	struct regmap *regmap;
+};
+
+static int ls1b_dwmac_syscon_init(struct platform_device *pdev, void *priv)
+{
+	struct ls1x_dwmac *dwmac = priv;
+	struct plat_stmmacenet_data *plat = dwmac->plat_dat;
+	struct regmap *regmap = dwmac->regmap;
+	struct resource *res;
+	unsigned long reg_base;
+
+	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+	if (!res) {
+		dev_err(&pdev->dev, "Could not get IO_MEM resources\n");
+		return -EINVAL;
+	}
+	reg_base = (unsigned long)res->start;
+
+	if (reg_base == LS1B_GMAC0_BASE) {
+		switch (plat->phy_interface) {
+		case PHY_INTERFACE_MODE_RGMII_ID:
+			regmap_update_bits(regmap, LS1X_SYSCON0,
+					   GMAC0_USE_TXCLK | GMAC0_USE_PWM01,
+					   0);
+			break;
+		case PHY_INTERFACE_MODE_MII:
+			regmap_update_bits(regmap, LS1X_SYSCON0,
+					   GMAC0_USE_TXCLK | GMAC0_USE_PWM01,
+					   GMAC0_USE_TXCLK | GMAC0_USE_PWM01);
+			break;
+		default:
+			dev_err(&pdev->dev, "Unsupported PHY mode %u\n",
+				plat->phy_interface);
+			return -EOPNOTSUPP;
+		}
+
+		regmap_update_bits(regmap, LS1X_SYSCON0, GMAC0_SHUT, 0);
+	} else if (reg_base == LS1B_GMAC1_BASE) {
+		regmap_update_bits(regmap, LS1X_SYSCON0,
+				   GMAC1_USE_UART1 | GMAC1_USE_UART0,
+				   GMAC1_USE_UART1 | GMAC1_USE_UART0);
+
+		switch (plat->phy_interface) {
+		case PHY_INTERFACE_MODE_RGMII_ID:
+			regmap_update_bits(regmap, LS1X_SYSCON1,
+					   GMAC1_USE_TXCLK | GMAC1_USE_PWM23,
+					   0);
+
+			break;
+		case PHY_INTERFACE_MODE_MII:
+			regmap_update_bits(regmap, LS1X_SYSCON1,
+					   GMAC1_USE_TXCLK | GMAC1_USE_PWM23,
+					   GMAC1_USE_TXCLK | GMAC1_USE_PWM23);
+			break;
+		default:
+			dev_err(&pdev->dev, "Unsupported PHY mode %u\n",
+				plat->phy_interface);
+			return -EOPNOTSUPP;
+		}
+
+		regmap_update_bits(regmap, LS1X_SYSCON1, GMAC1_SHUT, 0);
+	} else {
+		dev_err(&pdev->dev, "Invalid Ethernet MAC base address %lx",
+			reg_base);
+		return -EINVAL;
+	}
+
+	return 0;
+}
+
+static int ls1c_dwmac_syscon_init(struct platform_device *pdev, void *priv)
+{
+	struct ls1x_dwmac *dwmac = priv;
+	struct plat_stmmacenet_data *plat = dwmac->plat_dat;
+	struct regmap *regmap = dwmac->regmap;
+
+	switch (plat->phy_interface) {
+	case PHY_INTERFACE_MODE_MII:
+		regmap_update_bits(regmap, LS1X_SYSCON1, PHY_INTF_SELI,
+				   PHY_INTF_MII);
+		break;
+	case PHY_INTERFACE_MODE_RMII:
+		regmap_update_bits(regmap, LS1X_SYSCON1, PHY_INTF_SELI,
+				   PHY_INTF_RMII);
+		break;
+	default:
+		dev_err(&pdev->dev, "Unsupported PHY-mode %u\n",
+			plat->phy_interface);
+		return -EOPNOTSUPP;
+	}
+
+	regmap_update_bits(regmap, LS1X_SYSCON0, GMAC0_SHUT, 0);
+
+	return 0;
+}
+
+static int ls1x_dwmac_probe(struct platform_device *pdev)
+{
+	struct plat_stmmacenet_data *plat_dat;
+	struct stmmac_resources stmmac_res;
+	struct regmap *regmap;
+	struct ls1x_dwmac *dwmac;
+	int (*init)(struct platform_device *pdev, void *priv);
+	int ret;
+
+	ret = stmmac_get_platform_resources(pdev, &stmmac_res);
+	if (ret)
+		return ret;
+
+	/* Probe syscon */
+	regmap = syscon_regmap_lookup_by_phandle(pdev->dev.of_node,
+						 "loongson,ls1-syscon");
+	if (IS_ERR(regmap))
+		return dev_err_probe(&pdev->dev, PTR_ERR(regmap),
+				     "Unable to find syscon\n");
+
+	init = of_device_get_match_data(&pdev->dev);
+	if (!init) {

drivers/net/ethernet/stmicro/stmmac/dwmac-loongson1.c line 172

Quoted 10 lines
drivers/net/ethernet/stmicro/stmmac/dwmac-loongson1.c new file +9 -0
+		dev_err(&pdev->dev, "No of match data provided\n");
+		return -EINVAL;
+	}
+
+	dwmac = devm_kzalloc(&pdev->dev, sizeof(*dwmac), GFP_KERNEL);
+	if (!dwmac)
+		return -ENOMEM;
+
 
+	plat_dat = stmmac_probe_config_dt(pdev, stmmac_res.mac);

This can be replaced with devm_stmmac_probe_config_dt() and ...

drivers/net/ethernet/stmicro/stmmac/dwmac-loongson1.c line 182

Quoted 11 lines
drivers/net/ethernet/stmicro/stmmac/dwmac-loongson1.c new file +10 -0
+	if (IS_ERR(plat_dat))
+		return dev_err_probe(&pdev->dev, PTR_ERR(plat_dat),
+				     "dt configuration failed\n");
+
+	plat_dat->bsp_priv = dwmac;
+	plat_dat->init = init;
+	dwmac->plat_dat = plat_dat;
+	dwmac->regmap = regmap;
+
 
+	ret = stmmac_pltfr_probe(pdev, plat_dat, &stmmac_res);

... this can be replaced with devm_stmmac_pltfr_probe() thus ...

drivers/net/ethernet/stmicro/stmmac/dwmac-loongson1.c line 191

Quoted 10 lines
drivers/net/ethernet/stmicro/stmmac/dwmac-loongson1.c new file +9 -0
+	if (ret)
+		goto err_remove_config_dt;
+
+	return 0;
+
 
+err_remove_config_dt:
+	stmmac_remove_config_dt(pdev, plat_dat);
+
+	return ret;

... this could have been omitted and ...

Quoted 9 lines
drivers/net/ethernet/stmicro/stmmac/dwmac-loongson1.c new file +9 -0
+}
+
+static const struct of_device_id ls1x_dwmac_match[] = {
+	{
+		.compatible = "loongson,ls1b-gmac",
+		.data = &ls1b_dwmac_syscon_init,
+	},
+	{
+		.compatible = "loongson,ls1c-emac",

drivers/net/ethernet/stmicro/stmmac/dwmac-loongson1.c line 209

Quoted 10 lines
drivers/net/ethernet/stmicro/stmmac/dwmac-loongson1.c new file +9 -0
+		.data = &ls1c_dwmac_syscon_init,
+	},
+	{ }
+};
+MODULE_DEVICE_TABLE(of, ls1x_dwmac_match);
+
+static struct platform_driver ls1x_dwmac_driver = {
+	.probe = ls1x_dwmac_probe,
 
+	.remove_new = stmmac_pltfr_remove,

... this could have been dropped.

-Serge(y)

Quoted 14 lines
drivers/net/ethernet/stmicro/stmmac/dwmac-loongson1.c new file +10 -0
+	.driver = {
+		.name = "loongson1-dwmac",
+		.of_match_table = ls1x_dwmac_match,
+	},
+};
+module_platform_driver(ls1x_dwmac_driver);
+
+MODULE_AUTHOR("Keguang Zhang <[email protected]>");
+MODULE_DESCRIPTION("Loongson-1 DWMAC glue layer");
+MODULE_LICENSE("GPL");
Signature · 1 line
2.39.2
author maintainer
#9 lore raw

Re: [PATCH v4 3/4] net: stmmac: Add glue layer for Loongson-1 SoC

Quoted 299 lines · Serge Semin
Quoted 78 lines · Keguang Zhang

This glue driver is created based on the arch-code implemented earlier with the platform-specific settings.

Use syscon for SYSCON register access.

Partially based on the previous work by Serge Semin.

---
V3 -> V4: Drop ls1x_dwmac_syscon definition and its instances
Drop three redundant fields from the ls1x_dwmac structure Drop the ls1x_dwmac_init() method.
Some minor improvements
V2 -> V3: 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
V1 -> V2: 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

 drivers/net/ethernet/stmicro/stmmac/Kconfig   |  11 +
 drivers/net/ethernet/stmicro/stmmac/Makefile  |   1 +
 .../ethernet/stmicro/stmmac/dwmac-loongson1.c | 219 ++++++++++++++++++
 3 files changed, 231 insertions(+)
 create mode 100644 drivers/net/ethernet/stmicro/stmmac/dwmac-loongson1.c
drivers/net/ethernet/stmicro/stmmac/Kconfig +11 -0
index 06c6871f8788..a2b9e289aa36 100644
@@ -239,6 +239,17 @@ config DWMAC_INTEL_PLAT
        the stmmac device driver. This driver is used for the Intel Keem Bay
        SoC.
 
+config DWMAC_LOONGSON1
+     tristate "Loongson1 GMAC support"
+     default MACH_LOONGSON32
+     depends on OF && (MACH_LOONGSON32 || COMPILE_TEST)
+     help
+       Support for ethernet controller on Loongson1 SoC.
+
+       This selects Loongson1 SoC glue layer support for the stmmac
+       device driver. This driver is used for Loongson1-based boards
+       like Loongson LS1B/LS1C.
+
 config DWMAC_TEGRA
      tristate "NVIDIA Tegra MGBE support"
      depends on ARCH_TEGRA || COMPILE_TEST
drivers/net/ethernet/stmicro/stmmac/Makefile +1 -0
index 5b57aee19267..80e598bd4255 100644
@@ -29,6 +29,7 @@ obj-$(CONFIG_DWMAC_SUNXI)   += dwmac-sunxi.o
 obj-$(CONFIG_DWMAC_SUN8I)    += dwmac-sun8i.o
 obj-$(CONFIG_DWMAC_DWC_QOS_ETH)      += dwmac-dwc-qos-eth.o
 obj-$(CONFIG_DWMAC_INTEL_PLAT)       += dwmac-intel-plat.o
+obj-$(CONFIG_DWMAC_LOONGSON1)        += dwmac-loongson1.o
 obj-$(CONFIG_DWMAC_GENERIC)  += dwmac-generic.o
 obj-$(CONFIG_DWMAC_IMX8)     += dwmac-imx.o
 obj-$(CONFIG_DWMAC_TEGRA)    += dwmac-tegra.o
drivers/net/ethernet/stmicro/stmmac/dwmac-loongson1.c new file +9 -0
new file mode 100644
index 000000000000..f1732f15ff87
@@ -0,0 +1,219 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+/*
+ * Loongson-1 DWMAC glue layer
+ *
+ * Copyright (C) 2011-2023 Keguang Zhang <[email protected]>
+ */
+
+#include <linux/mfd/syscon.h>
+#include <linux/module.h>

drivers/net/ethernet/stmicro/stmmac/dwmac-loongson1.c line 18

Quoted 10 lines
drivers/net/ethernet/stmicro/stmmac/dwmac-loongson1.c new file +9 -0
+#include <linux/of.h>
+#include <linux/phy.h>
+#include <linux/platform_device.h>
+#include <linux/regmap.h>
+
+#include "stmmac.h"
+#include "stmmac_platform.h"
+
 
+#define LS1B_GMAC0_BASE              (0x1fe10000)

I was talking about the LS1B_GMAC1_BASE macro only. Since both LS1B and LS1C have GMAC0 at the same base address I would preserve LS1X_GMAC0_BASE name here. But seeing it's unused for the LS1C anyway it's not that a big deal.

Quoted 145 lines
drivers/net/ethernet/stmicro/stmmac/dwmac-loongson1.c new file +145 -0
+#define LS1B_GMAC1_BASE              (0x1fe20000)
+
+/* Loongson-1 SYSCON Registers */
+#define LS1X_SYSCON0         (0x0)
+#define LS1X_SYSCON1         (0x4)
+
+/* Loongson-1B SYSCON Register Bits */
+#define GMAC1_USE_UART1              BIT(4)
+#define GMAC1_USE_UART0              BIT(3)
+
+#define GMAC1_SHUT           BIT(13)
+#define GMAC0_SHUT           BIT(12)
+
+#define GMAC1_USE_TXCLK              BIT(3)
+#define GMAC0_USE_TXCLK              BIT(2)
+#define GMAC1_USE_PWM23              BIT(1)
+#define GMAC0_USE_PWM01              BIT(0)
+
+/* Loongson-1C SYSCON Register Bits */
+#define GMAC_SHUT            BIT(6)
+
+#define PHY_INTF_SELI                GENMASK(30, 28)
+#define PHY_INTF_MII         FIELD_PREP(PHY_INTF_SELI, 0)
+#define PHY_INTF_RMII                FIELD_PREP(PHY_INTF_SELI, 4)
+
+struct ls1x_dwmac {
+     struct plat_stmmacenet_data *plat_dat;
+     struct regmap *regmap;
+};
+
+static int ls1b_dwmac_syscon_init(struct platform_device *pdev, void *priv)
+{
+     struct ls1x_dwmac *dwmac = priv;
+     struct plat_stmmacenet_data *plat = dwmac->plat_dat;
+     struct regmap *regmap = dwmac->regmap;
+     struct resource *res;
+     unsigned long reg_base;
+
+     res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+     if (!res) {
+             dev_err(&pdev->dev, "Could not get IO_MEM resources\n");
+             return -EINVAL;
+     }
+     reg_base = (unsigned long)res->start;
+
+     if (reg_base == LS1B_GMAC0_BASE) {
+             switch (plat->phy_interface) {
+             case PHY_INTERFACE_MODE_RGMII_ID:
+                     regmap_update_bits(regmap, LS1X_SYSCON0,
+                                        GMAC0_USE_TXCLK | GMAC0_USE_PWM01,
+                                        0);
+                     break;
+             case PHY_INTERFACE_MODE_MII:
+                     regmap_update_bits(regmap, LS1X_SYSCON0,
+                                        GMAC0_USE_TXCLK | GMAC0_USE_PWM01,
+                                        GMAC0_USE_TXCLK | GMAC0_USE_PWM01);
+                     break;
+             default:
+                     dev_err(&pdev->dev, "Unsupported PHY mode %u\n",
+                             plat->phy_interface);
+                     return -EOPNOTSUPP;
+             }
+
+             regmap_update_bits(regmap, LS1X_SYSCON0, GMAC0_SHUT, 0);
+     } else if (reg_base == LS1B_GMAC1_BASE) {
+             regmap_update_bits(regmap, LS1X_SYSCON0,
+                                GMAC1_USE_UART1 | GMAC1_USE_UART0,
+                                GMAC1_USE_UART1 | GMAC1_USE_UART0);
+
+             switch (plat->phy_interface) {
+             case PHY_INTERFACE_MODE_RGMII_ID:
+                     regmap_update_bits(regmap, LS1X_SYSCON1,
+                                        GMAC1_USE_TXCLK | GMAC1_USE_PWM23,
+                                        0);
+
+                     break;
+             case PHY_INTERFACE_MODE_MII:
+                     regmap_update_bits(regmap, LS1X_SYSCON1,
+                                        GMAC1_USE_TXCLK | GMAC1_USE_PWM23,
+                                        GMAC1_USE_TXCLK | GMAC1_USE_PWM23);
+                     break;
+             default:
+                     dev_err(&pdev->dev, "Unsupported PHY mode %u\n",
+                             plat->phy_interface);
+                     return -EOPNOTSUPP;
+             }
+
+             regmap_update_bits(regmap, LS1X_SYSCON1, GMAC1_SHUT, 0);
+     } else {
+             dev_err(&pdev->dev, "Invalid Ethernet MAC base address %lx",
+                     reg_base);
+             return -EINVAL;
+     }
+
+     return 0;
+}
+
+static int ls1c_dwmac_syscon_init(struct platform_device *pdev, void *priv)
+{
+     struct ls1x_dwmac *dwmac = priv;
+     struct plat_stmmacenet_data *plat = dwmac->plat_dat;
+     struct regmap *regmap = dwmac->regmap;
+
+     switch (plat->phy_interface) {
+     case PHY_INTERFACE_MODE_MII:
+             regmap_update_bits(regmap, LS1X_SYSCON1, PHY_INTF_SELI,
+                                PHY_INTF_MII);
+             break;
+     case PHY_INTERFACE_MODE_RMII:
+             regmap_update_bits(regmap, LS1X_SYSCON1, PHY_INTF_SELI,
+                                PHY_INTF_RMII);
+             break;
+     default:
+             dev_err(&pdev->dev, "Unsupported PHY-mode %u\n",
+                     plat->phy_interface);
+             return -EOPNOTSUPP;
+     }
+
+     regmap_update_bits(regmap, LS1X_SYSCON0, GMAC0_SHUT, 0);
+
+     return 0;
+}
+
+static int ls1x_dwmac_probe(struct platform_device *pdev)
+{
+     struct plat_stmmacenet_data *plat_dat;
+     struct stmmac_resources stmmac_res;
+     struct regmap *regmap;
+     struct ls1x_dwmac *dwmac;
+     int (*init)(struct platform_device *pdev, void *priv);
+     int ret;
+
+     ret = stmmac_get_platform_resources(pdev, &stmmac_res);
+     if (ret)
+             return ret;
+
+     /* Probe syscon */
+     regmap = syscon_regmap_lookup_by_phandle(pdev->dev.of_node,
+                                              "loongson,ls1-syscon");
+     if (IS_ERR(regmap))
+             return dev_err_probe(&pdev->dev, PTR_ERR(regmap),
+                                  "Unable to find syscon\n");
+
+     init = of_device_get_match_data(&pdev->dev);
+     if (!init) {

drivers/net/ethernet/stmicro/stmmac/dwmac-loongson1.c line 172

Quoted 10 lines
drivers/net/ethernet/stmicro/stmmac/dwmac-loongson1.c new file +9 -0
+             dev_err(&pdev->dev, "No of match data provided\n");
+             return -EINVAL;
+     }
+
+     dwmac = devm_kzalloc(&pdev->dev, sizeof(*dwmac), GFP_KERNEL);
+     if (!dwmac)
+             return -ENOMEM;
+
 
+     plat_dat = stmmac_probe_config_dt(pdev, stmmac_res.mac);

This can be replaced with devm_stmmac_probe_config_dt() and ...

drivers/net/ethernet/stmicro/stmmac/dwmac-loongson1.c line 182

Quoted 11 lines
drivers/net/ethernet/stmicro/stmmac/dwmac-loongson1.c new file +10 -0
+     if (IS_ERR(plat_dat))
+             return dev_err_probe(&pdev->dev, PTR_ERR(plat_dat),
+                                  "dt configuration failed\n");
+
+     plat_dat->bsp_priv = dwmac;
+     plat_dat->init = init;
+     dwmac->plat_dat = plat_dat;
+     dwmac->regmap = regmap;
+
 
+     ret = stmmac_pltfr_probe(pdev, plat_dat, &stmmac_res);

... this can be replaced with devm_stmmac_pltfr_probe() thus ...

drivers/net/ethernet/stmicro/stmmac/dwmac-loongson1.c line 191

Quoted 10 lines
drivers/net/ethernet/stmicro/stmmac/dwmac-loongson1.c new file +9 -0
+     if (ret)
+             goto err_remove_config_dt;
+
+     return 0;
+
 
+err_remove_config_dt:
+     stmmac_remove_config_dt(pdev, plat_dat);
+
+     return ret;

... this could have been omitted and ...

Quoted 17 lines
drivers/net/ethernet/stmicro/stmmac/dwmac-loongson1.c new file +17 -0
+}
+
+static const struct of_device_id ls1x_dwmac_match[] = {
+     {
+             .compatible = "loongson,ls1b-gmac",
+             .data = &ls1b_dwmac_syscon_init,
+     },
+     {
+             .compatible = "loongson,ls1c-emac",
+             .data = &ls1c_dwmac_syscon_init,
+     },
+     { }
+};
+MODULE_DEVICE_TABLE(of, ls1x_dwmac_match);
+
+static struct platform_driver ls1x_dwmac_driver = {
+     .probe = ls1x_dwmac_probe,
Quoted 4 lines
Quoted 1 line

+ .remove_new = stmmac_pltfr_remove,

... this could have been dropped.

Will do all the above changes.
Thanks!

Quoted 16 lines

-Serge(y)

Quoted 14 lines
drivers/net/ethernet/stmicro/stmmac/dwmac-loongson1.c new file +10 -1
+     .driver = {
+             .name = "loongson1-dwmac",
+             .of_match_table = ls1x_dwmac_match,
+     },
+};
+module_platform_driver(ls1x_dwmac_driver);
+
+MODULE_AUTHOR("Keguang Zhang <[email protected]>");
+MODULE_DESCRIPTION("Loongson-1 DWMAC glue layer");
+MODULE_LICENSE("GPL");
--

2.39.2

Signature · 3 lines
Best regards,

Keguang Zhang
author maintainer
#10 lore raw

PATCH v4 4/4 MAINTAINERS: Update MIPS/LOONGSON1 entry

In reply to Keguang Zhang

Add two new F: entries for Loongson1 Ethernet driver and dt-binding document.
Add a new F: entry for the rest Loongson-1 dt-binding documents.

---
V3 -> V4: Update the dt-binding document entry of Loongson1 Ethernet V2 -> V3: Update the entries and the commit message
V1 -> V2: Improve the commit message

 MAINTAINERS | 3 +++
 1 file changed, 3 insertions(+)
MAINTAINERS +3 -0
index ff1f273b4f36..2519d06b5aab 100644
@@ -14344,9 +14344,12 @@ MIPS/LOONGSON1 ARCHITECTURE
 M:	Keguang Zhang <[email protected]>
 L:	[email protected]
 S:	Maintained
+F:	Documentation/devicetree/bindings/*/loongson,ls1x-*.yaml
+F:	Documentation/devicetree/bindings/net/loongson,ls1*.yaml
 F:	arch/mips/include/asm/mach-loongson32/
 F:	arch/mips/loongson32/
 F:	drivers/*/*loongson1*
+F:	drivers/net/ethernet/stmicro/stmmac/dwmac-loongson1.c
 
 MIPS/LOONGSON2EF ARCHITECTURE
 M:	Jiaxun Yang <[email protected]>
Signature · 1 line
2.39.2
#11 lore raw

Re: [PATCH v4 4/4] MAINTAINERS: Update MIPS/LOONGSON1 entry

Hi,

Quoted 18 lines · Keguang Zhang

Add two new F: entries for Loongson1 Ethernet driver and dt-binding document.
Add a new F: entry for the rest Loongson-1 dt-binding documents.

---
V3 -> V4: Update the dt-binding document entry of Loongson1 Ethernet V2 -> V3: Update the entries and the commit message
V1 -> V2: Improve the commit message

  MAINTAINERS | 3 +++
  1 file changed, 3 insertions(+)
MAINTAINERS +0 -0
index ff1f273b4f36..2519d06b5aab 100644

MAINTAINERS MIPS/LOONGSON1 ARCHITECTURE · line 14348

Quoted 5 lines
MAINTAINERS +2 -0
@@ -14344,9 +14344,12 @@ MIPS/LOONGSON1 ARCHITECTURE
  M:	Keguang Zhang <[email protected]>
  L:	[email protected]
  S:	Maintained
+F:	Documentation/devicetree/bindings/*/loongson,ls1x-*.yaml
+F:	Documentation/devicetree/bindings/net/loongson,ls1*.yaml

Why not simply squash in patch 2

MAINTAINERS MIPS/LOONGSON1 ARCHITECTURE · line 14352

Quoted 4 lines
MAINTAINERS +1 -0
  F:	arch/mips/include/asm/mach-loongson32/
  F:	arch/mips/loongson32/
  F:	drivers/*/*loongson1*
+F:	drivers/net/ethernet/stmicro/stmmac/dwmac-loongson1.c

and 3 of this series?

Quoted 2 lines
MAINTAINERS +0 -0
  MIPS/LOONGSON2EF ARCHITECTURE
  M:	Jiaxun Yang <[email protected]>
author maintainer
#12 lore raw

Re: [PATCH v4 4/4] MAINTAINERS: Update MIPS/LOONGSON1 entry

Quoted 30 lines · Philippe Mathieu-Daudé

Hi,

Quoted 18 lines · Keguang Zhang

Add two new F: entries for Loongson1 Ethernet driver and dt-binding document.
Add a new F: entry for the rest Loongson-1 dt-binding documents.

---
V3 -> V4: Update the dt-binding document entry of Loongson1 Ethernet V2 -> V3: Update the entries and the commit message
V1 -> V2: Improve the commit message

  MAINTAINERS | 3 +++
  1 file changed, 3 insertions(+)
MAINTAINERS +0 -0
index ff1f273b4f36..2519d06b5aab 100644

MAINTAINERS MIPS/LOONGSON1 ARCHITECTURE · line 14348

Quoted 5 lines
MAINTAINERS +2 -0
@@ -14344,9 +14344,12 @@ MIPS/LOONGSON1 ARCHITECTURE
  M:  Keguang Zhang <[email protected]>
  L:  [email protected]
  S:  Maintained
+F:   Documentation/devicetree/bindings/*/loongson,ls1x-*.yaml
+F:   Documentation/devicetree/bindings/net/loongson,ls1*.yaml

Why not simply squash in patch 2

Quoted 6 lines

MAINTAINERS MIPS/LOONGSON1 ARCHITECTURE · line 14352

Quoted 4 lines
MAINTAINERS +1 -0
  F:  arch/mips/include/asm/mach-loongson32/
  F:  arch/mips/loongson32/
  F:  drivers/*/*loongson1*
+F:   drivers/net/ethernet/stmicro/stmmac/dwmac-loongson1.c

and 3 of this series?

Do you mean squashing patch 2 and patch 4 into one patch?

Quoted 4 lines
Quoted 3 lines
MAINTAINERS +0 -0
  MIPS/LOONGSON2EF ARCHITECTURE
  M:  Jiaxun Yang <[email protected]>
Signature · 3 lines
Best regards,

Keguang Zhang
#13 lore raw

Re: [PATCH v4 4/4] MAINTAINERS: Update MIPS/LOONGSON1 entry

Quoted 32 lines · Keguang Zhang
Quoted 30 lines · Philippe Mathieu-Daudé

Hi,

Quoted 18 lines · Keguang Zhang

Add two new F: entries for Loongson1 Ethernet driver and dt-binding document.
Add a new F: entry for the rest Loongson-1 dt-binding documents.

---
V3 -> V4: Update the dt-binding document entry of Loongson1 Ethernet V2 -> V3: Update the entries and the commit message
V1 -> V2: Improve the commit message

   MAINTAINERS | 3 +++
   1 file changed, 3 insertions(+)
MAINTAINERS +0 -0
index ff1f273b4f36..2519d06b5aab 100644

MAINTAINERS MIPS/LOONGSON1 ARCHITECTURE · line 14348

Quoted 5 lines
MAINTAINERS +2 -0
@@ -14344,9 +14344,12 @@ MIPS/LOONGSON1 ARCHITECTURE
   M:  Keguang Zhang <[email protected]>
   L:  [email protected]
   S:  Maintained
+F:   Documentation/devicetree/bindings/*/loongson,ls1x-*.yaml
+F:   Documentation/devicetree/bindings/net/loongson,ls1*.yaml

Why not simply squash in patch 2

Quoted 8 lines
Quoted 6 lines

MAINTAINERS MIPS/LOONGSON1 ARCHITECTURE · line 14352

Quoted 4 lines
MAINTAINERS +1 -0
   F:  arch/mips/include/asm/mach-loongson32/
   F:  arch/mips/loongson32/
   F:  drivers/*/*loongson1*
+F:   drivers/net/ethernet/stmicro/stmmac/dwmac-loongson1.c

and 3 of this series?

Do you mean squashing patch 2 and patch 4 into one patch?

No, simply modify MAINTAINERS at the same time you add the new files.

maintainer
#14 lore raw
In reply to Keguang Zhang
Quoted 63 lines · Keguang Zhang

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
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

Keguang Zhang (4):
dt-bindings: mfd: syscon: Add compatibles for Loongson-1 syscon
dt-bindings: net: Add Loongson-1 Ethernet Controller
net: stmmac: Add glue layer for Loongson-1 SoC
MAINTAINERS: Update MIPS/LOONGSON1 entry

 .../devicetree/bindings/mfd/syscon.yaml       |   2 +
 .../bindings/net/loongson,ls1b-gmac.yaml      | 114 +++++++++
 .../bindings/net/loongson,ls1c-emac.yaml      | 113 +++++++++
 MAINTAINERS                                   |   3 +
 drivers/net/ethernet/stmicro/stmmac/Kconfig   |  11 +
 drivers/net/ethernet/stmicro/stmmac/Makefile  |   1 +
 .../ethernet/stmicro/stmmac/dwmac-loongson1.c | 219 ++++++++++++++++++
 7 files changed, 463 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/net/loongson,ls1b-gmac.yaml
 create mode 100644 Documentation/devicetree/bindings/net/loongson,ls1c-emac.yaml
 create mode 100644 drivers/net/ethernet/stmicro/stmmac/dwmac-loongson1.c
Quoted 1 line

base-commit: 56585460cc2ec44fc5d66924f0a116f57080f0dc

I guess the whole series should go through the networking tree, but please note that net-next is currently closed:

---
## Form letter - net-next-closed

The merge window for v6.6 has begun and therefore net-next is closed for new drivers, features, code refactoring and optimizations. We are currently accepting bug fixes only.

Please repost when net-next reopens after Sept 11th.

RFC patches sent for review only are obviously welcome at any time.

See:
https://www.kernel.org/doc/html/next/process/maintainer-netdev.html#development-cycle