Skip to contentSkip to conversation

Add GMAC support for S32 SoC family

PATCH Superseded Chester Lin 4 participants 15 messages Nov 28, 2022 – Dec 13, 2022

Subsystems (5)

v2 of 5 Superseded Latest is v5 →

lore
Share & tools
lore
#0 lore raw

v2 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

Changes in v2:
- Fix schema issues.
- Add minItems to clocks & clock-names.
- Replace all sgmii/SGMII terms with pcs/PCS.
- clock-names: tx_sgmii -> tx_pcs, rx_sgmii -> rx_pcs
- Adjust error handlings while calling devm_clk_get().
- Remove redundant dev_info messages.
- Remove unnecessary if conditions.
- Fix the copyright format suggested by NXP.

[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         | 135 ++++++++
 .../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 | 304 ++++++++++++++++++
 .../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, 492 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
#1 lore raw

PATCH v2 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.

---

No change in v2.

 Documentation/devicetree/bindings/net/snps,dwmac.yaml | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
Documentation/devicetree/bindings/net/snps,dwmac.yaml +3 -2
index 13b984076af5..c174d173591e 100644
@@ -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
#2 lore raw

Re: [PATCH v2 1/5] dt-bindings: net: snps, dwmac: add NXP S32CC support

Hi Chester,

Am 28.11.22 um 06:49 schrieb Chester Lin:

Quoted 17 lines

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.

---

No change in v2.

  Documentation/devicetree/bindings/net/snps,dwmac.yaml | 5 +++--
  1 file changed, 3 insertions(+), 2 deletions(-)
Documentation/devicetree/bindings/net/snps,dwmac.yaml +0 -0
index 13b984076af5..c174d173591e 100644

Documentation/devicetree/bindings/net/snps,dwmac.yaml properties: · line 68

Quoted 4 lines
Documentation/devicetree/bindings/net/snps,dwmac.yaml +1 -0
@@ -65,6 +65,7 @@ properties:
          - ingenic,x2000-mac
          - loongson,ls2k-dwmac
          - loongson,ls7a-dwmac
+        - nxp,s32cc-dwmac

As we had discussed offline, please change this to nxp,s32g2-dwmac.
S32G3 and S32R45 can then reuse it if they don't require changes; there is no difference here to how i.MX family or other vendors inherit IP across SoC models, so Rob's rules apply equally.

Also affects the following patches.

Thanks,
Andreas

Quoted 3 lines
Documentation/devicetree/bindings/net/snps,dwmac.yaml +0 -0
          - renesas,r9a06g032-gmac
          - renesas,rzn1-gmac
          - rockchip,px30-gmac

[snip]

Signature · 4 lines
SUSE Software Solutions Germany GmbH
Frankenstraße 146, 90461 Nürnberg, Germany
GF: Ivo Totev, Andrew Myers, Andrew McDonald, Boudien Moerman
HRB 36809 (AG Nürnberg)
#3 lore raw

PATCH v2 2/5 dt-bindings: net: add schema for NXP S32CC dwmac glue driver

In reply to Chester Lin

Add the DT schema for the DWMAC Ethernet controller on NXP S32 Common Chassis.

---

Changes in v2:
- Fix schema issues.
- Add minItems to clocks & clock-names.
- Replace all sgmii/SGMII terms with pcs/PCS.

 .../bindings/net/nxp,s32cc-dwmac.yaml         | 135 ++++++++++++++++++
 1 file changed, 135 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/net/nxp,s32cc-dwmac.yaml
Documentation/devicetree/bindings/net/nxp,s32cc-dwmac.yaml new file +135 -0
new file mode 100644
index 000000000000..c6839fd3df40
@@ -0,0 +1,135 @@
+# 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]>
+
+allOf:
+  - $ref: "snps,dwmac.yaml#"
+
+properties:
+  compatible:
+    enum:
+      - nxp,s32cc-dwmac
+
+  reg:
+    items:
+      - description: Main GMAC registers
+      - description: S32 MAC control registers
+
+  dma-coherent: true
+
+  clocks:
+    minItems: 5
+    items:
+      - description: Main GMAC clock
+      - description: Peripheral registers clock
+      - description: Transmit PCS clock
+      - description: Transmit RGMII clock
+      - description: Transmit RMII clock
+      - description: Transmit MII clock
+      - description: Receive PCS 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:
+    minItems: 5
+    items:
+      - const: stmmaceth
+      - const: pclk
+      - const: tx_pcs
+      - const: tx_rgmii
+      - const: tx_rmii
+      - const: tx_mii
+      - const: rx_pcs
+      - 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
+
+unevaluatedProperties: false
+
+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_PCS
+    #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_PCS
+    #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_PCS>,
+                 <&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_PCS>,
+                 <&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_pcs", "tx_rgmii", "tx_rmii", "tx_mii",
+                      "rx_pcs", "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
#4 lore raw

Re: [PATCH v2 2/5] dt-bindings: net: add schema for NXP S32CC dwmac glue driver

Quoted 5 lines · Chester Lin

Add the DT schema for the DWMAC Ethernet controller on NXP S32 Common Chassis.

Thank you for your patch. There is something to discuss/improve.

Quoted 17 lines

---

Changes in v2:
- Fix schema issues.
- Add minItems to clocks & clock-names.
- Replace all sgmii/SGMII terms with pcs/PCS.

 .../bindings/net/nxp,s32cc-dwmac.yaml         | 135 ++++++++++++++++++
 1 file changed, 135 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/net/nxp,s32cc-dwmac.yaml
Documentation/devicetree/bindings/net/nxp,s32cc-dwmac.yaml new file +0 -0
new file mode 100644
index 000000000000..c6839fd3df40

Documentation/devicetree/bindings/net/nxp,s32cc-dwmac.yaml line 6

Quoted 6 lines
Documentation/devicetree/bindings/net/nxp,s32cc-dwmac.yaml new file +6 -0
@@ -0,0 +1,135 @@
+# 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#"

Drop quotes from both.

Documentation/devicetree/bindings/net/nxp,s32cc-dwmac.yaml line 15

Quoted 9 lines
Documentation/devicetree/bindings/net/nxp,s32cc-dwmac.yaml new file +9 -0
+
+title: NXP S32CC DWMAC Ethernet controller
+
+maintainers:
+  - Jan Petrous <[email protected]>
+  - Chester Lin <[email protected]>
+
+allOf:
+  - $ref: "snps,dwmac.yaml#"

Drop quotes.

Quoted 5 lines
Documentation/devicetree/bindings/net/nxp,s32cc-dwmac.yaml new file +5 -0
+
+properties:
+  compatible:
+    enum:
+      - nxp,s32cc-dwmac

Documentation/devicetree/bindings/net/nxp,s32cc-dwmac.yaml line 30

Quoted 10 lines
Documentation/devicetree/bindings/net/nxp,s32cc-dwmac.yaml new file +10 -0
+
+  reg:
+    items:
+      - description: Main GMAC registers
+      - description: S32 MAC control registers
+
+  dma-coherent: true
+
+  clocks:
+    minItems: 5

Why only 5 clocks are required? Receive clocks don't have to be there? Is such system - only with clocks for transmit - usable?

Quoted 52 lines
Documentation/devicetree/bindings/net/nxp,s32cc-dwmac.yaml new file +52 -0
+    items:
+      - description: Main GMAC clock
+      - description: Peripheral registers clock
+      - description: Transmit PCS clock
+      - description: Transmit RGMII clock
+      - description: Transmit RMII clock
+      - description: Transmit MII clock
+      - description: Receive PCS 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:
+    minItems: 5
+    items:
+      - const: stmmaceth
+      - const: pclk
+      - const: tx_pcs
+      - const: tx_rgmii
+      - const: tx_rmii
+      - const: tx_mii
+      - const: rx_pcs
+      - 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
+
+unevaluatedProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/interrupt-controller/arm-gic.h>
+    #include <dt-bindings/interrupt-controller/irq.h>
+

Documentation/devicetree/bindings/net/nxp,s32cc-dwmac.yaml line 92

Quoted 10 lines
Documentation/devicetree/bindings/net/nxp,s32cc-dwmac.yaml new file +10 -0
+    #define S32GEN1_SCMI_CLK_GMAC0_AXI
+    #define S32GEN1_SCMI_CLK_GMAC0_TX_PCS
+    #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_PCS
+    #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

Why defines? Your clock controller is not ready? If so, just use raw numbers.

Documentation/devicetree/bindings/net/nxp,s32cc-dwmac.yaml line 101

Quoted 9 lines
Documentation/devicetree/bindings/net/nxp,s32cc-dwmac.yaml new file +9 -0
+
+    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 */

Lowercase hex.

Quoted 8 lines
Documentation/devicetree/bindings/net/nxp,s32cc-dwmac.yaml new file +8 -0
+        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>,

Documentation/devicetree/bindings/net/nxp,s32cc-dwmac.yaml line 119

Quoted 10 lines
Documentation/devicetree/bindings/net/nxp,s32cc-dwmac.yaml new file +10 -0
+                 <&clks S32GEN1_SCMI_CLK_GMAC0_AXI>,
+                 <&clks S32GEN1_SCMI_CLK_GMAC0_TX_PCS>,
+                 <&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_PCS>,
+                 <&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>;

Best regards,
Krzysztof

#5 lore raw

Re: [PATCH v2 2/5] dt-bindings: net: add schema for NXP S32CC dwmac glue driver

Hi Krysztof,

Am 30.11.22 um 16:51 schrieb Krzysztof Kozlowski:

Quoted 25 lines · Chester Lin
Quoted 5 lines

Add the DT schema for the DWMAC Ethernet controller on NXP S32 Common Chassis.

Thank you for your patch. There is something to discuss/improve.

Quoted 16 lines

---

Changes in v2:
- Fix schema issues.
- Add minItems to clocks & clock-names.
- Replace all sgmii/SGMII terms with pcs/PCS.

  .../bindings/net/nxp,s32cc-dwmac.yaml         | 135 ++++++++++++++++++
  1 file changed, 135 insertions(+)

create mode 100644 Documentation/devicetree/bindings/net/nxp,s32cc-dwmac.yaml

Documentation/devicetree/bindings/net/nxp,s32cc-dwmac.yaml new file +0 -0
new file mode 100644
index 000000000000..c6839fd3df40

[...]

Quoted 75 lines
Quoted 4 lines
Documentation/devicetree/bindings/net/nxp,s32cc-dwmac.yaml new file +4 -0
+properties:
+  compatible:
+    enum:
+      - nxp,s32cc-dwmac

Documentation/devicetree/bindings/net/nxp,s32cc-dwmac.yaml line 30

Quoted 10 lines
Documentation/devicetree/bindings/net/nxp,s32cc-dwmac.yaml new file +10 -0
+
+  reg:
+    items:
+      - description: Main GMAC registers
+      - description: S32 MAC control registers
+
+  dma-coherent: true
+
+  clocks:
+    minItems: 5

Why only 5 clocks are required? Receive clocks don't have to be there? Is such system - only with clocks for transmit - usable?

Quoted 57 lines
Documentation/devicetree/bindings/net/nxp,s32cc-dwmac.yaml new file +57 -0
+    items:
+      - description: Main GMAC clock
+      - description: Peripheral registers clock
+      - description: Transmit PCS clock
+      - description: Transmit RGMII clock
+      - description: Transmit RMII clock
+      - description: Transmit MII clock
+      - description: Receive PCS 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:
+    minItems: 5
+    items:
+      - const: stmmaceth
+      - const: pclk
+      - const: tx_pcs
+      - const: tx_rgmii
+      - const: tx_rmii
+      - const: tx_mii
+      - const: rx_pcs
+      - 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
+
+unevaluatedProperties: false
+
+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_PCS
+    #define S32GEN1_SCMI_CLK_GMAC0_TX_RGMII
+    #define S32GEN1_SCMI_CLK_GMAC0_TX_RMII
+    #define S32GEN1_SCMI_CLK_GMAC0_TX_MII
Quoted 8 lines

Documentation/devicetree/bindings/net/nxp,s32cc-dwmac.yaml line 92

Quoted 5 lines
Documentation/devicetree/bindings/net/nxp,s32cc-dwmac.yaml new file +5 -0
+    #define S32GEN1_SCMI_CLK_GMAC0_RX_PCS
+    #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

Why defines? Your clock controller is not ready? If so, just use raw numbers.

Please compare v1: There is no Linux-driven clock controller here but rather a fluid SCMI firmware interface. Work towards getting clocks into a kernel-hosted .dtsi was halted in favor of (downstream) TF-A, which also explains the ugly examples here and for pinctrl.

Logically there are only 5 input clocks; however due to SCMI not supporting re-parenting today, some clocks got duplicated at SCMI level. Andrew appeared to approve of that approach. I still dislike it but don't have a better proposal that would work today. So the two values above indeed seem wrong and should be 11 rather than 5.

Cheers,
Andreas

Quoted 35 lines

Documentation/devicetree/bindings/net/nxp,s32cc-dwmac.yaml line 101

Quoted 9 lines
Documentation/devicetree/bindings/net/nxp,s32cc-dwmac.yaml new file +9 -0
+
+    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 */

Lowercase hex.

Quoted 8 lines
Documentation/devicetree/bindings/net/nxp,s32cc-dwmac.yaml new file +8 -0
+        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>,

Documentation/devicetree/bindings/net/nxp,s32cc-dwmac.yaml line 119

Quoted 10 lines
Documentation/devicetree/bindings/net/nxp,s32cc-dwmac.yaml new file +10 -0
+                 <&clks S32GEN1_SCMI_CLK_GMAC0_AXI>,
+                 <&clks S32GEN1_SCMI_CLK_GMAC0_TX_PCS>,
+                 <&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_PCS>,
+                 <&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>;

Best regards,
Krzysztof

Signature · 4 lines
SUSE Software Solutions Germany GmbH
Frankenstraße 146, 90461 Nürnberg, Germany
GF: Ivo Totev, Andrew Myers, Andrew McDonald, Boudien Moerman
HRB 36809 (AG Nürnberg)
#6 lore raw

Re: [PATCH v2 2/5] dt-bindings: net: add schema for NXP S32CC dwmac glue driver

Quoted 10 lines

Please compare v1: There is no Linux-driven clock controller here but rather a fluid SCMI firmware interface. Work towards getting clocks into a kernel-hosted .dtsi was halted in favor of (downstream) TF-A, which also explains the ugly examples here and for pinctrl.

Logically there are only 5 input clocks; however due to SCMI not supporting re-parenting today, some clocks got duplicated at SCMI level. Andrew appeared to approve of that approach. I still dislike it but don't have a better proposal that would work today. So the two values above indeed seem wrong and should be 11 rather than 5.

Just be aware, you are setting an ABI here. So your fluid SCMI firmware interface must forever support this.

Andrew

_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

#7 lore raw

Re: [PATCH v2 2/5] dt-bindings: net: add schema for NXP S32CC dwmac glue driver

In reply to Andreas Färber
Quoted 23 lines · Andreas Färber

Hi Krysztof,

Am 30.11.22 um 16:51 schrieb Krzysztof Kozlowski:

Quoted 20 lines · Chester Lin
Quoted 5 lines

Add the DT schema for the DWMAC Ethernet controller on NXP S32 Common Chassis.

Thank you for your patch. There is something to discuss/improve.

Quoted 11 lines

---

Changes in v2:
- Fix schema issues.
- Add minItems to clocks & clock-names.
- Replace all sgmii/SGMII terms with pcs/PCS.

  .../bindings/net/nxp,s32cc-dwmac.yaml         | 135 ++++++++++++++++++
  1 file changed, 135 insertions(+)

create mode 100644 Documentation/devicetree/bindings/net/nxp,s32cc-dwmac.yaml

Quoted 23 lines
Quoted 5 lines
Quoted 5 lines
Documentation/devicetree/bindings/net/nxp,s32cc-dwmac.yaml new file +0 -0
new file mode 100644
index 000000000000..c6839fd3df40

[...]

Quoted 17 lines
Quoted 4 lines
Documentation/devicetree/bindings/net/nxp,s32cc-dwmac.yaml new file +4 -0
+properties:
+  compatible:
+    enum:
+      - nxp,s32cc-dwmac

Documentation/devicetree/bindings/net/nxp,s32cc-dwmac.yaml line 30

Quoted 10 lines
Documentation/devicetree/bindings/net/nxp,s32cc-dwmac.yaml new file +10 -0
+
+  reg:
+    items:
+      - description: Main GMAC registers
+      - description: S32 MAC control registers
+
+  dma-coherent: true
+
+  clocks:
+    minItems: 5

Why only 5 clocks are required? Receive clocks don't have to be there? Is such system - only with clocks for transmit - usable?

Any comments here? If not, drop minItems.

Quoted 67 lines
Quoted 58 lines
Quoted 58 lines
Documentation/devicetree/bindings/net/nxp,s32cc-dwmac.yaml new file +57 -0
+    items:
+      - description: Main GMAC clock
+      - description: Peripheral registers clock
+      - description: Transmit PCS clock
+      - description: Transmit RGMII clock
+      - description: Transmit RMII clock
+      - description: Transmit MII clock
+      - description: Receive PCS 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:
+    minItems: 5
+    items:
+      - const: stmmaceth
+      - const: pclk
+      - const: tx_pcs
+      - const: tx_rgmii
+      - const: tx_rmii
+      - const: tx_mii
+      - const: rx_pcs
+      - 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
+
+unevaluatedProperties: false
+
+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_PCS
+    #define S32GEN1_SCMI_CLK_GMAC0_TX_RGMII
+    #define S32GEN1_SCMI_CLK_GMAC0_TX_RMII
+    #define S32GEN1_SCMI_CLK_GMAC0_TX_MII
Quoted 8 lines

Documentation/devicetree/bindings/net/nxp,s32cc-dwmac.yaml line 92

Quoted 5 lines
Documentation/devicetree/bindings/net/nxp,s32cc-dwmac.yaml new file +5 -0
+    #define S32GEN1_SCMI_CLK_GMAC0_RX_PCS
+    #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

Why defines? Your clock controller is not ready? If so, just use raw numbers.

Quoted 4 lines

Please compare v1: There is no Linux-driven clock controller here but rather a fluid SCMI firmware interface. Work towards getting clocks into a kernel-hosted .dtsi was halted in favor of (downstream) TF-A, which also explains the ugly examples here and for pinctrl.

This does not explain to me why you added defines in the example. Are you saying these can change any moment?

Quoted 6 lines

Logically there are only 5 input clocks; however due to SCMI not supporting re-parenting today, some clocks got duplicated at SCMI level. Andrew appeared to approve of that approach. I still dislike it but don't have a better proposal that would work today. So the two values above indeed seem wrong and should be 11 rather than 5.

You should rather fix firmware then create some incorrect bindings as a workaround...

Best regards,
Krzysztof

#8 lore raw

Re: [PATCH v2 2/5] dt-bindings: net: add schema for NXP S32CC dwmac glue driver

Hi Krzysztof,

Quoted 5 lines · Krzysztof Kozlowski
Quoted 4 lines · Andreas Färber

Hi Krysztof,

Am 30.11.22 um 16:51 schrieb Krzysztof Kozlowski:

Quoted 1 line · Chester Lin
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 5 lines

Add the DT schema for the DWMAC Ethernet controller on NXP S32 Common Chassis.

Thank you for your patch. There is something to discuss/improve.

Thanks for taking time to review this patch!

Quoted 104 lines
Quoted 26 lines
Quoted 16 lines
Quoted 16 lines

---

Changes in v2:
- Fix schema issues.
- Add minItems to clocks & clock-names.
- Replace all sgmii/SGMII terms with pcs/PCS.

  .../bindings/net/nxp,s32cc-dwmac.yaml         | 135 ++++++++++++++++++
  1 file changed, 135 insertions(+)

create mode 100644 Documentation/devicetree/bindings/net/nxp,s32cc-dwmac.yaml

Documentation/devicetree/bindings/net/nxp,s32cc-dwmac.yaml new file +0 -0
new file mode 100644
index 000000000000..c6839fd3df40

[...]

Quoted 9 lines
Quoted 9 lines
Documentation/devicetree/bindings/net/nxp,s32cc-dwmac.yaml new file +9 -0
+properties:
+  compatible:
+    enum:
+      - nxp,s32cc-dwmac
+
+  reg:
+    items:
+      - description: Main GMAC registers
+      - description: S32 MAC control registers
Quoted 8 lines
Quoted 8 lines

Documentation/devicetree/bindings/net/nxp,s32cc-dwmac.yaml line 30

Quoted 5 lines
Documentation/devicetree/bindings/net/nxp,s32cc-dwmac.yaml new file +5 -0
+
+  dma-coherent: true
+
+  clocks:
+    minItems: 5

Why only 5 clocks are required? Receive clocks don't have to be there? Is such system - only with clocks for transmit - usable?

Any comments here? If not, drop minItems.

Quoted 67 lines
Quoted 66 lines
Quoted 53 lines
Documentation/devicetree/bindings/net/nxp,s32cc-dwmac.yaml new file +52 -0
+    items:
+      - description: Main GMAC clock
+      - description: Peripheral registers clock
+      - description: Transmit PCS clock
+      - description: Transmit RGMII clock
+      - description: Transmit RMII clock
+      - description: Transmit MII clock
+      - description: Receive PCS 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:
+    minItems: 5
+    items:
+      - const: stmmaceth
+      - const: pclk
+      - const: tx_pcs
+      - const: tx_rgmii
+      - const: tx_rmii
+      - const: tx_mii
+      - const: rx_pcs
+      - 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
+
+unevaluatedProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/interrupt-controller/arm-gic.h>
+    #include <dt-bindings/interrupt-controller/irq.h>
+

Documentation/devicetree/bindings/net/nxp,s32cc-dwmac.yaml line 92

Quoted 10 lines
Documentation/devicetree/bindings/net/nxp,s32cc-dwmac.yaml new file +10 -0
+    #define S32GEN1_SCMI_CLK_GMAC0_AXI
+    #define S32GEN1_SCMI_CLK_GMAC0_TX_PCS
+    #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_PCS
+    #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

Why defines? Your clock controller is not ready? If so, just use raw numbers.

Quoted 8 lines
Quoted 4 lines

Please compare v1: There is no Linux-driven clock controller here but rather a fluid SCMI firmware interface. Work towards getting clocks into a kernel-hosted .dtsi was halted in favor of (downstream) TF-A, which also explains the ugly examples here and for pinctrl.

This does not explain to me why you added defines in the example. Are you saying these can change any moment?

Actually these GMAC-related SCMI clock IDs changed once in NXP's downstream TF-A, some redundant TS clock IDs were removed and the rest of clock IDs were all moved forward. Apart from GMAC-related IDs, some other clock IDs were also appended in both base-clock IDs and platform-specific clock IDs [The first plat ID = The last base ID + 1]. Due to the current design of the clk-scmi driver and the SCMI clock protocol, IIUC, it's better to keep all clock IDs in sequence without a blank in order to avoid query miss, which could affect the probe speed.

Quoted 13 lines
Quoted 6 lines

Logically there are only 5 input clocks; however due to SCMI not supporting re-parenting today, some clocks got duplicated at SCMI level. Andrew appeared to approve of that approach. I still dislike it but don't have a better proposal that would work today. So the two values above indeed seem wrong and should be 11 rather than 5.

You should rather fix firmware then create some incorrect bindings as a workaround...

Best regards,
Krzysztof

#9 lore raw

Re: [PATCH v2 2/5] dt-bindings: net: add schema for NXP S32CC dwmac glue driver

Quoted 24 lines · Chester Lin
Quoted 24 lines
Quoted 23 lines
Quoted 10 lines
Quoted 10 lines
Documentation/devicetree/bindings/net/nxp,s32cc-dwmac.yaml new file +10 -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_PCS
+    #define S32GEN1_SCMI_CLK_GMAC0_TX_RGMII
+    #define S32GEN1_SCMI_CLK_GMAC0_TX_RMII
+    #define S32GEN1_SCMI_CLK_GMAC0_TX_MII
Quoted 8 lines

Documentation/devicetree/bindings/net/nxp,s32cc-dwmac.yaml line 92

Quoted 5 lines
Documentation/devicetree/bindings/net/nxp,s32cc-dwmac.yaml new file +5 -0
+    #define S32GEN1_SCMI_CLK_GMAC0_RX_PCS
+    #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

Why defines? Your clock controller is not ready? If so, just use raw numbers.

Please compare v1: There is no Linux-driven clock controller here but rather a fluid SCMI firmware interface. Work towards getting clocks into a kernel-hosted .dtsi was halted in favor of (downstream) TF-A, which also explains the ugly examples here and for pinctrl.

Quoted 7 lines
Quoted 3 lines

This does not explain to me why you added defines in the example. Are you saying these can change any moment?

Actually these GMAC-related SCMI clock IDs changed once in NXP's downstream TF-A, some redundant TS clock IDs were removed and the rest of clock IDs were all moved forward.

This is not accepted. Your downstream TF-A cannot change bindings. As an upstream contributor you should push this back and definitely not try to upstream such approach.

Quoted 5 lines

Apart from GMAC-related IDs, some other clock IDs were also appended in both base-clock IDs and platform-specific clock IDs [The first plat ID = The last base ID + 1]. Due to the current design of the clk-scmi driver and the SCMI clock protocol, IIUC, it's better to keep all clock IDs in sequence without a blank in order to avoid query miss, which could affect the probe speed.

You miss here broken ABI! Any change in IDs causes all DTBs to be broken. Downstream, upstream, other projects, everywhere.

Therefore thank you for clarifying that we need to be more careful about stuff coming from (or for) NXP. Here you need to drop all defines and all your patches must assume the ID is fixed. Once there, it's unchangeable without breaking the ABI.

Best regards,
Krzysztof

_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

#10 lore raw

Re: [PATCH v2 2/5] dt-bindings: net: add schema for NXP S32CC dwmac glue driver

Hi Krzysztof,

Sorry for the late reply.

Quoted 43 lines · Krzysztof Kozlowski
Quoted 24 lines · Chester Lin
Quoted 24 lines
Quoted 23 lines
Quoted 10 lines
Quoted 10 lines
Documentation/devicetree/bindings/net/nxp,s32cc-dwmac.yaml new file +10 -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_PCS
+    #define S32GEN1_SCMI_CLK_GMAC0_TX_RGMII
+    #define S32GEN1_SCMI_CLK_GMAC0_TX_RMII
+    #define S32GEN1_SCMI_CLK_GMAC0_TX_MII
Quoted 8 lines

Documentation/devicetree/bindings/net/nxp,s32cc-dwmac.yaml line 92

Quoted 5 lines
Documentation/devicetree/bindings/net/nxp,s32cc-dwmac.yaml new file +5 -0
+    #define S32GEN1_SCMI_CLK_GMAC0_RX_PCS
+    #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

Why defines? Your clock controller is not ready? If so, just use raw numbers.

Please compare v1: There is no Linux-driven clock controller here but rather a fluid SCMI firmware interface. Work towards getting clocks into a kernel-hosted .dtsi was halted in favor of (downstream) TF-A, which also explains the ugly examples here and for pinctrl.

Quoted 7 lines
Quoted 3 lines

This does not explain to me why you added defines in the example. Are you saying these can change any moment?

Actually these GMAC-related SCMI clock IDs changed once in NXP's downstream TF-A, some redundant TS clock IDs were removed and the rest of clock IDs were all moved forward.

This is not accepted. Your downstream TF-A cannot change bindings. As an upstream contributor you should push this back and definitely not try to upstream such approach.

Quoted 5 lines

Apart from GMAC-related IDs, some other clock IDs were also appended in both base-clock IDs and platform-specific clock IDs [The first plat ID = The last base ID + 1]. Due to the current design of the clk-scmi driver and the SCMI clock protocol, IIUC, it's better to keep all clock IDs in sequence without a blank in order to avoid query miss, which could affect the probe speed.

Quoted 8 lines

You miss here broken ABI! Any change in IDs causes all DTBs to be broken. Downstream, upstream, other projects, everywhere.

Therefore thank you for clarifying that we need to be more careful about stuff coming from (or for) NXP. Here you need to drop all defines and all your patches must assume the ID is fixed. Once there, it's unchangeable without breaking the ABI.

Please accept my apologies for submitting these bad patches. We were just confused since we thought that this approach might be acceptable because there were some similar examples got merged in the kernel tree:

https://elixir.bootlin.com/linux/latest/source/Documentation/devicetree/bindings/net/intel,dwmac-plat.yaml#L57
https://elixir.bootlin.com/linux/latest/source/Documentation/devicetree/bindings/usb/intel,keembay-dwc3.yaml#L55
https://elixir.bootlin.com/linux/latest/source/Documentation/devicetree/bindings/sound/intel,keembay-i2s.yaml#L73
https://elixir.bootlin.com/linux/latest/source/Documentation/devicetree/bindings/pwm/intel,keembay-pwm.yaml#L39
https://elixir.bootlin.com/linux/latest/source/Documentation/devicetree/bindings/watchdog/intel,keembay-wdt.yaml#L46
https://elixir.bootlin.com/linux/latest/source/Documentation/devicetree/bindings/pci/intel,keembay-pcie.yaml#L75
https://elixir.bootlin.com/linux/latest/source/Documentation/devicetree/bindings/mmc/arasan,sdhci.yaml#L282

The defines in these yaml files are not actually referred by kernel DTs or drivers so I assume that they should be provided by firmware as pure integer numbers and the clk-scmi driver should just take them to ask firmware for doing clk stuff.

Regards,
Chester

Quoted 3 lines

Best regards,
Krzysztof

#11 lore raw

Re: [PATCH v2 2/5] dt-bindings: net: add schema for NXP S32CC dwmac glue driver

Quoted 57 lines · Chester Lin

Hi Krzysztof,

Sorry for the late reply.

Quoted 43 lines · Krzysztof Kozlowski
Quoted 24 lines · Chester Lin
Quoted 24 lines
Quoted 23 lines
Quoted 10 lines
Quoted 10 lines
(quoted diff) +10 -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_PCS
+    #define S32GEN1_SCMI_CLK_GMAC0_TX_RGMII
+    #define S32GEN1_SCMI_CLK_GMAC0_TX_RMII
+    #define S32GEN1_SCMI_CLK_GMAC0_TX_MII
Quoted 8 lines

Review

Quoted 5 lines
(quoted diff) +5 -0
+    #define S32GEN1_SCMI_CLK_GMAC0_RX_PCS
+    #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

Why defines? Your clock controller is not ready? If so, just use raw numbers.

Please compare v1: There is no Linux-driven clock controller here but rather a fluid SCMI firmware interface. Work towards getting clocks into a kernel-hosted .dtsi was halted in favor of (downstream) TF-A, which also explains the ugly examples here and for pinctrl.

Quoted 7 lines
Quoted 3 lines

This does not explain to me why you added defines in the example. Are you saying these can change any moment?

Actually these GMAC-related SCMI clock IDs changed once in NXP's downstream TF-A, some redundant TS clock IDs were removed and the rest of clock IDs were all moved forward.

This is not accepted. Your downstream TF-A cannot change bindings. As an upstream contributor you should push this back and definitely not try to upstream such approach.

Quoted 5 lines

Apart from GMAC-related IDs, some other clock IDs were also appended in both base-clock IDs and platform-specific clock IDs [The first plat ID = The last base ID + 1]. Due to the current design of the clk-scmi driver and the SCMI clock protocol, IIUC, it's better to keep all clock IDs in sequence without a blank in order to avoid query miss, which could affect the probe speed.

Quoted 8 lines

You miss here broken ABI! Any change in IDs causes all DTBs to be broken. Downstream, upstream, other projects, everywhere.

Therefore thank you for clarifying that we need to be more careful about stuff coming from (or for) NXP. Here you need to drop all defines and all your patches must assume the ID is fixed. Once there, it's unchangeable without breaking the ABI.

Quoted 3 lines

Please accept my apologies for submitting these bad patches. We were just confused since we thought that this approach might be acceptable because there were some similar examples got merged in the kernel tree:

How are these related to the talk of ABI break?

Quoted 8 lines

https://elixir.bootlin.com/linux/latest/source/Documentation/devicetree/bindings/net/intel,dwmac-plat.yaml#L57
https://elixir.bootlin.com/linux/latest/source/Documentation/devicetree/bindings/usb/intel,keembay-dwc3.yaml#L55
https://elixir.bootlin.com/linux/latest/source/Documentation/devicetree/bindings/sound/intel,keembay-i2s.yaml#L73
https://elixir.bootlin.com/linux/latest/source/Documentation/devicetree/bindings/pwm/intel,keembay-pwm.yaml#L39
https://elixir.bootlin.com/linux/latest/source/Documentation/devicetree/bindings/watchdog/intel,keembay-wdt.yaml#L46
https://elixir.bootlin.com/linux/latest/source/Documentation/devicetree/bindings/pci/intel,keembay-pcie.yaml#L75
https://elixir.bootlin.com/linux/latest/source/Documentation/devicetree/bindings/mmc/arasan,sdhci.yaml#L282

How are these even relevant here? The support for this platform is incomplete, right? These are just few scattered pieces - only bindings - without drivers and DTS. It proves nothing. You cannot take some incomplete platform and build on top of it theory that you can keep changing ABI!

And anyway it is entirely independent problem. You just said you want to change defines which is not allowed. ABI break. No one changes the Keembay defines, whatever they are (you even do not know what they are...).

Quoted 5 lines

The defines in these yaml files are not actually referred by kernel DTs or drivers so I assume that they should be provided by firmware as pure integer numbers and the clk-scmi driver should just take them to ask firmware for doing clk stuff.

Best regards,
Krzysztof

#12 lore raw

PATCH v2 3/5 net: stmmac: Add CSR clock 500Mhz/800Mhz support

In reply to Chester Lin

Add additional 500Mhz/800Mhz CSR clock ranges since NXP S32CC DWMAC can support higher frequencies.

---

No change in v2.

 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
index 6b5d96bced47..5b7e8cc70439 100644
@@ -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
index 6b43da78cdf0..ff0b32c9e748 100644
@@ -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
index fb2e88614f5d..307980c808f7 100644
@@ -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
#13 lore raw

PATCH v2 4/5 net: stmmac: Add AXI4 ACE control support

In reply to Chester Lin

Add AXI4 cache coherency control in dwmac4 DMA core.

---

No change in v2.

 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
index d99fa028c646..4e6e2952abfd 100644
@@ -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
index 9321879b599c..7f491f2651b2 100644
@@ -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
index 592b4067f9b8..bffe2ec36bb3 100644
@@ -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
index ff0b32c9e748..c689723c7d93 100644
@@ -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
index 307980c808f7..23e740c6c7b8 100644
@@ -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		1024
 struct 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
#14 lore raw

PATCH v2 5/5 net: stmmac: Add NXP S32 SoC family support

In reply to Chester Lin

Add GMAC support for NXP S32 SoC family. This driver is mainly based on NXP's downstream implementation on CodeAurora[1].

[1] https://source.codeaurora.org/external/autobsps32/linux/tree/drivers/net/ethernet/stmicro/stmmac?h=bsp34.0-5.10.120-rt

---

Changes in v2:
- Replace clock names tx_sgmii/rx_sgmii with tx_pcs/rx_pcs.
- Adjust error handlings while calling devm_clk_get().
- Remove redundant dev_info messages.
- Remove unnecessary if conditions.
- Fix the copyright format suggested by NXP.

 drivers/net/ethernet/stmicro/stmmac/Kconfig   |  13 +
 drivers/net/ethernet/stmicro/stmmac/Makefile  |   1 +
 .../net/ethernet/stmicro/stmmac/dwmac-s32cc.c | 304 ++++++++++++++++++
 3 files changed, 318 insertions(+)
 create mode 100644 drivers/net/ethernet/stmicro/stmmac/dwmac-s32cc.c
drivers/net/ethernet/stmicro/stmmac/Kconfig +13 -0
index 31ff35174034..dd3fb5e462b7 100644
@@ -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
index d4e12e9ace4f..ec92cc2becd7 100644
@@ -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 +304 -0

304 lines not on this page · raw message

Signature · 1 line
2.37.3