* [RFC PATCH net-next v3 0/5] net: dsa: qca8k: add a QCA8337 CPU PHY consumer
@ 2026-09-23 21:58 Yongzhao Chen
2026-09-23 21:58 ` [RFC PATCH net-next v3 1/5] net: dsa: pass PHY flags when connecting shared ports Yongzhao Chen
0 siblings, 1 reply; 2+ messages in thread
From: Yongzhao Chen @ 2026-09-23 21:58 UTC (permalink / raw)
To: netdev
Cc: David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
Simon Horman, Jonathan Corbet, Shuah Khan, Randy Dunlap,
Florian Fainelli, Jonas Gorski, Andrew Lunn, Vladimir Oltean,
Woojung Huh, UNGLinuxDriver, Christian Marangi, Heiner Kallweit,
Russell King, linux-doc, linux-kernel, linux-arm-msm,
Ziyang Huang
The qca83xx PHY driver is already in net-next. This series allows
passing PHY flags on DSA shared ports and adds support for a QCA8337
internal CPU PHY. It implements CPU port selection, serializes MAC state
across global MTU updates, and proposes disabling SmartSpeed prior to
CPU PHY resets.
The first patch extends the DSA core interface; the qca8k patches
provide its concrete user. No board-name matching or board-specific DT
properties are introduced.
The minimal topology uses a single CPU link: a conduit PHY connects over
MDI to QCA8337 PHY4 on switch port 5, with each endpoint having its own
phy-handle. A reduced devicetree fixture based on Redmi AX5400 wiring
passed dtc and validation against the complete net-next schema set. This
is a binding fixture rather than a bootable board description. Because
the pinned base tree lacks the IPQ5018 Ethernet MAC driver and RA74
board support, this series has not been boot-tested on RA74 under pure
net-next.
On one RA74 board, diagnostic boot logs showed PHY4 advertising
1000BASE-T full duplex after generic config_aneg() succeeded, but a
later read found the advertisement missing. No intervening write was
found through the instrumented Clause 22 BMCR/CTRL1000 path; other paths
were not excluded. The exact trigger remains unknown. Clearing
SmartSpeed before the initial reset preserved the 1 Gb/s internal link
during the tested boot sequence. Runtime testing did not establish
late-peer causality, a broken pair, or successful fallback to 100 Mb/s.
Two scope questions remain for this RFC:
1. Internal CPU port selection currently falls back to ports 1 through 5
only on QCA8337. Dedicated ports 0 and 6 retain priority on all
models, including mixed CPU port descriptions. AR8327 documentation
describes per-port headers and destination bitmaps, but I have not
established its internal CPU link behavior. Should this fallback
remain limited to QCA8337, or can maintainers confirm the same support
for QCA8327?
2. The proposed SmartSpeed policy applies to QCA8337 internal CPU PHYs.
SmartSpeed is the hardware downshift feature, so disabling it removes
that fallback behavior. Current hardware evidence is limited to PHY4
on a single RA74 board. Is the internal CPU link role sufficient
justification for this policy, or should the quirk be scoped more
narrowly?
Changes since v2:
- Patch 2 uses reg_mutex across the MTU pause, frame-size write, and
state restoration. Variable declarations now follow reverse
Christmas-tree order. This patch precedes topology support so MTU
protection is in place when internal CPU ports become available.
- Patch 3 adds internal CPU port fallback while retaining port 0 and 6
priority, leaving QCA8327 support as an explicit RFC question.
- Patch 4 masks the revision before setting the CPU PHY flag, clarifies
SmartSpeed downshift behavior, and drops the delayed-conduit causal
claim.
- Patch 5 clarifies reset and config_aneg ordering along with hardware
evidence limits, keeping generic config_aneg.
This series depends on the separate net patch "net: dsa: qca8k:
propagate MDIO errors":
https://lore.kernel.org/netdev/20260923215748.1336-1-yongzhao.derek@gmail.com/
Testing:
Fault injection against the actual MDIO/PHY functions and kernel polling
macros covered busy-read errors, timeouts and successful transactions.
The old polling code reproduced false success on read error; the fixed
path blocked SmartSpeed writes and initial/resume resets. Tests with
mocked hardware also covered flag scope, CPU-port selection and
MDIO-to-MTU error handling.
The changed qca8k-8xxx.o built with W=1 for x86_64 and ARM64 under
allyesconfig and allmodconfig, with no compiler diagnostics. Unchanged
qca8k-common.o and MTU locking retain the earlier build and concurrency
test results. Hardware tests used downstream RA74 firmware. This
revision has no full kernel image/modules build, pure net-next RA74 boot
or hardware lockdep run.
Original RFC:
https://lore.kernel.org/netdev/20260919085406.1395-1-yongzhao.derek@gmail.com/
v2:
https://lore.kernel.org/netdev/20260922202653.1153-1-yongzhao.derek@gmail.com/
Base: net-next 8830e65ed46de41f849eefb8ba227d4852c460f6.
Local prerequisite: 3ba847ea54227f704ee3b04f95d4b52d4e22d483.
Yongzhao Chen (4):
net: dsa: pass PHY flags when connecting shared ports
net: dsa: qca8k: serialize CPU MAC pause during MTU changes
net: dsa: qca8k: flag QCA8337 internal CPU PHYs for SmartSpeed
net: phy: qca83xx: disable SmartSpeed before resetting CPU PHYs
Ziyang Huang (1):
net: dsa: qca8k: support QCA8337 internal PHY CPU links
Documentation/networking/dsa/dsa.rst | 2 +
MAINTAINERS | 1 +
drivers/net/dsa/bcm_sf2.c | 4 ++
drivers/net/dsa/microchip/ksz8.c | 4 ++
drivers/net/dsa/qca/qca8k-8xxx.c | 39 +++++++++-----
drivers/net/dsa/qca/qca8k-common.c | 79 ++++++++++++++++++++++------
drivers/net/phy/qcom/qca83xx.c | 32 +++++++++--
include/linux/qca83xx.h | 11 ++++
net/dsa/port.c | 6 ++-
9 files changed, 145 insertions(+), 33 deletions(-)
create mode 100644 include/linux/qca83xx.h
--
2.43.0
^ permalink raw reply [flat|nested] 2+ messages in thread
* [RFC PATCH net-next v3 1/5] net: dsa: pass PHY flags when connecting shared ports
2026-09-23 21:58 [RFC PATCH net-next v3 0/5] net: dsa: qca8k: add a QCA8337 CPU PHY consumer Yongzhao Chen
@ 2026-09-23 21:58 ` Yongzhao Chen
0 siblings, 0 replies; 2+ messages in thread
From: Yongzhao Chen @ 2026-09-23 21:58 UTC (permalink / raw)
To: netdev
Cc: David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
Simon Horman, Jonathan Corbet, Shuah Khan, Randy Dunlap,
Florian Fainelli, Jonas Gorski, Andrew Lunn, Vladimir Oltean,
Woojung Huh, UNGLinuxDriver, Russell King, linux-doc,
linux-kernel, Ziyang Huang
DSA calls get_phy_flags() for user ports, but passes zero when connecting
CPU or DSA port PHYs. Pass the callback result before PHY initialization
for shared ports too. Drivers without the callback still pass zero.
Keep bcm_sf2 and ksz88xx shared-port flags at zero, preserving their
existing behavior. Document the extended callback scope.
This lets qca8k pass revision information and a SmartSpeed quirk to an
internal PHY used as a CPU link. The remaining patches supply that user.
Assisted-by: LLM
Signed-off-by: Yongzhao Chen <yongzhao.derek@gmail.com>
Reviewed-by: Florian Fainelli <florian.fainelli@broadcom.com>
---
Documentation/networking/dsa/dsa.rst | 2 ++
drivers/net/dsa/bcm_sf2.c | 4 ++++
drivers/net/dsa/microchip/ksz8.c | 4 ++++
net/dsa/port.c | 6 +++++-
4 files changed, 15 insertions(+), 1 deletion(-)
diff --git a/Documentation/networking/dsa/dsa.rst b/Documentation/networking/dsa/dsa.rst
index 7edfdd555..647f952e3 100644
--- a/Documentation/networking/dsa/dsa.rst
+++ b/Documentation/networking/dsa/dsa.rst
@@ -668,6 +668,8 @@ PHY devices and link management
on its own (e.g.: coming from switch memory mapped registers), this function
should return a 32-bit bitmask of "flags" that is private between the switch
driver and the Ethernet PHY driver in ``drivers/net/phy/\*``.
+ It is called when connecting PHYs for user, CPU and DSA ports. Drivers
+ should return zero for ports that do not need switch-specific PHY flags.
- ``phy_read``: Function invoked by the DSA user MDIO bus when attempting to read
the switch port MDIO registers. If unavailable, return 0xffff for each read.
diff --git a/drivers/net/dsa/bcm_sf2.c b/drivers/net/dsa/bcm_sf2.c
index 9e5713015..f516fc396 100644
--- a/drivers/net/dsa/bcm_sf2.c
+++ b/drivers/net/dsa/bcm_sf2.c
@@ -709,6 +709,10 @@ static u32 bcm_sf2_sw_get_phy_flags(struct dsa_switch *ds, int port)
{
struct bcm_sf2_priv *priv = bcm_sf2_to_priv(ds);
+ /* Shared ports previously received no PHY flags. */
+ if (!dsa_is_user_port(ds, port))
+ return 0;
+
/* The BCM7xxx PHY driver expects to find the integrated PHY revision
* in bits 15:8 and the patch level in bits 7:0 which is exactly what
* the REG_PHY_REVISION register layout is.
diff --git a/drivers/net/dsa/microchip/ksz8.c b/drivers/net/dsa/microchip/ksz8.c
index d74981320..be8861a7a 100644
--- a/drivers/net/dsa/microchip/ksz8.c
+++ b/drivers/net/dsa/microchip/ksz8.c
@@ -3076,6 +3076,10 @@ static u32 ksz88xx_get_phy_flags(struct dsa_switch *ds, int port)
{
struct ksz_device *dev = ds->priv;
+ /* Shared ports previously received no PHY flags. */
+ if (!dsa_is_user_port(ds, port))
+ return 0;
+
switch (dev->chip_id) {
case KSZ88X3_CHIP_ID:
/* Silicon Errata Sheet (DS80000830A):
diff --git a/net/dsa/port.c b/net/dsa/port.c
index 1f5536c0d..4db7e6f9c 100644
--- a/net/dsa/port.c
+++ b/net/dsa/port.c
@@ -1666,6 +1666,7 @@ static int dsa_shared_port_phylink_register(struct dsa_port *dp)
{
struct dsa_switch *ds = dp->ds;
struct device_node *port_dn = dp->dn;
+ u32 phy_flags = 0;
int err;
dp->pl_config.dev = ds->dev;
@@ -1675,7 +1676,10 @@ static int dsa_shared_port_phylink_register(struct dsa_port *dp)
if (err)
return err;
- err = phylink_of_phy_connect(dp->pl, port_dn, 0);
+ if (ds->ops->get_phy_flags)
+ phy_flags = ds->ops->get_phy_flags(ds, dp->index);
+
+ err = phylink_of_phy_connect(dp->pl, port_dn, phy_flags);
if (err && err != -ENODEV) {
pr_err("could not attach to PHY: %d\n", err);
goto err_phy_connect;
--
2.43.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-09-23 21:59 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-09-23 21:58 [RFC PATCH net-next v3 0/5] net: dsa: qca8k: add a QCA8337 CPU PHY consumer Yongzhao Chen
2026-09-23 21:58 ` [RFC PATCH net-next v3 1/5] net: dsa: pass PHY flags when connecting shared ports Yongzhao Chen
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox