Skip to contentSkip to conversation

Add StarFive jhb100 soc SGMII GMAC support

PATCH Superseded Minda Chen 5 participants 13 messages May 19 – May 30

Subsystems (6)

v4 of 5 Superseded Latest is v5 →

lore
Share & tools
lore

Minda Chen

author maintainer
#0 lore raw

v4 cover Add StarFive jhb100 soc SGMII GMAC support

jhb100 is a Starfive new RISC-V SoC for datacenter BMC (BaseBoard Managent Controller). Similar with Aspeed 27x0.

The jhb100 minimal system upstream is in progress:
https://patchwork.kernel.org/project/linux-riscv/cover/[email protected]/

jhb100 GMAC still using designware GMAC core like JH7100 and JH7110, and contains 2 SGMII interfaces, 1 RGMII/RMII interface, 1 RMII interface. In JH7100/JH7110 dwmac-starfive.c have supported RGMII/RMII interface. So require to add SGMII support to dwmac-starfive.c for JHB100.

SGMII serdes PHY has been integrated in JHB100 and do not have driver setting.

In JHB100 EVB board, SGMII connect with motorcomm YT8531s external PHY and support RJ45 ethernet port.

The patch base net-next (base commit list below)

previous patch link:
v2: https://patchwork.kernel.org/project/netdevbpf/cover/[email protected]/
v3: https://patchwork.kernel.org/project/netdevbpf/cover/[email protected]/

changes
v4: patch1 and patch5 add review tag
patch 3 add sgmii clock dts setting more elegant and simple patch 4 remove redundant compatible and (void *)

v3:
patch2: Add jhb100 attach to jh7110 compatibible, remove redundant commit message. just descript the jhb100 hardware.
patch3: Add oneOf 5 clocks / 6 clocks to claim the clocks and make it pass yaml test.
patch4: Add review tag and unused tag to phy interface.

v2:
1. patch1 Add the remove reason
2. patch2 rename rx clock to sgmii_rx
3. patch4 confirm sgmii rx clock exist, or will probe error sgmii will not call starfive_dwmac_set_mode()

Minda Chen (5):
dt-bindings: net: starfive,jh7110-dwmac: Remove jh8100
dt-bindings: net: starfive,jh7110-dwmac: Add jhb100 support
dt-bindings: net: starfive,jh7110-dwmac: Add jhb100 sgmii rx clk
net: stmmac: starfive: Add jhb100 SGMII interface
net: stmmac: starfive: Add STMMAC_FLAG_SPH_DISABLE flag

 .../bindings/net/starfive,jh7110-dwmac.yaml   | 31 ++++++----
 .../ethernet/stmicro/stmmac/dwmac-starfive.c  | 58 ++++++++++++++-----
 2 files changed, 64 insertions(+), 25 deletions(-)

base-commit: 7af2a94f4dcf53a45f3be5870ebeb195402866d1

Signature · 1 line
2.17.1
author maintainer
#1 lore raw

PATCH v4 1/5 dt-bindings: net: starfive,jh7110-dwmac: Remove jh8100

Remove jh8100 dt-bindings because do not support it now. StarFive have stopped jh8100 developing and will not release it outside.

---
 .../bindings/net/starfive,jh7110-dwmac.yaml   | 28 ++++---------------
 1 file changed, 5 insertions(+), 23 deletions(-)
Documentation/devicetree/bindings/net/starfive,jh7110-dwmac.yaml +5 -23
index 313a15331661..0d1962980f57 100644
@@ -30,10 +30,6 @@ properties:
       - items:
           - const: starfive,jh7110-dwmac
           - const: snps,dwmac-5.20
-      - items:
-          - const: starfive,jh8100-dwmac
-          - const: starfive,jh7110-dwmac
-          - const: snps,dwmac-5.20
 
   reg:
     maxItems: 1
@@ -120,25 +116,11 @@ allOf:
           minItems: 3
           maxItems: 3
 
-      if:
-        properties:
-          compatible:
-            contains:
-              const: starfive,jh8100-dwmac
-      then:
-        properties:
-          resets:
-            maxItems: 1
-
-          reset-names:
-            const: stmmaceth
-      else:
-        properties:
-          resets:
-            minItems: 2
-
-          reset-names:
-            minItems: 2
+        resets:
+          minItems: 2
+
+        reset-names:
+          minItems: 2
 
 unevaluatedProperties: false
 
Signature · 1 line
2.17.1
author maintainer
#2 lore raw

PATCH v4 2/5 dt-bindings: net: starfive,jh7110-dwmac: Add jhb100 support

In reply to Minda Chen

The jhb100 GMAC still using Synopsys designware GMAC core. hardware features are similar with jh7100.
Add jhb100 GMAC compatible and reset, interrupts features. jhb100 dwmac has only one reset signal and one interrupt line.

---
 .../bindings/net/starfive,jh7110-dwmac.yaml   | 51 ++++++++++++++-----
 1 file changed, 37 insertions(+), 14 deletions(-)
Documentation/devicetree/bindings/net/starfive,jh7110-dwmac.yaml +37 -14
index 0d1962980f57..06aeaa0f6f00 100644
@@ -30,6 +30,10 @@ properties:
       - items:
           - const: starfive,jh7110-dwmac
           - const: snps,dwmac-5.20
+      - items:
+          - const: starfive,jhb100-dwmac
+          - const: starfive,jh7110-dwmac
+          - const: snps,dwmac-5.20
 
   reg:
     maxItems: 1
@@ -107,20 +111,39 @@ allOf:
           contains:
             const: starfive,jh7110-dwmac
     then:
-      properties:
-        interrupts:
-          minItems: 3
-          maxItems: 3
-
-        interrupt-names:
-          minItems: 3
-          maxItems: 3
-
-        resets:
-          minItems: 2
-
-        reset-names:
-          minItems: 2
+      if:
+        properties:
+          compatible:
+            contains:
+              const: starfive,jhb100-dwmac
+      then:
+        properties:
+          interrupts:
+            maxItems: 1
+
+          interrupt-names:
+            const: macirq
+
+          resets:
+            maxItems: 1
+
+          reset-names:
+            const: stmmaceth
+      else:
+        properties:
+          interrupts:
+            minItems: 3
+            maxItems: 3
+
+          interrupt-names:
+            minItems: 3
+            maxItems: 3
+
+          resets:
+            minItems: 2
+
+          reset-names:
+            minItems: 2
 
 unevaluatedProperties: false
 
Signature · 1 line
2.17.1
author maintainer
#5 lore raw

PATCH v4 3/5 dt-bindings: net: starfive,jh7110-dwmac: Add jhb100 sgmii rx clk

In reply to Minda Chen

jhb100 SGMII interface tx/rx mac clock is split and require to set clock rate in 10M/100M/1000M speed. So dts need to add a new rx clock in code, dts and dt binding doc.
So in jhb100 SGMII interface contain 6 clocks, RMII/RGMII interface still contail 5 clocks.

---
 .../devicetree/bindings/net/starfive,jh7110-dwmac.yaml        | 4 ++++
 1 file changed, 4 insertions(+)
Documentation/devicetree/bindings/net/starfive,jh7110-dwmac.yaml +4 -0
index 06aeaa0f6f00..fdcc61c65f87 100644
@@ -39,20 +39,24 @@ properties:
     maxItems: 1
 
   clocks:
+    minItems: 5
     items:
       - description: GMAC main clock
       - description: GMAC AHB clock
       - description: PTP clock
       - description: TX clock
       - description: GTX clock
+      - description: SGMII RX clock
 
   clock-names:
+    minItems: 5
     items:
       - const: stmmaceth
       - const: pclk
       - const: ptp_ref
       - const: tx
       - const: gtx
+      - const: sgmii_rx
 
   starfive,tx-use-rgmii-clk:
     description:
Signature · 1 line
2.17.1
author maintainer
#9 lore raw

PATCH v4 4/5 net: stmmac: starfive: Add jhb100 SGMII interface

In reply to Minda Chen

Add jhb100 compatible and SGMII support. jhb100 soc contains 2 SGMII interfaces and integrated with serdes PHY. SGMII with split TX/RX MAC clock and need to set 2.5M/25M/125M TX/RX clock rate in 10M/100M/1000M speed mode.

---
 .../ethernet/stmicro/stmmac/dwmac-starfive.c  | 58 ++++++++++++++-----
 1 file changed, 44 insertions(+), 14 deletions(-)
drivers/net/ethernet/stmicro/stmmac/dwmac-starfive.c +44 -14
index 16b955a6d77b..eb882ec14c8d 100644
@@ -26,6 +26,7 @@ struct starfive_dwmac_data {
 struct starfive_dwmac {
 	struct device *dev;
 	const struct starfive_dwmac_data *data;
+	struct clk *sgmii_rx;
 };
 
 static int starfive_dwmac_set_mode(struct plat_stmmacenet_data *plat_dat)
@@ -68,6 +69,25 @@ static int starfive_dwmac_set_mode(struct plat_stmmacenet_data *plat_dat)
 	return 0;
 }
 
+static int stmmac_starfive_sgmii_set_clk_rate(void *bsp_priv, struct clk *clk_tx_i,
+					      phy_interface_t __maybe_unused interface,
+					      int speed)
+{
+	struct starfive_dwmac *dwmac = bsp_priv;
+	long rate = rgmii_clock(speed);
+	int ret;
+
+	/* MAC clock rate the same as RGMII */
+	if (rate < 0)
+		return 0;
+
+	ret = clk_set_rate(clk_tx_i, rate);
+	if (ret)
+		return ret;
+
+	return clk_set_rate(dwmac->sgmii_rx, rate);
+}
+
 static int starfive_dwmac_probe(struct platform_device *pdev)
 {
 	struct plat_stmmacenet_data *plat_dat;
@@ -102,23 +122,33 @@ static int starfive_dwmac_probe(struct platform_device *pdev)
 		return dev_err_probe(&pdev->dev, PTR_ERR(clk_gtx),
 				     "error getting gtx clock\n");
 
-	/* Generally, the rgmii_tx clock is provided by the internal clock,
-	 * which needs to match the corresponding clock frequency according
-	 * to different speeds. If the rgmii_tx clock is provided by the
-	 * external rgmii_rxin, there is no need to configure the clock
-	 * internally, because rgmii_rxin will be adaptively adjusted.
-	 */
-	if (!device_property_read_bool(&pdev->dev, "starfive,tx-use-rgmii-clk"))
-		plat_dat->set_clk_tx_rate = stmmac_set_clk_tx_rate;
-
 	dwmac->dev = &pdev->dev;
-	plat_dat->flags |= STMMAC_FLAG_EN_TX_LPI_CLK_PHY_CAP;
 	plat_dat->bsp_priv = dwmac;
-	plat_dat->dma_cfg->dche = true;
+	if (plat_dat->phy_interface == PHY_INTERFACE_MODE_SGMII) {
+		dwmac->sgmii_rx = devm_clk_get_enabled(&pdev->dev, "sgmii_rx");
+		if (IS_ERR(dwmac->sgmii_rx))
+			return dev_err_probe(&pdev->dev,
+					     PTR_ERR(dwmac->sgmii_rx),
+					     "error getting sgmii rx clock\n");
+		plat_dat->set_clk_tx_rate = stmmac_starfive_sgmii_set_clk_rate;
+	} else {
+		/*
+		 * Generally, the rgmii_tx clock is provided by the internal clock,
+		 * which needs to match the corresponding clock frequency according
+		 * to different speeds. If the rgmii_tx clock is provided by the
+		 * external rgmii_rxin, there is no need to configure the clock
+		 * internally, because rgmii_rxin will be adaptively adjusted.
+		 */
+		if (!device_property_read_bool(&pdev->dev, "starfive,tx-use-rgmii-clk"))
+			plat_dat->set_clk_tx_rate = stmmac_set_clk_tx_rate;
+
+		err = starfive_dwmac_set_mode(plat_dat);
+		if (err)
+			return err;
+	}
 
-	err = starfive_dwmac_set_mode(plat_dat);
-	if (err)
-		return err;
+	plat_dat->flags |= STMMAC_FLAG_EN_TX_LPI_CLK_PHY_CAP;
+	plat_dat->dma_cfg->dche = true;
 
 	return stmmac_dvr_probe(&pdev->dev, plat_dat, &stmmac_res);
 }
