From 106ce4a01c179b8de664767cf5c7367210b66dba Mon Sep 17 00:00:00 2001 From: Minda Chen Date: Wed, 27 May 2026 16:41:05 +0800 Subject: [PATCH 1/4] 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. Signed-off-by: Minda Chen Acked-by: Conor Dooley Reviewed-by: Andrew Lunn Link: https://patch.msgid.link/20260527084108.121416-2-minda.chen@starfivetech.com Signed-off-by: Jakub Kicinski --- .../bindings/net/starfive,jh7110-dwmac.yaml | 26 +++---------------- 1 file changed, 4 insertions(+), 22 deletions(-) diff --git a/Documentation/devicetree/bindings/net/starfive,jh7110-dwmac.yaml b/Documentation/devicetree/bindings/net/starfive,jh7110-dwmac.yaml index 313a15331661..0d1962980f57 100644 --- a/Documentation/devicetree/bindings/net/starfive,jh7110-dwmac.yaml +++ b/Documentation/devicetree/bindings/net/starfive,jh7110-dwmac.yaml @@ -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 + resets: + minItems: 2 - reset-names: - const: stmmaceth - else: - properties: - resets: - minItems: 2 - - reset-names: - minItems: 2 + reset-names: + minItems: 2 unevaluatedProperties: false From 64772e4d06a574e2359547d97f79674c28f07f75 Mon Sep 17 00:00:00 2001 From: Minda Chen Date: Wed, 27 May 2026 16:41:06 +0800 Subject: [PATCH 2/4] dt-bindings: net: starfive,jh7110-dwmac: Add jhb100 support 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. 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. Signed-off-by: Minda Chen Acked-by: Conor Dooley Link: https://patch.msgid.link/20260527084108.121416-3-minda.chen@starfivetech.com Signed-off-by: Jakub Kicinski --- .../bindings/net/starfive,jh7110-dwmac.yaml | 49 ++++++++++++++----- 1 file changed, 38 insertions(+), 11 deletions(-) diff --git a/Documentation/devicetree/bindings/net/starfive,jh7110-dwmac.yaml b/Documentation/devicetree/bindings/net/starfive,jh7110-dwmac.yaml index 0d1962980f57..fdcc61c65f87 100644 --- a/Documentation/devicetree/bindings/net/starfive,jh7110-dwmac.yaml +++ b/Documentation/devicetree/bindings/net/starfive,jh7110-dwmac.yaml @@ -30,25 +30,33 @@ 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 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: @@ -107,20 +115,39 @@ allOf: contains: const: starfive,jh7110-dwmac then: - properties: - interrupts: - minItems: 3 - maxItems: 3 + if: + properties: + compatible: + contains: + const: starfive,jhb100-dwmac + then: + properties: + interrupts: + maxItems: 1 - interrupt-names: - minItems: 3 - maxItems: 3 + interrupt-names: + const: macirq - resets: - minItems: 2 + resets: + maxItems: 1 - reset-names: - minItems: 2 + 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 From 98182c748125d453945d6f4246d2706aae718285 Mon Sep 17 00:00:00 2001 From: Minda Chen Date: Wed, 27 May 2026 16:41:07 +0800 Subject: [PATCH 3/4] net: stmmac: starfive: Add jhb100 SGMII interface 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. Signed-off-by: Minda Chen Reviewed-by: Sai Krishna Link: https://patch.msgid.link/20260527084108.121416-4-minda.chen@starfivetech.com Signed-off-by: Jakub Kicinski --- .../ethernet/stmicro/stmmac/dwmac-starfive.c | 59 ++++++++++++++----- 1 file changed, 45 insertions(+), 14 deletions(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-starfive.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-starfive.c index 16b955a6d77b..b1717a6f97f1 100644 --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-starfive.c +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-starfive.c @@ -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 -EINVAL; + + 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,34 @@ 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; + /* generic sgmii, 1000_BASEX not support yet */ + 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); } From 7e9ea8de277a24750626d2a14264775e7796be04 Mon Sep 17 00:00:00 2001 From: Minda Chen Date: Wed, 27 May 2026 16:41:08 +0800 Subject: [PATCH 4/4] net: stmmac: starfive: Add STMMAC_FLAG_SPH_DISABLE flag Add default disable split header flag in all the starfive soc. Signed-off-by: Minda Chen Reviewed-by: Andrew Lunn Link: https://patch.msgid.link/20260527084108.121416-5-minda.chen@starfivetech.com Signed-off-by: Jakub Kicinski --- drivers/net/ethernet/stmicro/stmmac/dwmac-starfive.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-starfive.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-starfive.c index b1717a6f97f1..b1ea248e3311 100644 --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-starfive.c +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-starfive.c @@ -148,7 +148,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);