net: stmmac: qcom-ethqos: add support for SCMI power domains
Subsystems (25)
v16 cover net: stmmac: qcom-ethqos: add support for SCMI power domains
Add support for the firmware-managed variant of the DesignWare MAC on the sa8255p platform. This series contains new DT bindings and driver changes required to support the MAC in the STMMAC driver.
It also reorganizes the ethqos code quite a bit to make the introduction of power domains into the driver a bit easier on the eye.
The DTS changes will go in separately.
---
Changes in v16:
- Split out the SerDes PHY patches into their own series
- only set the serdes mode for actual serdes PHY modes
- reject non-serdes PHY modes on SCMI variants
- extend some comments to unconfuse sashiko
- add a fix for an issue reported by sashiko where the tick counter would
get reprogrammed even without the CSR clock
- Link to v15: https://patch.msgid.link/[email protected]
Changes in v15:
- Squash patches 6 and 7 to avoid a potential hang-on-resume regression
(Sashiko)
- Fix the AUTONEG_DISABLE early return path in forced mode (Sashiko)
- Fix Kconfig dependencies on generic power domains (Sashiko)
- Set the performance level back to 0 on unbind in the PHY driver
(Sashiko)
- Use devm_pm_runtime_enable() where applicable
- Link to v14: https://patch.msgid.link/[email protected]
Changes in v14:
- let genpd's own runtime suspend/resume callbacks own the perf state entirely
by calling dev_pm_genpd_set_performance_state() in set_mode()
unconditionally in the sgmii PHY driver
- drop usleep_range() from the PHY driver when setting the state as the level
setting is already synchronous
- add missing power-domains limits for ma35d1/k3-dwmac
- fix ordering of clearing the sgmii loopback
- configure the wrapper clocks synchronously in scmi setup
- Link to v13: https://patch.msgid.link/[email protected]
Changes in v13:
- Reapply OPP on speed change in the PHY driver
- Use linux/device-id/of.h instead of mod_devicetable.h
- Fix the "invalid PTP clock rate" warning on sa8255p
- Add commits necessary to allow correct link speed change with SCMI
- Link to v12: https://patch.msgid.link/[email protected]
Changes in v12:
- Drop the power-domain-names from the SGMII PHY DT bindings
- Add missing Kconfig dependency on PM for the new SGMII PHY driver
- Link to v11: https://patch.msgid.link/[email protected]
Changes in v11:
- Take a new approach: add a dedicated driver for the firmware-managed
SGMII PHY and simplify changes made to the MAC driver
- Link to v10: https://patch.msgid.link/[email protected]
Changes in v10:
- Fix unit address in DT example
- Link to v9: https://patch.msgid.link/[email protected]
Changes in v9:
- Rebase on top of current linux-next again
- Link to v8: https://patch.msgid.link/[email protected]
Changes in v8:
- Rebase on top of recent changes in linux-next which required an
extensive rework
- Drop partial R-b tags
- Link to v7: https://patch.msgid.link/[email protected]
Changes in v7:
- Restored the correct authorship after learning git uses .mailmap for
the --author switch
- Rebased on top of changes from Russell
- Fixed resource management issues in error paths
- Link to v6: https://lore.kernel.org/r/[email protected]
Changes in v6:
- Fix $id value in the bindings
- Drop patch 3/8 from the series
- Update init/exit callback signatures
- Link to v5: https://lore.kernel.org/r/[email protected]
- Link to v6: https://lore.kernel.org/r/[email protected]
Changes in v5:
- Name the DT binding document after the new compatbile
- Add missing space
- Make the power-domains limits stricter
- Link to v4: https://lore.kernel.org/r/[email protected]
Changes in v4:
- Remove the phys property from the SCMI bindings
- Mark the power-domain-names property as required
- Set maxItems for power-domains to 1 for all existing bindings to
maintain the current requirements after modifying the value in the
top-level document
- Link to v3: https://lore.kernel.org/r/[email protected]
Changes in v3:
- Drop 'power' and 'perf' prefixes from power domain names
- Rebase on top of Russell's changes to dwmac
- Rebase on top of even more changes from Russell that are not yet
in next ([email protected])
- Link to v2: https://lore.kernel.org/all/[email protected]/
Changes in v2:
- Fix the power-domains property in DT bindings
- Rework the DT bindings example
- Drop the DTS patch, it will go upstream separately
- Link to v1: https://lore.kernel.org/r/[email protected]
---
Bartosz Golaszewski (7):
net: stmmac: dwmac4: don't program the 1us tick counter without a CSR clock
dt-bindings: net: qcom: document the ethqos device for SCMI-based systems
net: stmmac: qcom-ethqos: set serdes mode before powerup
net: stmmac: qcom-ethqos: update phy_mode to the resolved interface in mac_finish()
net: stmmac: qcom-ethqos: reuse the address of ethqos_emac_driver_data
net: stmmac: qcom-ethqos: factor out linux-level setup into a separate function
net: stmmac: qcom-ethqos: add support for sa8255p
.../bindings/net/allwinner,sun7i-a20-gmac.yaml | 3 + .../bindings/net/altr,socfpga-stmmac.yaml | 3 + .../bindings/net/amlogic,meson-dwmac.yaml | 3 + .../devicetree/bindings/net/eswin,eic7700-eth.yaml | 3 + .../devicetree/bindings/net/intel,dwmac-plat.yaml | 3 + .../bindings/net/loongson,ls1b-gmac.yaml | 3 + .../bindings/net/loongson,ls1c-emac.yaml | 3 + .../bindings/net/nuvoton,ma35d1-dwmac.yaml | 3 + .../devicetree/bindings/net/nxp,dwmac-imx.yaml | 3 + .../devicetree/bindings/net/nxp,lpc1850-dwmac.yaml | 3 + .../devicetree/bindings/net/nxp,s32-dwmac.yaml | 3 + .../devicetree/bindings/net/qcom,ethqos.yaml | 3 + .../bindings/net/qcom,sa8255p-ethqos.yaml | 107 +++++++++ .../devicetree/bindings/net/renesas,rzn1-gmac.yaml | 3 + .../bindings/net/renesas,rzv2h-gbeth.yaml | 3 + .../devicetree/bindings/net/rockchip-dwmac.yaml | 3 + .../devicetree/bindings/net/snps,dwmac.yaml | 5 +- .../bindings/net/sophgo,cv1800b-dwmac.yaml | 3 + .../bindings/net/sophgo,sg2044-dwmac.yaml | 3 + .../devicetree/bindings/net/spacemit,k3-dwmac.yaml | 3 + .../bindings/net/starfive,jh7110-dwmac.yaml | 3 + .../devicetree/bindings/net/stm32-dwmac.yaml | 3 + .../devicetree/bindings/net/tesla,fsd-ethqos.yaml | 3 + .../devicetree/bindings/net/thead,th1520-gmac.yaml | 3 + .../bindings/net/toshiba,visconti-dwmac.yaml | 3 + MAINTAINERS | 1 + .../ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c | 265 +++++++++++++++++---- drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c | 9 +- 28 files changed, 402 insertions(+), 54 deletions(-)
---
base-commit: 07d73541fde12a6c05f230509142a66e6c8751eb
change-id: 20250704-qcom-sa8255p-emac-8460235ac512
Best regards,
Signature · 1 line
Bartosz Golaszewski <[email protected]>
PATCH v16 1/7 net: stmmac: dwmac4: don't program the 1us tick counter without a CSR clock
dwmac4_core_init() derives the TIC counter value from the rate of the CSR clock. If no such clock is available (for instance because clocks are managed by firmware and not described in DT), the rate is 0 and (0 / 1000000) - 1 underflows to 0xffffffff, which is then written to the register and can break the LPI timers that count in microseconds.
Leave the register at its reset value when the CSR clock rate is unknown. The RX watchdog conversion helpers already cope with a missing clock by falling back to clk_ref_rate or returning 0, so nothing else needs to change.
This is first hit with the Qualcomm sa8255p ethernet, whose DT has no clocks.
--- drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)
drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c +7 -2
@@ -48,9 +48,14 @@ static void dwmac4_core_init(struct mac_device_info *hw, value =readl (ioaddr +GMAC_CONFIG );writel (value |GMAC_CORE_INIT , ioaddr +GMAC_CONFIG ); -/* Configure LPI 1us counter to number of CSR clock ticks in 1us - 1 */ +/* Configure LPI 1us counter to number of CSR clock ticks in 1us - 1. +* Platforms with firmware-managed clocks may not expose the CSR clock +* to linux, in which case there's no meaningful value to program. +*/ clk_rate =clk_get_rate (priv->plat->stmmac_clk); -writel ((clk_rate /1000000 ) -1 , ioaddr +GMAC4_MAC_ONEUS_TIC_COUNTER ); +if (clk_rate >=1000000 ) +writel ((clk_rate /1000000 ) -1 , + ioaddr +GMAC4_MAC_ONEUS_TIC_COUNTER );/* Enable GMAC interrupts */ writel (GMAC_INT_DEFAULT_ENABLE , ioaddr +GMAC_INT_EN );
Signature · 1 line
2.47.3
PATCH v16 2/7 dt-bindings: net: qcom: document the ethqos device for SCMI-based systems
In reply to Bartosz GolaszewskiFrom: Bartosz Golaszewski <[email protected]>
Describe the firmware-managed variant of the QCom DesignWare MAC. As the properties here differ a lot from the HLOS-managed variant, lets put it in a separate file. Since we need to update the maximum number of power domains, let's update existing bindings referencing the top-level snps,dwmac.yaml and limit their maxItems for power-domains to 1.
--- .../bindings/net/allwinner,sun7i-a20-gmac.yaml | 3 + .../bindings/net/altr,socfpga-stmmac.yaml | 3 + .../bindings/net/amlogic,meson-dwmac.yaml | 3 + .../devicetree/bindings/net/eswin,eic7700-eth.yaml | 3 + .../devicetree/bindings/net/intel,dwmac-plat.yaml | 3 + .../bindings/net/loongson,ls1b-gmac.yaml | 3 + .../bindings/net/loongson,ls1c-emac.yaml | 3 + .../bindings/net/nuvoton,ma35d1-dwmac.yaml | 3 + .../devicetree/bindings/net/nxp,dwmac-imx.yaml | 3 + .../devicetree/bindings/net/nxp,lpc1850-dwmac.yaml | 3 + .../devicetree/bindings/net/nxp,s32-dwmac.yaml | 3 + .../devicetree/bindings/net/qcom,ethqos.yaml | 3 + .../bindings/net/qcom,sa8255p-ethqos.yaml | 107 +++++++++++++++++++++ .../devicetree/bindings/net/renesas,rzn1-gmac.yaml | 3 + .../bindings/net/renesas,rzv2h-gbeth.yaml | 3 + .../devicetree/bindings/net/rockchip-dwmac.yaml | 3 + .../devicetree/bindings/net/snps,dwmac.yaml | 5 +- .../bindings/net/sophgo,cv1800b-dwmac.yaml | 3 + .../bindings/net/sophgo,sg2044-dwmac.yaml | 3 + .../devicetree/bindings/net/spacemit,k3-dwmac.yaml | 3 + .../bindings/net/starfive,jh7110-dwmac.yaml | 3 + .../devicetree/bindings/net/stm32-dwmac.yaml | 3 + .../devicetree/bindings/net/tesla,fsd-ethqos.yaml | 3 + .../devicetree/bindings/net/thead,th1520-gmac.yaml | 3 + .../bindings/net/toshiba,visconti-dwmac.yaml | 3 + MAINTAINERS | 1 + 26 files changed, 181 insertions(+), 1 deletion(-)
Documentation/devicetree/bindings/net/allwinner,sun7i-a20-gmac.yaml +3 -0
@@ -40,6 +40,9 @@ properties: description: PHY regulator + power-domains: + maxItems: 1 + required: - compatible - reg
Documentation/devicetree/bindings/net/altr,socfpga-stmmac.yaml +3 -0
@@ -156,6 +156,9 @@ properties: - description: offset of the control register - description: shift within the control register + power-domains: + maxItems: 1 + patternProperties: "^mdio[0-9]$": type: object
Documentation/devicetree/bindings/net/amlogic,meson-dwmac.yaml +3 -0
@@ -158,6 +158,9 @@ properties: interrupt-names: const: macirq + power-domains: + maxItems: 1 + required: - compatible - reg
Documentation/devicetree/bindings/net/eswin,eic7700-eth.yaml +3 -0
@@ -120,6 +120,9 @@ properties: - description: Optional offset of register controlling TXD delay - description: Optional offset of register controlling RXD delay + power-domains: + maxItems: 1 + required: - compatible - reg
Documentation/devicetree/bindings/net/intel,dwmac-plat.yaml +3 -0
@@ -47,6 +47,9 @@ properties: interrupt-names: const: macirq + power-domains: + maxItems: 1 + required: - compatible - clocks
Documentation/devicetree/bindings/net/loongson,ls1b-gmac.yaml +3 -0
@@ -66,6 +66,9 @@ properties: - mii - rgmii-id + power-domains: + maxItems: 1 + required: - compatible - reg
Documentation/devicetree/bindings/net/loongson,ls1c-emac.yaml +3 -0
@@ -65,6 +65,9 @@ properties: - mii - rmii + power-domains: + maxItems: 1 + required: - compatible - reg
Documentation/devicetree/bindings/net/nuvoton,ma35d1-dwmac.yaml +3 -0
@@ -69,6 +69,9 @@ properties: items: - const: stmmaceth + power-domains: + maxItems: 1 + phy-mode: enum: - rmii
Documentation/devicetree/bindings/net/nxp,dwmac-imx.yaml +3 -0
@@ -83,6 +83,9 @@ properties: description: To select RMII reference clock from external. + power-domains: + maxItems: 1 + required: - compatible - clocks
Documentation/devicetree/bindings/net/nxp,lpc1850-dwmac.yaml +3 -0
@@ -51,6 +51,9 @@ properties: items: - const: stmmaceth + power-domains: + maxItems: 1 + required: - compatible - reg
Documentation/devicetree/bindings/net/nxp,s32-dwmac.yaml +3 -0
@@ -81,6 +81,9 @@ properties: - const: rx - const: ptp_ref + power-domains: + maxItems: 1 + required: - clocks - clock-names
Documentation/devicetree/bindings/net/qcom,ethqos.yaml +3 -0
@@ -86,6 +86,9 @@ properties: phy-names: const: serdes + power-domains: + maxItems: 1 + required: - compatible - clocks
Documentation/devicetree/bindings/net/qcom,sa8255p-ethqos.yaml new file +107 -0
107 lines not on this page · raw message
Documentation/devicetree/bindings/net/renesas,rzn1-gmac.yaml +3 -0
@@ -44,6 +44,9 @@ properties: phandle pointing to a PCS sub-node compatible with renesas,rzn1-miic.yaml# + power-domains: + maxItems: 1 + required: - compatible
Documentation/devicetree/bindings/net/renesas,rzv2h-gbeth.yaml +3 -0
@@ -154,6 +154,9 @@ properties: Documentation/devicetree/bindings/net/pcs/renesas,rzn1-miic.yaml# (Refer RZ/T2H portion in the DT-binding file) + power-domains: + maxItems: 1 + required: - compatible - reg
Documentation/devicetree/bindings/net/rockchip-dwmac.yaml +3 -0
@@ -123,6 +123,9 @@ properties: phy-supply: description: PHY regulator + power-domains: + maxItems: 1 + required: - compatible - clocks
Documentation/devicetree/bindings/net/snps,dwmac.yaml +4 -1
@@ -73,6 +73,7 @@ properties: - nuvoton,ma35d1-dwmac - nxp,s32g2-dwmac - qcom,qcs404-ethqos + - qcom,sa8255p-ethqos - qcom,sa8775p-ethqos - qcom,sc8280xp-ethqos - qcom,sm8150-ethqos
@@ -187,7 +188,8 @@ properties: - enum: [ahb, stmmaceth-ocp] power-domains: - maxItems: 1 + minItems: 1 + maxItems: 2 mac-mode: $ref: ethernet-controller.yaml#/properties/phy-connection-type
@@ -583,6 +585,7 @@ allOf: - ingenic,x1830-mac - ingenic,x2000-mac - qcom,qcs404-ethqos + - qcom,sa8255p-ethqos - qcom,sa8775p-ethqos - qcom,sc8280xp-ethqos - qcom,sm8150-ethqos
Documentation/devicetree/bindings/net/sophgo,cv1800b-dwmac.yaml +3 -0
@@ -49,6 +49,9 @@ properties: reset-names: const: stmmaceth + power-domains: + maxItems: 1 + required: - compatible - reg
Documentation/devicetree/bindings/net/sophgo,sg2044-dwmac.yaml +3 -0
@@ -52,6 +52,9 @@ properties: interrupt-names: maxItems: 1 + power-domains: + maxItems: 1 + resets: maxItems: 1
Documentation/devicetree/bindings/net/spacemit,k3-dwmac.yaml +3 -0
@@ -56,6 +56,9 @@ properties: reset-names: const: stmmaceth + power-domains: + maxItems: 1 + spacemit,apmu: $ref: /schemas/types.yaml#/definitions/phandle-array items:
Documentation/devicetree/bindings/net/starfive,jh7110-dwmac.yaml +3 -0
@@ -75,6 +75,9 @@ properties: The argument one is the offset of phy mode selection, the argument two is the shift of phy mode selection. + power-domains: + maxItems: 1 + required: - compatible - reg
Documentation/devicetree/bindings/net/stm32-dwmac.yaml +3 -0
@@ -121,6 +121,9 @@ properties: minItems: 1 maxItems: 2 + power-domains: + maxItems: 1 + required: - compatible - clocks
Documentation/devicetree/bindings/net/tesla,fsd-ethqos.yaml +3 -0
@@ -67,6 +67,9 @@ properties: - rgmii-rxid - rgmii-txid + power-domains: + maxItems: 1 + required: - compatible - reg
Documentation/devicetree/bindings/net/thead,th1520-gmac.yaml +3 -0
@@ -78,6 +78,9 @@ properties: items: - const: macirq + power-domains: + maxItems: 1 + required: - clocks - clock-names
Documentation/devicetree/bindings/net/toshiba,visconti-dwmac.yaml +3 -0
@@ -48,6 +48,9 @@ properties: interrupt-names: const: macirq + power-domains: + maxItems: 1 + required: - compatible - reg
MAINTAINERS +1 -0
@@ -22888,6 +22888,7 @@ L: [email protected] L: [email protected] S: Maintained F: Documentation/devicetree/bindings/net/qcom,ethqos.yaml +F: Documentation/devicetree/bindings/net/qcom,sa8255p-ethqos.yaml F: drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c QUALCOMM FASTRPC DRIVER
Signature · 1 line
2.47.3
[email protected]
AI reviewRe: [PATCH net-next v16 2/7] dt-bindings: net: qcom: document the ethqos device for SCMI-based systems
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider: - [Low] dt-bindings: net: missed power-domains constraint in ultrarisc,dp1000-gmac.yaml --
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Low] dt-bindings: net: missed power-domains constraint in ultrarisc,dp1000-gmac.yaml --
commit eaf763b0d0d309757c6cf7f9fe067155eb99eb11
Author: Bartosz Golaszewski <[email protected]>
dt-bindings: net: qcom: document the ethqos device for SCMI-based systems
This commit describes the firmware-managed variant of the QCom DesignWare MAC in a separate file. It updates the top-level snps,dwmac.yaml to allow up to two power domains and restricts existing referencing bindings to a maximum of one power domain.
Quoted 4 lines
Documentation/devicetree/bindings/net/snps,dwmac.yaml +0
-0
[ ... ]
Documentation/devicetree/bindings/net/snps,dwmac.yaml properties: · line 195
Quoted 10 lines
Documentation/devicetree/bindings/net/snps,dwmac.yaml +2
-1@@ -187,7 +188,8 @@ properties: - enum: [ahb, stmmaceth-ocp] power-domains: - maxItems: 1 + minItems: 1 + maxItems: 2 mac-mode: $ref: ethernet-controller.yaml#/properties/phy-connection-type
[Severity: Low]
Was Documentation/devicetree/bindings/net/ultrarisc,dp1000-gmac.yaml missed in the updates to other bindings?
The commit message states the intent to update existing bindings referencing snps,dwmac.yaml to limit their maxItems for power-domains to 1. However, ultrarisc,dp1000-gmac.yaml references snps,dwmac.yaml under its allOf node:
Documentation/devicetree/bindings/net/ultrarisc,dp1000-gmac.yaml:
allOf:
- $ref: snps,dwmac.yaml#
Because the top-level snps,dwmac.yaml was relaxed to allow 2 power domains here, and ultrarisc,dp1000-gmac.yaml lacks a local override, does it implicitly inherit the newly relaxed limit of 2?
Could this cause a schema validation regression where device trees for the hardware could incorrectly specify up to two power domains without failing validation?
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=2
PATCH v16 3/7 net: stmmac: qcom-ethqos: set serdes mode before powerup
In reply to Bartosz GolaszewskiCall phy_set_mode_ext() before phy_power_on() in qcom_ethqos_serdes_powerup(). This is harmless for existing users but on SCMI systems this is required for the PHY driver to select the right performance level - which translates to the link speed. This is done ahead of adding support for the firmware-managed EMAC on Qualcomm sa8255p.
--- drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-)
drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c +13 -1
@@ -601,10 +601,22 @@ static int qcom_ethqos_serdes_powerup(struct net_device *ndev, void *priv)if (ret)return ret; +if (ethqos->phy_mode ==PHY_INTERFACE_MODE_SGMII || + ethqos->phy_mode ==PHY_INTERFACE_MODE_2500BASEX ) { + ret =phy_set_mode_ext (ethqos->serdes_phy,PHY_MODE_ETHERNET , + ethqos->phy_mode); +if (ret) + goto err_out; + } + ret =phy_power_on (ethqos->serdes_phy);if (ret) -phy_exit (ethqos->serdes_phy); + goto err_out; +return 0 ; + +err_out: +phy_exit (ethqos->serdes_phy);return ret; }
Signature · 1 line
2.47.3
Re: [PATCH net-next v16 3/7] net: stmmac: qcom-ethqos: set serdes mode before powerup
Quoted 8 lines · Bartosz Golaszewski
Call
phy_set_mode_ext()beforephy_power_on()inqcom_ethqos_serdes_powerup(). This is harmless for existing users but on SCMI systems this is required for the PHY driver to select the right performance level - which translates to the link speed. This is done ahead of adding support for the firmware-managed EMAC on Qualcomm sa8255p.Signed-off-by Bartosz Golaszewski <[email protected]>---
As mentioned in the commit message, this should be harmless for existing non-SCMI systems and I did not see any issues while testing this series on IQ 9075 EVK, so:
Ayaan
PATCH v16 4/7 net: stmmac: qcom-ethqos: update phy_mode to the resolved interface in mac_finish()
In reply to Bartosz Golaszewskiethqos->phy_mode is read by serdes_powerup() and qcom_ethqos_set_sgmii_loopback() to configure the SerDes and its wrapper for the correct interface. It is set once at probe from the DT phy-mode property and never updated.
phylink resolves the actual runtime interface and passes it to the mac_finish() callback. On platforms that only ever operate at one speed these two values are always the same, but when the interface changes at runtime - for example switching between SGMII and 2500BASE-X - the stored value becomes stale. The next serdes_powerup() call, on a subsequent link cycle, then reinitializes the SerDes to the wrong mode.
Update ethqos->phy_mode from the interface argument in ethqos_mac_finish_serdes() so that it always reflects the last resolved interface.
With that, we now update the phy_mode to the runtime-resolved interface, so any subsequent resume with a 1G SGMII link skips the loopback setup and the DMA reset hangs. To remedy this, extend the guard to include PHY_INTERFACE_MODE_SGMII.
--- drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)
drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c +8 -1
@@ -190,7 +190,8 @@ static void qcom_ethqos_set_sgmii_loopback(struct qcom_ethqos *ethqos, bool enable) {if (!ethqos->needs_sgmii_loopback || - ethqos->phy_mode !=PHY_INTERFACE_MODE_2500BASEX ) + (ethqos->phy_mode !=PHY_INTERFACE_MODE_2500BASEX && + ethqos->phy_mode !=PHY_INTERFACE_MODE_SGMII ))return ; rgmii_updatel(ethqos,
@@ -637,6 +638,12 @@ static int ethqos_mac_finish_serdes(struct net_device *ndev, void *priv,qcom_ethqos_set_sgmii_loopback (ethqos, false); +/* The interface mode is only known once phylink has resolved it and +* may change at runtime, so keep it in sync for later +* serdes_powerup() and qcom_ethqos_set_sgmii_loopback() calls. +*/ + ethqos->phy_mode = interface; +if (interface ==PHY_INTERFACE_MODE_SGMII || interface ==PHY_INTERFACE_MODE_2500BASEX ) ret = phy_set_mode_ext(ethqos->serdes_phy, PHY_MODE_ETHERNET,
Signature · 1 line
2.47.3
Re: [PATCH net-next v16 4/7] net: stmmac: qcom-ethqos: update phy_mode to the resolved interface in mac_finish()
Quoted 16 lines · Bartosz Golaszewski
ethqos->phy_modeis read byserdes_powerup()andqcom_ethqos_set_sgmii_loopback()to configure the SerDes and its wrapper for the correct interface. It is set once at probe from the DT phy-mode property and never updated.phylink resolves the actual runtime interface and passes it to the
mac_finish()callback. On platforms that only ever operate at one speed these two values are always the same, but when the interface changes at runtime - for example switching between SGMII and 2500BASE-X - the stored value becomes stale. The nextserdes_powerup()call, on a subsequent link cycle, then reinitializes the SerDes to the wrong mode.Update
ethqos->phy_modefrom the interface argument inethqos_mac_finish_serdes()so that it always reflects the last resolved interface.
Quoted 7 lines
With that, we now update the
phy_modeto the runtime-resolved interface, so any subsequent resume with a 1G SGMII link skips the loopback setup and the DMA reset hangs. To remedy this, extend the guard to includePHY_INTERFACE_MODE_SGMII.Signed-off-by Bartosz Golaszewski <[email protected]>---
I am not sure but should this have a Fixes: tag?
Ayaan
PATCH v16 5/7 net: stmmac: qcom-ethqos: reuse the address of ethqos_emac_driver_data
In reply to Bartosz GolaszewskiInstead of needlessly copying the fields of ethqos_emac_driver_data into struct qcom_ethqos, just use the address of the former as a reference. It's .rodata after all. This is done in order to avoid having either two calls to of_device_get_match_data() or having to extend the latter with another field when adding support for SCMI.
--- .../ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c | 37 ++++++++-------------- 1 file changed, 14 insertions(+), 23 deletions(-)
drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c +14 -23
@@ -103,12 +103,7 @@ struct qcom_ethqos {struct clk *link_clk;struct phy *serdes_phy;phy_interface_t phy_mode; - -const struct ethqos_emac_por *rgmii_por; -unsigned int num_rgmii_por; -bool rgmii_config_loopback_en; -bool has_emac_ge_3; -bool needs_sgmii_loopback; +const struct ethqos_emac_driver_data *data; };static u32 rgmii_readl (struct qcom_ethqos *ethqos,unsigned int offset)
@@ -189,7 +184,7 @@ static int ethqos_set_clk_tx_rate(void *bsp_priv, struct clk *clk_tx_i,static void qcom_ethqos_set_sgmii_loopback (struct qcom_ethqos *ethqos,bool enable) { -if (!ethqos->needs_sgmii_loopback || +if (!ethqos->data->needs_sgmii_loopback || (ethqos->phy_mode !=PHY_INTERFACE_MODE_2500BASEX && ethqos->phy_mode !=PHY_INTERFACE_MODE_SGMII ))return ;
@@ -323,7 +318,7 @@ static int ethqos_dll_configure(struct qcom_ethqos *ethqos)/* Set DLL_EN */ rgmii_setmask (ethqos,SDCC_DLL_CONFIG_DLL_EN ,SDCC_HC_REG_DLL_CONFIG ); -if (!ethqos->has_emac_ge_3) { +if (!ethqos->data->has_emac_ge_3) {rgmii_clrmask (ethqos,SDCC_DLL_MCLK_GATING_EN ,SDCC_HC_REG_DLL_CONFIG );
@@ -353,7 +348,7 @@ static int ethqos_dll_configure(struct qcom_ethqos *ethqos)rgmii_setmask (ethqos,SDCC_DLL_CONFIG2_DDR_CAL_EN ,SDCC_HC_REG_DLL_CONFIG2 ); -if (!ethqos->has_emac_ge_3) { +if (!ethqos->data->has_emac_ge_3) {rgmii_clrmask (ethqos,SDCC_DLL_CONFIG2_DLL_CLOCK_DIS ,SDCC_HC_REG_DLL_CONFIG2 );
@@ -433,7 +428,7 @@ static int ethqos_rgmii_macro_init(struct qcom_ethqos *ethqos, int speed)rgmii_clrmask (ethqos,RGMII_CONFIG2_RSVD_CONFIG15 ,RGMII_IO_MACRO_CONFIG2 ); -if (speed ==SPEED_1000 || ethqos->has_emac_ge_3) +if (speed ==SPEED_1000 || ethqos->data->has_emac_ge_3)rgmii_setmask (ethqos,RGMII_CONFIG2_RX_PROG_SWAP ,RGMII_IO_MACRO_CONFIG2 );else
@@ -457,7 +452,7 @@ static int ethqos_rgmii_macro_init(struct qcom_ethqos *ethqos, int speed)* in practice this becomes PRG_RCLK_DLY = 52 * 4 / * (2 * RX delay ns) */ -if (ethqos->has_emac_ge_3) { +if (ethqos->data->has_emac_ge_3) {/* 0.9 ns */ prg_rclk_dly =115 ; }else {
@@ -473,7 +468,7 @@ static int ethqos_rgmii_macro_init(struct qcom_ethqos *ethqos, int speed) SDCC_HC_REG_DDR_CONFIG); } -if (ethqos->rgmii_config_loopback_en) +if (ethqos->data->rgmii_config_loopback_en) loopback =RGMII_CONFIG_LOOPBACK_EN ;else loopback =0 ;
@@ -496,9 +491,9 @@ static void ethqos_fix_mac_speed_rgmii(void *bsp_priv, dev = ðqos->pdev->dev;/* Reset to POR values and enable clk */ -for (i =0 ; i < ethqos->num_rgmii_por; i++) -rgmii_writel (ethqos, ethqos->rgmii_por[i].value, - ethqos->rgmii_por[i].offset); +for (i =0 ; i < ethqos->data->num_rgmii_por; i++) +rgmii_writel (ethqos, ethqos->data->rgmii_por[i].value, + ethqos->data->rgmii_por[i].offset);ethqos_set_func_clk_en (ethqos);
@@ -512,7 +507,7 @@ static void ethqos_fix_mac_speed_rgmii(void *bsp_priv,rgmii_setmask (ethqos,SDCC_DLL_CONFIG_PDN ,SDCC_HC_REG_DLL_CONFIG ); -if (ethqos->has_emac_ge_3) { +if (ethqos->data->has_emac_ge_3) {if (speed ==SPEED_1000 ) {rgmii_writel (ethqos,0x1800000 ,SDCC_TEST_CTL );rgmii_writel (ethqos,0x2C010800 ,SDCC_USR_CTL );
@@ -539,7 +534,7 @@ static void ethqos_fix_mac_speed_rgmii(void *bsp_priv, SDCC_HC_REG_DLL_CONFIG);/* Set USR_CTL bit 26 with mask of 3 bits */ -if (!ethqos->has_emac_ge_3) +if (!ethqos->data->has_emac_ge_3)rgmii_updatel (ethqos,GENMASK (26 ,24 ),BIT (26 ),SDCC_USR_CTL );
@@ -753,11 +748,7 @@ static int qcom_ethqos_probe(struct platform_device *pdev) "Failed to map rgmii resource\n"); data =of_device_get_match_data (dev); - ethqos->rgmii_por = data->rgmii_por; - ethqos->num_rgmii_por = data->num_rgmii_por; - ethqos->rgmii_config_loopback_en = data->rgmii_config_loopback_en; - ethqos->has_emac_ge_3 = data->has_emac_ge_3; - ethqos->needs_sgmii_loopback = data->needs_sgmii_loopback; + ethqos->data = data; ethqos->link_clk =devm_clk_get (dev, data->link_clk_name ?:"rgmii" );if (IS_ERR (ethqos->link_clk))
@@ -794,7 +785,7 @@ static int qcom_ethqos_probe(struct platform_device *pdev) plat_dat->dump_debug_regs = rgmii_dump; plat_dat->ptp_clk_freq_config = ethqos_ptp_clk_freq_config; plat_dat->core_type =DWMAC_CORE_GMAC4 ; -if (ethqos->has_emac_ge_3) +if (data->has_emac_ge_3) plat_dat->dwmac4_addrs = &data->dwmac4_addrs; plat_dat->pmt = true;if (of_property_read_bool (np,"snps,tso" ))
Signature · 1 line
2.47.3
Re: [PATCH net-next v16 5/7] net: stmmac: qcom-ethqos: reuse the address of ethqos_emac_driver_data
Quoted 8 lines · Bartosz Golaszewski
Instead of needlessly copying the fields of
ethqos_emac_driver_datainto structqcom_ethqos, just use the address of the former as a reference. It's .rodata after all. This is done in order to avoid having either two calls toof_device_get_match_data()or having to extend the latter with another field when adding support for SCMI.Signed-off-by Bartosz Golaszewski <[email protected]>---
After testing it on a couple of legacy non-SCMI boards, I did not find any issues with this patch, so:
Ayaan
PATCH v16 6/7 net: stmmac: qcom-ethqos: factor out linux-level setup into a separate function
In reply to Bartosz GolaszewskiAhead of adding support for firmware-controlled EMAC variants, extend the ethqos_emac_driver_data structure with a setup() callback, implement it for the existing models and move all operations not required in SCMI mode into it.
--- .../ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c | 94 ++++++++++++++++------ 1 file changed, 68 insertions(+), 26 deletions(-)
drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c +68 -26
@@ -5,6 +5,7 @@#include <linux/of.h> #include <linux/of_net.h> #include <linux/platform_device.h> +#include <linux/pm_domain.h> #include <linux/phy.h> #include <linux/phy/phy.h>
@@ -81,6 +82,8 @@#define SGMII_10M_RX_CLK_DVDR 0x31 +struct qcom_ethqos ; +struct ethqos_emac_por {unsigned int offset;unsigned int value;
@@ -95,6 +98,8 @@ struct ethqos_emac_driver_data {const char *link_clk_name;struct dwmac4_addrs dwmac4_addrs;bool needs_sgmii_loopback; +int (*setup)(struct qcom_ethqos *ethqos, +struct plat_stmmacenet_data *plat_dat); };struct qcom_ethqos {
@@ -200,6 +205,9 @@ static void ethqos_set_func_clk_en(struct qcom_ethqos *ethqos)rgmii_setmask (ethqos,RGMII_CONFIG_FUNC_CLK_EN ,RGMII_IO_MACRO_CONFIG ); } +static int ethqos_hlos_setup (struct qcom_ethqos *ethqos, +struct plat_stmmacenet_data *plat_dat); +static const struct ethqos_emac_por emac_v2_3_0_por[] = { { .offset =RGMII_IO_MACRO_CONFIG , .value =0x00C01343 }, { .offset =SDCC_HC_REG_DLL_CONFIG , .value =0x2004642C },
@@ -214,6 +222,7 @@ static const struct ethqos_emac_driver_data emac_v2_3_0_data = { .num_rgmii_por = ARRAY_SIZE(emac_v2_3_0_por), .rgmii_config_loopback_en = true, .has_emac_ge_3 = false, + .setup = ethqos_hlos_setup, };static const struct ethqos_emac_por emac_v2_1_0_por[] = {
@@ -230,6 +239,7 @@ static const struct ethqos_emac_driver_data emac_v2_1_0_data = { .num_rgmii_por = ARRAY_SIZE(emac_v2_1_0_por), .rgmii_config_loopback_en = false, .has_emac_ge_3 = false, + .setup = ethqos_hlos_setup, };static const struct ethqos_emac_por emac_v3_0_0_por[] = {
@@ -262,6 +272,7 @@ static const struct ethqos_emac_driver_data emac_v3_0_0_data = { .mtl_low_cred = 0x00008024, .mtl_low_cred_offset = 0x1000, }, + .setup = ethqos_hlos_setup, }; static const struct ethqos_emac_por emac_v4_0_0_por[] = {
@@ -297,6 +308,7 @@ static const struct ethqos_emac_driver_data emac_v4_0_0_data = { .mtl_low_cred = 0x00008024, .mtl_low_cred_offset = 0x1000, }, + .setup = ethqos_hlos_setup, };static int ethqos_dll_configure (struct qcom_ethqos *ethqos)
@@ -695,6 +707,58 @@ static void ethqos_ptp_clk_freq_config(struct stmmac_priv *priv)netdev_dbg (priv->dev,"PTP rate %lu\n" , plat_dat->clk_ptp_rate); } +static int ethqos_hlos_setup (struct qcom_ethqos *ethqos, +struct plat_stmmacenet_data *plat_dat) +{ +struct platform_device *pdev = ethqos->pdev; +struct device *dev = &pdev->dev; +int ret; + + ethqos->rgmii_base =devm_platform_ioremap_resource_byname (pdev,"rgmii" ); +if (IS_ERR (ethqos->rgmii_base)) +return dev_err_probe (dev,PTR_ERR (ethqos->rgmii_base), +"Failed to map rgmii resource\n" ); + + ethqos->link_clk =devm_clk_get (dev, ethqos->data->link_clk_name ?:"rgmii" ); +if (IS_ERR (ethqos->link_clk)) +return dev_err_probe (dev,PTR_ERR (ethqos->link_clk), +"Failed to get link_clk\n" ); + + plat_dat->clks_config = ethqos_clks_config; + + ret =ethqos_clks_config (ethqos, true); +if (ret) +return ret; + + ret =devm_add_action_or_reset (dev, ethqos_clks_disable, ethqos); +if (ret) +return ret; + +ethqos_set_clk_tx_rate (ethqos,NULL , plat_dat->phy_interface,SPEED_1000 ); +qcom_ethqos_set_sgmii_loopback (ethqos, true); +ethqos_set_func_clk_en (ethqos); + +switch (ethqos->phy_mode) { +case PHY_INTERFACE_MODE_RGMII : +case PHY_INTERFACE_MODE_RGMII_ID : +case PHY_INTERFACE_MODE_RGMII_RXID : +case PHY_INTERFACE_MODE_RGMII_TXID : + plat_dat->fix_mac_speed = ethqos_fix_mac_speed_rgmii; +break ; +case PHY_INTERFACE_MODE_2500BASEX : +case PHY_INTERFACE_MODE_SGMII : + plat_dat->fix_mac_speed = ethqos_fix_mac_speed_sgmii; +break ; +default : +break ; + } + + plat_dat->set_clk_tx_rate = ethqos_set_clk_tx_rate; + plat_dat->dump_debug_regs = rgmii_dump; + +return 0 ; +} +static int qcom_ethqos_probe (struct platform_device *pdev) {struct device_node *np = pdev->dev.of_node;
@@ -716,23 +780,20 @@ static int qcom_ethqos_probe(struct platform_device *pdev) "dt configuration failed\n"); } - plat_dat->clks_config = ethqos_clks_config; - ethqos =devm_kzalloc (dev,sizeof (*ethqos),GFP_KERNEL );if (!ethqos)return -ENOMEM ; ethqos->phy_mode = plat_dat->phy_interface; +switch (ethqos->phy_mode) {case PHY_INTERFACE_MODE_RGMII :case PHY_INTERFACE_MODE_RGMII_ID :case PHY_INTERFACE_MODE_RGMII_RXID :case PHY_INTERFACE_MODE_RGMII_TXID : - plat_dat->fix_mac_speed = ethqos_fix_mac_speed_rgmii;break ;case PHY_INTERFACE_MODE_2500BASEX :case PHY_INTERFACE_MODE_SGMII : - plat_dat->fix_mac_speed = ethqos_fix_mac_speed_sgmii; plat_dat->mac_finish = ethqos_mac_finish_serdes;break ;default :
@@ -742,24 +803,13 @@ static int qcom_ethqos_probe(struct platform_device *pdev) } ethqos->pdev = pdev; - ethqos->rgmii_base =devm_platform_ioremap_resource_byname (pdev,"rgmii" ); -if (IS_ERR (ethqos->rgmii_base)) -return dev_err_probe (dev,PTR_ERR (ethqos->rgmii_base), -"Failed to map rgmii resource\n" ); - data =of_device_get_match_data (dev); ethqos->data = data; - ethqos->link_clk =devm_clk_get (dev, data->link_clk_name ?:"rgmii" ); -if (IS_ERR (ethqos->link_clk)) -return dev_err_probe (dev,PTR_ERR (ethqos->link_clk), -"Failed to get link_clk\n" ); - - ret =ethqos_clks_config (ethqos, true); -if (ret) -return ret; +if (WARN_ON (!data->setup)) +return -EINVAL ; - ret =devm_add_action_or_reset (dev, ethqos_clks_disable, ethqos); + ret = data->setup (ethqos, plat_dat);if (ret)return ret;
@@ -768,12 +818,6 @@ static int qcom_ethqos_probe(struct platform_device *pdev)return dev_err_probe (dev,PTR_ERR (ethqos->serdes_phy),"Failed to get serdes phy\n" ); -ethqos_set_clk_tx_rate (ethqos,NULL , plat_dat->phy_interface, -SPEED_1000 ); - -qcom_ethqos_set_sgmii_loopback (ethqos, true); -ethqos_set_func_clk_en (ethqos); -/* The clocks are controlled by firmware, so we don't know for certain * what clock rate is being used. Hardware documentation mentions that * the AHB slave clock will be in the range of 50 to 100MHz, which
@@ -781,8 +825,6 @@ static int qcom_ethqos_probe(struct platform_device *pdev)*/ plat_dat->clk_csr =STMMAC_CSR_60_100M ; plat_dat->bsp_priv = ethqos; - plat_dat->set_clk_tx_rate = ethqos_set_clk_tx_rate; - plat_dat->dump_debug_regs = rgmii_dump; plat_dat->ptp_clk_freq_config = ethqos_ptp_clk_freq_config; plat_dat->core_type =DWMAC_CORE_GMAC4 ;if (data->has_emac_ge_3)
Signature · 1 line
2.47.3
Re: [PATCH net-next v16 6/7] net: stmmac: qcom-ethqos: factor out linux-level setup into a separate function
Quoted 7 lines · Bartosz Golaszewski
Ahead of adding support for firmware-controlled EMAC variants, extend the
ethqos_emac_driver_datastructure with asetup()callback, implement it for the existing models and move all operations not required in SCMI mode into it.Signed-off-by Bartosz Golaszewski <[email protected]>---
Ayaan
PATCH v16 7/7 net: stmmac: qcom-ethqos: add support for sa8255p
In reply to Bartosz GolaszewskiExtend the driver to support a new model - sa8255p. Unlike the previously supported variants, this one's power management is done in the firmware over SCMI. This is modeled in linux using power domains so add a new emac data variant and a separate setup callback.
--- .../ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c | 111 +++++++++++++++++++++ 1 file changed, 111 insertions(+)
drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c +111 -0
@@ -98,6 +98,11 @@ struct ethqos_emac_driver_data {const char *link_clk_name;struct dwmac4_addrs dwmac4_addrs;bool needs_sgmii_loopback; +/* Fixed PTP reference clock rate, used on SCMI platforms where +* firmware does not implement the clock protocol allowing linux to +* query it. +*/ +unsigned long ptp_clk_rate;int (*setup)(struct qcom_ethqos *ethqos,struct plat_stmmacenet_data *plat_dat); };
@@ -108,6 +113,7 @@ struct qcom_ethqos {struct clk *link_clk;struct phy *serdes_phy;phy_interface_t phy_mode; +struct dev_pm_domain_list *pds;const struct ethqos_emac_driver_data *data; };
@@ -207,6 +213,8 @@ static void ethqos_set_func_clk_en(struct qcom_ethqos *ethqos)static int ethqos_hlos_setup (struct qcom_ethqos *ethqos,struct plat_stmmacenet_data *plat_dat); +static int ethqos_scmi_setup (struct qcom_ethqos *ethqos, +struct plat_stmmacenet_data *plat_dat);static const struct ethqos_emac_por emac_v2_3_0_por[] = { { .offset =RGMII_IO_MACRO_CONFIG , .value =0x00C01343 },
@@ -311,6 +319,30 @@ static const struct ethqos_emac_driver_data emac_v4_0_0_data = { .setup = ethqos_hlos_setup, }; +static const struct ethqos_emac_driver_data emac_v4_0_0_scmi_data = { + .has_emac_ge_3 = true, + .needs_sgmii_loopback = true, + .dma_addr_width =36 , + .ptp_clk_rate =230400000 , + .dwmac4_addrs = { + .dma_chan =0x00008100 , + .dma_chan_offset =0x1000 , + .mtl_chan =0x00008000 , + .mtl_chan_offset =0x1000 , + .mtl_ets_ctrl =0x00008010 , + .mtl_ets_ctrl_offset =0x1000 , + .mtl_txq_weight =0x00008018 , + .mtl_txq_weight_offset =0x1000 , + .mtl_send_slp_cred =0x0000801c , + .mtl_send_slp_cred_offset =0x1000 , + .mtl_high_cred =0x00008020 , + .mtl_high_cred_offset =0x1000 , + .mtl_low_cred =0x00008024 , + .mtl_low_cred_offset =0x1000 , + }, + .setup = ethqos_scmi_setup, +}; +static int ethqos_dll_configure (struct qcom_ethqos *ethqos) {struct device *dev = ðqos->pdev->dev;
@@ -759,6 +791,84 @@ static int ethqos_hlos_setup(struct qcom_ethqos *ethqos,return 0 ; } +static const char *const ethqos_scmi_pd_names[] = {"core" ,"mdio" }; + +static int ethqos_scmi_setup (struct qcom_ethqos *ethqos, +struct plat_stmmacenet_data *plat_dat) +{ +const struct dev_pm_domain_attach_data pd_data = { + .pd_names = ethqos_scmi_pd_names, + .num_pd_names =ARRAY_SIZE (ethqos_scmi_pd_names), + .pd_flags =PD_FLAG_DEV_LINK_ON , + }; + +struct platform_device *pdev = ethqos->pdev; +struct device *dev = &pdev->dev; +int ret; + + ret =devm_pm_domain_attach_list (dev, &pd_data, ðqos->pds); +if (ret <0 ) +return dev_err_probe (dev, ret, +"Failed to attach power domains\n" ); + +/* +* The MAC AXI/AHB clocks are owned by firmware and brought up through +* the "core" and "mdio" SCMI power domains above, while the SerDes +* lane is powered by the SerDes PHY's own power domain from +* serdes_powerup() in stmmac_open(). The MAC wrapper itself, however +* is in the kernel's register space: the wrapper bit that loops the +* PHY TX clock into the MAC's clk_rx_i - needed because no recovered +* RX clock exists yet - is not configured by firmware. Without it, +* clk_rx_i never toggles and the DMA SW-reset polled in +* dwmac4_dma_reset() never completes. +* +* Map the wrapper and program the same loopback/functional clock bits +* the non-firmware platforms rely on (see ethqos_clks_config) so the +* RX clock is present by the time the DMA engine is reset. +*/ + ethqos->rgmii_base =devm_platform_ioremap_resource_byname (pdev,"rgmii" ); +if (IS_ERR (ethqos->rgmii_base)) +return dev_err_probe (dev,PTR_ERR (ethqos->rgmii_base), +"Failed to map rgmii resource\n" ); + +/* +* Register clks_config to run on every subsequent runtime resume, +* which stmmac performs after the power domains are on but before +* serdes_powerup() and the DMA reset. This alone isn't enough for +* the very first reset done from stmmac_open(), though: probe() +* fakes the device into RPM_ACTIVE without invoking the resume +* callback, so whether clks_config() has run by then depends on +* whether the device has already gone through one real suspend/resume +* cycle in the meantime. Call it here explicitly so the wrapper is +* always configured before the first DMA reset regardless of that +* timing. +*/ + plat_dat->clks_config = ethqos_clks_config; + + ret =ethqos_clks_config (ethqos, true); +if (ret) +return ret; + + ret =devm_add_action_or_reset (dev, ethqos_clks_disable, ethqos); +if (ret) +return ret; + + plat_dat->clk_ptp_rate = ethqos->data->ptp_clk_rate; + +switch (ethqos->phy_mode) { +case PHY_INTERFACE_MODE_2500BASEX : +case PHY_INTERFACE_MODE_SGMII : + plat_dat->fix_mac_speed = ethqos_fix_mac_speed_sgmii; +break ; +default : +/* The firmware-managed SerDes only supports SGMII modes. */ +return dev_err_probe (dev, -EINVAL ,"Unsupported phy-mode: %s\n" , +phy_modes (ethqos->phy_mode)); + } + +return 0 ; +} +static int qcom_ethqos_probe (struct platform_device *pdev) {struct device_node *np = pdev->dev.of_node;
@@ -851,6 +961,7 @@ static int qcom_ethqos_probe(struct platform_device *pdev)static const struct of_device_id qcom_ethqos_match[] = { { .compatible ="qcom,qcs404-ethqos" , .data = &emac_v2_3_0_data}, + { .compatible ="qcom,sa8255p-ethqos" , .data = &emac_v4_0_0_scmi_data}, { .compatible ="qcom,sa8775p-ethqos" , .data = &emac_v4_0_0_data}, { .compatible ="qcom,sc8280xp-ethqos" , .data = &emac_v3_0_0_data}, { .compatible ="qcom,sm8150-ethqos" , .data = &emac_v2_1_0_data},
Signature · 1 line
2.47.3
This series was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:
Hello:
This series was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:
Quoted 8 lines · On Wed, 14 Oct 2026 14:36:39 +0200 you wrote:
Add support for the firmware-managed variant of the DesignWare MAC on the sa8255p platform. This series contains new DT bindings and driver changes required to support the MAC in the STMMAC driver.
It also reorganizes the ethqos code quite a bit to make the introduction of power domains into the driver a bit easier on the eye.
[...]
Here is the summary with links:
- [net-next,v16,1/7] net: stmmac: dwmac4: don't program the 1us tick counter without a CSR clock
https://git.kernel.org/netdev/net-next/c/d09d7b8e86e5 - [net-next,v16,2/7] dt-bindings: net: qcom: document the ethqos device for SCMI-based systems https://git.kernel.org/netdev/net-next/c/534198a05d92 - [net-next,v16,3/7] net: stmmac: qcom-ethqos: set serdes mode before powerup https://git.kernel.org/netdev/net-next/c/7af44cb9e447 - [net-next,v16,4/7] net: stmmac: qcom-ethqos: update phy_mode to the resolved interface in mac_finish() https://git.kernel.org/netdev/net-next/c/05b3ea7346e3 - [net-next,v16,5/7] net: stmmac: qcom-ethqos: reuse the address of ethqos_emac_driver_data https://git.kernel.org/netdev/net-next/c/92719abd6378 - [net-next,v16,6/7] net: stmmac: qcom-ethqos: factor out linux-level setup into a separate function https://git.kernel.org/netdev/net-next/c/acf1e3db9151 - [net-next,v16,7/7] net: stmmac: qcom-ethqos: add support for sa8255p https://git.kernel.org/netdev/net-next/c/bb3183e1c938
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html
This series was applied to riscv/linux.git (fixes) by Jakub Kicinski <[email protected]>:
Hello:
This series was applied to riscv/linux.git (fixes) by Jakub Kicinski <[email protected]>:
Quoted 8 lines · On Wed, 14 Oct 2026 14:36:39 +0200 you wrote:
Add support for the firmware-managed variant of the DesignWare MAC on the sa8255p platform. This series contains new DT bindings and driver changes required to support the MAC in the STMMAC driver.
It also reorganizes the ethqos code quite a bit to make the introduction of power domains into the driver a bit easier on the eye.
[...]
Here is the summary with links:
- [net-next,v16,1/7] net: stmmac: dwmac4: don't program the 1us tick counter without a CSR clock
https://git.kernel.org/riscv/c/d09d7b8e86e5 - [net-next,v16,2/7] dt-bindings: net: qcom: document the ethqos device for SCMI-based systems https://git.kernel.org/riscv/c/534198a05d92 - [net-next,v16,3/7] net: stmmac: qcom-ethqos: set serdes mode before powerup https://git.kernel.org/riscv/c/7af44cb9e447 - [net-next,v16,4/7] net: stmmac: qcom-ethqos: update phy_mode to the resolved interface in mac_finish() https://git.kernel.org/riscv/c/05b3ea7346e3 - [net-next,v16,5/7] net: stmmac: qcom-ethqos: reuse the address of ethqos_emac_driver_data https://git.kernel.org/riscv/c/92719abd6378 - [net-next,v16,6/7] net: stmmac: qcom-ethqos: factor out linux-level setup into a separate function https://git.kernel.org/riscv/c/acf1e3db9151 - [net-next,v16,7/7] net: stmmac: qcom-ethqos: add support for sa8255p https://git.kernel.org/riscv/c/bb3183e1c938
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html