* [PATCH net-next v3 0/9] net: stmmac: qcom-ethqos: add Shikra EMAC support
@ 2026-10-17 9:45 Mohd Ayaan Anwar
2026-10-17 9:45 ` [PATCH net-next v3 1/9] net: phy: dp83867: add regulator supply management Mohd Ayaan Anwar
` (9 more replies)
0 siblings, 10 replies; 13+ messages in thread
From: Mohd Ayaan Anwar @ 2026-10-17 9:45 UTC (permalink / raw)
To: Andrew Lunn, David S. Miller, Eric Dumazet, Jakub Kicinski,
Paolo Abeni, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
Andrew Davis, Andrew Lunn, Heiner Kallweit, Russell King,
Richard Cochran, Bjorn Andersson, Konrad Dybcio, Alexandre Torgue,
Giuseppe Cavallaro, Jose Abreu, Maxime Chevallier,
Maxime Coquelin, Lorenzo Bianconi
Cc: netdev, devicetree, linux-kernel, linux-arm-msm, linux-stm32,
linux-arm-kernel, Mohd Ayaan Anwar
This series incorporates feedback from the RFC and adds the dt-bindings
and driver changes required to enable Gigabit Ethernet support on the
Qualcomm Shikra SoC. DTS changes will be sent out separately.
The series has grown from the RFC and can be broadly divided into three
areas: PHY power supply management, proper support for RGMII ID mode in
the Qualcomm ETHQOS driver, and Shikra specific clock dependencies
required for NOC access.
1. Shikra EVK boards use a GPIO-gated regulator for the DP83867 PHY
power supply. Patches 1 and 2 add supply management to the DP83867
driver so the PHY driver holds the regulator vote at probe. These
changes are largely inspired by similar work done for the QCA8081 PHY:
https://lore.kernel.org/netdev/20261015143849.483339-1-elder@riscstar.com/
2. The generic RGMII fixes from the RFC remain. As suggested, an
additional patch now emits a warning (patch 6) when the legacy "rgmii"
or "rgmii-txid" modes are detected. A new change (patch 7) now
initialises the RGMII link clock at SPEED_10 on probe instead of
SPEED_1000, dropping the unnecessary 250 MHz source before link up.
3. NOC clock voting (patch 9) now uses dev_pm_opp_set_opp() so the
required VDD_CX performance state can be propagated through the clock
controller. The Shikra binding (patch 3) is updated accordingly: an
if/else block constrains Shikra to exactly six clocks and requires
operating-points-v2.
Testing:
The following boards have been tested with this new (proper) handling
for RGMII ID:
- Shikra CQ/IQ variants (with the TI DP83867 PHY)
- QCS615 Ride (with the Micrel KSZ9031 PHY)
- Talos EVK (again with the Micrel KSZ9031 PHY)
- Talos Lyra EVK (TI DP83867 PHY, this board also has a GPIO-gated
regulator for the PHY power supply)
Changes in v3:
- Remove #ifdef CONFIG_OF from the dp83867_power_on() function. This is
a result of the recent discussion regarding similar handling in the
qca808x driver:
https://lore.kernel.org/netdev/atCSWZQAyqvz62_K@aspen.lan/
- Clean up the -ENODEV handling in dp83867_power_on() and use a boolean
to identify if supplies are provided -- Lorenzo.
- Patch 7's commit message now says set_clk_tx_rate instead of
fix_mac_speed -- Sashiko.
- Add a new patch to abstract away the common dwma4_addrs for different
versions of ethqos rather than duplicating them -- Lorenzo.
- Use OPP table to set both the required clock rates and power state,
update ethqos bindings accordingly to specify how the clock rates are
described in DTS -- Konrad, Lorenzo.
- Link to v2: https://lore.kernel.org/r/20260908-shikra_ethernet-v2-0-bbe3389d0652@oss.qualcomm.com
Changes in v2:
- Collected Maxime's Reviewed-by tags.
- Updated Patch 9's commit message to explain the double enable vote
on the "stmmaceth" clock. Open to discussion on how best to handle
this.
- Wrapped regulator vote for dp83867 inside an #ifdef CONFIG_OF check
to avoid adding an unnecessary 200 ms delay on systems where
devm_regulator_get_enable_optional() would return 0. The change now
mirrors the QCA8081 patch -- Sashiko.
- Fixed ethqos_set_clk_tx_rate() to double the rate for all PHY modes
other than RGMII-ID -- Sashiko.
- Moved warning about the use of non RGMII-ID mode to probe instead
of fix_mac_speed to avoid spamming during each link up event --
Sashiko.
- Fixed error unwind drops OPP before stopping link_clk -- Sashiko.
- Fixed OPP vote set in probe not cleaned up on error -- Sashiko.
- Link to v1: https://lore.kernel.org/netdev/20260904-shikra_ethernet-v1-0-a50765996035@oss.qualcomm.com/#t
Changes since RFC:
- Two new patches add supply management for the DP83867, replacing
the gpio-hog approach for PHY power -- Konrad, Andrew.
- Use dev_pm_opp_set_rate() for the NOC AXI clock and require
operating-points-v2 for Shikra -- Konrad.
- Warn on legacy "rgmii"/"rgmii-txid" to encourage DTB migration --
Andrew, Maxime.
- Updated binding document for qcom,ethqos and snps,dwmac.
- Drop the duplicate "axi" clock from Shikra's DT; use "axi-noc" and
"pcie-tile-axi-noc" as the only additional clock-names.
- Initialise RGMII link clock at SPEED_10 rather than SPEED_1000 on
probe.
- Link to RFC: https://lore.kernel.org/netdev/20260612-shikra_ethernet-v1-0-f0f4a1d19929@oss.qualcomm.com/
Signed-off-by: Mohd Ayaan Anwar <mohd.anwar@oss.qualcomm.com>
---
Mohd Ayaan Anwar (9):
net: phy: dp83867: add regulator supply management
dt-bindings: net: qcom,ethqos: add qcom,shikra-ethqos compatible
net: stmmac: qcom-ethqos: convert ethqos_rgmii_macro_init() to void
net: stmmac: qcom-ethqos: fix RGMII_ID mode to use DLL bypass
net: stmmac: qcom-ethqos: warn about legacy RGMII PHY modes
net: stmmac: qcom-ethqos: set initial RGMII link clock to lowest speed
net: stmmac: qcom-ethqos: share common GMAC4 address table
net: stmmac: qcom-ethqos: add per-platform NOC clock voting
net: stmmac: qcom-ethqos: add Shikra EMAC support
.../devicetree/bindings/net/qcom,ethqos.yaml | 55 ++++-
.../devicetree/bindings/net/snps,dwmac.yaml | 2 +
drivers/net/ethernet/stmicro/stmmac/Kconfig | 1 +
.../ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c | 259 +++++++++++++++++----
drivers/net/phy/dp83867.c | 32 +++
5 files changed, 297 insertions(+), 52 deletions(-)
---
base-commit: 8b71f1f5a28347cefb1a4711c4eeb492d5c619fb
change-id: 20260903-shikra_ethernet-ae7bee5e804e
Best regards,
--
Mohd Ayaan Anwar <mohd.anwar@oss.qualcomm.com>
^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH net-next v3 1/9] net: phy: dp83867: add regulator supply management
2026-10-17 9:45 [PATCH net-next v3 0/9] net: stmmac: qcom-ethqos: add Shikra EMAC support Mohd Ayaan Anwar
@ 2026-10-17 9:45 ` Mohd Ayaan Anwar
2026-10-17 13:52 ` Andrew Lunn
2026-10-17 9:45 ` [PATCH net-next v3 2/9] dt-bindings: net: qcom,ethqos: add qcom,shikra-ethqos compatible Mohd Ayaan Anwar
` (8 subsequent siblings)
9 siblings, 1 reply; 13+ messages in thread
From: Mohd Ayaan Anwar @ 2026-10-17 9:45 UTC (permalink / raw)
To: Andrew Lunn, David S. Miller, Eric Dumazet, Jakub Kicinski,
Paolo Abeni, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
Andrew Davis, Andrew Lunn, Heiner Kallweit, Russell King,
Richard Cochran, Bjorn Andersson, Konrad Dybcio, Alexandre Torgue,
Giuseppe Cavallaro, Jose Abreu, Maxime Chevallier,
Maxime Coquelin, Lorenzo Bianconi
Cc: netdev, devicetree, linux-kernel, linux-arm-msm, linux-stm32,
linux-arm-kernel, Mohd Ayaan Anwar
Some embedded board designs use GPIO-controlled regulators for the
DP83867 power rails. Add dp83867_power_on() to enable all four supply
domains at probe time. Absent supplies are silently skipped, so boards
that do not describe them are unaffected.
When any supply is newly enabled the driver sleeps for 200 ms before
returning. This satisfies the post power-up stabilisation requirement
mentioned in section 6.6 of the DP83867E/IS/CS datasheet.
Acked-by: Lorenzo Bianconi <lorenzo.bianconi@oss.qualcomm.com>
Acked-by: Andrew Davis <afd@ti.com>
Signed-off-by: Mohd Ayaan Anwar <mohd.anwar@oss.qualcomm.com>
---
I have kept the Acked-by's since the overall premise of the change
remains the same between v2 and v3, please let me know if you would like
me to remove them.
---
drivers/net/phy/dp83867.c | 32 ++++++++++++++++++++++++++++++++
1 file changed, 32 insertions(+)
diff --git a/drivers/net/phy/dp83867.c b/drivers/net/phy/dp83867.c
index a3cd5cb11ea0ac108219e05d990b378483b67d7a..092bc68bb9bc6561e2457f596206453dd84e56fc 100644
--- a/drivers/net/phy/dp83867.c
+++ b/drivers/net/phy/dp83867.c
@@ -16,6 +16,7 @@
#include <linux/etherdevice.h>
#include <linux/bitfield.h>
#include <linux/nvmem-consumer.h>
+#include <linux/regulator/consumer.h>
#include <dt-bindings/net/ti-dp83867.h>
@@ -730,11 +731,42 @@ static int dp83867_resume(struct phy_device *phydev)
return 0;
}
+static int dp83867_power_on(struct phy_device *phydev)
+{
+ static const char * const supply_names[] = {
+ "vdda-2p5", "vdd-1p0", "vdda-1p8", "vddio",
+ };
+ struct device *dev = &phydev->mdio.dev;
+ bool supplies_enabled = false;
+ int i, ret;
+
+ for (i = 0; i < ARRAY_SIZE(supply_names); i++) {
+ ret = devm_regulator_get_enable_optional(dev, supply_names[i]);
+ if (ret == -ENODEV)
+ continue;
+ if (ret)
+ return dev_err_probe(dev, ret,
+ "failed to enable %s supply\n",
+ supply_names[i]);
+ supplies_enabled = true;
+ }
+
+ /* Datasheet section 6.6 suggests a 200ms post power-up stabilization */
+ if (supplies_enabled)
+ fsleep(200000);
+
+ return 0;
+}
+
static int dp83867_probe(struct phy_device *phydev)
{
struct dp83867_private *dp83867;
int ret;
+ ret = dp83867_power_on(phydev);
+ if (ret)
+ return ret;
+
dp83867 = devm_kzalloc(&phydev->mdio.dev, sizeof(*dp83867),
GFP_KERNEL);
if (!dp83867)
--
2.34.1
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH net-next v3 2/9] dt-bindings: net: qcom,ethqos: add qcom,shikra-ethqos compatible
2026-10-17 9:45 [PATCH net-next v3 0/9] net: stmmac: qcom-ethqos: add Shikra EMAC support Mohd Ayaan Anwar
2026-10-17 9:45 ` [PATCH net-next v3 1/9] net: phy: dp83867: add regulator supply management Mohd Ayaan Anwar
@ 2026-10-17 9:45 ` Mohd Ayaan Anwar
2026-10-17 9:45 ` [PATCH net-next v3 3/9] net: stmmac: qcom-ethqos: convert ethqos_rgmii_macro_init() to void Mohd Ayaan Anwar
` (7 subsequent siblings)
9 siblings, 0 replies; 13+ messages in thread
From: Mohd Ayaan Anwar @ 2026-10-17 9:45 UTC (permalink / raw)
To: Andrew Lunn, David S. Miller, Eric Dumazet, Jakub Kicinski,
Paolo Abeni, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
Andrew Davis, Andrew Lunn, Heiner Kallweit, Russell King,
Richard Cochran, Bjorn Andersson, Konrad Dybcio, Alexandre Torgue,
Giuseppe Cavallaro, Jose Abreu, Maxime Chevallier,
Maxime Coquelin, Lorenzo Bianconi
Cc: netdev, devicetree, linux-kernel, linux-arm-msm, linux-stm32,
linux-arm-kernel, Mohd Ayaan Anwar
Shikra's EMAC requires two additional clocks for NOC interconnect
access (axi-noc, pcie-tile-axi-noc) beyond the standard four, and an
OPP table with required-opps to vote VDD_CX to SVS when the NOC clocks
are enabled.
Add qcom,shikra-ethqos to the compatible enum and use an if/else
block to constrain Shikra to exactly six clocks and require
operating-points-v2, while leaving existing compatibles unchanged.
Add the relevant compatible to the binding document for snps,dwmac as
well.
Signed-off-by: Mohd Ayaan Anwar <mohd.anwar@oss.qualcomm.com>
---
.../devicetree/bindings/net/qcom,ethqos.yaml | 55 ++++++++++++++++++++--
.../devicetree/bindings/net/snps,dwmac.yaml | 2 +
2 files changed, 53 insertions(+), 4 deletions(-)
diff --git a/Documentation/devicetree/bindings/net/qcom,ethqos.yaml b/Documentation/devicetree/bindings/net/qcom,ethqos.yaml
index 423959cb928d945aa3e758a3c803d12bd61ec42b..1167f11adbf30c234186a415004a75a774aa4492 100644
--- a/Documentation/devicetree/bindings/net/qcom,ethqos.yaml
+++ b/Documentation/devicetree/bindings/net/qcom,ethqos.yaml
@@ -14,9 +14,6 @@ description:
dwmmac based Qualcomm ethernet devices which support Gigabit
ethernet (version v2.3.0 and onwards).
-allOf:
- - $ref: snps,dwmac.yaml#
-
properties:
compatible:
oneOf:
@@ -32,6 +29,7 @@ properties:
- qcom,qcs404-ethqos
- qcom,sa8775p-ethqos
- qcom,sc8280xp-ethqos
+ - qcom,shikra-ethqos
- qcom,sm8150-ethqos
reg:
@@ -57,9 +55,11 @@ properties:
- const: sfty
clocks:
- maxItems: 4
+ minItems: 4
+ maxItems: 6
clock-names:
+ minItems: 4
items:
- const: stmmaceth
- const: pclk
@@ -67,6 +67,8 @@ properties:
- enum:
- rgmii
- phyaux
+ - const: axi-noc
+ - const: pcie-tile-axi-noc
iommus:
maxItems: 1
@@ -81,6 +83,11 @@ properties:
- const: cpu-mac
- const: mac-mem
+ operating-points-v2: true
+
+ opp-table:
+ type: object
+
phys: true
phy-names:
@@ -92,6 +99,46 @@ required:
- clock-names
- reg-names
+allOf:
+ - $ref: snps,dwmac.yaml#
+
+ - if:
+ properties:
+ compatible:
+ contains:
+ const: qcom,shikra-ethqos
+ then:
+ properties:
+ clocks:
+ minItems: 6
+ clock-names:
+ items:
+ - const: stmmaceth
+ - const: pclk
+ - const: ptp_ref
+ - const: rgmii
+ - const: axi-noc
+ - const: pcie-tile-axi-noc
+ operating-points-v2:
+ description: |
+ The OPP table specifies the rates for the NOC access
+ clocks in "stmmaceth", "axi-noc", "pcie-tile-axi-noc"
+ order.
+ required:
+ - operating-points-v2
+ else:
+ properties:
+ clocks:
+ maxItems: 4
+ clock-names:
+ items:
+ - const: stmmaceth
+ - const: pclk
+ - const: ptp_ref
+ - enum:
+ - rgmii
+ - phyaux
+
unevaluatedProperties: false
examples:
diff --git a/Documentation/devicetree/bindings/net/snps,dwmac.yaml b/Documentation/devicetree/bindings/net/snps,dwmac.yaml
index 2218a492817fd3d864e0bc529b83fdcbb4ed023b..20b1da2f1096c94215902834a1ea014fb4ae44b2 100644
--- a/Documentation/devicetree/bindings/net/snps,dwmac.yaml
+++ b/Documentation/devicetree/bindings/net/snps,dwmac.yaml
@@ -75,6 +75,7 @@ properties:
- qcom,qcs404-ethqos
- qcom,sa8775p-ethqos
- qcom,sc8280xp-ethqos
+ - qcom,shikra-ethqos
- qcom,sm8150-ethqos
- renesas,r9a06g032-gmac
- renesas,r9a08g046-gbeth
@@ -585,6 +586,7 @@ allOf:
- qcom,qcs404-ethqos
- qcom,sa8775p-ethqos
- qcom,sc8280xp-ethqos
+ - qcom,shikra-ethqos
- qcom,sm8150-ethqos
- snps,dwmac-4.00
- snps,dwmac-4.10a
--
2.34.1
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH net-next v3 3/9] net: stmmac: qcom-ethqos: convert ethqos_rgmii_macro_init() to void
2026-10-17 9:45 [PATCH net-next v3 0/9] net: stmmac: qcom-ethqos: add Shikra EMAC support Mohd Ayaan Anwar
2026-10-17 9:45 ` [PATCH net-next v3 1/9] net: phy: dp83867: add regulator supply management Mohd Ayaan Anwar
2026-10-17 9:45 ` [PATCH net-next v3 2/9] dt-bindings: net: qcom,ethqos: add qcom,shikra-ethqos compatible Mohd Ayaan Anwar
@ 2026-10-17 9:45 ` Mohd Ayaan Anwar
2026-10-17 9:45 ` [PATCH net-next v3 4/9] net: stmmac: qcom-ethqos: fix RGMII_ID mode to use DLL bypass Mohd Ayaan Anwar
` (6 subsequent siblings)
9 siblings, 0 replies; 13+ messages in thread
From: Mohd Ayaan Anwar @ 2026-10-17 9:45 UTC (permalink / raw)
To: Andrew Lunn, David S. Miller, Eric Dumazet, Jakub Kicinski,
Paolo Abeni, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
Andrew Davis, Andrew Lunn, Heiner Kallweit, Russell King,
Richard Cochran, Bjorn Andersson, Konrad Dybcio, Alexandre Torgue,
Giuseppe Cavallaro, Jose Abreu, Maxime Chevallier,
Maxime Coquelin, Lorenzo Bianconi
Cc: netdev, devicetree, linux-kernel, linux-arm-msm, linux-stm32,
linux-arm-kernel, Mohd Ayaan Anwar
The return value is never checked by its sole caller and the speed
validation duplicates a check higher up the call stack. Convert to
void and remove the dead code.
Reviewed-by: Maxime Chevallier <maxime.chevallier@bootlin.com>
Acked-by: Lorenzo Bianconi <lorenzo.bianconi@oss.qualcomm.com>
Signed-off-by: Mohd Ayaan Anwar <mohd.anwar@oss.qualcomm.com>
---
drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c | 10 +---------
1 file changed, 1 insertion(+), 9 deletions(-)
diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c
index ac7d6d3e205a1ab5b391def879d6f1033a0961b6..44270c25d874f72e7f971757fec659d36468c315 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c
@@ -371,9 +371,8 @@ static int ethqos_dll_configure(struct qcom_ethqos *ethqos)
return 0;
}
-static int ethqos_rgmii_macro_init(struct qcom_ethqos *ethqos, int speed)
+static void ethqos_rgmii_macro_init(struct qcom_ethqos *ethqos, int speed)
{
- struct device *dev = ðqos->pdev->dev;
unsigned int prg_rclk_dly, loopback;
unsigned int phase_shift;
@@ -384,11 +383,6 @@ static int ethqos_rgmii_macro_init(struct qcom_ethqos *ethqos, int speed)
/* Select RGMII, write 0 to interface select */
rgmii_clrmask(ethqos, RGMII_CONFIG_INTF_SEL, RGMII_IO_MACRO_CONFIG);
- if (speed != SPEED_1000 && speed != SPEED_100 && speed != SPEED_10) {
- dev_err(dev, "Invalid speed %d\n", speed);
- return -EINVAL;
- }
-
rgmii_setmask(ethqos, RGMII_CONFIG_DDR_MODE, RGMII_IO_MACRO_CONFIG);
if (speed == SPEED_1000) {
@@ -479,8 +473,6 @@ static int ethqos_rgmii_macro_init(struct qcom_ethqos *ethqos, int speed)
rgmii_updatel(ethqos, RGMII_CONFIG_LOOPBACK_EN, loopback,
RGMII_IO_MACRO_CONFIG);
-
- return 0;
}
static void ethqos_fix_mac_speed_rgmii(void *bsp_priv,
--
2.34.1
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH net-next v3 4/9] net: stmmac: qcom-ethqos: fix RGMII_ID mode to use DLL bypass
2026-10-17 9:45 [PATCH net-next v3 0/9] net: stmmac: qcom-ethqos: add Shikra EMAC support Mohd Ayaan Anwar
` (2 preceding siblings ...)
2026-10-17 9:45 ` [PATCH net-next v3 3/9] net: stmmac: qcom-ethqos: convert ethqos_rgmii_macro_init() to void Mohd Ayaan Anwar
@ 2026-10-17 9:45 ` Mohd Ayaan Anwar
2026-10-17 14:00 ` Andrew Lunn
2026-10-17 9:45 ` [PATCH net-next v3 5/9] net: stmmac: qcom-ethqos: warn about legacy RGMII PHY modes Mohd Ayaan Anwar
` (5 subsequent siblings)
9 siblings, 1 reply; 13+ messages in thread
From: Mohd Ayaan Anwar @ 2026-10-17 9:45 UTC (permalink / raw)
To: Andrew Lunn, David S. Miller, Eric Dumazet, Jakub Kicinski,
Paolo Abeni, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
Andrew Davis, Andrew Lunn, Heiner Kallweit, Russell King,
Richard Cochran, Bjorn Andersson, Konrad Dybcio, Alexandre Torgue,
Giuseppe Cavallaro, Jose Abreu, Maxime Chevallier,
Maxime Coquelin, Lorenzo Bianconi
Cc: netdev, devicetree, linux-kernel, linux-arm-msm, linux-stm32,
linux-arm-kernel, Mohd Ayaan Anwar
When "rgmii-id" is selected the PHY supplies both TX and RX delays, so
the MAC must not add its own. The driver currently falls through to the
generic DLL initialisation path which programs it to add a delay.
Power down the DLL and set DDR bypass mode for RGMII_ID, then program
the IO_MACRO via a new ethqos_rgmii_id_macro_init() helper. Also fix
ethqos_set_clk_tx_rate() to not double the clock rate in bypass mode at
100M/10M, and remove RGMII_ID from the phase-shift suppression in
ethqos_rgmii_macro_init() since RGMII_ID no longer reaches that path.
Signed-off-by: Mohd Ayaan Anwar <mohd.anwar@oss.qualcomm.com>
---
.../ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c | 67 +++++++++++++++++++++-
1 file changed, 64 insertions(+), 3 deletions(-)
diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c
index 44270c25d874f72e7f971757fec659d36468c315..53fb9de4d92c7f1b3c51c183064024f06150444d 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c
@@ -67,6 +67,9 @@
/* SDC4_STATUS bits */
#define SDC4_STATUS_DLL_LOCK BIT(7)
+/* SDCC_USR_CTL bits */
+#define SDCC_USR_CTL_DDR_BYPASS BIT(30)
+
/* RGMII_IO_MACRO_CONFIG2 fields */
#define RGMII_CONFIG2_RSVD_CONFIG15 GENMASK(31, 17)
#define RGMII_CONFIG2_RGMII_CLK_SEL_CFG BIT(16)
@@ -183,7 +186,15 @@ static int ethqos_set_clk_tx_rate(void *bsp_priv, struct clk *clk_tx_i,
if (rate < 0)
return rate;
- return clk_set_rate(ethqos->link_clk, rate * 2);
+ /* Clock Rate Requirements:
+ * MAC added delay: 250/50/5 Mhz for 1G/100M/10M
+ * No MAC delay (DLL bypass): 250/25/2.5 Mhz for 1G/100M/10M
+ */
+ if (ethqos->phy_mode != PHY_INTERFACE_MODE_RGMII_ID ||
+ speed == SPEED_1000)
+ rate *= 2;
+
+ return clk_set_rate(ethqos->link_clk, rate);
}
static void
@@ -405,8 +416,7 @@ static void ethqos_rgmii_macro_init(struct qcom_ethqos *ethqos, int speed)
RGMII_IO_MACRO_CONFIG2);
/* Determine if the PHY adds a 2 ns TX delay or the MAC handles it */
- if (ethqos->phy_mode == PHY_INTERFACE_MODE_RGMII_ID ||
- ethqos->phy_mode == PHY_INTERFACE_MODE_RGMII_TXID)
+ if (ethqos->phy_mode == PHY_INTERFACE_MODE_RGMII_TXID)
phase_shift = 0;
else
phase_shift = RGMII_CONFIG2_TX_CLK_PHASE_SHIFT_EN;
@@ -475,6 +485,42 @@ static void ethqos_rgmii_macro_init(struct qcom_ethqos *ethqos, int speed)
RGMII_IO_MACRO_CONFIG);
}
+static void ethqos_rgmii_id_macro_init(struct qcom_ethqos *ethqos, int speed)
+{
+ rgmii_clrmask(ethqos, RGMII_CONFIG2_TX_TO_RX_LOOPBACK_EN,
+ RGMII_IO_MACRO_CONFIG2);
+
+ if (speed == SPEED_1000)
+ rgmii_setmask(ethqos, RGMII_CONFIG_DDR_MODE, RGMII_IO_MACRO_CONFIG);
+ else
+ rgmii_clrmask(ethqos, RGMII_CONFIG_DDR_MODE, RGMII_IO_MACRO_CONFIG);
+ rgmii_setmask(ethqos, RGMII_CONFIG_BYPASS_TX_ID_EN, RGMII_IO_MACRO_CONFIG);
+ rgmii_clrmask(ethqos, RGMII_CONFIG_POS_NEG_DATA_SEL, RGMII_IO_MACRO_CONFIG);
+ rgmii_clrmask(ethqos, RGMII_CONFIG_PROG_SWAP, RGMII_IO_MACRO_CONFIG);
+
+ if (ethqos->has_emac_ge_3)
+ rgmii_clrmask(ethqos, RGMII_CONFIG2_DATA_DIVIDE_CLK_SEL,
+ RGMII_IO_MACRO_CONFIG2);
+ else
+ rgmii_setmask(ethqos, RGMII_CONFIG2_DATA_DIVIDE_CLK_SEL,
+ RGMII_IO_MACRO_CONFIG2);
+
+ rgmii_clrmask(ethqos, RGMII_CONFIG2_TX_CLK_PHASE_SHIFT_EN,
+ RGMII_IO_MACRO_CONFIG2);
+
+ if (speed == SPEED_1000)
+ rgmii_clrmask(ethqos, RGMII_CONFIG2_RSVD_CONFIG15, RGMII_IO_MACRO_CONFIG2);
+ else
+ rgmii_setmask(ethqos, RGMII_CONFIG2_RSVD_CONFIG15, RGMII_IO_MACRO_CONFIG2);
+
+ if (ethqos->rgmii_config_loopback_en)
+ rgmii_setmask(ethqos, RGMII_CONFIG_LOOPBACK_EN, RGMII_IO_MACRO_CONFIG);
+ else
+ rgmii_clrmask(ethqos, RGMII_CONFIG_LOOPBACK_EN, RGMII_IO_MACRO_CONFIG);
+
+ rgmii_setmask(ethqos, RGMII_CONFIG2_RX_PROG_SWAP, RGMII_IO_MACRO_CONFIG2);
+}
+
static void ethqos_fix_mac_speed_rgmii(void *bsp_priv,
phy_interface_t interface, int speed,
unsigned int mode)
@@ -493,6 +539,21 @@ static void ethqos_fix_mac_speed_rgmii(void *bsp_priv,
ethqos_set_func_clk_en(ethqos);
+ /* For rgmii-id mode, the PHY should add the required delays.
+ * Therefore, power down the DLL and program it in bypass mode.
+ * Program the IO_MACRO as per the settings recommended by the
+ * programming guide for bypass mode. This will ensure that the
+ * MAC core doesn't add any additional delays.
+ */
+ if (ethqos->phy_mode == PHY_INTERFACE_MODE_RGMII_ID) {
+ rgmii_setmask(ethqos, SDCC_DLL_CONFIG_PDN, SDCC_HC_REG_DLL_CONFIG);
+ rgmii_setmask(ethqos, SDCC_USR_CTL_DDR_BYPASS, SDCC_USR_CTL);
+
+ ethqos_rgmii_id_macro_init(ethqos, speed);
+
+ return;
+ }
+
/* Initialize the DLL first */
/* Set DLL_RST */
--
2.34.1
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH net-next v3 5/9] net: stmmac: qcom-ethqos: warn about legacy RGMII PHY modes
2026-10-17 9:45 [PATCH net-next v3 0/9] net: stmmac: qcom-ethqos: add Shikra EMAC support Mohd Ayaan Anwar
` (3 preceding siblings ...)
2026-10-17 9:45 ` [PATCH net-next v3 4/9] net: stmmac: qcom-ethqos: fix RGMII_ID mode to use DLL bypass Mohd Ayaan Anwar
@ 2026-10-17 9:45 ` Mohd Ayaan Anwar
2026-10-17 9:45 ` [PATCH net-next v3 6/9] net: stmmac: qcom-ethqos: set initial RGMII link clock to lowest speed Mohd Ayaan Anwar
` (4 subsequent siblings)
9 siblings, 0 replies; 13+ messages in thread
From: Mohd Ayaan Anwar @ 2026-10-17 9:45 UTC (permalink / raw)
To: Andrew Lunn, David S. Miller, Eric Dumazet, Jakub Kicinski,
Paolo Abeni, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
Andrew Davis, Andrew Lunn, Heiner Kallweit, Russell King,
Richard Cochran, Bjorn Andersson, Konrad Dybcio, Alexandre Torgue,
Giuseppe Cavallaro, Jose Abreu, Maxime Chevallier,
Maxime Coquelin, Lorenzo Bianconi
Cc: netdev, devicetree, linux-kernel, linux-arm-msm, linux-stm32,
linux-arm-kernel, Mohd Ayaan Anwar
The qcom-ethqos driver is moving towards using "rgmii-id" together
with PHY-provided delays. However, existing DTBs use "rgmii" and
"rgmii-txid" and must remain supported for backwards compatibility.
Warn when either of these legacy PHY modes is used to encourage users
to migrate to updated DTBs using "rgmii-id".
Signed-off-by: Mohd Ayaan Anwar <mohd.anwar@oss.qualcomm.com>
---
drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c
index 53fb9de4d92c7f1b3c51c183064024f06150444d..a92bf4a6a2dbd987893bd4a3890df770bb7a7e56 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c
@@ -764,9 +764,11 @@ static int qcom_ethqos_probe(struct platform_device *pdev)
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:
+ dev_warn(dev, "legacy RGMII phy-mode detected; consider upgrading to a newer DTB\n");
+ fallthrough;
+ case PHY_INTERFACE_MODE_RGMII_ID:
plat_dat->fix_mac_speed = ethqos_fix_mac_speed_rgmii;
break;
case PHY_INTERFACE_MODE_2500BASEX:
--
2.34.1
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH net-next v3 6/9] net: stmmac: qcom-ethqos: set initial RGMII link clock to lowest speed
2026-10-17 9:45 [PATCH net-next v3 0/9] net: stmmac: qcom-ethqos: add Shikra EMAC support Mohd Ayaan Anwar
` (4 preceding siblings ...)
2026-10-17 9:45 ` [PATCH net-next v3 5/9] net: stmmac: qcom-ethqos: warn about legacy RGMII PHY modes Mohd Ayaan Anwar
@ 2026-10-17 9:45 ` Mohd Ayaan Anwar
2026-10-17 9:45 ` [PATCH net-next v3 7/9] net: stmmac: qcom-ethqos: share common GMAC4 address table Mohd Ayaan Anwar
` (3 subsequent siblings)
9 siblings, 0 replies; 13+ messages in thread
From: Mohd Ayaan Anwar @ 2026-10-17 9:45 UTC (permalink / raw)
To: Andrew Lunn, David S. Miller, Eric Dumazet, Jakub Kicinski,
Paolo Abeni, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
Andrew Davis, Andrew Lunn, Heiner Kallweit, Russell King,
Richard Cochran, Bjorn Andersson, Konrad Dybcio, Alexandre Torgue,
Giuseppe Cavallaro, Jose Abreu, Maxime Chevallier,
Maxime Coquelin, Lorenzo Bianconi
Cc: netdev, devicetree, linux-kernel, linux-arm-msm, linux-stm32,
linux-arm-kernel, Mohd Ayaan Anwar
On probe the RGMII link clock is initialised at SPEED_1000, which
translates to a 250 MHz source clock even when no PHY link is present,
drawing unnecessary power.
Initialise at SPEED_10 instead; set_clk_tx_rate updates the rate once
a link is established.
Reviewed-by: Maxime Chevallier <maxime.chevallier@bootlin.com>
Signed-off-by: Mohd Ayaan Anwar <mohd.anwar@oss.qualcomm.com>
---
v3: changed fix_mac_speed to set_clk_tx_rate in the commit message since
that's the function actually changing the RGMII link clock rate.
---
drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c
index a92bf4a6a2dbd987893bd4a3890df770bb7a7e56..2471871562ed9915398614d5c88d1c6673829db8 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c
@@ -814,7 +814,7 @@ static int qcom_ethqos_probe(struct platform_device *pdev)
"Failed to get serdes phy\n");
ethqos_set_clk_tx_rate(ethqos, NULL, plat_dat->phy_interface,
- SPEED_1000);
+ SPEED_10);
qcom_ethqos_set_sgmii_loopback(ethqos, true);
ethqos_set_func_clk_en(ethqos);
--
2.34.1
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH net-next v3 7/9] net: stmmac: qcom-ethqos: share common GMAC4 address table
2026-10-17 9:45 [PATCH net-next v3 0/9] net: stmmac: qcom-ethqos: add Shikra EMAC support Mohd Ayaan Anwar
` (5 preceding siblings ...)
2026-10-17 9:45 ` [PATCH net-next v3 6/9] net: stmmac: qcom-ethqos: set initial RGMII link clock to lowest speed Mohd Ayaan Anwar
@ 2026-10-17 9:45 ` Mohd Ayaan Anwar
2026-10-17 9:45 ` [PATCH net-next v3 8/9] net: stmmac: qcom-ethqos: add per-platform NOC clock voting Mohd Ayaan Anwar
` (2 subsequent siblings)
9 siblings, 0 replies; 13+ messages in thread
From: Mohd Ayaan Anwar @ 2026-10-17 9:45 UTC (permalink / raw)
To: Andrew Lunn, David S. Miller, Eric Dumazet, Jakub Kicinski,
Paolo Abeni, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
Andrew Davis, Andrew Lunn, Heiner Kallweit, Russell King,
Richard Cochran, Bjorn Andersson, Konrad Dybcio, Alexandre Torgue,
Giuseppe Cavallaro, Jose Abreu, Maxime Chevallier,
Maxime Coquelin, Lorenzo Bianconi
Cc: netdev, devicetree, linux-kernel, linux-arm-msm, linux-stm32,
linux-arm-kernel, Mohd Ayaan Anwar
Several ETHQOS versions use identical GMAC4 DMA and MTL address offsets.
Store the descriptor once and let per-compatible data reference it.
Use its presence, rather than has_emac_ge_3, when passing it to stmmac
core. This keeps address-table ownership independent of the feature
flag.
No functional change intended.
Suggested-by: Lorenzo Bianconi <lorenzo.bianconi@oss.qualcomm.com>
Signed-off-by: Mohd Ayaan Anwar <mohd.anwar@oss.qualcomm.com>
---
.../ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c | 57 +++++++++-------------
1 file changed, 22 insertions(+), 35 deletions(-)
diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c
index 2471871562ed9915398614d5c88d1c6673829db8..370eb05caabc00a20d887ac88c1ffa4473bc4021 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c
@@ -96,7 +96,7 @@ struct ethqos_emac_driver_data {
bool has_emac_ge_3;
u8 dma_addr_width;
const char *link_clk_name;
- struct dwmac4_addrs dwmac4_addrs;
+ const struct dwmac4_addrs *dwmac4_addrs;
bool needs_sgmii_loopback;
};
@@ -247,6 +247,23 @@ static const struct ethqos_emac_driver_data emac_v2_1_0_data = {
.has_emac_ge_3 = false,
};
+static const struct dwmac4_addrs ethqos_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,
+};
+
static const struct ethqos_emac_por emac_v3_0_0_por[] = {
{ .offset = RGMII_IO_MACRO_CONFIG, .value = 0x40c01343 },
{ .offset = SDCC_HC_REG_DLL_CONFIG, .value = 0x2004642c },
@@ -261,22 +278,7 @@ static const struct ethqos_emac_driver_data emac_v3_0_0_data = {
.num_rgmii_por = ARRAY_SIZE(emac_v3_0_0_por),
.rgmii_config_loopback_en = false,
.has_emac_ge_3 = true,
- .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,
- },
+ .dwmac4_addrs = ðqos_dwmac4_addrs,
};
static const struct ethqos_emac_por emac_v4_0_0_por[] = {
@@ -296,22 +298,7 @@ static const struct ethqos_emac_driver_data emac_v4_0_0_data = {
.link_clk_name = "phyaux",
.needs_sgmii_loopback = true,
.dma_addr_width = 36,
- .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,
- },
+ .dwmac4_addrs = ðqos_dwmac4_addrs,
};
static int ethqos_dll_configure(struct qcom_ethqos *ethqos)
@@ -830,8 +817,8 @@ 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)
- plat_dat->dwmac4_addrs = &data->dwmac4_addrs;
+ if (data->dwmac4_addrs)
+ plat_dat->dwmac4_addrs = data->dwmac4_addrs;
plat_dat->pmt = true;
if (of_property_read_bool(np, "snps,tso"))
plat_dat->flags |= STMMAC_FLAG_TSO_EN;
--
2.34.1
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH net-next v3 8/9] net: stmmac: qcom-ethqos: add per-platform NOC clock voting
2026-10-17 9:45 [PATCH net-next v3 0/9] net: stmmac: qcom-ethqos: add Shikra EMAC support Mohd Ayaan Anwar
` (6 preceding siblings ...)
2026-10-17 9:45 ` [PATCH net-next v3 7/9] net: stmmac: qcom-ethqos: share common GMAC4 address table Mohd Ayaan Anwar
@ 2026-10-17 9:45 ` Mohd Ayaan Anwar
2026-10-17 9:45 ` [PATCH net-next v3 9/9] net: stmmac: qcom-ethqos: add Shikra EMAC support Mohd Ayaan Anwar
2026-10-17 9:53 ` [PATCH net-next v3 0/9] " Mohd Ayaan Anwar
9 siblings, 0 replies; 13+ messages in thread
From: Mohd Ayaan Anwar @ 2026-10-17 9:45 UTC (permalink / raw)
To: Andrew Lunn, David S. Miller, Eric Dumazet, Jakub Kicinski,
Paolo Abeni, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
Andrew Davis, Andrew Lunn, Heiner Kallweit, Russell King,
Richard Cochran, Bjorn Andersson, Konrad Dybcio, Alexandre Torgue,
Giuseppe Cavallaro, Jose Abreu, Maxime Chevallier,
Maxime Coquelin, Lorenzo Bianconi
Cc: netdev, devicetree, linux-kernel, linux-arm-msm, linux-stm32,
linux-arm-kernel, Mohd Ayaan Anwar
Some SoCs gate the EMAC DMA path behind dedicated AXI clocks. Add
per-platform clock-name lists and configure them as a single
multi-clock OPP. The OPP core programs every clock rate and propagates
the required power state.
Select PM_OPP because DWMAC_QCOM_ETHQOS calls PM OPP APIs for
compatibles that describe AXI OPP clocks.
No functional change for existing compatibles. This will help us when
we add support for Shikra.
Signed-off-by: Mohd Ayaan Anwar <mohd.anwar@oss.qualcomm.com>
---
drivers/net/ethernet/stmicro/stmmac/Kconfig | 1 +
.../ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c | 104 +++++++++++++++++++++
2 files changed, 105 insertions(+)
diff --git a/drivers/net/ethernet/stmicro/stmmac/Kconfig b/drivers/net/ethernet/stmicro/stmmac/Kconfig
index ab3c4cf964239d724945651f7f7b5448118ad5f3..c86fbe2680ad46b6d444c1469b90872dff9b26b4 100644
--- a/drivers/net/ethernet/stmicro/stmmac/Kconfig
+++ b/drivers/net/ethernet/stmicro/stmmac/Kconfig
@@ -146,6 +146,7 @@ config DWMAC_QCOM_ETHQOS
tristate "Qualcomm ETHQOS support"
default ARCH_QCOM
depends on OF && (ARCH_QCOM || COMPILE_TEST)
+ select PM_OPP
help
Support for the Qualcomm ETHQOS core.
diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c
index 370eb05caabc00a20d887ac88c1ffa4473bc4021..9c602755532e141f4b822721686b1481b29b7d4c 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c
@@ -7,6 +7,7 @@
#include <linux/platform_device.h>
#include <linux/phy.h>
#include <linux/phy/phy.h>
+#include <linux/pm_opp.h>
#include "stmmac.h"
#include "stmmac_platform.h"
@@ -98,6 +99,8 @@ struct ethqos_emac_driver_data {
const char *link_clk_name;
const struct dwmac4_addrs *dwmac4_addrs;
bool needs_sgmii_loopback;
+ const char * const *noc_clk_names;
+ unsigned int num_noc_clks;
};
struct qcom_ethqos {
@@ -112,6 +115,9 @@ struct qcom_ethqos {
bool rgmii_config_loopback_en;
bool has_emac_ge_3;
bool needs_sgmii_loopback;
+
+ struct clk_bulk_data *noc_clks;
+ unsigned int num_noc_clks;
};
static u32 rgmii_readl(struct qcom_ethqos *ethqos, unsigned int offset)
@@ -673,18 +679,61 @@ static int ethqos_mac_finish_serdes(struct net_device *ndev, void *priv,
return ret;
}
+static int qcom_ethqos_set_opp(struct qcom_ethqos *ethqos)
+{
+ struct device *dev = ðqos->pdev->dev;
+ unsigned long freq = ULONG_MAX;
+ struct dev_pm_opp *opp;
+ int ret;
+
+ opp = dev_pm_opp_find_freq_floor_indexed(dev, &freq, 0);
+ if (IS_ERR(opp)) {
+ ret = PTR_ERR(opp);
+ dev_err(dev, "Failed to find AXI NOC OPP: %d\n", ret);
+ return ret;
+ }
+
+ ret = dev_pm_opp_set_opp(dev, opp);
+ dev_pm_opp_put(opp);
+
+ return ret;
+}
+
static int ethqos_clks_config(void *priv, bool enabled)
{
struct qcom_ethqos *ethqos = priv;
int ret = 0;
if (enabled) {
+ if (ethqos->num_noc_clks) {
+ ret = qcom_ethqos_set_opp(ethqos);
+ if (ret) {
+ dev_err(ðqos->pdev->dev,
+ "NOC OPP set failed: %d\n", ret);
+ return ret;
+ }
+ }
+
ret = clk_prepare_enable(ethqos->link_clk);
if (ret) {
dev_err(ðqos->pdev->dev, "link_clk enable failed\n");
+ if (ethqos->num_noc_clks)
+ dev_pm_opp_set_rate(ðqos->pdev->dev, 0);
return ret;
}
+ if (ethqos->num_noc_clks) {
+ ret = clk_bulk_prepare_enable(ethqos->num_noc_clks,
+ ethqos->noc_clks);
+ if (ret) {
+ dev_err(ðqos->pdev->dev,
+ "NOC clocks enable failed: %d\n", ret);
+ clk_disable_unprepare(ethqos->link_clk);
+ dev_pm_opp_set_rate(ðqos->pdev->dev, 0);
+ return ret;
+ }
+ }
+
/* Enable functional clock to prevent DMA reset to timeout due
* to lacking PHY clock after the hardware block has been power
* cycled. The actual configuration will be adjusted once
@@ -693,7 +742,12 @@ static int ethqos_clks_config(void *priv, bool enabled)
qcom_ethqos_set_sgmii_loopback(ethqos, true);
ethqos_set_func_clk_en(ethqos);
} else {
+ if (ethqos->num_noc_clks)
+ clk_bulk_disable_unprepare(ethqos->num_noc_clks,
+ ethqos->noc_clks);
clk_disable_unprepare(ethqos->link_clk);
+ if (ethqos->num_noc_clks)
+ dev_pm_opp_set_rate(ðqos->pdev->dev, 0);
}
return ret;
@@ -721,6 +775,52 @@ 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 void qcom_ethqos_noc_opp_cleanup(void *dev)
+{
+ dev_pm_opp_set_rate(dev, 0);
+}
+
+/* Some SoCs gate NOC access behind dedicated clocks. Acquire them here
+ * and set up an OPP table to vote for the required rate and power.
+ */
+static int qcom_ethqos_init_noc_clks(struct qcom_ethqos *ethqos,
+ const struct ethqos_emac_driver_data *data)
+{
+ struct dev_pm_opp_config config = {
+ .clk_names = data->noc_clk_names,
+ .config_clks = dev_pm_opp_config_clks_simple,
+ };
+ struct device *dev = ðqos->pdev->dev;
+ unsigned int i;
+ int ret;
+
+ if (!data->num_noc_clks)
+ return 0;
+
+ ethqos->noc_clks = devm_kcalloc(dev, data->num_noc_clks,
+ sizeof(*ethqos->noc_clks), GFP_KERNEL);
+ if (!ethqos->noc_clks)
+ return -ENOMEM;
+
+ for (i = 0; i < data->num_noc_clks; i++)
+ ethqos->noc_clks[i].id = data->noc_clk_names[i];
+ ethqos->num_noc_clks = data->num_noc_clks;
+
+ ret = devm_clk_bulk_get(dev, ethqos->num_noc_clks, ethqos->noc_clks);
+ if (ret)
+ return dev_err_probe(dev, ret, "Failed to get NOC clocks\n");
+
+ ret = devm_pm_opp_set_config(dev, &config);
+ if (ret)
+ return dev_err_probe(dev, ret, "Failed to configure OPP clocks\n");
+
+ ret = devm_pm_opp_of_add_table(dev);
+ if (ret)
+ return dev_err_probe(dev, ret, "Failed to add OPP table\n");
+
+ return devm_add_action_or_reset(dev, qcom_ethqos_noc_opp_cleanup, dev);
+}
+
static int qcom_ethqos_probe(struct platform_device *pdev)
{
struct device_node *np = pdev->dev.of_node;
@@ -782,6 +882,10 @@ static int qcom_ethqos_probe(struct platform_device *pdev)
ethqos->has_emac_ge_3 = data->has_emac_ge_3;
ethqos->needs_sgmii_loopback = data->needs_sgmii_loopback;
+ ret = qcom_ethqos_init_noc_clks(ethqos, data);
+ if (ret)
+ return ret;
+
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),
--
2.34.1
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH net-next v3 9/9] net: stmmac: qcom-ethqos: add Shikra EMAC support
2026-10-17 9:45 [PATCH net-next v3 0/9] net: stmmac: qcom-ethqos: add Shikra EMAC support Mohd Ayaan Anwar
` (7 preceding siblings ...)
2026-10-17 9:45 ` [PATCH net-next v3 8/9] net: stmmac: qcom-ethqos: add per-platform NOC clock voting Mohd Ayaan Anwar
@ 2026-10-17 9:45 ` Mohd Ayaan Anwar
2026-10-17 9:53 ` [PATCH net-next v3 0/9] " Mohd Ayaan Anwar
9 siblings, 0 replies; 13+ messages in thread
From: Mohd Ayaan Anwar @ 2026-10-17 9:45 UTC (permalink / raw)
To: Andrew Lunn, David S. Miller, Eric Dumazet, Jakub Kicinski,
Paolo Abeni, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
Andrew Davis, Andrew Lunn, Heiner Kallweit, Russell King,
Richard Cochran, Bjorn Andersson, Konrad Dybcio, Alexandre Torgue,
Giuseppe Cavallaro, Jose Abreu, Maxime Chevallier,
Maxime Coquelin, Lorenzo Bianconi
Cc: netdev, devicetree, linux-kernel, linux-arm-msm, linux-stm32,
linux-arm-kernel, Mohd Ayaan Anwar
Shikra integrates two Qualcomm ETHQOS controllers based on the Synopsys
GMAC IP, similar to previous platforms. Register qcom,shikra-ethqos
backed by a new shikra_data descriptor that enables the three NOC clocks
required for DMA memory access (axi-noc, pcie-tile-axi-noc, stmmaceth),
and the 36-bit DMA address width.
The NOC clock rates are set using an OPP table. As part of the NOC
clock voting logic, the qcom-ethqos glue driver takes a second enable
reference on the "stmmaceth" clock, which is already enabled by the
stmmac core. Since, all three clocks must run at 120 MHzs, managing
"stmmaceth" through the same clk_bulk path keeps the rate-setting and
enable/disable together.
Signed-off-by: Mohd Ayaan Anwar <mohd.anwar@oss.qualcomm.com>
---
drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c | 17 +++++++++++++++++
1 file changed, 17 insertions(+)
diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c
index 9c602755532e141f4b822721686b1481b29b7d4c..a4e083a8517d095e5571b1340f9dd4b5e0c6e81f 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c
@@ -307,6 +307,22 @@ static const struct ethqos_emac_driver_data emac_v4_0_0_data = {
.dwmac4_addrs = ðqos_dwmac4_addrs,
};
+static const char * const shikra_noc_clk_names[] = {
+ "stmmaceth",
+ "axi-noc",
+ "pcie-tile-axi-noc",
+ NULL,
+};
+
+static const struct ethqos_emac_driver_data shikra_data = {
+ .dma_addr_width = 36,
+ .has_emac_ge_3 = true,
+ .noc_clk_names = shikra_noc_clk_names,
+ .num_noc_clks = ARRAY_SIZE(shikra_noc_clk_names) - 1,
+ .rgmii_config_loopback_en = false,
+ .dwmac4_addrs = ðqos_dwmac4_addrs,
+};
+
static int ethqos_dll_configure(struct qcom_ethqos *ethqos)
{
struct device *dev = ðqos->pdev->dev;
@@ -947,6 +963,7 @@ static const struct of_device_id qcom_ethqos_match[] = {
{ .compatible = "qcom,qcs404-ethqos", .data = &emac_v2_3_0_data},
{ .compatible = "qcom,sa8775p-ethqos", .data = &emac_v4_0_0_data},
{ .compatible = "qcom,sc8280xp-ethqos", .data = &emac_v3_0_0_data},
+ { .compatible = "qcom,shikra-ethqos", .data = &shikra_data},
{ .compatible = "qcom,sm8150-ethqos", .data = &emac_v2_1_0_data},
{ }
};
--
2.34.1
^ permalink raw reply related [flat|nested] 13+ messages in thread
* Re: [PATCH net-next v3 0/9] net: stmmac: qcom-ethqos: add Shikra EMAC support
2026-10-17 9:45 [PATCH net-next v3 0/9] net: stmmac: qcom-ethqos: add Shikra EMAC support Mohd Ayaan Anwar
` (8 preceding siblings ...)
2026-10-17 9:45 ` [PATCH net-next v3 9/9] net: stmmac: qcom-ethqos: add Shikra EMAC support Mohd Ayaan Anwar
@ 2026-10-17 9:53 ` Mohd Ayaan Anwar
9 siblings, 0 replies; 13+ messages in thread
From: Mohd Ayaan Anwar @ 2026-10-17 9:53 UTC (permalink / raw)
To: Andrew Lunn, David S. Miller, Eric Dumazet, Jakub Kicinski,
Paolo Abeni, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
Andrew Davis, Andrew Lunn, Heiner Kallweit, Russell King,
Richard Cochran, Bjorn Andersson, Konrad Dybcio, Alexandre Torgue,
Giuseppe Cavallaro, Jose Abreu, Maxime Chevallier,
Maxime Coquelin, Lorenzo Bianconi
Cc: netdev, devicetree, linux-kernel, linux-arm-msm, linux-stm32,
linux-arm-kernel
On Sat, Oct 17, 2026 at 03:15:11PM +0530, Mohd Ayaan Anwar wrote:
>
> net: phy: dp83867: add regulator supply management
> dt-bindings: net: qcom,ethqos: add qcom,shikra-ethqos compatible
> net: stmmac: qcom-ethqos: convert ethqos_rgmii_macro_init() to void
> net: stmmac: qcom-ethqos: fix RGMII_ID mode to use DLL bypass
> net: stmmac: qcom-ethqos: warn about legacy RGMII PHY modes
> net: stmmac: qcom-ethqos: set initial RGMII link clock to lowest speed
> net: stmmac: qcom-ethqos: share common GMAC4 address table
> net: stmmac: qcom-ethqos: add per-platform NOC clock voting
> net: stmmac: qcom-ethqos: add Shikra EMAC support
There should be 10 patches, not 9.
Looks like I messed up some b4 setting and it dropped the bindings
change for dp83867. It is the same as v2:
https://lore.kernel.org/all/20260908-shikra_ethernet-v2-1-bbe3389d0652@oss.qualcomm.com/
I hope I can resend the series after 24 hours.
Ayaan
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH net-next v3 1/9] net: phy: dp83867: add regulator supply management
2026-10-17 9:45 ` [PATCH net-next v3 1/9] net: phy: dp83867: add regulator supply management Mohd Ayaan Anwar
@ 2026-10-17 13:52 ` Andrew Lunn
0 siblings, 0 replies; 13+ messages in thread
From: Andrew Lunn @ 2026-10-17 13:52 UTC (permalink / raw)
To: Mohd Ayaan Anwar
Cc: Andrew Lunn, David S. Miller, Eric Dumazet, Jakub Kicinski,
Paolo Abeni, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
Andrew Davis, Heiner Kallweit, Russell King, Richard Cochran,
Bjorn Andersson, Konrad Dybcio, Alexandre Torgue,
Giuseppe Cavallaro, Jose Abreu, Maxime Chevallier,
Maxime Coquelin, Lorenzo Bianconi, netdev, devicetree,
linux-kernel, linux-arm-msm, linux-stm32, linux-arm-kernel
On Sat, Oct 17, 2026 at 03:15:12PM +0530, Mohd Ayaan Anwar wrote:
> Some embedded board designs use GPIO-controlled regulators for the
> DP83867 power rails. Add dp83867_power_on() to enable all four supply
> domains at probe time. Absent supplies are silently skipped, so boards
> that do not describe them are unaffected.
>
> When any supply is newly enabled the driver sleeps for 200 ms before
> returning. This satisfies the post power-up stabilisation requirement
> mentioned in section 6.6 of the DP83867E/IS/CS datasheet.
>
> Acked-by: Lorenzo Bianconi <lorenzo.bianconi@oss.qualcomm.com>
> Acked-by: Andrew Davis <afd@ti.com>
> Signed-off-by: Mohd Ayaan Anwar <mohd.anwar@oss.qualcomm.com>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Andrew
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH net-next v3 4/9] net: stmmac: qcom-ethqos: fix RGMII_ID mode to use DLL bypass
2026-10-17 9:45 ` [PATCH net-next v3 4/9] net: stmmac: qcom-ethqos: fix RGMII_ID mode to use DLL bypass Mohd Ayaan Anwar
@ 2026-10-17 14:00 ` Andrew Lunn
0 siblings, 0 replies; 13+ messages in thread
From: Andrew Lunn @ 2026-10-17 14:00 UTC (permalink / raw)
To: Mohd Ayaan Anwar
Cc: Andrew Lunn, David S. Miller, Eric Dumazet, Jakub Kicinski,
Paolo Abeni, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
Andrew Davis, Heiner Kallweit, Russell King, Richard Cochran,
Bjorn Andersson, Konrad Dybcio, Alexandre Torgue,
Giuseppe Cavallaro, Jose Abreu, Maxime Chevallier,
Maxime Coquelin, Lorenzo Bianconi, netdev, devicetree,
linux-kernel, linux-arm-msm, linux-stm32, linux-arm-kernel
On Sat, Oct 17, 2026 at 03:15:15PM +0530, Mohd Ayaan Anwar wrote:
> When "rgmii-id" is selected the PHY supplies both TX and RX delays, so
> the MAC must not add its own. The driver currently falls through to the
> generic DLL initialisation path which programs it to add a delay.
>
> Power down the DLL and set DDR bypass mode for RGMII_ID, then program
> the IO_MACRO via a new ethqos_rgmii_id_macro_init() helper. Also fix
> ethqos_set_clk_tx_rate() to not double the clock rate in bypass mode at
> 100M/10M, and remove RGMII_ID from the phase-shift suppression in
> ethqos_rgmii_macro_init() since RGMII_ID no longer reaches that path.
How many different boards have you tested this on? How confident are
you there will not be regressions?
Since you are adding a new compatible "qcom,shikra-ethqos", you could
limit the change in behaviour to just this.
Andrew
^ permalink raw reply [flat|nested] 13+ messages in thread
end of thread, other threads:[~2026-10-17 14:00 UTC | newest]
Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-10-17 9:45 [PATCH net-next v3 0/9] net: stmmac: qcom-ethqos: add Shikra EMAC support Mohd Ayaan Anwar
2026-10-17 9:45 ` [PATCH net-next v3 1/9] net: phy: dp83867: add regulator supply management Mohd Ayaan Anwar
2026-10-17 13:52 ` Andrew Lunn
2026-10-17 9:45 ` [PATCH net-next v3 2/9] dt-bindings: net: qcom,ethqos: add qcom,shikra-ethqos compatible Mohd Ayaan Anwar
2026-10-17 9:45 ` [PATCH net-next v3 3/9] net: stmmac: qcom-ethqos: convert ethqos_rgmii_macro_init() to void Mohd Ayaan Anwar
2026-10-17 9:45 ` [PATCH net-next v3 4/9] net: stmmac: qcom-ethqos: fix RGMII_ID mode to use DLL bypass Mohd Ayaan Anwar
2026-10-17 14:00 ` Andrew Lunn
2026-10-17 9:45 ` [PATCH net-next v3 5/9] net: stmmac: qcom-ethqos: warn about legacy RGMII PHY modes Mohd Ayaan Anwar
2026-10-17 9:45 ` [PATCH net-next v3 6/9] net: stmmac: qcom-ethqos: set initial RGMII link clock to lowest speed Mohd Ayaan Anwar
2026-10-17 9:45 ` [PATCH net-next v3 7/9] net: stmmac: qcom-ethqos: share common GMAC4 address table Mohd Ayaan Anwar
2026-10-17 9:45 ` [PATCH net-next v3 8/9] net: stmmac: qcom-ethqos: add per-platform NOC clock voting Mohd Ayaan Anwar
2026-10-17 9:45 ` [PATCH net-next v3 9/9] net: stmmac: qcom-ethqos: add Shikra EMAC support Mohd Ayaan Anwar
2026-10-17 9:53 ` [PATCH net-next v3 0/9] " Mohd Ayaan Anwar
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox