Skip to content

Commit

Permalink
Merge branch 'loongson1-mac'
Browse files Browse the repository at this point in the history
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 <davem@davemloft.net>
  • Loading branch information
David S. Miller committed Sep 16, 2023
2 parents 487e193 + d301c66 commit 2fa6175
Show file tree
Hide file tree
Showing 7 changed files with 452 additions and 0 deletions.
2 changes: 2 additions & 0 deletions Documentation/devicetree/bindings/mfd/syscon.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
114 changes: 114 additions & 0 deletions Documentation/devicetree/bindings/net/loongson,ls1b-gmac.yaml
Original file line number Diff line number Diff line change
@@ -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 <keguang.zhang@gmail.com>

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>;
};
};
};
113 changes: 113 additions & 0 deletions Documentation/devicetree/bindings/net/loongson,ls1c-emac.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
%YAML 1.2
---
$id: http://devicetree.org/schemas/net/loongson,ls1c-emac.yaml#
$schema: http://devicetree.org/meta-schemas/core.yaml#

title: Loongson-1C Ethernet MAC Controller

maintainers:
- Keguang Zhang <keguang.zhang@gmail.com>

description: |
Loongson-1C Ethernet MAC Controller is based on
Synopsys DesignWare MAC (version 3.50a).
Main features
- 10/100Mbps
- Full-duplex operation (IEEE 802.3x flow control automatic transmission)
- Half-duplex operation (CSMA/CD Protocol and back-pressure support)
- IEEE 802.1Q VLAN tag detection for reception frames
- MII interface
- RMII interface
select:
properties:
compatible:
contains:
enum:
- loongson,ls1c-emac
required:
- compatible

properties:
compatible:
items:
- enum:
- loongson,ls1c-emac
- 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
- rmii

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>
emac: ethernet@1fe10000 {
compatible = "loongson,ls1c-emac", "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@13 {
reg = <0x13>;
};
};
};
2 changes: 2 additions & 0 deletions MAINTAINERS
Original file line number Diff line number Diff line change
Expand Up @@ -14344,9 +14344,11 @@ MIPS/LOONGSON1 ARCHITECTURE
M: Keguang Zhang <keguang.zhang@gmail.com>
L: linux-mips@vger.kernel.org
S: Maintained
F: Documentation/devicetree/bindings/*/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 <jiaxun.yang@flygoat.com>
Expand Down
11 changes: 11 additions & 0 deletions drivers/net/ethernet/stmicro/stmmac/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions drivers/net/ethernet/stmicro/stmmac/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading

0 comments on commit 2fa6175

Please sign in to comment.