net: stmmac: add SL2610 ethernet support
Subsystems (7)
Jisheng Zhang
maintainercover net: stmmac: add SL2610 ethernet support
This series add SL2610 ethernet support. First of all, introduce the mdio demultiplexer, then add the stmmac glue layer, finally touch dts.
NOTE: this series depends on the sl2610 SoC support series which is still under review:
https://lore.kernel.org/linux-arm-kernel/[email protected]/
Jisheng Zhang (8):
dt-bindings: net: Add MDIO demultiplexer
net: mdio: Add MDIO demultiplexer driver
dt-bindings: net: Add Synaptics SL2610 DWMAC
net: stmmac: Add glue layer for Synaptics SL2610 SoC
dt-bindings: soc: synaptics: Allow SL2610 mux controller children
soc: synaptics: Populate SL2610 system controller DT children
arm64: dts: synaptics: Add SL2610 Ethernet nodes
arm64: dts: synaptics: Enable Ethernet on SL2619 RDK
.../devicetree/bindings/net/mdio-demux.yaml | 102 ++++++ .../devicetree/bindings/net/snps,dwmac.yaml | 1 + .../bindings/net/syna,sl2610-dwmac.yaml | 75 +++++ .../soc/synaptics/syna,sl2610-soc-syscon.yaml | 10 + MAINTAINERS | 2 + arch/arm64/boot/dts/synaptics/sl2611.dtsi | 41 +++ arch/arm64/boot/dts/synaptics/sl2619-rdk.dts | 77 +++++ arch/arm64/boot/dts/synaptics/sl2619.dtsi | 36 +++ drivers/net/ethernet/stmicro/stmmac/Kconfig | 11 + drivers/net/ethernet/stmicro/stmmac/Makefile | 1 + .../net/ethernet/stmicro/stmmac/dwmac-syna.c | 116 +++++++ drivers/net/mdio/Kconfig | 12 + drivers/net/mdio/Makefile | 1 + drivers/net/mdio/mdio-demux.c | 298 ++++++++++++++++++ drivers/soc/synaptics/sl2610-syscon.c | 10 +- 15 files changed, 791 insertions(+), 2 deletions(-) create mode 100644 Documentation/devicetree/bindings/net/mdio-demux.yaml create mode 100644 Documentation/devicetree/bindings/net/syna,sl2610-dwmac.yaml create mode 100644 drivers/net/ethernet/stmicro/stmmac/dwmac-syna.c create mode 100644 drivers/net/mdio/mdio-demux.c
Signature · 1 line
2.55.0
Jisheng Zhang
maintainerPATCH 1/8 dt-bindings: net: Add MDIO demultiplexer
Assume we have the following implementation:
----------
|mmio reg|
----------
|
-------- | -------
| MAC0 |--MDIO-----| PHY |
-------- | | -------
| |
-------- | | -------
| MAC1 |-- ----| PHY |
-------- -------Both MAC0 and MAC1 have MDIO bus masters, and tie together to a single set of clock and data lines, which go to some PHYs. While there's a mmio reg to control which MAC mdio master can operate the single mdio clock and data lines, so only one MAC can operate the mdio clock and data lines.
We also need to fully support three use cases: only MAC0 + PHY is used on board; only MAC1 + PHY is used on board; MAC0 + MAC1 + PHYs are all used.
To support this kind of usage, we need a kind of mdio demuxer. This patch add the dt-bindings doc.
--- .../devicetree/bindings/net/mdio-demux.yaml | 102 ++++++++++++++++++ 1 file changed, 102 insertions(+) create mode 100644 Documentation/devicetree/bindings/net/mdio-demux.yaml
Documentation/devicetree/bindings/net/mdio-demux.yaml new file +102 -0
@@ -0,0 +1,102 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/net/mdio-demux.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: MDIO bus demultiplexer with multiple parent controllers + +maintainers: + - Andrew Lunn <[email protected]> + +description: | + An MDIO demultiplexer connects multiple independent MDIO controllers to + one physical set of MDIO signals. The mux control selects the parent + controller used by each child bus. Child buses and their parent buses + are listed in matching order: the first child uses the first parent, + and so on. The child's reg value is passed to the mux controller as + the state to select for that parent. + +properties: + compatible: + const: mdio-demux + + mux-controls: + maxItems: 1 + + mdio-parent-bus: + $ref: /schemas/types.yaml#/definitions/phandle-array + minItems: 1 + maxItems: 2 + items: + maxItems: 1 + description: + Phandles to parent MDIO controllers, in the same order as the child + buses. + + '#address-cells': + const: 1 + + '#size-cells': + const: 0 + +patternProperties: + '^mdio@[0-9a-f]+$': + $ref: /schemas/net/mdio.yaml# + unevaluatedProperties: false + properties: + reg: + maxItems: 1 + +required: + - compatible + - mux-controls + - mdio-parent-bus + - '#address-cells' + - '#size-cells' + +additionalProperties: false + +examples: + - | + /* MDIO buses registered by two Ethernet MACs. */ + mac0_mdio: mdio-0 { + #address-cells = <1>; + #size-cells = <0>; + }; + + mac1_mdio: mdio-1 { + #address-cells = <1>; + #size-cells = <0>; + }; + + mux: mux-controller { + compatible = "reg-mux"; + #mux-control-cells = <1>; + mux-reg-masks = <0x4 0x10>; + }; + + mdio-demux { + compatible = "mdio-demux"; + mux-controls = <&mux 0>; + mdio-parent-bus = <&mac0_mdio>, <&mac1_mdio>; + #address-cells = <1>; + #size-cells = <0>; + + mdio@0 { + reg = <0>; + #address-cells = <1>; + #size-cells = <0>; + + ethernet-phy@1 { + reg = <1>; + }; + }; + + mdio@1 { + reg = <1>; + #address-cells = <1>; + #size-cells = <0>; + }; + }; +...
Signature · 1 line
2.55.0
Jisheng Zhang
maintainerPATCH 2/8 net: mdio: Add MDIO demultiplexer driver
In reply to Jisheng ZhangAssume we have the following implementation:
----------
|mmio reg|
----------
|
-------- | -------
| MAC0 |--MDIO-----| PHY |
-------- | | -------
| |
-------- | | -------
| MAC1 |-- ----| PHY |
-------- -------Both MAC0 and MAC1 have MDIO bus masters, and tie together to a single set of clock and data lines, which go to some PHYs. While there's a mmio reg to control which MAC mdio master can operate the single mdio clock and data lines, so only one MAC can operate the mdio clock and data lines.
We also need to fully support three use cases: only MAC0 + PHY is used on board; only MAC1 + PHY is used on board; MAC0 + MAC1 + PHYs are all used.
To support this kind of usage, we need a kind of mdio demuxer. This patch add the driver code.
--- drivers/net/mdio/Kconfig | 12 ++ drivers/net/mdio/Makefile | 1 + drivers/net/mdio/mdio-demux.c | 298 ++++++++++++++++++++++++++++++++++ 3 files changed, 311 insertions(+) create mode 100644 drivers/net/mdio/mdio-demux.c
drivers/net/mdio/Kconfig +12 -0
@@ -289,5 +289,17 @@ config MDIO_BUS_MUX_MMIOREG Currently, only 8/16/32 bits registers are supported. +config MDIO_BUS_DEMUX + tristate "MDIO bus demultiplexer" + depends on OF_MDIO + select MULTIPLEXER + help + This driver provides child MDIO buses backed by separate parent + MDIO buses. A shared mux control selects which parent bus is + connected to the physical MDIO lines for each transaction. + + To compile this driver as a module, choose M here. The module + will be called mdio-demux. + endmenu endmenu
drivers/net/mdio/Makefile +1 -0
@@ -35,3 +35,4 @@ obj-$(CONFIG_MDIO_BUS_MUX_MESON_G12A) += mdio-mux-meson-g12a.o obj-$(CONFIG_MDIO_BUS_MUX_MESON_GXL) += mdio-mux-meson-gxl.o obj-$(CONFIG_MDIO_BUS_MUX_MMIOREG) += mdio-mux-mmioreg.o obj-$(CONFIG_MDIO_BUS_MUX_MULTIPLEXER) += mdio-mux-multiplexer.o +obj-$(CONFIG_MDIO_BUS_DEMUX) += mdio-demux.o
drivers/net/mdio/mdio-demux.c new file +298 -0
298 lines not on this page · raw message
Signature · 1 line
2.55.0
Jisheng Zhang
maintainerPATCH 3/8 dt-bindings: net: Add Synaptics SL2610 DWMAC
In reply to Jisheng ZhangDescribe the Synaptics SL2610 integration of the Synopsys DWMAC 5.20. The PHY interface mode is selected through a system-controller register, identified by a syscon phandle and register offset.
Restrict PHY modes to the RMII and RGMII variants supported by the glue and extend the common DWMAC compatible list for the new integration.
--- .../devicetree/bindings/net/snps,dwmac.yaml | 1 + .../bindings/net/syna,sl2610-dwmac.yaml | 75 +++++++++++++++++++ 2 files changed, 76 insertions(+) create mode 100644 Documentation/devicetree/bindings/net/syna,sl2610-dwmac.yaml
Documentation/devicetree/bindings/net/snps,dwmac.yaml +1 -0
@@ -119,6 +119,7 @@ properties: - sophgo,sg2044-dwmac - starfive,jh7100-dwmac - starfive,jh7110-dwmac + - syna,sl2610-dwmac - tesla,fsd-ethqos - thead,th1520-gmac - ultrarisc,dp1000-gmac
Documentation/devicetree/bindings/net/syna,sl2610-dwmac.yaml new file +75 -0
75 lines not on this page · raw message
Signature · 1 line
2.55.0
Jisheng Zhang
maintainerPATCH 4/8 net: stmmac: Add glue layer for Synaptics SL2610 SoC
In reply to Jisheng ZhangAdd dwmac glue driver to support the DesignWare-based GMAC controllers in the Synaptics SL2610 SoC.
--- MAINTAINERS | 2 + drivers/net/ethernet/stmicro/stmmac/Kconfig | 11 ++ drivers/net/ethernet/stmicro/stmmac/Makefile | 1 + .../net/ethernet/stmicro/stmmac/dwmac-syna.c | 116 ++++++++++++++++++ 4 files changed, 130 insertions(+) create mode 100644 drivers/net/ethernet/stmicro/stmmac/dwmac-syna.c
MAINTAINERS +2 -0
@@ -3808,12 +3808,14 @@ M: Jisheng Zhang <[email protected]> M: Sebastian Hesselbarth <[email protected]> L: [email protected] (moderated for non-subscribers) S: Maintained +F: Documentation/devicetree/bindings/net/syna,sl2610-dwmac.yaml F: Documentation/devicetree/bindings/soc/synaptics/ F: arch/arm/boot/dts/synaptics/ F: arch/arm/mach-berlin/ F: arch/arm64/boot/dts/synaptics/ F: drivers/clk/berlin/*sl2610* F: drivers/clk/berlin/sl-* +F: drivers/net/ethernet/stmicro/stmmac/dwmac-syna.c F: drivers/pinctrl/berlin/pinctrl-sl2610.c F: drivers/reset/reset-sl2610.c F: drivers/soc/synaptics/
drivers/net/ethernet/stmicro/stmmac/Kconfig +11 -0
@@ -310,6 +310,17 @@ config DWMAC_SUN55I stmmac device driver. This driver is used for A523/T527 GMAC200 ethernet controller. +config DWMAC_SYNA + tristate "Synaptics SL2610 DWMAC support" + depends on OF && HAS_DMA && (ARCH_BERLIN || COMPILE_TEST) + select MFD_SYSCON + help + Support for the Synaptics SL2610 DesignWare Ethernet MAC glue. + This configures the PHY interface through the system controller. + + To compile this driver as a module, choose M here. The module + will be called dwmac-syna. + config DWMAC_THEAD tristate "T-HEAD dwmac support" depends on OF && (ARCH_THEAD || COMPILE_TEST)
drivers/net/ethernet/stmicro/stmmac/Makefile +1 -0
@@ -35,6 +35,7 @@ obj-$(CONFIG_DWMAC_STM32) += dwmac-stm32.o obj-$(CONFIG_DWMAC_SUNXI) += dwmac-sunxi.o obj-$(CONFIG_DWMAC_SUN8I) += dwmac-sun8i.o obj-$(CONFIG_DWMAC_SUN55I) += dwmac-sun55i.o +obj-$(CONFIG_DWMAC_SYNA) += dwmac-syna.o obj-$(CONFIG_DWMAC_THEAD) += dwmac-thead.o obj-$(CONFIG_DWMAC_ULTRARISC) += dwmac-ultrarisc.o obj-$(CONFIG_DWMAC_DWC_QOS_ETH) += dwmac-dwc-qos-eth.o
drivers/net/ethernet/stmicro/stmmac/dwmac-syna.c new file +116 -0
116 lines not on this page · raw message
Signature · 1 line
2.55.0
Jisheng Zhang
maintainerPATCH 5/8 dt-bindings: soc: synaptics: Allow SL2610 mux controller children
In reply to Jisheng ZhangThe SL2610 system controller includes selector fields for routing shared peripheral signals. Allow a mux-controller child using the register mux binding and show the shared MDIO master selector in the example.
--- .../bindings/soc/synaptics/syna,sl2610-soc-syscon.yaml | 10 ++++++++++ 1 file changed, 10 insertions(+)
Documentation/devicetree/bindings/soc/synaptics/syna,sl2610-soc-syscon.yaml +10 -0
@@ -45,6 +45,10 @@ properties: $ref: /schemas/types.yaml#/definitions/phandle description: Phandle to the SoC system control registers for CPU PLL bypass. + mux-controller: + $ref: /schemas/mux/reg-mux.yaml# + description: Selector fields in the system control registers. + patternProperties: '-(pmux|pins)$': type: object
@@ -136,6 +140,12 @@ examples: #clock-cells = <1>; #reset-cells = <1>; + mux-controller { + compatible = "mmio-mux"; + #mux-control-cells = <1>; + mux-reg-masks = <0xa04 0x10>; + }; + i2c2-pmux { groups = "GPIO23", "GPIO24"; function = "tw2";
Signature · 1 line
2.55.0
Jisheng Zhang
maintainerPATCH 6/8 soc: synaptics: Populate SL2610 system controller DT children
In reply to Jisheng ZhangThe SL2610 system controller currently creates only its fixed clock, reset and pinctrl MFD devices. DT children such as the MDIO mmio-mux therefore never become platform devices, leaving their consumers in deferred probe indefinitely.
Populate enabled DT children after adding the MFD devices. Use the managed helper to remove these children before the MFD devices during teardown and probe-error cleanup.
--- drivers/soc/synaptics/sl2610-syscon.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-)
drivers/soc/synaptics/sl2610-syscon.c +8 -2
@@ -6,6 +6,7 @@#include <linux/mfd/core.h> #include <linux/module.h> #include <linux/of.h> +#include <linux/of_platform.h> #include <linux/platform_device.h> struct sl2610_syscon_data {
@@ -56,9 +57,14 @@ static const struct sl2610_syscon_data sl2610_cpu_data = {static int sl2610_syscon_probe (struct platform_device *pdev) {const struct sl2610_syscon_data *data =device_get_match_data (&pdev->dev); +int ret; -return devm_mfd_add_devices (&pdev->dev,PLATFORM_DEVID_AUTO , - data->cells, data->num_cells,NULL ,0 ,NULL ); + ret =devm_mfd_add_devices (&pdev->dev,PLATFORM_DEVID_AUTO , + data->cells, data->num_cells,NULL ,0 ,NULL ); +if (ret) +return ret; + +return devm_of_platform_populate (&pdev->dev); }static const struct of_device_id sl2610_syscon_of_match[] = {
Signature · 1 line
2.55.0
Jisheng Zhang
maintainerPATCH 7/8 arm64: dts: synaptics: Add SL2610 Ethernet nodes
In reply to Jisheng ZhangAdd the first DWMAC controller in the common SL2611 dtsi, then add the second controller for SL2619, including interrupts, clocks, PHY interface control offsets, queues and AXI burst configuration.
Add the shared MDIO master selector as an mmio-mux child of the global system controller. Leave the MACs and selector disabled for boards to enable according to their wiring.
--- arch/arm64/boot/dts/synaptics/sl2611.dtsi | 41 +++++++++++++++++++++++ arch/arm64/boot/dts/synaptics/sl2619.dtsi | 36 ++++++++++++++++++++ 2 files changed, 77 insertions(+)
arch/arm64/boot/dts/synaptics/sl2611.dtsi +41 -0
@@ -281,12 +281,53 @@ aioclk: aviogbl: syscon@f7490000 { clocks = <&osc>; }; + ethernet0: ethernet@f7a04000 { + compatible = "syna,sl2610-dwmac", "snps,dwmac-5.20"; + reg = <0xf7a04000 0x2000>; + interrupts = <GIC_SPI 15 IRQ_TYPE_LEVEL_HIGH>; + interrupt-names = "macirq"; + clocks = <&clk CLK_GETHRGMII>, + <&clk CLK_GETHRGMIISYS>, <&clk CLK_GE0_PTP_REF>; + clock-names = "stmmaceth", "pclk", "ptp_ref"; + snps,axi-config = <&stmmac_axi_config_0>; + snps,mixed-burst; + snps,mtl-rx-config = <&mtl_rx_setup_0>; + snps,mtl-tx-config = <&mtl_tx_setup_0>; + snps,pbl = <32>; + syna,syscon = <&chip 0xa18>; + status = "disabled"; + + mtl_rx_setup_0: rx-queues-config { + snps,rx-queues-to-use = <1>; + queue0 {}; + }; + + mtl_tx_setup_0: tx-queues-config { + snps,tx-queues-to-use = <2>; + queue0 {}; + queue1 {}; + }; + + stmmac_axi_config_0: stmmac-axi-config { + snps,blen = <256 128 64 32 0 0 0>; + snps,rd_osr_lmt = <0x7>; + snps,wr_osr_lmt = <0x7>; + }; + }; + clk: pinctrl: rst: chip: syscon@f7e10000 { compatible = "syna,sl2610-soc-syscon", "syscon"; reg = <0xf7e10000 0x10000>; #clock-cells = <1>; #reset-cells = <1>; clocks = <&osc>; + + mux1: mux-controller { + compatible = "mmio-mux"; + #mux-control-cells = <1>; + mux-reg-masks = <0xa04 0x10>; + status = "disabled"; + }; }; cpuclk: cpu_wrap: syscon@f7e30000 {
arch/arm64/boot/dts/synaptics/sl2619.dtsi +36 -0
@@ -41,4 +41,40 @@ pmu { interrupt-affinity = <&cpu0>, <&cpu1>; }; + + soc { + ethernet1: ethernet@f7a06000 { + compatible = "syna,sl2610-dwmac", "snps,dwmac-5.20"; + reg = <0xf7a06000 0x2000>; + interrupts = <GIC_SPI 16 IRQ_TYPE_LEVEL_HIGH>; + interrupt-names = "macirq"; + clocks = <&clk CLK_GETHRGMII1>, + <&clk CLK_GETHRGMII1SYS>, <&clk CLK_GE1_PTP_REF>; + clock-names = "stmmaceth", "pclk", "ptp_ref"; + snps,axi-config = <&stmmac_axi_config_1>; + snps,mixed-burst; + snps,mtl-rx-config = <&mtl_rx_setup_1>; + snps,mtl-tx-config = <&mtl_tx_setup_1>; + snps,pbl = <32>; + syna,syscon = <&chip 0xa3c>; + status = "disabled"; + + mtl_rx_setup_1: rx-queues-config { + snps,rx-queues-to-use = <1>; + queue0 {}; + }; + + mtl_tx_setup_1: tx-queues-config { + snps,tx-queues-to-use = <2>; + queue0 {}; + queue1 {}; + }; + + stmmac_axi_config_1: stmmac-axi-config { + snps,blen = <256 128 64 32 0 0 0>; + snps,rd_osr_lmt = <0x7>; + snps,wr_osr_lmt = <0x7>; + }; + }; + }; };
Signature · 1 line
2.55.0
Jisheng Zhang
maintainerPATCH 8/8 arm64: dts: synaptics: Enable Ethernet on SL2619 RDK
In reply to Jisheng ZhangThe SL2619 RDK uses the second MAC with an external RGMII PHY at MDIO address 2. Enable the MAC, its pin configuration and the shared MDIO selector. Describe the PHY reset GPIO and timing on the demultiplexed bus selecting the second MDIO master.
--- arch/arm64/boot/dts/synaptics/sl2619-rdk.dts | 77 ++++++++++++++++++++ 1 file changed, 77 insertions(+)
arch/arm64/boot/dts/synaptics/sl2619-rdk.dts +77 -0
@@ -13,4 +13,81 @@ / { model = "Synaptics SL2619 RDK"; compatible = "syna,sl2619-rdk", "syna,sl2619"; + + aliases { + ethernet0 = ðernet1; + ethernet1 = ðernet0; + }; + + mdio-demux { + compatible = "mdio-demux"; + mdio-parent-bus = <&mdio1>; + mux-controls = <&mux1 0>; + #address-cells = <1>; + #size-cells = <0>; + + mdio@1 { + reg = <0x1>; + #address-cells = <1>; + #size-cells = <0>; + + ethernet_phy1: ethernet-phy@2 { + compatible = "ethernet-phy-id001c.c916"; + reg = <2>; + pinctrl-0 = <ð1_phy_rst_pmux>; + pinctrl-names = "default"; + realtek,clkout-disable; + reset-assert-us = <20000>; + reset-deassert-us = <100000>; + reset-gpios = <&portf 3 GPIO_ACTIVE_HIGH>; + }; + }; + }; +}; + +&sm_pinctrl { + eth1_phy_rst_pmux: eth1_phy_rst-pmux { + groups = "SM_GPIO35"; + function = "gpio"; + }; +}; + +&pinctrl { + eth_mdio_pmux: eth-mdio-pmux { + groups = "GPIO31", "GPIO32"; + function = "rgmii"; + drive-strength = <7>; + }; + + eth1_tx_pmux: eth1_tx-pmux { + groups = "GPIO48", "GPIO49", "GPIO50", "GPIO51", "GPIO57", "GPIO58"; + function = "rgmii2"; + drive-strength = <10>; + input-disable; + bias-disable; + }; + + eth1_rx_pmux: eth1_rx-pmux { + groups = "GPIO52", "GPIO53", "GPIO54", "GPIO55", "GPIO56", "GPIO59"; + function = "rgmii2"; + drive-strength = <7>; + }; +}; + +&mux1 { + status = "okay"; +}; + +ðernet1 { + status = "okay"; + pinctrl-0 = <ð_mdio_pmux>, <ð1_tx_pmux>, <ð1_rx_pmux>; + pinctrl-names = "default"; + phy-handle = <ðernet_phy1>; + phy-mode = "rgmii-id"; + + mdio1: mdio { + compatible = "snps,dwmac-mdio"; + #address-cells = <1>; + #size-cells = <0>; + }; };
Signature · 1 line
2.55.0
Andrew Lunn
maintainerRe: [PATCH 1/8] dt-bindings: net: Add MDIO demultiplexer
In reply to Jisheng ZhangQuoted 13 lines · Jisheng Zhang
Assume we have the following implementation:
---------- |mmio reg| ---------- | -------- | ------- | MAC0 |--MDIO-----| PHY | -------- | | ------- | | -------- | | ------- | MAC1 |-- ----| PHY | -------- -------
Quoted 5 lines
Both MAC0 and MAC1 have MDIO bus masters, and tie together to a single set of clock and data lines, which go to some PHYs. While there's a mmio reg to control which MAC mdio master can operate the single mdio clock and data lines, so only one MAC can operate the mdio clock and data lines.
How does this differ from pinmux?
Andrew
Jisheng Zhang
maintainerRe: [PATCH 1/8] dt-bindings: net: Add MDIO demultiplexer
Quoted 14 lines · Andrew Lunn
Quoted 13 lines · Jisheng Zhang
Assume we have the following implementation:
---------- |mmio reg| ---------- | -------- | ------- | MAC0 |--MDIO-----| PHY | -------- | | ------- | | -------- | | ------- | MAC1 |-- ----| PHY | -------- -------
Quoted 8 lines
Quoted 5 lines
Both MAC0 and MAC1 have MDIO bus masters, and tie together to a single set of clock and data lines, which go to some PHYs. While there's a mmio reg to control which MAC mdio master can operate the single mdio clock and data lines, so only one MAC can operate the mdio clock and data lines.
How does this differ from pinmux?
in my case, the two MAC MDIO bus masters share the same MDC and MDIO pins.
Andrew Lunn
maintainerRe: [PATCH 1/8] dt-bindings: net: Add MDIO demultiplexer
Quoted 21 lines · Jisheng Zhang
Quoted 20 lines · Andrew Lunn
Quoted 18 lines · Jisheng Zhang
Assume we have the following implementation:
---------- |mmio reg| ---------- | -------- | ------- | MAC0 |--MDIO-----| PHY | -------- | | ------- | | -------- | | ------- | MAC1 |-- ----| PHY | -------- -------Both MAC0 and MAC1 have MDIO bus masters, and tie together to a single set of clock and data lines, which go to some PHYs. While there's a mmio reg to control which MAC mdio master can operate the single mdio clock and data lines, so only one MAC can operate the mdio clock and data lines.
Quoted 5 lines
Quoted 2 lines
How does this differ from pinmux?
in my case, the two MAC MDIO bus masters share the same MDC and MDIO pins.
That does not answer my question. How is this different to pinmux?
Andrew
---
pw-bot: cr
Jisheng Zhang
maintainerRe: [PATCH 1/8] dt-bindings: net: Add MDIO demultiplexer
Quoted 22 lines · Andrew Lunn
Quoted 21 lines · Jisheng Zhang
Quoted 20 lines · Andrew Lunn
Quoted 18 lines · Jisheng Zhang
Assume we have the following implementation:
---------- |mmio reg| ---------- | -------- | ------- | MAC0 |--MDIO-----| PHY | -------- | | ------- | | -------- | | ------- | MAC1 |-- ----| PHY | -------- -------Both MAC0 and MAC1 have MDIO bus masters, and tie together to a single set of clock and data lines, which go to some PHYs. While there's a mmio reg to control which MAC mdio master can operate the single mdio clock and data lines, so only one MAC can operate the mdio clock and data lines.
Quoted 7 lines
Quoted 5 lines
Quoted 2 lines
How does this differ from pinmux?
in my case, the two MAC MDIO bus masters share the same MDC and MDIO pins.
That does not answer my question. How is this different to pinmux?
Let me explain the HW in details:
The pad have their own pinmux configuation, which selects the MDC/MDIO fucntion instead of GPIO or another perif function. That pad configuration stays MDC/MDIO, I.E unchanged.
The register discussed here is a separate selector between the two MACs' MDIO controllers. With the pads already configured for MDC/MDIO, it choose whether MAC0 or MAC1 drives the MDC and MDIO.
So the proposed demux controls this internal selector and serializes selection plus the complete MDIO transaction across both MDIO controllers.
Would you prefer model the selector as pinctrl states, with an MDIO demux selecting the appropriate state under a shared lock before each transaction?
Thanks
Andrew Lunn
maintainerRe: [PATCH 1/8] dt-bindings: net: Add MDIO demultiplexer
Quoted 40 lines · Jisheng Zhang
Quoted 22 lines · Andrew Lunn
Quoted 21 lines · Jisheng Zhang
Quoted 20 lines · Andrew Lunn
Quoted 18 lines · Jisheng Zhang
Assume we have the following implementation:
---------- |mmio reg| ---------- | -------- | ------- | MAC0 |--MDIO-----| PHY | -------- | | ------- | | -------- | | ------- | MAC1 |-- ----| PHY | -------- -------Both MAC0 and MAC1 have MDIO bus masters, and tie together to a single set of clock and data lines, which go to some PHYs. While there's a mmio reg to control which MAC mdio master can operate the single mdio clock and data lines, so only one MAC can operate the mdio clock and data lines.
Quoted 7 lines
Quoted 5 lines
Quoted 2 lines
How does this differ from pinmux?
in my case, the two MAC MDIO bus masters share the same MDC and MDIO pins.
That does not answer my question. How is this different to pinmux?
Let me explain the HW in details:
The pad have their own pinmux configuation, which selects the MDC/MDIO fucntion instead of GPIO or another perif function. That pad configuration stays MDC/MDIO, I.E unchanged.The register discussed here is a separate selector between the two MACs' MDIO controllers. With the pads already configured for MDC/MDIO, it choose whether MAC0 or MAC1 drives the MDC and MDIO.
Quoted 7 lines
So the proposed demux controls this internal selector and serializes selection plus the complete MDIO transaction across both MDIO controllers.
Would you prefer model the selector as pinctrl states, with an MDIO demux selecting the appropriate state under a shared lock before each transaction?
Each transaction?
Are you proposing to use both MDIO bus master? Why? To the outside world, it is one MDIO bus, so you only need one active MDIO bus master. All the PHYs are then on that one bus.
I would let the DT pinctrl node connect one MDIO bus master to the outside world, and that is all you need.
I've no idea if you can stack pinmux drivers. You might want to reach out to Linus Walleij. But this is basically a pinmux problem, there is nothing specific to MDIO here.
Andrew
Jisheng Zhang
maintainerRe: [PATCH 1/8] dt-bindings: net: Add MDIO demultiplexer
Quoted 45 lines · Andrew Lunn
Quoted 44 lines · Jisheng Zhang
Quoted 22 lines · Andrew Lunn
Quoted 21 lines · Jisheng Zhang
Quoted 20 lines · Andrew Lunn
Quoted 18 lines · Jisheng Zhang
Assume we have the following implementation:
---------- |mmio reg| ---------- | -------- | ------- | MAC0 |--MDIO-----| PHY | -------- | | ------- | | -------- | | ------- | MAC1 |-- ----| PHY | -------- -------Both MAC0 and MAC1 have MDIO bus masters, and tie together to a single set of clock and data lines, which go to some PHYs. While there's a mmio reg to control which MAC mdio master can operate the single mdio clock and data lines, so only one MAC can operate the mdio clock and data lines.
Quoted 7 lines
Quoted 5 lines
Quoted 2 lines
How does this differ from pinmux?
in my case, the two MAC MDIO bus masters share the same MDC and MDIO pins.
That does not answer my question. How is this different to pinmux?
Let me explain the HW in details:
The pad have their own pinmux configuation, which selects the MDC/MDIO fucntion instead of GPIO or another perif function. That pad configuration stays MDC/MDIO, I.E unchanged.The register discussed here is a separate selector between the two MACs' MDIO controllers. With the pads already configured for MDC/MDIO, it choose whether MAC0 or MAC1 drives the MDC and MDIO.
So the proposed demux controls this internal selector and serializes selection plus the complete MDIO transaction across both MDIO controllers.
Quoted 8 lines
Quoted 3 lines
Would you prefer model the selector as pinctrl states, with an MDIO demux selecting the appropriate state under a shared lock before each transaction?
Each transaction?
Are you proposing to use both MDIO bus master? Why? To the outside world, it is one MDIO bus, so you only need one active MDIO bus
Yep, both MDIO bus masters. I wanted to let each MAC uses its own MDIO rather than disturbe another MAC for dual MACs case. But now it looks like a over-designed solution.
Quoted 4 lines
master. All the PHYs are then on that one bus.
I would let the DT pinctrl node connect one MDIO bus master to the outside world, and that is all you need.
What about coping with the selector in sl2610 stmmac glue layer? I.E use the presence of the mdio child node to identify the provider.
For dual MACs case:
ðernet0 {
phy-phandle = <&phy0>;
};ðernet1 {
phy-phandle = <&phy1>;
mdio {
...
phy0: ethernet-phy@1 {
reg = <1>;
...
};
phy1: ethernet-phy@2 {
reg = <2>;
...
};
};
};For single MAC case, it should be as simple as coding the selector to let itself act as the provider.
This way looks simpler than modeling it as pinctrl. what do you think?
Andrew Lunn
maintainerRe: [PATCH 1/8] dt-bindings: net: Add MDIO demultiplexer
Quoted 7 lines
Quoted 4 lines
Each transaction?
Are you proposing to use both MDIO bus master? Why? To the outside world, it is one MDIO bus, so you only need one active MDIO bus
Yep, both MDIO bus masters. I wanted to let each MAC uses its own MDIO rather than disturbe another MAC for dual MACs case.
How does this actually work? Each bus master sees each PHY. So one hardware device is represented twice in Linux. Bad things are then going to happen.
As i said, the outside world has one bus. So you need one MDIO bus master. This is nothing new, the FEC has been doing this for a decade.
Andrew
Jisheng Zhang
maintainerRe: [PATCH 1/8] dt-bindings: net: Add MDIO demultiplexer
Quoted 9 lines · Andrew Lunn
Quoted 7 lines
Quoted 4 lines
Each transaction?
Are you proposing to use both MDIO bus master? Why? To the outside world, it is one MDIO bus, so you only need one active MDIO bus
Yep, both MDIO bus masters. I wanted to let each MAC uses its own MDIO rather than disturbe another MAC for dual MACs case.
How does this actually work? Each bus master sees each PHY. So one
This could work since the demux serializes two masters' access + only point to one phy phandle in one mac's DT node.
Quoted 4 lines
hardware device is represented twice in Linux. Bad things are then going to happen.
As i said, the outside world has one bus. So you need one MDIO bus
Yep, I will switch to one MDIO bus solution by coping with the selector in the sl2610 stmmac glue driver. A sample dts for dual MACs case has been shown in last email.
Andrew Lunn
maintainerRe: [PATCH 1/8] dt-bindings: net: Add MDIO demultiplexer
Quoted 6 lines · Jisheng Zhang
Quoted 5 lines · Andrew Lunn
Quoted 5 lines
Quoted 4 lines
Each transaction?
Are you proposing to use both MDIO bus master? Why? To the outside world, it is one MDIO bus, so you only need one active MDIO bus
Quoted 7 lines
Quoted 4 lines
Quoted 2 lines
Yep, both MDIO bus masters. I wanted to let each MAC uses its own MDIO rather than disturbe another MAC for dual MACs case.
How does this actually work? Each bus master sees each PHY. So one
This could work since the demux serializes two masters' access + only point to one phy phandle in one mac's DT node.
And it all blows up when you don't use DT, or the MDIO node is missing and of_mdiobus_register() falls back to mdiobus_register() which scans all the devices on the bus.
Quoted 2 lines
Yep, I will switch to one MDIO bus solution by coping with the selector in the sl2610 stmmac glue driver.
Good.
Andrew
Re: [PATCH 5/8] dt-bindings: soc: synaptics: Allow SL2610 mux controller children
In reply to Jisheng ZhangQuoted 6 lines · Jisheng Zhang
The SL2610 system controller includes selector fields for routing shared peripheral signals. Allow a mux-controller child using the register mux binding and show the shared MDIO master selector in the example.
Signed-off-by Jisheng Zhang <[email protected]>Assisted-by LLM
Please run scripts/checkpatch.pl on the patches and fix reported warnings. After that, run also 'scripts/checkpatch.pl --strict' on the patches and (probably) fix more warnings. Some warnings can be ignored, especially from --strict run, but the code here looks like it needs a fix. Feel free to get in touch if the warning is not clear.
Quoted 2 lines
--- .../bindings/soc/synaptics/syna,sl2610-soc-syscon.yaml | 10 ++++++++++
There is no such file, which means you are fixing in-flight patches. Squash it with in-flight patches instead so we see entire picture.
Best regards,
Krzysztof
Re: [PATCH 3/8] dt-bindings: net: Add Synaptics SL2610 DWMAC
In reply to Jisheng ZhangDocumentation/devicetree/bindings/net/syna,sl2610-dwmac.yaml line 45
Quoted 7 lines · Jisheng Zhang
Documentation/devicetree/bindings/net/syna,sl2610-dwmac.yaml new file +7
-0+ phy-mode: + enum: + - rmii + - rgmii + - rgmii-id + - rgmii-rxid + - rgmii-txid
Missing constraints for interrupts, clocks, resets, domains and so on.
Quoted 10 lines
Documentation/devicetree/bindings/net/syna,sl2610-dwmac.yaml new file +10
-0+ +required: + - compatible + - syna,syscon + - phy-mode + +unevaluatedProperties: false + +examples: + - |
Documentation/devicetree/bindings/net/syna,sl2610-dwmac.yaml line 65
Quoted 10 lines
Documentation/devicetree/bindings/net/syna,sl2610-dwmac.yaml new file +10
-0+ #include <dt-bindings/interrupt-controller/arm-gic.h> + #include <dt-bindings/interrupt-controller/irq.h> + + chip: syscon@f7e10000 { + compatible = "syna,sl2610-soc-syscon", "syscon"; + reg = <0xf7e10000 0x10000>; + clocks = <&osc>; + #clock-cells = <1>; + #reset-cells = <1>; + };
Not relevant, drop entire node.
Best regards,
Krzysztof
Maxime Chevallier
maintainerRe: [PATCH 4/8] net: stmmac: Add glue layer for Synaptics SL2610 SoC
In reply to Jisheng ZhangHi,
Quoted 83 lines · Jisheng Zhang
Add dwmac glue driver to support the DesignWare-based GMAC controllers in the Synaptics SL2610 SoC.
Signed-off-by Jisheng Zhang <[email protected]>--- MAINTAINERS | 2 + drivers/net/ethernet/stmicro/stmmac/Kconfig | 11 ++ drivers/net/ethernet/stmicro/stmmac/Makefile | 1 + .../net/ethernet/stmicro/stmmac/dwmac-syna.c | 116 ++++++++++++++++++ 4 files changed, 130 insertions(+) create mode 100644 drivers/net/ethernet/stmicro/stmmac/dwmac-syna.cMAINTAINERS +2
-0@@ -3808,12 +3808,14 @@ M: Jisheng Zhang <[email protected]> M: Sebastian Hesselbarth <[email protected]> L: [email protected] (moderated for non-subscribers) S: Maintained +F: Documentation/devicetree/bindings/net/syna,sl2610-dwmac.yaml F: Documentation/devicetree/bindings/soc/synaptics/ F: arch/arm/boot/dts/synaptics/ F: arch/arm/mach-berlin/ F: arch/arm64/boot/dts/synaptics/ F: drivers/clk/berlin/*sl2610* F: drivers/clk/berlin/sl-* +F: drivers/net/ethernet/stmicro/stmmac/dwmac-syna.c F: drivers/pinctrl/berlin/pinctrl-sl2610.c F: drivers/reset/reset-sl2610.c F: drivers/soc/synaptics/drivers/net/ethernet/stmicro/stmmac/Kconfig +11
-0@@ -310,6 +310,17 @@ config DWMAC_SUN55I stmmac device driver. This driver is used for A523/T527 GMAC200 ethernet controller. +config DWMAC_SYNA + tristate "Synaptics SL2610 DWMAC support" + depends on OF && HAS_DMA && (ARCH_BERLIN || COMPILE_TEST) + select MFD_SYSCON + help + Support for the Synaptics SL2610 DesignWare Ethernet MAC glue. + This configures the PHY interface through the system controller. + + To compile this driver as a module, choose M here. The module + will be called dwmac-syna. + config DWMAC_THEAD tristate "T-HEAD dwmac support" depends on OF && (ARCH_THEAD || COMPILE_TEST)drivers/net/ethernet/stmicro/stmmac/Makefile +1
-0@@ -35,6 +35,7 @@ obj-$(CONFIG_DWMAC_STM32) += dwmac-stm32.o obj-$(CONFIG_DWMAC_SUNXI) += dwmac-sunxi.o obj-$(CONFIG_DWMAC_SUN8I) += dwmac-sun8i.o obj-$(CONFIG_DWMAC_SUN55I) += dwmac-sun55i.o +obj-$(CONFIG_DWMAC_SYNA) += dwmac-syna.o obj-$(CONFIG_DWMAC_THEAD) += dwmac-thead.o obj-$(CONFIG_DWMAC_ULTRARISC) += dwmac-ultrarisc.o obj-$(CONFIG_DWMAC_DWC_QOS_ETH) += dwmac-dwc-qos-eth.odrivers/net/ethernet/stmicro/stmmac/dwmac-syna.c new file +12
-0@@ -0,0 +1,116 @@ +// SPDX-License-Identifier: GPL-2.0 +/* +* Synaptics DWMAC platform driver +* +* Copyright (C) 2026 Jisheng Zhang <[email protected]> +* +*/ + +#include <linux/bitfield.h> +#include <linux/module.h> +#include <linux/mfd/syscon.h> +#include <linux/of.h>
drivers/net/ethernet/stmicro/stmmac/dwmac-syna.c line 22
Quoted 10 lines
drivers/net/ethernet/stmicro/stmmac/dwmac-syna.c new file +10
-0+#include <linux/of_device.h> +#include <linux/of_net.h> +#include <linux/platform_device.h> +#include <linux/regmap.h> + +#include "stmmac_platform.h" + +#define CTL_PHY_INTF_SEL GENMASK(4, 1) +#define CTL_PHY_INTF_RGMII FIELD_PREP(CTL_PHY_INTF_SEL, 1) +#define CTL_PHY_INTF_RMII FIELD_PREP(CTL_PHY_INTF_SEL, 4)
Please use PHY_INTF_SEL_RGMII and PHY_INTF_SEL_RMII from "common.h"
Quoted 28 lines
drivers/net/ethernet/stmicro/stmmac/dwmac-syna.c new file +28
-0+ +struct syna_dwmac { +struct plat_stmmacenet_data *plat; +struct regmap *regmap; +u32 rgmii_ctl; +struct device *dev; +}; + +static int syna_dwmac_set_phy_if (struct plat_stmmacenet_data *plat) +{ +struct syna_dwmac *dwmac = plat->bsp_priv; +u32 phyif; + +switch (plat->phy_interface) { +case PHY_INTERFACE_MODE_RMII : + phyif =CTL_PHY_INTF_RMII ; +break ; +case PHY_INTERFACE_MODE_RGMII : +case PHY_INTERFACE_MODE_RGMII_ID : +case PHY_INTERFACE_MODE_RGMII_TXID : +case PHY_INTERFACE_MODE_RGMII_RXID : + phyif =CTL_PHY_INTF_RGMII ; +break ; +default : +dev_err (dwmac->dev,"unsupported phy interface %s\n" , +phy_modes (plat->phy_interface)); +return -EINVAL ; + }
drivers/net/ethernet/stmicro/stmmac/dwmac-syna.c line 60
Quoted 10 lines
drivers/net/ethernet/stmicro/stmmac/dwmac-syna.c new file +10
-0+ +return regmap_update_bits (dwmac->regmap, dwmac->rgmii_ctl,CTL_PHY_INTF_SEL , phyif); +} + +static int syna_dwmac_init (struct device *dev,void *priv) +{ +struct syna_dwmac *dwmac = priv; + +return syna_dwmac_set_phy_if (dwmac->plat); +}
Can you implement .set_phy_intf_sel() instead ? that should simplify that quite a lot.
Thanks,
Maxime
Jisheng Zhang
maintainerRe: [PATCH 4/8] net: stmmac: Add glue layer for Synaptics SL2610 SoC
Quoted 90 lines · Maxime Chevallier
Hi,
Quoted 87 lines · Jisheng Zhang
Add dwmac glue driver to support the DesignWare-based GMAC controllers in the Synaptics SL2610 SoC.
Signed-off-by Jisheng Zhang <[email protected]>--- MAINTAINERS | 2 + drivers/net/ethernet/stmicro/stmmac/Kconfig | 11 ++ drivers/net/ethernet/stmicro/stmmac/Makefile | 1 + .../net/ethernet/stmicro/stmmac/dwmac-syna.c | 116 ++++++++++++++++++ 4 files changed, 130 insertions(+) create mode 100644 drivers/net/ethernet/stmicro/stmmac/dwmac-syna.cMAINTAINERS +2
-0@@ -3808,12 +3808,14 @@ M: Jisheng Zhang <[email protected]> M: Sebastian Hesselbarth <[email protected]> L: [email protected] (moderated for non-subscribers) S: Maintained +F: Documentation/devicetree/bindings/net/syna,sl2610-dwmac.yaml F: Documentation/devicetree/bindings/soc/synaptics/ F: arch/arm/boot/dts/synaptics/ F: arch/arm/mach-berlin/ F: arch/arm64/boot/dts/synaptics/ F: drivers/clk/berlin/*sl2610* F: drivers/clk/berlin/sl-* +F: drivers/net/ethernet/stmicro/stmmac/dwmac-syna.c F: drivers/pinctrl/berlin/pinctrl-sl2610.c F: drivers/reset/reset-sl2610.c F: drivers/soc/synaptics/drivers/net/ethernet/stmicro/stmmac/Kconfig +11
-0@@ -310,6 +310,17 @@ config DWMAC_SUN55I stmmac device driver. This driver is used for A523/T527 GMAC200 ethernet controller. +config DWMAC_SYNA + tristate "Synaptics SL2610 DWMAC support" + depends on OF && HAS_DMA && (ARCH_BERLIN || COMPILE_TEST) + select MFD_SYSCON + help + Support for the Synaptics SL2610 DesignWare Ethernet MAC glue. + This configures the PHY interface through the system controller. + + To compile this driver as a module, choose M here. The module + will be called dwmac-syna. + config DWMAC_THEAD tristate "T-HEAD dwmac support" depends on OF && (ARCH_THEAD || COMPILE_TEST)drivers/net/ethernet/stmicro/stmmac/Makefile +1
-0@@ -35,6 +35,7 @@ obj-$(CONFIG_DWMAC_STM32) += dwmac-stm32.o obj-$(CONFIG_DWMAC_SUNXI) += dwmac-sunxi.o obj-$(CONFIG_DWMAC_SUN8I) += dwmac-sun8i.o obj-$(CONFIG_DWMAC_SUN55I) += dwmac-sun55i.o +obj-$(CONFIG_DWMAC_SYNA) += dwmac-syna.o obj-$(CONFIG_DWMAC_THEAD) += dwmac-thead.o obj-$(CONFIG_DWMAC_ULTRARISC) += dwmac-ultrarisc.o obj-$(CONFIG_DWMAC_DWC_QOS_ETH) += dwmac-dwc-qos-eth.odrivers/net/ethernet/stmicro/stmmac/dwmac-syna.c new file +16
-0@@ -0,0 +1,116 @@ +// SPDX-License-Identifier: GPL-2.0 +/* +* Synaptics DWMAC platform driver +* +* Copyright (C) 2026 Jisheng Zhang <[email protected]> +* +*/ + +#include <linux/bitfield.h> +#include <linux/module.h> +#include <linux/mfd/syscon.h> +#include <linux/of.h> +#include <linux/of_device.h> +#include <linux/of_net.h> +#include <linux/platform_device.h> +#include <linux/regmap.h>
Quoted 8 lines
drivers/net/ethernet/stmicro/stmmac/dwmac-syna.c line 22
Quoted 6 lines
drivers/net/ethernet/stmicro/stmmac/dwmac-syna.c new file +6
-0+ +#include "stmmac_platform.h" + +#define CTL_PHY_INTF_SEL GENMASK(4, 1) +#define CTL_PHY_INTF_RGMII FIELD_PREP(CTL_PHY_INTF_SEL, 1) +#define CTL_PHY_INTF_RMII FIELD_PREP(CTL_PHY_INTF_SEL, 4)Please use
PHY_INTF_SEL_RGMIIandPHY_INTF_SEL_RMIIfrom "common.h"
I read this as "use SYNA_PHY_INTF_SEL_RGMII and SYNA_PHY_INTF_SEL_RMII", correct me if there's misunderstanding.
Quoted 33 lines
Quoted 33 lines
drivers/net/ethernet/stmicro/stmmac/dwmac-syna.c new file +32
-0+ +struct syna_dwmac { +struct plat_stmmacenet_data *plat; +struct regmap *regmap; +u32 rgmii_ctl; +struct device *dev; +}; + +static int syna_dwmac_set_phy_if (struct plat_stmmacenet_data *plat) +{ +struct syna_dwmac *dwmac = plat->bsp_priv; +u32 phyif; + +switch (plat->phy_interface) { +case PHY_INTERFACE_MODE_RMII : + phyif =CTL_PHY_INTF_RMII ; +break ; +case PHY_INTERFACE_MODE_RGMII : +case PHY_INTERFACE_MODE_RGMII_ID : +case PHY_INTERFACE_MODE_RGMII_TXID : +case PHY_INTERFACE_MODE_RGMII_RXID : + phyif =CTL_PHY_INTF_RGMII ; +break ; +default : +dev_err (dwmac->dev,"unsupported phy interface %s\n" , +phy_modes (plat->phy_interface)); +return -EINVAL ; + } + +return regmap_update_bits (dwmac->regmap, dwmac->rgmii_ctl,CTL_PHY_INTF_SEL , phyif); +} +
Quoted 9 lines
drivers/net/ethernet/stmicro/stmmac/dwmac-syna.c line 60
Quoted 6 lines
drivers/net/ethernet/stmicro/stmmac/dwmac-syna.c new file +6
-0+static int syna_dwmac_init (struct device *dev,void *priv) +{ +struct syna_dwmac *dwmac = priv; + +return syna_dwmac_set_phy_if (dwmac->plat); +}Can you implement .set_phy_intf_sel() instead ? that should simplify that quite a lot.
Good idea. Thanks for the suggestion
Andrew Lunn
maintainerRe: [PATCH 4/8] net: stmmac: Add glue layer for Synaptics SL2610 SoC
Quoted 8 lines
Quoted 5 lines
drivers/net/ethernet/stmicro/stmmac/dwmac-syna.c line 22
Quoted 3 lines
drivers/net/ethernet/stmicro/stmmac/dwmac-syna.c new file +3
-0+#define CTL_PHY_INTF_SEL GENMASK(4, 1) +#define CTL_PHY_INTF_RGMII FIELD_PREP(CTL_PHY_INTF_SEL, 1) +#define CTL_PHY_INTF_RMII FIELD_PREP(CTL_PHY_INTF_SEL, 4)Please use
PHY_INTF_SEL_RGMIIandPHY_INTF_SEL_RMIIfrom "common.h"I read this as "use
SYNA_PHY_INTF_SEL_RGMIIandSYNA_PHY_INTF_SEL_RMII", correct me if there's misunderstanding.
https://elixir.bootlin.com/linux/v7.3.1/source/drivers/net/ethernet/stmicro/stmmac/common.h#L316
#define PHY_INTF_SEL_RGMII 1
#define PHY_INTF_SEL_SGMII 2
#define PHY_INTF_SEL_TBI 3
#define PHY_INTF_SEL_RMII 4
Which is easier to understand?
#define CTL_PHY_INTF_RGMII FIELD_PREP(CTL_PHY_INTF_SEL, 1)
or
#define CTL_PHY_INTF_RGMII FIELD_PREP(CTL_PHY_INTF_SEL, PHY_INTF_SEL_RGMII)
You should try to avoid magic numbers.
Andrew