Signature · 1 line
2.17.1
author maintainer
#12 lore raw

PATCH v4 5/5 net: stmmac: starfive: Add STMMAC_FLAG_SPH_DISABLE flag

In reply to Minda Chen

Add default disable split header flag in all the starfive soc.

---
 drivers/net/ethernet/stmicro/stmmac/dwmac-starfive.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/stmicro/stmmac/dwmac-starfive.c +1 -1
index eb882ec14c8d..6a887260d5ee 100644
@@ -147,7 +147,7 @@ static int starfive_dwmac_probe(struct platform_device *pdev)
 			return err;
 	}
 
-	plat_dat->flags |= STMMAC_FLAG_EN_TX_LPI_CLK_PHY_CAP;
+	plat_dat->flags |= (STMMAC_FLAG_EN_TX_LPI_CLK_PHY_CAP | STMMAC_FLAG_SPH_DISABLE);
 	plat_dat->dma_cfg->dche = true;
 
 	return stmmac_dvr_probe(&pdev->dev, plat_dat, &stmmac_res);
Signature · 1 line
2.17.1
#10 lore raw

Re: [net-next v4 4/5] net: stmmac: starfive: Add jhb100 SGMII interface

In reply to Minda Chen

drivers/net/ethernet/stmicro/stmmac/dwmac-starfive.c static int starfive_dwmac_set_mode(struct plat_stmmacenet_data *plat_dat) · line 82

