Add GMAC support for S32 SoC family
Subsystems (5)
cover Add GMAC support for S32 SoC family
Hello,
Here I want to introduce a new patch series, which aims to support GMAC functions on S32 SoCs, such as S32G2. This series is originally from NXP's implementation on CodeAurora[1] and it will be required by upstream kernel to configure platform settings at the DWMAC glue layer before activating the DWMAC core on different S32G boards. In this patchset I also introduce more register fields needed by S32 SoCs, such as higher CSR clock ranges and cache coherency settings. For more information please see NXP's GMACSUBSYS Reference Manual[2].
Currently, the whole architecture relies on FDTs offered by ATF[3] on CodeAurora to keep the flexibility of handling multiple S32 platforms since now S32 clks can be triggered via the ARM SCMI clock protocol and clk IDs/ settings can vary according to different board designs. To ensure that the driver can work properly, the dt-binding schemas in this patchset is still required as a reference.
Thanks,
Chester
[1] https://source.codeaurora.org/external/autobsps32/linux/tree/drivers/net/ethernet/stmicro/stmmac?h=bsp34.0-5.10.120-rt
[2] https://www.nxp.com/webapp/Download?colCode=GMACSUBSYSRM
[3] https://source.codeaurora.org/external/autobsps32/arm-trusted-firmware/tag/?h=bsp34.0-2.5
Chester Lin (5):
dt-bindings: net: snps, dwmac: add NXP S32CC support
dt-bindings: net: add schema for NXP S32CC dwmac glue driver
net: stmmac: Add CSR clock 500Mhz/800Mhz support
net: stmmac: Add AXI4 ACE control support
net: stmmac: Add NXP S32 SoC family support
.../bindings/net/nxp,s32cc-dwmac.yaml | 145 ++++++++ .../devicetree/bindings/net/snps,dwmac.yaml | 5 +- drivers/net/ethernet/stmicro/stmmac/Kconfig | 13 + drivers/net/ethernet/stmicro/stmmac/Makefile | 1 + drivers/net/ethernet/stmicro/stmmac/common.h | 2 + .../net/ethernet/stmicro/stmmac/dwmac-s32cc.c | 318 ++++++++++++++++++ .../net/ethernet/stmicro/stmmac/dwmac4_dma.c | 10 + .../net/ethernet/stmicro/stmmac/dwmac4_dma.h | 4 +- drivers/net/ethernet/stmicro/stmmac/hwif.h | 5 + .../net/ethernet/stmicro/stmmac/stmmac_main.c | 7 + include/linux/stmmac.h | 9 + 11 files changed, 516 insertions(+), 3 deletions(-) create mode 100644 Documentation/devicetree/bindings/net/nxp,s32cc-dwmac.yaml create mode 100644 drivers/net/ethernet/stmicro/stmmac/dwmac-s32cc.c
Signature · 1 line
2.37.3
PATCH 1/5 dt-bindings: net: snps, dwmac: add NXP S32CC support
Add a new compatible string for NXP S32CC DWMAC glue driver. The maxItems of clock and clock-names need be increased because S32CC has up to 11 clocks for its DWMAC.
--- Documentation/devicetree/bindings/net/snps,dwmac.yaml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
Documentation/devicetree/bindings/net/snps,dwmac.yaml +3 -2
@@ -65,6 +65,7 @@ properties: - ingenic,x2000-mac - loongson,ls2k-dwmac - loongson,ls7a-dwmac + - nxp,s32cc-dwmac - renesas,r9a06g032-gmac - renesas,rzn1-gmac - rockchip,px30-gmac
@@ -110,7 +111,7 @@ properties: clocks: minItems: 1 - maxItems: 8 + maxItems: 11 additionalItems: true items: - description: GMAC main clock
@@ -122,7 +123,7 @@ properties: clock-names: minItems: 1 - maxItems: 8 + maxItems: 11 additionalItems: true contains: enum:
Signature · 1 line
2.37.3
PATCH 2/5 dt-bindings: net: add schema for NXP S32CC dwmac glue driver
In reply to Chester LinAdd the DT schema for the DWMAC Ethernet controller on NXP S32 Common Chassis.
--- .../bindings/net/nxp,s32cc-dwmac.yaml | 145 ++++++++++++++++++ 1 file changed, 145 insertions(+) create mode 100644 Documentation/devicetree/bindings/net/nxp,s32cc-dwmac.yaml
Documentation/devicetree/bindings/net/nxp,s32cc-dwmac.yaml new file +145 -0
@@ -0,0 +1,145 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +# Copyright 2021-2022 NXP +%YAML 1.2 +--- +$id: "http://devicetree.org/schemas/net/nxp,s32cc-dwmac.yaml#" +$schema: "http://devicetree.org/meta-schemas/core.yaml#" + +title: NXP S32CC DWMAC Ethernet controller + +maintainers: + - Jan Petrous <[email protected]> + - Chester Lin <[email protected]> + +select: + properties: + compatible: + contains: + enum: + - nxp,s32cc-dwmac + required: + - compatible + +allOf: + - $ref: "snps,dwmac.yaml#" + +properties: + compatible: + contains: + enum: + - nxp,s32cc-dwmac + + reg: + items: + - description: Main GMAC registers + - description: S32 MAC control registers + + dma-coherent: + description: + Declares GMAC device as DMA coherent + + clocks: + items: + - description: Main GMAC clock + - description: Peripheral registers clock + - description: Transmit SGMII clock + - description: Transmit RGMII clock + - description: Transmit RMII clock + - description: Transmit MII clock + - description: Receive SGMII clock + - description: Receive RGMII clock + - description: Receive RMII clock + - description: Receive MII clock + - description: + PTP reference clock. This clock is used for programming the + Timestamp Addend Register. If not passed then the system + clock will be used. + + clock-names: + items: + - const: stmmaceth + - const: pclk + - const: tx_sgmii + - const: tx_rgmii + - const: tx_rmii + - const: tx_mii + - const: rx_sgmii + - const: rx_rgmii + - const: rx_rmii + - const: rx_mii + - const: ptp_ref + + tx-fifo-depth: + const: 20480 + + rx-fifo-depth: + const: 20480 + +required: + - compatible + - reg + - tx-fifo-depth + - rx-fifo-depth + - clocks + - clock-names + +additionalProperties: true + +examples: + - | + #include <dt-bindings/interrupt-controller/arm-gic.h> + #include <dt-bindings/interrupt-controller/irq.h> + + #define S32GEN1_SCMI_CLK_GMAC0_AXI + #define S32GEN1_SCMI_CLK_GMAC0_TX_SGMII + #define S32GEN1_SCMI_CLK_GMAC0_TX_RGMII + #define S32GEN1_SCMI_CLK_GMAC0_TX_RMII + #define S32GEN1_SCMI_CLK_GMAC0_TX_MII + #define S32GEN1_SCMI_CLK_GMAC0_RX_SGMII + #define S32GEN1_SCMI_CLK_GMAC0_RX_RGMII + #define S32GEN1_SCMI_CLK_GMAC0_RX_RMII + #define S32GEN1_SCMI_CLK_GMAC0_RX_MII + #define S32GEN1_SCMI_CLK_GMAC0_TS + + soc { + #address-cells = <1>; + #size-cells = <1>; + + gmac0: ethernet@4033c000 { + compatible = "nxp,s32cc-dwmac"; + reg = <0x4033c000 0x2000>, /* gmac IP */ + <0x4007C004 0x4>; /* S32 CTRL_STS reg */ + interrupt-parent = <&gic>; + interrupts = <GIC_SPI 57 IRQ_TYPE_LEVEL_HIGH>; + interrupt-names = "macirq"; + phy-mode = "rgmii-id"; + tx-fifo-depth = <20480>; + rx-fifo-depth = <20480>; + dma-coherent; + clocks = <&clks S32GEN1_SCMI_CLK_GMAC0_AXI>, + <&clks S32GEN1_SCMI_CLK_GMAC0_AXI>, + <&clks S32GEN1_SCMI_CLK_GMAC0_TX_SGMII>, + <&clks S32GEN1_SCMI_CLK_GMAC0_TX_RGMII>, + <&clks S32GEN1_SCMI_CLK_GMAC0_TX_RMII>, + <&clks S32GEN1_SCMI_CLK_GMAC0_TX_MII>, + <&clks S32GEN1_SCMI_CLK_GMAC0_RX_SGMII>, + <&clks S32GEN1_SCMI_CLK_GMAC0_RX_RGMII>, + <&clks S32GEN1_SCMI_CLK_GMAC0_RX_RMII>, + <&clks S32GEN1_SCMI_CLK_GMAC0_RX_MII>, + <&clks S32GEN1_SCMI_CLK_GMAC0_TS>; + clock-names = "stmmaceth", "pclk", + "tx_sgmii", "tx_rgmii", "tx_rmii", "tx_mii", + "rx_sgmii", "rx_rgmii", "rx_rmii", "rx_mii", + "ptp_ref"; + + gmac0_mdio: mdio { + #address-cells = <1>; + #size-cells = <0>; + compatible = "snps,dwmac-mdio"; + + ethernet-phy@4 { + reg = <0x04>; + }; + }; + }; + };
Signature · 1 line
2.37.3
Rob Herring
maintainerRe: [PATCH 2/5] dt-bindings: net: add schema for NXP S32CC dwmac glue driver
Quoted 20 lines · Chester Lin
Add the DT schema for the DWMAC Ethernet controller on NXP S32 Common Chassis.
Signed-off-by Jan Petrous <[email protected]>Signed-off-by Chester Lin <[email protected]>--- .../bindings/net/nxp,s32cc-dwmac.yaml | 145 ++++++++++++++++++ 1 file changed, 145 insertions(+) create mode 100644 Documentation/devicetree/bindings/net/nxp,s32cc-dwmac.yamlDocumentation/devicetree/bindings/net/nxp,s32cc-dwmac.yaml new file +4
-0@@ -0,0 +1,145 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +# Copyright 2021-2022 NXP +%YAML 1.2 +---
Documentation/devicetree/bindings/net/nxp,s32cc-dwmac.yaml line 14
Quoted 10 lines
Documentation/devicetree/bindings/net/nxp,s32cc-dwmac.yaml new file +10
-0+$id: "http://devicetree.org/schemas/net/nxp,s32cc-dwmac.yaml#" +$schema: "http://devicetree.org/meta-schemas/core.yaml#" + +title: NXP S32CC DWMAC Ethernet controller + +maintainers: + - Jan Petrous <[email protected]> + - Chester Lin <[email protected]> + +select:
Don't need this.
Quoted 4 lines
Documentation/devicetree/bindings/net/nxp,s32cc-dwmac.yaml new file +4
-0+ properties: + compatible: + contains: + enum:
Documentation/devicetree/bindings/net/nxp,s32cc-dwmac.yaml line 28
Quoted 10 lines
Documentation/devicetree/bindings/net/nxp,s32cc-dwmac.yaml new file +10
-0+ - nxp,s32cc-dwmac + required: + - compatible + +allOf: + - $ref: "snps,dwmac.yaml#" + +properties: + compatible: + contains:
Drop 'contains'.
Documentation/devicetree/bindings/net/nxp,s32cc-dwmac.yaml line 39
Quoted 11 lines
Documentation/devicetree/bindings/net/nxp,s32cc-dwmac.yaml new file +11
-0+ enum: + - nxp,s32cc-dwmac + + reg: + items: + - description: Main GMAC registers + - description: S32 MAC control registers + + dma-coherent: + description: + Declares GMAC device as DMA coherent
Don't need a generic description. Just 'true' is enough.
Quoted 7 lines
Documentation/devicetree/bindings/net/nxp,s32cc-dwmac.yaml new file +7
-0+ + clocks: + items: + - description: Main GMAC clock + - description: Peripheral registers clock + - description: Transmit SGMII clock + - description: Transmit RGMII clock
Documentation/devicetree/bindings/net/nxp,s32cc-dwmac.yaml line 56
Quoted 10 lines
Documentation/devicetree/bindings/net/nxp,s32cc-dwmac.yaml new file +10
-0+ - description: Transmit RMII clock + - description: Transmit MII clock + - description: Receive SGMII clock + - description: Receive RGMII clock + - description: Receive RMII clock + - description: Receive MII clock + - description: + PTP reference clock. This clock is used for programming the + Timestamp Addend Register. If not passed then the system + clock will be used.
If optional, then you need 'minItems'.
Quoted 20 lines
Documentation/devicetree/bindings/net/nxp,s32cc-dwmac.yaml new file +20
-0+ + clock-names: + items: + - const: stmmaceth + - const: pclk + - const: tx_sgmii + - const: tx_rgmii + - const: tx_rmii + - const: tx_mii + - const: rx_sgmii + - const: rx_rgmii + - const: rx_rmii + - const: rx_mii + - const: ptp_ref + + tx-fifo-depth: + const: 20480 + + rx-fifo-depth: + const: 20480
Documentation/devicetree/bindings/net/nxp,s32cc-dwmac.yaml line 86
Quoted 10 lines
Documentation/devicetree/bindings/net/nxp,s32cc-dwmac.yaml new file +10
-0+ +required: + - compatible + - reg + - tx-fifo-depth + - rx-fifo-depth + - clocks + - clock-names + +additionalProperties: true
'true' is only allowed for common, incomplete schemas. Should be:
unevaluatedProperties: false
Quoted 63 lines
Documentation/devicetree/bindings/net/nxp,s32cc-dwmac.yaml new file +59
-0+ +examples: + - | + #include <dt-bindings/interrupt-controller/arm-gic.h> + #include <dt-bindings/interrupt-controller/irq.h> + + #define S32GEN1_SCMI_CLK_GMAC0_AXI + #define S32GEN1_SCMI_CLK_GMAC0_TX_SGMII + #define S32GEN1_SCMI_CLK_GMAC0_TX_RGMII + #define S32GEN1_SCMI_CLK_GMAC0_TX_RMII + #define S32GEN1_SCMI_CLK_GMAC0_TX_MII + #define S32GEN1_SCMI_CLK_GMAC0_RX_SGMII + #define S32GEN1_SCMI_CLK_GMAC0_RX_RGMII + #define S32GEN1_SCMI_CLK_GMAC0_RX_RMII + #define S32GEN1_SCMI_CLK_GMAC0_RX_MII + #define S32GEN1_SCMI_CLK_GMAC0_TS + + soc { + #address-cells = <1>; + #size-cells = <1>; + + gmac0: ethernet@4033c000 { + compatible = "nxp,s32cc-dwmac"; + reg = <0x4033c000 0x2000>, /* gmac IP */ + <0x4007C004 0x4>; /* S32 CTRL_STS reg */ + interrupt-parent = <&gic>; + interrupts = <GIC_SPI 57 IRQ_TYPE_LEVEL_HIGH>; + interrupt-names = "macirq"; + phy-mode = "rgmii-id"; + tx-fifo-depth = <20480>; + rx-fifo-depth = <20480>; + dma-coherent; + clocks = <&clks S32GEN1_SCMI_CLK_GMAC0_AXI>, + <&clks S32GEN1_SCMI_CLK_GMAC0_AXI>, + <&clks S32GEN1_SCMI_CLK_GMAC0_TX_SGMII>, + <&clks S32GEN1_SCMI_CLK_GMAC0_TX_RGMII>, + <&clks S32GEN1_SCMI_CLK_GMAC0_TX_RMII>, + <&clks S32GEN1_SCMI_CLK_GMAC0_TX_MII>, + <&clks S32GEN1_SCMI_CLK_GMAC0_RX_SGMII>, + <&clks S32GEN1_SCMI_CLK_GMAC0_RX_RGMII>, + <&clks S32GEN1_SCMI_CLK_GMAC0_RX_RMII>, + <&clks S32GEN1_SCMI_CLK_GMAC0_RX_MII>, + <&clks S32GEN1_SCMI_CLK_GMAC0_TS>; + clock-names = "stmmaceth", "pclk", + "tx_sgmii", "tx_rgmii", "tx_rmii", "tx_mii", + "rx_sgmii", "rx_rgmii", "rx_rmii", "rx_mii", + "ptp_ref"; + + gmac0_mdio: mdio { + #address-cells = <1>; + #size-cells = <0>; + compatible = "snps,dwmac-mdio"; + + ethernet-phy@4 { + reg = <0x04>; + }; + }; + }; + };Signature · 1 line
2.37.3
Re: [PATCH 2/5] dt-bindings: net: add schema for NXP S32CC dwmac glue driver
Hi Rob,
Quoted 29 lines · Rob Herring
Quoted 28 lines · Chester Lin
Add the DT schema for the DWMAC Ethernet controller on NXP S32 Common Chassis.
Signed-off-by Jan Petrous <[email protected]>Signed-off-by Chester Lin <[email protected]>--- .../bindings/net/nxp,s32cc-dwmac.yaml | 145 ++++++++++++++++++ 1 file changed, 145 insertions(+)create mode 100644
Documentation/devicetree/bindings/net/nxp,s32cc-dwmac.yamlDocumentation/devicetree/bindings/net/nxp,s32cc-dwmac.yaml new file +12
-0@@ -0,0 +1,145 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +# Copyright 2021-2022 NXP +%YAML 1.2 +--- +$id: "http://devicetree.org/schemas/net/nxp,s32cc-dwmac.yaml#" +$schema: "http://devicetree.org/meta-schemas/core.yaml#" + +title: NXP S32CC DWMAC Ethernet controller + +maintainers: + - Jan Petrous <[email protected]> + - Chester Lin <[email protected]>
[...]
Quoted 8 lines
Documentation/devicetree/bindings/net/nxp,s32cc-dwmac.yaml line 17
Quoted 3 lines
Documentation/devicetree/bindings/net/nxp,s32cc-dwmac.yaml new file +3
-0+properties: + compatible: + contains:Drop 'contains'.
Quoted 2 lines
Documentation/devicetree/bindings/net/nxp,s32cc-dwmac.yaml new file +2
-0+ enum: + - nxp,s32cc-dwmac
In the past you were adamant that we use concrete SoC-specific strings. Here that would mean s32g2 or s32g274 instead of s32cc (which aims to share with S32G3 IIUC).
[...]
Quoted 17 lines
Quoted 6 lines
Documentation/devicetree/bindings/net/nxp,s32cc-dwmac.yaml new file +6
-0+ clocks: + items: + - description: Main GMAC clock + - description: Peripheral registers clock + - description: Transmit SGMII clock + - description: Transmit RGMII clockDocumentation/devicetree/bindings/net/nxp,s32cc-dwmac.yaml line 56
Quoted 10 lines
Documentation/devicetree/bindings/net/nxp,s32cc-dwmac.yaml new file +10
-0+ - description: Transmit RMII clock + - description: Transmit MII clock + - description: Receive SGMII clock + - description: Receive RGMII clock + - description: Receive RMII clock + - description: Receive MII clock + - description: + PTP reference clock. This clock is used for programming the + Timestamp Addend Register. If not passed then the system + clock will be used.
Quoted 1 line
If optional, then you need 'minItems'.
[snip]
Do we have any precedence of bindings with *MII clocks like these?
AFAIU the reason there are so many here is that there are in fact physically just five, but different parent clock configurations that SCMI does not currently expose to Linux. Thus I was raising that we may want to extend the SCMI protocol with some SET_PARENT operation that could allow us to use less input clocks here, but obviously such a standardization process will take time...
What are your thoughts on how to best handle this here?
Not clear to me has been whether the PHY mode can be switched at runtime (like DPAA2 on Layerscape allows for SFPs) or whether this is fixed by board design. If the latter, the two out of six SCMI IDs could get selected in TF-A, to have only physical clocks here in the binding.
Regards,
Andreas
Signature · 4 lines
SUSE Software Solutions Germany GmbH Frankenstr. 146, 90461 Nürnberg, Germany GF: Ivo Totev, Andrew Myers, Andrew McDonald, Boudien Moerman HRB 36809 (AG Nürnberg)
Rob Herring
maintainerRe: [PATCH 2/5] dt-bindings: net: add schema for NXP S32CC dwmac glue driver
Quoted 37 lines · Andreas Färber
Hi Rob,
Quoted 29 lines · Rob Herring
Quoted 28 lines · Chester Lin
Add the DT schema for the DWMAC Ethernet controller on NXP S32 Common Chassis.
Signed-off-by Jan Petrous <[email protected]>Signed-off-by Chester Lin <[email protected]>--- .../bindings/net/nxp,s32cc-dwmac.yaml | 145 ++++++++++++++++++ 1 file changed, 145 insertions(+)create mode 100644
Documentation/devicetree/bindings/net/nxp,s32cc-dwmac.yamlDocumentation/devicetree/bindings/net/nxp,s32cc-dwmac.yaml new file +12
-0@@ -0,0 +1,145 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +# Copyright 2021-2022 NXP +%YAML 1.2 +--- +$id: "http://devicetree.org/schemas/net/nxp,s32cc-dwmac.yaml#" +$schema: "http://devicetree.org/meta-schemas/core.yaml#" + +title: NXP S32CC DWMAC Ethernet controller + +maintainers: + - Jan Petrous <[email protected]> + - Chester Lin <[email protected]>[...]
Quoted 4 lines
Quoted 3 lines
Documentation/devicetree/bindings/net/nxp,s32cc-dwmac.yaml new file +3
-0+properties: + compatible: + contains:
Quoted 8 lines
Quoted 4 lines
Drop 'contains'.
Quoted 2 lines
Documentation/devicetree/bindings/net/nxp,s32cc-dwmac.yaml new file +2
-0+ enum: + - nxp,s32cc-dwmacIn the past you were adamant that we use concrete SoC-specific strings. Here that would mean s32g2 or s32g274 instead of s32cc (which aims to share with S32G3 IIUC).
Yes they should be SoC specific. Really, 1 per maskset or die is fine if that level of detail is known. No need for different compatibles for different part numbers created by fused off features or package pinout differences.
Quoted 18 lines
[...]
Quoted 17 lines
Quoted 16 lines
Documentation/devicetree/bindings/net/nxp,s32cc-dwmac.yaml new file +16
-0+ clocks: + items: + - description: Main GMAC clock + - description: Peripheral registers clock + - description: Transmit SGMII clock + - description: Transmit RGMII clock + - description: Transmit RMII clock + - description: Transmit MII clock + - description: Receive SGMII clock + - description: Receive RGMII clock + - description: Receive RMII clock + - description: Receive MII clock + - description: + PTP reference clock. This clock is used for programming the + Timestamp Addend Register. If not passed then the system + clock will be used.
Quoted 4 lines
Quoted 1 line
If optional, then you need 'minItems'.
[snip]
Do we have any precedence of bindings with *MII clocks like these?
Don't know...
Quoted 8 lines
AFAIU the reason there are so many here is that there are in fact physically just five, but different parent clock configurations that SCMI does not currently expose to Linux. Thus I was raising that we may want to extend the SCMI protocol with some
SET_PARENToperation that could allow us to use less input clocks here, but obviously such a standardization process will take time...What are your thoughts on how to best handle this here?
Perhaps use assigned-clocks if it is static for a board.
Quoted 7 lines
Not clear to me has been whether the PHY mode can be switched at runtime (like DPAA2 on Layerscape allows for SFPs) or whether this is fixed by board design. If the latter, the two out of six SCMI IDs could get selected in TF-A, to have only physical clocks here in the binding.
Regards,
Andreas
Re: [PATCH 2/5] dt-bindings: net: add schema for NXP S32CC dwmac glue driver
Hi Rob and Andreas,
Quoted 43 lines · Rob Herring
Quoted 42 lines · Andreas Färber
Hi Rob,
Quoted 29 lines · Rob Herring
Quoted 28 lines · Chester Lin
Add the DT schema for the DWMAC Ethernet controller on NXP S32 Common Chassis.
Signed-off-by Jan Petrous <[email protected]>Signed-off-by Chester Lin <[email protected]>--- .../bindings/net/nxp,s32cc-dwmac.yaml | 145 ++++++++++++++++++ 1 file changed, 145 insertions(+)create mode 100644
Documentation/devicetree/bindings/net/nxp,s32cc-dwmac.yamlDocumentation/devicetree/bindings/net/nxp,s32cc-dwmac.yaml new file +12
-0@@ -0,0 +1,145 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +# Copyright 2021-2022 NXP +%YAML 1.2 +--- +$id: "http://devicetree.org/schemas/net/nxp,s32cc-dwmac.yaml#" +$schema: "http://devicetree.org/meta-schemas/core.yaml#" + +title: NXP S32CC DWMAC Ethernet controller + +maintainers: + - Jan Petrous <[email protected]> + - Chester Lin <[email protected]>[...]
Quoted 8 lines
Documentation/devicetree/bindings/net/nxp,s32cc-dwmac.yaml line 17
Quoted 3 lines
Documentation/devicetree/bindings/net/nxp,s32cc-dwmac.yaml new file +3
-0+properties: + compatible: + contains:Drop 'contains'.
Quoted 2 lines
Documentation/devicetree/bindings/net/nxp,s32cc-dwmac.yaml new file +2
-0+ enum: + - nxp,s32cc-dwmac
Quoted 9 lines
Quoted 3 lines
In the past you were adamant that we use concrete SoC-specific strings. Here that would mean s32g2 or s32g274 instead of s32cc (which aims to share with S32G3 IIUC).
Yes they should be SoC specific. Really, 1 per maskset or die is fine if that level of detail is known. No need for different compatibles for different part numbers created by fused off features or package pinout differences.
If I understand correctly from NXP, the GMAC0 belongs to a common hardware sub-architecture called "S32 Common Chassis", which is a common IP set applied in many S32 SoC series, such as S32G2/G3 and S32R45. Therefore this binding is not specifically for S32G2 but it supports all S32 SoC series who adopt S32CC sub-arch if they could all be upstreamed in the future.
Logically S32G2 and S32R45 have the same subset *S32CC* but it doesn't mean that S32G2 and S32R45 are derived from each other.
Regards,
Chester
Quoted 43 lines
Quoted 18 lines
[...]
Quoted 17 lines
Quoted 16 lines
Documentation/devicetree/bindings/net/nxp,s32cc-dwmac.yaml new file +16
-0+ clocks: + items: + - description: Main GMAC clock + - description: Peripheral registers clock + - description: Transmit SGMII clock + - description: Transmit RGMII clock + - description: Transmit RMII clock + - description: Transmit MII clock + - description: Receive SGMII clock + - description: Receive RGMII clock + - description: Receive RMII clock + - description: Receive MII clock + - description: + PTP reference clock. This clock is used for programming the + Timestamp Addend Register. If not passed then the system + clock will be used.Quoted 4 lines
Quoted 1 line
If optional, then you need 'minItems'.
[snip]
Do we have any precedence of bindings with *MII clocks like these?
Don't know...
Quoted 8 lines
AFAIU the reason there are so many here is that there are in fact physically just five, but different parent clock configurations that SCMI does not currently expose to Linux. Thus I was raising that we may want to extend the SCMI protocol with some
SET_PARENToperation that could allow us to use less input clocks here, but obviously such a standardization process will take time...What are your thoughts on how to best handle this here?
Perhaps use assigned-clocks if it is static for a board.
Quoted 7 lines
Not clear to me has been whether the PHY mode can be switched at runtime (like DPAA2 on Layerscape allows for SFPs) or whether this is fixed by board design. If the latter, the two out of six SCMI IDs could get selected in TF-A, to have only physical clocks here in the binding.
Regards,
Andreas
Re: [PATCH 2/5] dt-bindings: net: add schema for NXP S32CC dwmac glue driver
In reply to Andreas FärberQuoted 15 lines
Quoted 6 lines
Quoted 6 lines
Documentation/devicetree/bindings/net/nxp,s32cc-dwmac.yaml new file +6
-0+ - description: Main GMAC clock + - description: Peripheral registers clock + - description: Transmit SGMII clock + - description: Transmit RGMII clock + - description: Transmit RMII clock + - description: Transmit MII clockQuoted 8 lines
Documentation/devicetree/bindings/net/nxp,s32cc-dwmac.yaml line 56
Quoted 8 lines
Documentation/devicetree/bindings/net/nxp,s32cc-dwmac.yaml new file +8
-0+ - description: Receive SGMII clock + - description: Receive RGMII clock + - description: Receive RMII clock + - description: Receive MII clock + - description: + PTP reference clock. This clock is used for programming the + Timestamp Addend Register. If not passed then the system + clock will be used.
Quoted 3 lines
Not clear to me has been whether the PHY mode can be switched at runtime (like DPAA2 on Layerscape allows for SFPs) or whether this is fixed by board design.
Does the hardware support 1000BaseX? Often the hardware implementing SGMII can also do 1000BaseX, since SGMII is an extended/hacked up 1000BaseX.
If you have an SFP connected to the SERDES, a fibre module will want 1000BaseX and a copper module will want SGMII. phylink will tell you what phy-mode you need to use depending on what module is in the socket. This however might be a mute point, since both of these are probably using the SGMII clocks.
Of the other MII modes listed, it is very unlikely a runtime swap will occur.
Andrew
Re: [PATCH 2/5] dt-bindings: net: add schema for NXP S32CC dwmac glue driver
Hi Andrew and Andreas,
Quoted 29 lines · Andrew Lunn
Quoted 15 lines
Quoted 6 lines
Quoted 6 lines
Documentation/devicetree/bindings/net/nxp,s32cc-dwmac.yaml new file +6
-0+ - description: Main GMAC clock + - description: Peripheral registers clock + - description: Transmit SGMII clock + - description: Transmit RGMII clock + - description: Transmit RMII clock + - description: Transmit MII clockQuoted 8 lines
Documentation/devicetree/bindings/net/nxp,s32cc-dwmac.yaml line 56
Quoted 8 lines
Documentation/devicetree/bindings/net/nxp,s32cc-dwmac.yaml new file +8
-0+ - description: Receive SGMII clock + - description: Receive RGMII clock + - description: Receive RMII clock + - description: Receive MII clock + - description: + PTP reference clock. This clock is used for programming the + Timestamp Addend Register. If not passed then the system + clock will be used.Quoted 3 lines
Not clear to me has been whether the PHY mode can be switched at runtime (like DPAA2 on Layerscape allows for SFPs) or whether this is fixed by board design.
Does the hardware support 1000BaseX? Often the hardware implementing SGMII can also do 1000BaseX, since SGMII is an extended/hacked up 1000BaseX.
If you have an SFP connected to the SERDES, a fibre module will want 1000BaseX and a copper module will want SGMII. phylink will tell you what phy-mode you need to use depending on what module is in the socket. This however might be a mute point, since both of these are probably using the SGMII clocks.
Quoted 4 lines
Of the other MII modes listed, it is very unlikely a runtime swap will occur.
Andrew
Here I just focus on GMAC since there are other LAN interfaces that S32 family uses [e.g. PFE]. According to the public GMACSUBSYS ref manual rev2[1] provided on NXP website, theoretically GMAC can run SGMII in 1000Mbps and 2500Mbps so I assume that supporting 1000BASE-X could be achievable. I'm not sure if any S32 board variant might have SFP ports but RJ-45 [1000BASE-T] should be the major type used on S32G-EVB and S32G-RDB2.
@NXP, please feel free to correct me if anything wrong.
Thanks,
Chester
[1] https://www.nxp.com/webapp/Download?colCode=GMACSUBSYSRM -> Membership subscription is required although it's free IIRC.
Re: [PATCH 2/5] dt-bindings: net: add schema for NXP S32CC dwmac glue driver
Quoted 6 lines
Here I just focus on GMAC since there are other LAN interfaces that S32 family uses [e.g. PFE]. According to the public GMACSUBSYS ref manual rev2[1] provided on NXP website, theoretically GMAC can run SGMII in 1000Mbps and 2500Mbps so I assume that supporting 1000BASE-X could be achievable. I'm not sure if any S32 board variant might have SFP ports but RJ-45 [1000BASE-T] should be the major type used on S32G-EVB and S32G-RDB2.
SGMII at 2500Mbps does not exist. Lots of people get this wrong. It will be 2500Base-X.
Does the clock need to change in order to support 2500Base-X? If i understand you correctly, Linux does not control the clocks, and so cannot change the clocks? So that probably means you cannot actually support 2500Base-X? Once you have Linux actually controlling the hardware, you can then make use of an SFP or a copper PHY which supports 2.5G. The PHY will swap its host side between SGMII and 2500Base-X depending on what the line side negotiates, 1000Base-T or 2500Base-T. The MAC driver then needs to change its configuration to suite.
Andrew
Re: [PATCH 2/5] dt-bindings: net: add schema for NXP S32CC dwmac glue driver
Hi Andrew,
Quoted 10 lines · Andrew Lunn
Quoted 6 lines
Here I just focus on GMAC since there are other LAN interfaces that S32 family uses [e.g. PFE]. According to the public GMACSUBSYS ref manual rev2[1] provided on NXP website, theoretically GMAC can run SGMII in 1000Mbps and 2500Mbps so I assume that supporting 1000BASE-X could be achievable. I'm not sure if any S32 board variant might have SFP ports but RJ-45 [1000BASE-T] should be the major type used on S32G-EVB and S32G-RDB2.
SGMII at 2500Mbps does not exist. Lots of people get this wrong. It will be 2500Base-X.
Thanks for your correction.
Quoted 1 line
Does the clock need to change in order to support 2500Base-X? If i
Since I'm not a hardware designer from NXP and I can't find any board that S32G2 CPUs could integrate SFP, so I am not able to tell how the clock could be configured while supporting 2500Base-X.
Quoted 2 lines
understand you correctly, Linux does not control the clocks, and so cannot change the clocks? So that probably means you cannot actually
To be more precise, the SCMI clock protocol in ATF [ARM Trusted Firmware] doesn't design any interface to get/set parents of a clock so that re-parenting clocks via the SCMI clk driver [clk-scmi.c] in Linux Kernel is impossible for this case. That means, if any board design allows run-time swap on different phys, the dedicated clks which represent each phy-mode are required in order to trigger clock re-parenting in ATF since different phy connections would need different clock sources.
Quoted 8 lines
support 2500Base-X? Once you have Linux actually controlling the hardware, you can then make use of an SFP or a copper PHY which supports 2.5G. The PHY will swap its host side between SGMII and 2500Base-X depending on what the line side negotiates, 1000Base-T or 2500Base-T. The MAC driver then needs to change its configuration to suite.
Andrew
RE: [EXT] Re: [PATCH 2/5] dt-bindings: net: add schema for NXP S32CC dwmac glue driver
In reply to Chester LinHi Chester,
Quoted 51 lines
Hi Andrew and Andreas,
Quoted 15 lines · Andrew Lunn
Quoted 14 lines
Quoted 14 lines
Quoted 14 lines
Documentation/devicetree/bindings/net/nxp,s32cc-dwmac.yaml new file +14
-0+ - description: Main GMAC clock + - description: Peripheral registers clock + - description: Transmit SGMII clock + - description: Transmit RGMII clock + - description: Transmit RMII clock + - description: Transmit MII clock + - description: Receive SGMII clock + - description: Receive RGMII clock + - description: Receive RMII clock + - description: Receive MII clock + - description: + PTP reference clock. This clock is used for programming the + Timestamp Addend Register. If not passed then the system + clock will be used.Quoted 1 line
Quoted 1 line
Not clear to me has been whether the PHY mode can be switched at
runtime
Quoted 1 line
Quoted 1 line
(like DPAA2 on Layerscape allows for SFPs) or whether this is fixed by
board
Quoted 12 lines
Quoted 1 line
design.
Does the hardware support 1000BaseX? Often the hardware implementing SGMII can also do 1000BaseX, since SGMII is an extended/hacked up 1000BaseX.
If you have an SFP connected to the SERDES, a fibre module will want 1000BaseX and a copper module will want SGMII. phylink will tell you what phy-mode you need to use depending on what module is in the socket. This however might be a mute point, since both of these are probably using the SGMII clocks.
Quoted 4 lines
Of the other MII modes listed, it is very unlikely a runtime swap will occur.
Andrew
Here I just focus on GMAC since there are other LAN interfaces that S32 family
uses [e.g. PFE]. According to the public GMACSUBSYS ref manual rev2[1] provided
on NXP website, theoretically GMAC can run SGMII in 1000Mbps and 2500Mbps so I
assume that supporting 1000BASE-X could be achievable. I'm not sure if any S32
board variant might have SFP ports but RJ-45 [1000BASE-T] should be the major
type used on S32G-EVB and S32G-RDB2.
Quoted 2 lines
@NXP, please feel free to correct me if anything wrong.
NXP eval boards (EVB or RDB) have also 2.5G PHYs, so together with SerDes driver we support 100M/1G/2.5G on such copper PHYs.
/Jan
--
NXP Czechia, AP Ethernet
Re: [EXT] Re: [PATCH 2/5] dt-bindings: net: add schema for NXP S32CC dwmac glue driver
Quoted 12 lines
Quoted 12 lines
Here I just focus on GMAC since there are other LAN interfaces that S32 family
uses [e.g. PFE]. According to the public GMACSUBSYS ref manual rev2[1] provided
on NXP website, theoretically GMAC can run SGMII in 1000Mbps and 2500Mbps so I
assume that supporting 1000BASE-X could be achievable. I'm not sure if any S32
board variant might have SFP ports but RJ-45 [1000BASE-T] should be the major
type used on S32G-EVB and S32G-RDB2.
Quoted 5 lines
Quoted 2 lines
@NXP, please feel free to correct me if anything wrong.
NXP eval boards (EVB or RDB) have also 2.5G PHYs, so together with SerDes driver we support 100M/1G/2.5G on such copper PHYs.
Hi Jan
Does the SERDES clock need to change when going between 1000BaseX and 2500BaseX?
If so, it sounds like Linux not having control of that clock is going to limit what can be supported.
Andrew
RE: [EXT] Re: [PATCH 2/5] dt-bindings: net: add schema for NXP S32CC dwmac glue driver
Hi Andrew,
Quoted 19 lines
Quoted 7 lines
Quoted 7 lines
Here I just focus on GMAC since there are other LAN interfaces that S32 family
uses [e.g. PFE]. According to the public GMACSUBSYS ref manual rev2[1] provided
on NXP website, theoretically GMAC can run SGMII in 1000Mbps and 2500Mbps so I
assume that supporting 1000BASE-X could be achievable. I'm not sure ifany
Quoted 10 lines
Quoted 7 lines
S32
board variant might have SFP ports but RJ-45 [1000BASE-T] should be the major
type used on S32G-EVB and S32G-RDB2.@NXP, please feel free to correct me if anything wrong.
NXP eval boards (EVB or RDB) have also 2.5G PHYs, so together with SerDes driver we support 100M/1G/2.5G on such copper PHYs.
Quoted 7 lines
Hi Jan
Does the SERDES clock need to change when going between 1000BaseX and 2500BaseX?
If so, it sounds like Linux not having control of that clock is going to limit what can be supported.
No, the SerDes clock remains the same, the change is done internally, without any necessity of clock change intervention by GMAC driver.
/Jan
Re: [EXT] Re: [PATCH 2/5] dt-bindings: net: add schema for NXP S32CC dwmac glue driver
Quoted 23 lines · Jan Petrous
Hi Andrew,
Quoted 21 lines
Quoted 7 lines
Quoted 7 lines
Here I just focus on GMAC since there are other LAN interfaces that S32 family
uses [e.g. PFE]. According to the public GMACSUBSYS ref manual rev2[1] provided
on NXP website, theoretically GMAC can run SGMII in 1000Mbps and 2500Mbps so I
assume that supporting 1000BASE-X could be achievable. I'm not sure ifany
Quoted 10 lines
Quoted 7 lines
S32
board variant might have SFP ports but RJ-45 [1000BASE-T] should be the major
type used on S32G-EVB and S32G-RDB2.@NXP, please feel free to correct me if anything wrong.
NXP eval boards (EVB or RDB) have also 2.5G PHYs, so together with SerDes driver we support 100M/1G/2.5G on such copper PHYs.
Hi Jan
Quoted 8 lines
Quoted 5 lines
Does the SERDES clock need to change when going between 1000BaseX and 2500BaseX?
If so, it sounds like Linux not having control of that clock is going to limit what can be supported.
No, the SerDes clock remains the same, the change is done internally, without any necessity of clock change intervention by GMAC driver.
Hi Jan
Thanks for the information. So this binding should work.
The only suggestion i have is that the binding does not call is SGMII clock, because it is used for more than SGMII, also 1000base-X, and 2500Base-X. So PCS clock might be better.
Andrew
RE: [EXT] Re: [PATCH 2/5] dt-bindings: net: add schema for NXP S32CC dwmac glue driver
In reply to Andreas FärberHi Andreas,
Quoted 29 lines
Hi Rob,
Quoted 2 lines · Rob Herring
Quoted 1 line · Chester Lin
Add the DT schema for the DWMAC Ethernet controller on NXP S32
Common
Quoted 8 lines
Quoted 8 lines
Chassis.
Signed-off-by Jan Petrous <[email protected]>Signed-off-by Chester Lin <[email protected]>--- .../bindings/net/nxp,s32cc-dwmac.yaml | 145 ++++++++++++++++++ 1 file changed, 145 insertions(+)create mode 100644
Documentation/devicetree/bindings/net/nxp,s32cc-
dwmac.yamlQuoted 2 lines
Review
Quoted 2 lines
(quoted diff) +0
-0
dwmac.yamlb/Documentation/devicetree/bindings/net/nxp,s32cc-dwmac.yamlQuoted 10 lines
Quoted 10 lines
new file mode 100644
index 000000000000..f6b8486f9d42Documentation/devicetree/bindings/net/nxp,s32cc-dwmac.yaml new file +5
-0@@ -0,0 +1,145 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +# Copyright 2021-2022 NXP +%YAML 1.2 +--- +$id:
[...]
Quoted 37 lines
Quoted 5 lines
Quoted 5 lines
Documentation/devicetree/bindings/net/nxp,s32cc-dwmac.yaml new file +5
-0+title: NXP S32CC DWMAC Ethernet controller + +maintainers: + - Jan Petrous <[email protected]> + - Chester Lin <[email protected]>[...]
Quoted 8 lines
Documentation/devicetree/bindings/net/nxp,s32cc-dwmac.yaml line 17
Quoted 3 lines
Documentation/devicetree/bindings/net/nxp,s32cc-dwmac.yaml new file +3
-0+properties: + compatible: + contains:Drop 'contains'.
Quoted 2 lines
Documentation/devicetree/bindings/net/nxp,s32cc-dwmac.yaml new file +2
-0+ enum: + - nxp,s32cc-dwmacIn the past you were adamant that we use concrete SoC-specific strings. Here that would mean s32g2 or s32g274 instead of s32cc (which aims to share with S32G3 IIUC).
[...]
Quoted 17 lines
Quoted 16 lines
Documentation/devicetree/bindings/net/nxp,s32cc-dwmac.yaml new file +16
-0+ clocks: + items: + - description: Main GMAC clock + - description: Peripheral registers clock + - description: Transmit SGMII clock + - description: Transmit RGMII clock + - description: Transmit RMII clock + - description: Transmit MII clock + - description: Receive SGMII clock + - description: Receive RGMII clock + - description: Receive RMII clock + - description: Receive MII clock + - description: + PTP reference clock. This clock is used for programming the + Timestamp Addend Register. If not passed then the system + clock will be used.
Quoted 8 lines
Quoted 1 line
If optional, then you need 'minItems'.
[snip]
Do we have any precedence of bindings with *MII clocks like these?
AFAIU the reason there are so many here is that there are in fact physically just five, but different parent clock configurations that SCMI does not currently expose to Linux. Thus I was raising that we may
Correct. The different clock names represent different configs of the same clocks.
Quoted 10 lines
want to extend the SCMI protocol with some
SET_PARENToperation that could allow us to use less input clocks here, but obviously such a standardization process will take time...What are your thoughts on how to best handle this here?
Not clear to me has been whether the PHY mode can be switched at runtime (like DPAA2 on Layerscape allows for SFPs) or whether this is fixed by board design. If the latter, the two out of six SCMI IDs could get selected in TF-A, to have only physical clocks here in the binding.
The eval board allows to use different PHYs/switches connected by RGMII or SGMII to the GMAC. Some combinations require change of board's hw switches, but not all of them. Anyway, until we get a board with SFP, the connection type can be treated as fixed (declared in DT).
/Jan
--
NXP Czechia, AP Ethernet
PATCH 3/5 net: stmmac: Add CSR clock 500Mhz/800Mhz support
In reply to Chester LinAdd additional 500Mhz/800Mhz CSR clock ranges since NXP S32CC DWMAC can support higher frequencies.
--- drivers/net/ethernet/stmicro/stmmac/common.h | 2 ++ drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 4 ++++ include/linux/stmmac.h | 2 ++ 3 files changed, 8 insertions(+)
drivers/net/ethernet/stmicro/stmmac/common.h +2 -0
@@ -222,6 +222,8 @@ struct stmmac_safety_stats {#define CSR_F_150M 150000000#define CSR_F_250M 250000000#define CSR_F_300M 300000000 +#define CSR_F_500M 500000000 +#define CSR_F_800M 800000000#define MAC_CSR_H_FRQ_MASK 0x20
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +4 -0
@@ -323,6 +323,10 @@ static void stmmac_clk_csr_set(struct stmmac_priv *priv) priv->clk_csr =STMMAC_CSR_150_250M ; else if ((clk_rate >= CSR_F_250M) && (clk_rate <= CSR_F_300M)) priv->clk_csr = STMMAC_CSR_250_300M; + else if ((clk_rate >= CSR_F_300M) && (clk_rate < CSR_F_500M)) + priv->clk_csr = STMMAC_CSR_300_500M; + else if ((clk_rate >= CSR_F_500M) && (clk_rate < CSR_F_800M)) + priv->clk_csr = STMMAC_CSR_500_800M; }if (priv->plat->has_sun8i) {
include/linux/stmmac.h +2 -0
@@ -34,6 +34,8 @@#define STMMAC_CSR_35_60M 0x3/* MDC = clk_scr_i/26 */ #define STMMAC_CSR_150_250M 0x4/* MDC = clk_scr_i/102 */ #define STMMAC_CSR_250_300M 0x5/* MDC = clk_scr_i/122 */ +#define STMMAC_CSR_300_500M 0x6/* MDC = clk_scr_i/204 */ +#define STMMAC_CSR_500_800M 0x7/* MDC = clk_scr_i/324 */ /* MTL algorithms identifiers */ #define MTL_TX_ALGORITHM_WRR 0x0
Signature · 1 line
2.37.3
PATCH 4/5 net: stmmac: Add AXI4 ACE control support
In reply to Chester LinAdd AXI4 cache coherency control in dwmac4 DMA core.
--- drivers/net/ethernet/stmicro/stmmac/dwmac4_dma.c | 10 ++++++++++ drivers/net/ethernet/stmicro/stmmac/dwmac4_dma.h | 4 +++- drivers/net/ethernet/stmicro/stmmac/hwif.h | 5 +++++ drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 3 +++ include/linux/stmmac.h | 7 +++++++ 5 files changed, 28 insertions(+), 1 deletion(-)
drivers/net/ethernet/stmicro/stmmac/dwmac4_dma.c +10 -0
@@ -517,6 +517,15 @@ static int dwmac4_enable_tbs(void __iomem *ioaddr, bool en, u32 chan)return 0 ; } +static void dwmac4_axi4_cc (void __iomem *ioaddr, +struct stmmac_axi4_ace_ctrl *acecfg) +{ +/* Configure AXI4 cache coherency for Tx/Rx DMA channels */ +writel (acecfg->tx_ar_reg, ioaddr +DMA_AXI4_TX_AR_ACE_CONTROL ); +writel (acecfg->rx_aw_reg, ioaddr +DMA_AXI4_RX_AW_ACE_CONTROL ); +writel (acecfg->txrx_awar_reg, ioaddr +DMA_AXI4_TXRX_AWAR_ACE_CONTROL ); +} +const struct stmmac_dma_ops dwmac4_dma_ops = { .reset = dwmac4_dma_reset, .init = dwmac4_dma_init,
@@ -574,4 +583,5 @@ const struct stmmac_dma_ops dwmac410_dma_ops = { .set_bfsize = dwmac4_set_bfsize, .enable_sph = dwmac4_enable_sph, .enable_tbs = dwmac4_enable_tbs, + .axi4_cc = dwmac4_axi4_cc, };
drivers/net/ethernet/stmicro/stmmac/dwmac4_dma.h +3 -1
@@ -21,7 +21,9 @@#define DMA_DEBUG_STATUS_0 0x0000100c#define DMA_DEBUG_STATUS_1 0x00001010#define DMA_DEBUG_STATUS_2 0x00001014 -#define DMA_AXI_BUS_MODE 0x00001028 +#define DMA_AXI4_TX_AR_ACE_CONTROL 0x00001020 +#define DMA_AXI4_RX_AW_ACE_CONTROL 0x00001024 +#define DMA_AXI4_TXRX_AWAR_ACE_CONTROL 0x00001028#define DMA_TBS_CTRL 0x00001050/* DMA Bus Mode bitmap */
drivers/net/ethernet/stmicro/stmmac/hwif.h +5 -0
@@ -212,6 +212,9 @@ struct stmmac_dma_ops {void (*set_bfsize)(void __iomem *ioaddr,int bfsize,u32 chan);void (*enable_sph)(void __iomem *ioaddr,bool en,u32 chan);int (*enable_tbs)(void __iomem *ioaddr,bool en,u32 chan); +/* Configure AXI4 cache coherency for Tx and Rx DMA channels */ +void (*axi4_cc)(void __iomem *ioaddr, +struct stmmac_axi4_ace_ctrl *acecfg); }; #define stmmac_reset(__priv, __args...) \
@@ -272,6 +275,8 @@ struct stmmac_dma_ops { stmmac_do_void_callback(__priv, dma, enable_sph, __args) #define stmmac_enable_tbs(__priv, __args...) \ stmmac_do_callback(__priv, dma, enable_tbs, __args) +#define stmmac_axi4_cc(__priv, __args...) \ + stmmac_do_void_callback(__priv, dma, axi4_cc, __args)struct mac_device_info ;struct net_device ;
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +3 -0
@@ -2917,6 +2917,9 @@ static int stmmac_init_dma_engine(struct stmmac_priv *priv)if (priv->plat->axi)stmmac_axi (priv, priv->ioaddr, priv->plat->axi); +if (priv->plat->axi4_ace_ctrl) +stmmac_axi4_cc (priv, priv->ioaddr, priv->plat->axi4_ace_ctrl); +/* DMA CSR Channel configuration */ for (chan =0 ; chan < dma_csr_ch; chan++) {stmmac_init_chan (priv, priv->ioaddr, priv->plat->dma_cfg, chan);
include/linux/stmmac.h +7 -0
@@ -115,6 +115,12 @@ struct stmmac_axi {bool axi_rb; }; +struct stmmac_axi4_ace_ctrl { +u32 tx_ar_reg; +u32 rx_aw_reg; +u32 txrx_awar_reg; +}; +#define EST_GCL 1024struct stmmac_est {struct mutex lock;
@@ -248,6 +254,7 @@ struct plat_stmmacenet_data {struct reset_control *stmmac_rst;struct reset_control *stmmac_ahb_rst;struct stmmac_axi *axi; +struct stmmac_axi4_ace_ctrl *axi4_ace_ctrl;int has_gmac4;bool has_sun8i;bool tso_en;
Signature · 1 line
2.37.3
PATCH 5/5 net: stmmac: Add NXP S32 SoC family support
In reply to Chester LinAdd GMAC support for NXP S32 SoC family. This driver is mainly based on NXP's downstream implementation on CodeAurora[1].
--- drivers/net/ethernet/stmicro/stmmac/Kconfig | 13 + drivers/net/ethernet/stmicro/stmmac/Makefile | 1 + .../net/ethernet/stmicro/stmmac/dwmac-s32cc.c | 318 ++++++++++++++++++ 3 files changed, 332 insertions(+) create mode 100644 drivers/net/ethernet/stmicro/stmmac/dwmac-s32cc.c
drivers/net/ethernet/stmicro/stmmac/Kconfig +13 -0
@@ -153,6 +153,19 @@ config DWMAC_ROCKCHIP This selects the Rockchip RK3288 SoC glue layer support for the stmmac device driver. +config DWMAC_S32CC + tristate "NXP S32 series GMAC support" + default ARCH_S32 + depends on OF && (ARCH_S32 || COMPILE_TEST) + select MFD_SYSCON + select PHYLINK + help + Support for ethernet controller on NXP S32 series SOCs. + + This selects NXP SoC glue layer support for the stmmac + device driver. This driver is used for the S32 series + SOCs GMAC ethernet controller. + config DWMAC_SOCFPGA tristate "SOCFPGA dwmac support" default ARCH_INTEL_SOCFPGA
drivers/net/ethernet/stmicro/stmmac/Makefile +1 -0
@@ -32,6 +32,7 @@ obj-$(CONFIG_DWMAC_INTEL_PLAT) += dwmac-intel-plat.o obj-$(CONFIG_DWMAC_GENERIC) += dwmac-generic.o obj-$(CONFIG_DWMAC_IMX8) += dwmac-imx.o obj-$(CONFIG_DWMAC_VISCONTI) += dwmac-visconti.o +obj-$(CONFIG_DWMAC_S32CC) += dwmac-s32cc.o stmmac-platform-objs:= stmmac_platform.o dwmac-altr-socfpga-objs := altr_tse_pcs.o dwmac-socfpga.o
drivers/net/ethernet/stmicro/stmmac/dwmac-s32cc.c new file +318 -0
318 lines not on this page · raw message
Signature · 1 line
2.37.3
Re: [PATCH 5/5] net: stmmac: Add NXP S32 SoC family support
drivers/net/ethernet/stmicro/stmmac/dwmac-s32cc.c line 75
Quoted 6 lines
drivers/net/ethernet/stmicro/stmmac/dwmac-s32cc.c new file +6
-0+/* set interface mode */ +if (gmac->ctrl_sts) { +switch (gmac->intf_mode) { +default : +dev_info (&pdev->dev,"unsupported mode %u, set the default phy mode.\n" , + gmac->intf_mode);
If it is an unsupported mode use dev_err() and return -EINVAL;
drivers/net/ethernet/stmicro/stmmac/dwmac-s32cc.c line 78
Quoted 3 lines
drivers/net/ethernet/stmicro/stmmac/dwmac-s32cc.c new file +3
-0+ fallthrough; +case PHY_INTERFACE_MODE_SGMII : +dev_info (&pdev->dev,"phy mode set to SGMII\n" );
dev_dbg()
Please don't spam the lock with useless information.
drivers/net/ethernet/stmicro/stmmac/dwmac-s32cc.c line 85
Quoted 7 lines
drivers/net/ethernet/stmicro/stmmac/dwmac-s32cc.c new file +7
-0+ intf_sel =PHY_INTF_SEL_SGMII ; +break ; +case PHY_INTERFACE_MODE_RGMII : +case PHY_INTERFACE_MODE_RGMII_ID : +case PHY_INTERFACE_MODE_RGMII_TXID : +case PHY_INTERFACE_MODE_RGMII_RXID : +dev_info (&pdev->dev,"phy mode set to RGMII\n" );
dev_dbg()
drivers/net/ethernet/stmicro/stmmac/dwmac-s32cc.c line 89
Quoted 4 lines
drivers/net/ethernet/stmicro/stmmac/dwmac-s32cc.c new file +4
-0+ intf_sel =PHY_INTF_SEL_RGMII ; +break ; +case PHY_INTERFACE_MODE_RMII : +dev_info (&pdev->dev,"phy mode set to RMII\n" );
dev_dbg()
drivers/net/ethernet/stmicro/stmmac/dwmac-s32cc.c line 93
Quoted 4 lines
drivers/net/ethernet/stmicro/stmmac/dwmac-s32cc.c new file +4
-0+ intf_sel =PHY_INTF_SEL_RMII ; +break ; +case PHY_INTERFACE_MODE_MII : +dev_info (&pdev->dev,"phy mode set to MII\n" );
dev_dbg()
Quoted 10 lines
drivers/net/ethernet/stmicro/stmmac/dwmac-s32cc.c new file +10
-0+ intf_sel =PHY_INTF_SEL_MII ; +break ; + } + +writel (intf_sel, gmac->ctrl_sts); + } + +return 0 ; +} +
drivers/net/ethernet/stmicro/stmmac/dwmac-s32cc.c line 154
Quoted 10 lines
drivers/net/ethernet/stmicro/stmmac/dwmac-s32cc.c new file +10
-0+static int s32cc_config_cache_coherency (struct platform_device *pdev, +struct plat_stmmacenet_data *plat_dat) +{ + plat_dat->axi4_ace_ctrl = +devm_kzalloc (&pdev->dev, +sizeof (struct stmmac_axi4_ace_ctrl ), +GFP_KERNEL ); + +if (!plat_dat->axi4_ace_ctrl) { +dev_info (&pdev->dev,"Fail to allocate axi4_ace_ctrl\n" );
dev_err(). But devm_kzalloc() failing will produce log messages, so you probably don't need this.
Andrew