Quoted 11 lines
drivers/net/ethernet/stmicro/stmmac/dwmac-starfive.c +11 -0
+static int stmmac_starfive_sgmii_set_clk_rate(void *bsp_priv, struct clk *clk_tx_i,
+					      phy_interface_t __maybe_unused interface,
+					      int speed)
+{
+	struct starfive_dwmac *dwmac = bsp_priv;
+	long rate = rgmii_clock(speed);
+	int ret;
+
+	/* MAC clock rate the same as RGMII */
+	if (rate < 0)
+		return 0;

You probably should return the error code, because something has gone wrong, you have been asked to do a rate you don't support.

Quoted 18 lines
drivers/net/ethernet/stmicro/stmmac/dwmac-starfive.c +7 -4
+	ret = clk_set_rate(clk_tx_i, rate);
+	if (ret)
+		return ret;
+
+	return clk_set_rate(dwmac->sgmii_rx, rate);
+}
+
 static int starfive_dwmac_probe(struct platform_device *pdev)
 {
 	struct plat_stmmacenet_data *plat_dat;
@@ -102,23 +122,33 @@ static int starfive_dwmac_probe(struct platform_device *pdev)
 		return dev_err_probe(&pdev->dev, PTR_ERR(clk_gtx),
 				     "error getting gtx clock\n");
 
-	/* Generally, the rgmii_tx clock is provided by the internal clock,
-	 * which needs to match the corresponding clock frequency according
-	 * to different speeds. If the rgmii_tx clock is provided by the
-	 * external rgmii_rxin, there is no need to configure the clock

drivers/net/ethernet/stmicro/stmmac/dwmac-starfive.c static int starfive_dwmac_probe(struct platform_device *pdev) · line 127

Quoted 10 lines
drivers/net/ethernet/stmicro/stmmac/dwmac-starfive.c +1 -7
-	 * internally, because rgmii_rxin will be adaptively adjusted.
-	 */
-	if (!device_property_read_bool(&pdev->dev, "starfive,tx-use-rgmii-clk"))
-		plat_dat->set_clk_tx_rate = stmmac_set_clk_tx_rate;
-
 	dwmac->dev = &pdev->dev;
-	plat_dat->flags |= STMMAC_FLAG_EN_TX_LPI_CLK_PHY_CAP;
 	plat_dat->bsp_priv = dwmac;
-	plat_dat->dma_cfg->dche = true;
+	if (plat_dat->phy_interface == PHY_INTERFACE_MODE_SGMII) {

Does the PCS support 1000BaseX? It is not needed now, but it is something to keep in mind, try to avoid making to code too SGMII specific when it might need to be more generic to support 1000BaseX as well.

Andrew

Acked-by on v4 2/5
#3 lore raw

Re: [net-next v4 2/5] dt-bindings: net: starfive,jh7110-dwmac: Add jhb100 support

In reply to Minda Chen
Quoted 7 lines · Minda Chen

The jhb100 GMAC still using Synopsys designware GMAC core. hardware features are similar with jh7100.
Add jhb100 GMAC compatible and reset, interrupts features. jhb100 dwmac has only one reset signal and one interrupt line.

pw-bot: not-applicable

Quoted 77 lines
---
 .../bindings/net/starfive,jh7110-dwmac.yaml   | 51 ++++++++++++++-----
 1 file changed, 37 insertions(+), 14 deletions(-)
Documentation/devicetree/bindings/net/starfive,jh7110-dwmac.yaml +37 -14
index 0d1962980f57..06aeaa0f6f00 100644
@@ -30,6 +30,10 @@ properties:
       - items:
           - const: starfive,jh7110-dwmac
           - const: snps,dwmac-5.20
+      - items:
+          - const: starfive,jhb100-dwmac
+          - const: starfive,jh7110-dwmac
+          - const: snps,dwmac-5.20
 
   reg:
     maxItems: 1
@@ -107,20 +111,39 @@ allOf:
           contains:
             const: starfive,jh7110-dwmac
     then:
-      properties:
-        interrupts:
-          minItems: 3
-          maxItems: 3
-
-        interrupt-names:
-          minItems: 3
-          maxItems: 3
-
-        resets:
-          minItems: 2
-
-        reset-names:
-          minItems: 2
+      if:
+        properties:
+          compatible:
+            contains:
+              const: starfive,jhb100-dwmac
+      then:
+        properties:
+          interrupts:
+            maxItems: 1
+
+          interrupt-names:
+            const: macirq
+
+          resets:
+            maxItems: 1
+
+          reset-names:
+            const: stmmaceth
+      else:
+        properties:
+          interrupts:
+            minItems: 3
+            maxItems: 3
+
+          interrupt-names:
+            minItems: 3
+            maxItems: 3
+
+          resets:
+            minItems: 2
+
+          reset-names:
+            minItems: 2
 
 unevaluatedProperties: false
 
Signature · 1 line
2.17.1
#6 lore raw

Re: [net-next v4 3/5] dt-bindings: net: starfive,jh7110-dwmac: Add jhb100 sgmii rx clk

In reply to Minda Chen
Quoted 5 lines · Minda Chen

jhb100 SGMII interface tx/rx mac clock is split and require to set clock rate in 10M/100M/1000M speed. So dts need to add a new rx clock in code, dts and dt binding doc.
So in jhb100 SGMII interface contain 6 clocks, RMII/RGMII interface still contail 5 clocks.

If this is for jhb100, why isn't this part of previous patch?

Does this need constraints per variant of the device?

Best regards,
Krzysztof

author maintainer
#11 lore raw

Re: [net-next v4 4/5] net: stmmac: starfive: Add jhb100 SGMII interface

In reply to Andrew Lunn
Quoted 4 lines
Quoted 3 lines

+static int stmmac_starfive_sgmii_set_clk_rate(void *bsp_priv, struct clk

*clk_tx_i,

Quoted 14 lines

drivers/net/ethernet/stmicro/stmmac/dwmac-starfive.c static int starfive_dwmac_set_mode(struct plat_stmmacenet_data *plat_dat) · line 82

Quoted 10 lines
drivers/net/ethernet/stmicro/stmmac/dwmac-starfive.c +10 -0
+					      phy_interface_t __maybe_unused interface,
+					      int speed)
+{
+	struct starfive_dwmac *dwmac = bsp_priv;
+	long rate = rgmii_clock(speed);
+	int ret;
+
+	/* MAC clock rate the same as RGMII */
+	if (rate < 0)
+		return 0;

You probably should return the error code, because something has gone wrong, you have been asked to do a rate you don't support.

Okay. I think return -EINVAL is correct.

Quoted 31 lines
Quoted 16 lines
drivers/net/ethernet/stmicro/stmmac/dwmac-starfive.c +6 -0
+	ret = clk_set_rate(clk_tx_i, rate);
+	if (ret)
+		return ret;
+
+	return clk_set_rate(dwmac->sgmii_rx, rate); }
+
 static int starfive_dwmac_probe(struct platform_device *pdev)  {
 	struct plat_stmmacenet_data *plat_dat; @@ -102,23 +122,33 @@ static

int starfive_dwmac_probe(struct platform_device *pdev)

drivers/net/ethernet/stmicro/stmmac/dwmac-starfive.c +0 -4
 		return dev_err_probe(&pdev->dev, PTR_ERR(clk_gtx),
 				     "error getting gtx clock\n");
 
-	/* Generally, the rgmii_tx clock is provided by the internal clock,
-	 * which needs to match the corresponding clock frequency according
-	 * to different speeds. If the rgmii_tx clock is provided by the
-	 * external rgmii_rxin, there is no need to configure the clock

drivers/net/ethernet/stmicro/stmmac/dwmac-starfive.c static int starfive_dwmac_probe(struct platform_device *pdev) · line 127

Quoted 10 lines
drivers/net/ethernet/stmicro/stmmac/dwmac-starfive.c +1 -7
-	 * internally, because rgmii_rxin will be adaptively adjusted.
-	 */
-	if (!device_property_read_bool(&pdev->dev, "starfive,tx-use-rgmii-clk"))
-		plat_dat->set_clk_tx_rate = stmmac_set_clk_tx_rate;
-
 	dwmac->dev = &pdev->dev;
-	plat_dat->flags |= STMMAC_FLAG_EN_TX_LPI_CLK_PHY_CAP;
 	plat_dat->bsp_priv = dwmac;
-	plat_dat->dma_cfg->dche = true;
+	if (plat_dat->phy_interface == PHY_INTERFACE_MODE_SGMII) {

Does the PCS support 1000BaseX? It is not needed now, but it is something to keep in mind, try to avoid making to code too SGMII specific when it might need to be more generic to support 1000BaseX as well.

Quoted 1 line

Andrew

No. do NOT support 1000BaseX in jhb100 soc. I think 1000BaseX need new serdes PHY be Intergrated it and maybe new setting.

author maintainer
#7 lore raw

Re: [net-next v4 3/5] dt-bindings: net: starfive,jh7110-dwmac: Add jhb100 sgmii rx clk

In reply to Krzysztof Kozlowski
Quoted 10 lines · Minda Chen
Quoted 5 lines

jhb100 SGMII interface tx/rx mac clock is split and require to set clock rate in 10M/100M/1000M speed. So dts need to add a new rx clock in code, dts and dt binding doc.
So in jhb100 SGMII interface contain 6 clocks, RMII/RGMII interface still contail 5 clocks.

Quoted 6 lines

If this is for jhb100, why isn't this part of previous patch?

Does this need constraints per variant of the device?

Best regards,
Krzysztof

Okay. I will merge this to patch2.

#4 lore raw

Re: [net-next v4 2/5] dt-bindings: net: starfive,jh7110-dwmac: Add jhb100 support

In reply to Minda Chen
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider: - [Medium] Incorrect fallback compatibility for `starfive,jhb100-dwmac` and nested schema logic --

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] Incorrect fallback compatibility for starfive,jhb100-dwmac and nested schema logic --

commit 6b46c7eda188eefbc105849442bf373d3049d603
Author: Minda Chen <[email protected]>

dt-bindings: net: starfive,jh7110-dwmac: Add jhb100 support

This commit adds device tree bindings for the jhb100 GMAC. It notes that the hardware is similar to jh7100 but only has one reset signal and one interrupt line.

Documentation/devicetree/bindings/net/starfive,jh7110-dwmac.yaml properties: · line 36

Quoted 11 lines
Documentation/devicetree/bindings/net/starfive,jh7110-dwmac.yaml +4 -0
@@ -30,6 +30,10 @@ properties:
       - items:
           - const: starfive,jh7110-dwmac
           - const: snps,dwmac-5.20
+      - items:
+          - const: starfive,jhb100-dwmac
+          - const: starfive,jh7110-dwmac
+          - const: snps,dwmac-5.20

Is it correct to use starfive,jh7110-dwmac as a fallback compatible string here?

A fallback compatible implies that an older OS driver written for the jh7110 can successfully drive the jhb100 hardware. Since the jh7110 expects 3 interrupts and 2 resets, won't an older driver fail to probe the jhb100 because of missing required resources?

[ ... ]

Quoted 17 lines
Documentation/devicetree/bindings/net/starfive,jh7110-dwmac.yaml +0 -13
@@ -107,20 +111,39 @@ allOf:
           contains:
             const: starfive,jh7110-dwmac
     then:
-      properties:
-        interrupts:
-          minItems: 3
-          maxItems: 3
-
-        interrupt-names:
-          minItems: 3
-          maxItems: 3
-
-        resets:
-          minItems: 2
-
-        reset-names:

Documentation/devicetree/bindings/net/starfive,jh7110-dwmac.yaml allOf: · line 122

Quoted 10 lines
Documentation/devicetree/bindings/net/starfive,jh7110-dwmac.yaml +9 -1
-          minItems: 2
+      if:
+        properties:
+          compatible:
+            contains:
+              const: starfive,jhb100-dwmac
+      then:
+        properties:
+          interrupts:
+            maxItems: 1

Because of the fallback compatible, the schema patch nests the jhb100 constraints inside the jh7110 'if' block in allOf.

If starfive,jh7110-dwmac is removed from the jhb100 compatible list, could these constraints be defined in an independent 'if' block instead?

Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=2
#8 lore raw

Re: [net-next v4 3/5] dt-bindings: net: starfive,jh7110-dwmac: Add jhb100 sgmii rx clk

In reply to Minda Chen
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider: - [Medium] Relaxed dt-binding schema for older generations allows invalid configurations to pass…

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] Relaxed dt-binding schema for older generations allows invalid configurations to pass validation. --

commit f6b7d4c26e8b69a59239f5f0ceb9244961ac4979
Author: Minda Chen <[email protected]>

dt-bindings: net: starfive,jh7110-dwmac: Add jhb100 sgmii rx clk

This commit adds a 6th clock, the SGMII RX clock, to the starfive,jh7110-dwmac binding for the jhb100 SGMII interface. It updates the global clocks and clock-names properties to allow up to 6 items.

Quoted 4 lines
Documentation/devicetree/bindings/net/starfive,jh7110-dwmac.yaml +0 -0
index 06aeaa0f6f009..fdcc61c65f87d 100644

[ ... ]

Quoted 12 lines
Documentation/devicetree/bindings/net/starfive,jh7110-dwmac.yaml +2 -0
@@ -39,20 +39,24 @@ properties:
     maxItems: 1
 
   clocks:
+    minItems: 5
     items:
       - description: GMAC main clock
       - description: GMAC AHB clock
       - description: PTP clock
       - description: TX clock
       - description: GTX clock
+      - description: SGMII RX clock

Documentation/devicetree/bindings/net/starfive,jh7110-dwmac.yaml properties: · line 59

Quoted 10 lines
Documentation/devicetree/bindings/net/starfive,jh7110-dwmac.yaml +2 -0
 
   clock-names:
+    minItems: 5
     items:
       - const: stmmaceth
       - const: pclk
       - const: ptp_ref
       - const: tx
       - const: gtx
+      - const: sgmii_rx

Should the schema restrict older generations to a maximum of 5 clocks using an allOf block?

Since the global list now contains 6 items, the schema implicitly allows up to 6 clocks for all compatible strings. If prior hardware generations or standard RMII/RGMII variants only support 5 clocks, they could silently pass validation even if an invalid 6th clock is mistakenly specified in their device tree node.

Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=3