Devicetree
 help / color / mirror / Atom feed
* [net-next v5 0/7] net: dsa: mt7530: support EcoNet EN751221
@ 2026-11-16 18:33 Caleb James DeLisle
  2026-11-16 18:33 ` [net-next v5 1/7] net: dsa: mt7530: get ctrl phy addr using a function Caleb James DeLisle
                   ` (6 more replies)
  0 siblings, 7 replies; 14+ messages in thread
From: Caleb James DeLisle @ 2026-11-16 18:33 UTC (permalink / raw)
  To: netdev
  Cc: andrew, olteanv, davem, edumazet, kuba, pabeni, robh, krzk+dt,
	conor+dt, matthias.bgg, angelogioacchino.delregno, chester.a.unal,
	daniel, linux, arinc.unal, Landen.Chao, dqfext, sean.wang,
	devicetree, linux-kernel, linux-arm-kernel, linux-mediatek,
	naseefkm, b.larsson, Caleb James DeLisle

The EcoNet EN751221 has a unique switch configuration. Every chip made
with an EN751221 die has at least one on-die MT7530 that is MMIO based.
This switch has 3x 10/100 ports and 1x gigabit port.

Some popular chip packages such as the EN7513G and EN7526G have another
MT7530 implemented as a multi-chip-module that connects to port 5 of
the on-die switch and is controlled via the MDIO controller integrated
in the on-die MT7530.

In this configurations, the upstream switch is put into a "passthrough"
mode in which all traffic is forwarded between port 5 and port 6
without altering its DSA tags.

Furthermore, since the DSA core does not call mt753x_setup until all
switches are present, and the downstream switch only becomes available
when the upstream switch has configured its MDIO controller, the MDIO
controller setup on MMIO implementations must be done before
mt753x_setup, or else it will never complete.

Finally, the on-die switch and the MCM switch connect via a TRGMII link
which requires calibration. In order to calibrate this, PLL adjustment
must be possible on the on-die switch, necessitating changes to the
core_(set|clear|write|rmw) functions to support MMIO implementations.

Solve all of these issues, add the TRGMII calibration, and add support
for both switches.

Since this patchset will probably be subject to some discussion, please
consider accepting any patches that are non-controversial since it will
make future re-submissions easier.

Thanks!

Changes since v4:

Updated to net-next 2026-11-11 and applied multiple changes per Sashiko
notes:

Patch 2:
* Added note that in passthrough configurations, the fully-featured
(downstream) switch must use DSA index 0.
Following Sashiko note: http://lore.kernel.org/netdev/2928da24-a379-4d1e-baae-a5ae68acdf46@cjdns.fr

Patch 3:
* add mt753x_upstream_port_index() which is consistent with change of
conduit.
* skip mt753x_trap_frames() if passthrough
* mt753x_check_passthrough() now returns true when there is 1 CPU port,
1 DSA port and no other ports, and does not return error in any
configuration.
Following Sashiko notes: http://lore.kernel.org/sashiko-reviews/3624a201-be82-423f-ac96-7ab530e7918e@cjdns.fr

Patch 5:
* Early call to mt7530_setup_mdio() now conditioned on "mdio" child DT
node.
* mt7530_setup_irq() now called from within mt7530_setup_mdio() so that
PHYs requiring interrupts from switch can start.
* MT7530_TOP_SIG_CTRL set for IRQ moved to mt7530_setup() so it runs
post-reset.
* Lockdep keys added to mutex to distinguish MDIO and MMIO switch.
* Early call to mt7530_setup_mdio() returns ret in case of error.
Following Sashiko notes: http://lore.kernel.org/sashiko-reviews/6b8a44ad-2795-45f4-9248-bdd5ead0e66f@cjdns.fr
NOTE: Move the content of mt7988_setup to mt7988_probe per above email
was NOT implemented.

Patch 7:
* Two calls to en751221_trgmii_calibrate_direction() had inverted
defaults.
* Set MT7530_CHG_TRAP | MT7530_PHY_INDIRECT_ACCESS on MMIO EN751221
switch.

v4: http://lore.kernel.org/netdev/20261029184202.1859843-1-cjd@cjdns.fr

Changes since v3:
* Fix "econet,en751221-gswitch" not correctly used in driver
* "support MDIO switch downstream of MMIO switch" - clearer comments
* mt7530_port_change_mtu prefer moved function to forward declaration
* dt binding "passthrough mode" documentation, clarify it is a
restricted case of switch hierarchy
* Use different dsa_switch_ops for passthrough rather than short
circuiting in each function.
v3: https://lore.kernel.org/netdev/20261028011317.1557238-1-cjd@cjdns.fr/

Changes since v2:
* The MCM switch previously identified as econet,en751221, similarly to
mediatek,mt7621, however since econet,en751221 is already used for the
SoC compatible, is it changed to econet,en751221-gswitch. The name
"gswitch" is chosen as there's apparently no standard and for EN751221
this is intuitive because it is the gigabit switch used in
implementations with a "G" in the chip name.

* Do not use a special mt7530_switch_ops for passthrough mode, instead
detect passthrough mode in each function and exit early so as to avoid
errors when trying to make a configuration switch-tree wide.

Changes since v1:
* Move mt7530_setup_mdio_irq out of mt7530_setup_mdio because
mt7530_setup_mdio may be called before mt753x_setup

* Do not return error in mt7988_probe if mt7530_setup_mdio fails because
doing so leaks the DSA switch registration, and in any case
mt7530_setup_mdio will be called again.

* default_taps_ondie not being used en751221_trgmii_cal_ok unused args

* Use clk_drvp / clk_drvp instead of drvp / drvn (typo)

* en751221_set_tx_drive ext values too large for fields - values taken
from reference implementation, reduced from 16 to 15.

v1: https://lore.kernel.org/netdev/20260909140346.2861572-1-cjd@cjdns.fr/

Caleb James DeLisle (7):
  net: dsa: mt7530: get ctrl phy addr using a function
  dt-bindings: net: dsa: mediatek,mt7530: describe 'passthrough'
    hierarchy
  net: dsa: mediatek: add support for passthrough mode
  net: dsa: mediatek: support PLL setup on MMIO MT7530
  net: dsa: mediatek: support MDIO switch downstream of MMIO switch
  dt-bindings: net: dsa: mediatek,mt7530: add EcoNet EN751221 switches
  net: dsa: mediatek: support EN751221 switch

 .../bindings/net/dsa/mediatek,mt7530.yaml     |  49 +-
 drivers/net/dsa/mt7530-mdio.c                 |   1 +
 drivers/net/dsa/mt7530-mmio.c                 |  24 +-
 drivers/net/dsa/mt7530.c                      | 868 ++++++++++++++++--
 drivers/net/dsa/mt7530.h                      |  46 +-
 5 files changed, 887 insertions(+), 101 deletions(-)


base-commit: 7ccc5e05043b1bb84326b19a2b05938d8f7a2ae6
-- 
2.39.5


^ permalink raw reply	[flat|nested] 14+ messages in thread

* [net-next v5 1/7] net: dsa: mt7530: get ctrl phy addr using a function
  2026-11-16 18:33 [net-next v5 0/7] net: dsa: mt7530: support EcoNet EN751221 Caleb James DeLisle
@ 2026-11-16 18:33 ` Caleb James DeLisle
  2026-11-16 18:33 ` [net-next v5 2/7] dt-bindings: net: dsa: mediatek,mt7530: describe 'passthrough' hierarchy Caleb James DeLisle
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 14+ messages in thread
From: Caleb James DeLisle @ 2026-11-16 18:33 UTC (permalink / raw)
  To: netdev
  Cc: andrew, olteanv, davem, edumazet, kuba, pabeni, robh, krzk+dt,
	conor+dt, matthias.bgg, angelogioacchino.delregno, chester.a.unal,
	daniel, linux, arinc.unal, Landen.Chao, dqfext, sean.wang,
	devicetree, linux-kernel, linux-arm-kernel, linux-mediatek,
	naseefkm, b.larsson, Caleb James DeLisle

The MDIO MT7530 has 5 integrated PHYs, of these, the first PHY has
the additional registers that are used for such things as configuring
the clock configuration for the switch. The switch is typically on
MDIO address 31 and the PHYs are 0, 1, 2, 3, and 4 with 0 being the
special one. So taking the address of mdiodev (the switch) add 1 and
modulo 31 finds the first PHY.

However there are a number of MMIO based implementations of MT7530
and on these, mdiodev is NULL though they often still have a control
PHY for the purpose. Move MT753X_CTRL_PHY_ADDR to a function which
handles the NULL condition somewhat more gracefully and allows a
place for MMIO implementations to add special case handling to
provide their control PHY address.

Signed-off-by: Caleb James DeLisle <cjd@cjdns.fr>
---
 drivers/net/dsa/mt7530.c | 54 +++++++++++++++++++++-------------------
 drivers/net/dsa/mt7530.h |  2 --
 2 files changed, 29 insertions(+), 27 deletions(-)

diff --git a/drivers/net/dsa/mt7530.c b/drivers/net/dsa/mt7530.c
index d5a199293f78..3bfe29b3b93e 100644
--- a/drivers/net/dsa/mt7530.c
+++ b/drivers/net/dsa/mt7530.c
@@ -46,6 +46,16 @@ static const struct mt7530_mib_desc mt7530_mib[] = {
 	MIB_DESC(1, MT7530_PORT_MIB_RX_ARL_DROP, "RxArlDrop"),
 };
 
+static int
+mt753x_ctrl_phy_addr(struct mt7530_priv *priv)
+{
+	if (WARN_ON_ONCE(!priv->mdiodev))
+		return 0;
+
+	/* Default is 1st PHY */
+	return (priv->mdiodev->addr + 1) & (PHY_MAX_ADDR - 1);
+}
+
 static void
 mt7530_mutex_lock(struct mt7530_priv *priv)
 {
@@ -63,32 +73,30 @@ mt7530_mutex_unlock(struct mt7530_priv *priv)
 static void
 core_write(struct mt7530_priv *priv, u32 reg, u32 val)
 {
+	int ctl_phy = mt753x_ctrl_phy_addr(priv);
 	struct mii_bus *bus = priv->bus;
 	int ret;
 
 	mt7530_mutex_lock(priv);
 
 	/* Write the desired MMD Devad */
-	ret = bus->write(bus, MT753X_CTRL_PHY_ADDR(priv->mdiodev->addr),
-			 MII_MMD_CTRL, MDIO_MMD_VEND2);
+	ret = bus->write(bus, ctl_phy, MII_MMD_CTRL, MDIO_MMD_VEND2);
 	if (ret < 0)
 		goto err;
 
 	/* Write the desired MMD register address */
-	ret = bus->write(bus, MT753X_CTRL_PHY_ADDR(priv->mdiodev->addr),
-			 MII_MMD_DATA, reg);
+	ret = bus->write(bus, ctl_phy, MII_MMD_DATA, reg);
 	if (ret < 0)
 		goto err;
 
 	/* Select the Function : DATA with no post increment */
-	ret = bus->write(bus, MT753X_CTRL_PHY_ADDR(priv->mdiodev->addr),
+	ret = bus->write(bus, ctl_phy,
 			 MII_MMD_CTRL, MDIO_MMD_VEND2 | MII_MMD_CTRL_NOINCR);
 	if (ret < 0)
 		goto err;
 
 	/* Write the data into MMD's selected register */
-	ret = bus->write(bus, MT753X_CTRL_PHY_ADDR(priv->mdiodev->addr),
-			 MII_MMD_DATA, val);
+	ret = bus->write(bus, ctl_phy, MII_MMD_DATA, val);
 err:
 	if (ret < 0)
 		dev_err(&bus->dev, "failed to write mmd register\n");
@@ -99,6 +107,7 @@ core_write(struct mt7530_priv *priv, u32 reg, u32 val)
 static void
 core_rmw(struct mt7530_priv *priv, u32 reg, u32 mask, u32 set)
 {
+	int ctl_phy = mt753x_ctrl_phy_addr(priv);
 	struct mii_bus *bus = priv->bus;
 	u32 val;
 	int ret;
@@ -106,26 +115,23 @@ core_rmw(struct mt7530_priv *priv, u32 reg, u32 mask, u32 set)
 	mt7530_mutex_lock(priv);
 
 	/* Write the desired MMD Devad */
-	ret = bus->write(bus, MT753X_CTRL_PHY_ADDR(priv->mdiodev->addr),
-			 MII_MMD_CTRL, MDIO_MMD_VEND2);
+	ret = bus->write(bus, ctl_phy, MII_MMD_CTRL, MDIO_MMD_VEND2);
 	if (ret < 0)
 		goto err;
 
 	/* Write the desired MMD register address */
-	ret = bus->write(bus, MT753X_CTRL_PHY_ADDR(priv->mdiodev->addr),
-			 MII_MMD_DATA, reg);
+	ret = bus->write(bus, ctl_phy, MII_MMD_DATA, reg);
 	if (ret < 0)
 		goto err;
 
 	/* Select the Function : DATA with no post increment */
-	ret = bus->write(bus, MT753X_CTRL_PHY_ADDR(priv->mdiodev->addr),
+	ret = bus->write(bus, ctl_phy,
 			 MII_MMD_CTRL, MDIO_MMD_VEND2 | MII_MMD_CTRL_NOINCR);
 	if (ret < 0)
 		goto err;
 
 	/* Read the content of the MMD's selected register */
-	ret = bus->read(bus, MT753X_CTRL_PHY_ADDR(priv->mdiodev->addr),
-			MII_MMD_DATA);
+	ret = bus->read(bus, ctl_phy, MII_MMD_DATA);
 	if (ret < 0)
 		goto err;
 	val = ret;
@@ -133,8 +139,7 @@ core_rmw(struct mt7530_priv *priv, u32 reg, u32 mask, u32 set)
 	val &= ~mask;
 	val |= set;
 	/* Write the data into MMD's selected register */
-	ret = bus->write(bus, MT753X_CTRL_PHY_ADDR(priv->mdiodev->addr),
-			 MII_MMD_DATA, val);
+	ret = bus->write(bus, ctl_phy, MII_MMD_DATA, val);
 err:
 	if (ret < 0)
 		dev_err(&bus->dev, "failed to write mmd register\n");
@@ -2668,8 +2673,11 @@ mt7531_setup(struct dsa_switch *ds)
 {
 	struct mt7530_priv *priv = ds->priv;
 	u32 val, id;
+	int ctl_phy;
 	int ret, i;
 
+	ctl_phy = mt753x_ctrl_phy_addr(priv);
+
 	/* Reset whole chip through gpio pin or memory-mapped registers for
 	 * different type of hardware
 	 */
@@ -2737,25 +2745,21 @@ mt7531_setup(struct dsa_switch *ds)
 	 * phy_[read,write]_mmd_indirect is called, we provide our own
 	 * mt7531_ind_mmd_phy_[read,write] to complete this function.
 	 */
-	ret = mt7531_ind_c45_phy_read(priv,
-				      MT753X_CTRL_PHY_ADDR(priv->mdiodev->addr),
-				      MDIO_MMD_VEND2, CORE_PLL_GROUP4);
+	ret = mt7531_ind_c45_phy_read(priv, ctl_phy, MDIO_MMD_VEND2,
+				      CORE_PLL_GROUP4);
 	if (ret < 0)
 		return ret;
 
 	val = ret;
 	val |= MT7531_RG_SYSPLL_DMY2 | MT7531_PHY_PLL_BYPASS_MODE;
 	val &= ~MT7531_PHY_PLL_OFF;
-	ret = mt7531_ind_c45_phy_write(priv,
-				       MT753X_CTRL_PHY_ADDR(priv->mdiodev->addr),
-				       MDIO_MMD_VEND2, CORE_PLL_GROUP4, val);
+	ret = mt7531_ind_c45_phy_write(priv, ctl_phy, MDIO_MMD_VEND2,
+				       CORE_PLL_GROUP4, val);
 	if (ret < 0)
 		return ret;
 
 	/* Disable EEE advertisement on the switch PHYs. */
-	for (i = MT753X_CTRL_PHY_ADDR(priv->mdiodev->addr);
-	     i < MT753X_CTRL_PHY_ADDR(priv->mdiodev->addr) + MT7530_NUM_PHYS;
-	     i++) {
+	for (i = ctl_phy; i < ctl_phy + MT7530_NUM_PHYS; i++) {
 		mt7531_ind_c45_phy_write(priv, i, MDIO_MMD_AN, MDIO_AN_EEE_ADV,
 					 0);
 	}
diff --git a/drivers/net/dsa/mt7530.h b/drivers/net/dsa/mt7530.h
index 2bbbe617b52e..3dabbc99fbbc 100644
--- a/drivers/net/dsa/mt7530.h
+++ b/drivers/net/dsa/mt7530.h
@@ -747,8 +747,6 @@ enum mt7531_xtal_fsel {
 #define  MT7531_PHY_PLL_OFF		BIT(5)
 #define  MT7531_PHY_PLL_BYPASS_MODE	BIT(4)
 
-#define MT753X_CTRL_PHY_ADDR(addr)	(((addr) + 1) & (PHY_MAX_ADDR - 1))
-
 #define CORE_PLL_GROUP5			0x404
 #define  RG_LCDDS_PCW_NCPO1_MASK	GENMASK(15, 0)
 #define  RG_LCDDS_PCW_NCPO1(x)		FIELD_PREP(RG_LCDDS_PCW_NCPO1_MASK, x)
-- 
2.39.5


^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [net-next v5 2/7] dt-bindings: net: dsa: mediatek,mt7530: describe 'passthrough' hierarchy
  2026-11-16 18:33 [net-next v5 0/7] net: dsa: mt7530: support EcoNet EN751221 Caleb James DeLisle
  2026-11-16 18:33 ` [net-next v5 1/7] net: dsa: mt7530: get ctrl phy addr using a function Caleb James DeLisle
@ 2026-11-16 18:33 ` Caleb James DeLisle
  2026-11-16 18:33 ` [net-next v5 3/7] net: dsa: mediatek: add support for passthrough mode Caleb James DeLisle
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 14+ messages in thread
From: Caleb James DeLisle @ 2026-11-16 18:33 UTC (permalink / raw)
  To: netdev
  Cc: andrew, olteanv, davem, edumazet, kuba, pabeni, robh, krzk+dt,
	conor+dt, matthias.bgg, angelogioacchino.delregno, chester.a.unal,
	daniel, linux, arinc.unal, Landen.Chao, dqfext, sean.wang,
	devicetree, linux-kernel, linux-arm-kernel, linux-mediatek,
	naseefkm, b.larsson, Caleb James DeLisle

Due to hardware limitations, full switch hierarchies are not supported
with DSA based on the mt7530 DSA tag, however it does support a simplified
hierarchy in which one or more switches act as passthrough conduits with
only one CPU port and one DSA port active. Document this capability.

Signed-off-by: Caleb James DeLisle <cjd@cjdns.fr>
---
 .../devicetree/bindings/net/dsa/mediatek,mt7530.yaml        | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml b/Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml
index 90b3582b7619..590eb39d6b93 100644
--- a/Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml
+++ b/Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml
@@ -73,6 +73,12 @@ description: |
 
       Check out example 7.
 
+  The MT7530 and MT7531 switches offer limited support for switch hierarchies,
+  particularly in the case where one or more switches have only one upstream
+  and one downstream port, and can act as blind pass-throughs to a fully
+  featured switch downstream. When using this configuration, the fully featured
+  switch must have a DSA index of zero.
+
 properties:
   compatible:
     oneOf:
-- 
2.39.5


^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [net-next v5 3/7] net: dsa: mediatek: add support for passthrough mode
  2026-11-16 18:33 [net-next v5 0/7] net: dsa: mt7530: support EcoNet EN751221 Caleb James DeLisle
  2026-11-16 18:33 ` [net-next v5 1/7] net: dsa: mt7530: get ctrl phy addr using a function Caleb James DeLisle
  2026-11-16 18:33 ` [net-next v5 2/7] dt-bindings: net: dsa: mediatek,mt7530: describe 'passthrough' hierarchy Caleb James DeLisle
@ 2026-11-16 18:33 ` Caleb James DeLisle
  2026-11-17  0:30   ` kernel test robot
  2026-11-17 18:35   ` sashiko-bot
  2026-11-16 18:33 ` [net-next v5 4/7] net: dsa: mediatek: support PLL setup on MMIO MT7530 Caleb James DeLisle
                   ` (3 subsequent siblings)
  6 siblings, 2 replies; 14+ messages in thread
From: Caleb James DeLisle @ 2026-11-16 18:33 UTC (permalink / raw)
  To: netdev
  Cc: andrew, olteanv, davem, edumazet, kuba, pabeni, robh, krzk+dt,
	conor+dt, matthias.bgg, angelogioacchino.delregno, chester.a.unal,
	daniel, linux, arinc.unal, Landen.Chao, dqfext, sean.wang,
	devicetree, linux-kernel, linux-arm-kernel, linux-mediatek,
	naseefkm, b.larsson, Caleb James DeLisle

In some cases, hardware integrators add a second MT7530 switch to a
port of the CPU-connected MT7530 and configure the upstream switch to
pass all traffic to and from the downstream switch. Particularly,
without altering the MediaTek DSA tag. The typical reason for this is
because the downstream switch is more capable, but the upstream switch
is an irremovable part of the SoC.

To enable passthrough, the main switch has its CPU port, and the port
to the second switch, both configured as MT7530_VLAN_EG_DISABLED and
MT7530_VLAN_TRANSPARENT and it uses the port matrix to control
forwarding.

Support passing through to a downstream switch, and also support being
the downstream switch - meaning the upstream link is not a CPU port but
rather a DSA port.

As a point of information:

There exist features in the hardware which appear to enable full
two-switch hierarchies (i.e. ports on the upstream switch are also
available for use). The way that this is supposed to work is though a
PASSTHROUGH flag in the DSA tag on BIT(7). The downstream switch sets
a flag called "PT_OPTION" on the PVC register of its "CPU" port (the
port linking to the upstream switch). This causes the downstream switch
to set the PASSTHROUGH flag on all ingress traffic. The CPU then sets
the PASSTHROUGH flag on egress traffic meant for the downstream switch.

In this configuration, the upstream switch sets MT7530_VLAN_USER, and
PORT_SPEC_TAG on the (real) CPU port (as usual), but also sets it on
the port leading to the downstream switch. The PORT_SPEC_TAG flag on
the downstream link port causes incoming DSA tags to be copied over
rather than being replaced by tags identifying the traffic as having
come from the link port. Finally, an ACL is installed which causes the
upstream switch to forward all egress traffic with the PASSTHROUGH bit
to the link port.

However for reasons unknown, the PASSTHROUGH bit is cleared by the
upstream switch as it receives ingress traffic from the downstream
switch. So by the time the traffic reaches the CPU, it no longer bears
the PASSTHROUGH bit and its origin cannot be known.

Reference code defaults to passthrough mode as is implemented here, but
supports a limited hierarchical implementation for hardware that needs
it. In this mode it is not permitted to use the same port number on
both switches. This implementation does not implement that mode because
there is no known hardware using ports on both switches.

Signed-off-by: Caleb James DeLisle <cjd@cjdns.fr>
---
 drivers/net/dsa/mt7530.c | 413 +++++++++++++++++++++++++++++++++------
 drivers/net/dsa/mt7530.h |   6 +
 2 files changed, 362 insertions(+), 57 deletions(-)

diff --git a/drivers/net/dsa/mt7530.c b/drivers/net/dsa/mt7530.c
index 3bfe29b3b93e..09b7e9d2d025 100644
--- a/drivers/net/dsa/mt7530.c
+++ b/drivers/net/dsa/mt7530.c
@@ -193,6 +193,11 @@ mt7530_fdb_cmd(struct mt7530_priv *priv, enum mt7530_fdb_cmd cmd, u32 *rsp)
 	return 0;
 }
 
+static void mt7530_passthrough_port_fast_age(struct dsa_switch *ds,
+					     int port)
+{
+}
+
 static void mt7530_port_fast_age(struct dsa_switch *ds, int port)
 {
 	struct mt7530_priv *priv = ds->priv;
@@ -960,6 +965,12 @@ static void mt7530_get_eth_ctrl_stats(struct dsa_switch *ds, int port,
 			       &ctrl_stats->MACControlFramesReceived);
 }
 
+static int
+mt7530_passthrough_set_ageing_time(struct dsa_switch *ds, unsigned int msecs)
+{
+	return 0;
+}
+
 static int
 mt7530_set_ageing_time(struct dsa_switch *ds, unsigned int msecs)
 {
@@ -1286,13 +1297,81 @@ mt753x_trap_frames(struct mt7530_priv *priv)
 				   TO_CPU_FW_CPU_ONLY);
 }
 
+static int
+mt7530_passthrough_port_change_mtu(struct dsa_switch *ds, int port,
+				   int new_mtu)
+{
+	return 0;
+}
+
+static int
+mt7530_port_change_mtu(struct dsa_switch *ds, int port, int new_mtu)
+{
+	struct mt7530_priv *priv = ds->priv;
+	int length;
+	u32 val;
+
+	/* When a new MTU is set, DSA always set the CPU port's MTU to the
+	 * largest MTU of the user ports. Because the switch only has a global
+	 * RX length register, only allowing CPU port here is enough.
+	 */
+	if (!dsa_is_upstream_port(ds, port))
+		return 0;
+
+	regmap_read(priv->regmap, MT7530_GMACCR, &val);
+	val &= ~MAX_RX_PKT_LEN_MASK;
+
+	/* RX length also includes Ethernet header, MTK tag, and FCS length */
+	length = new_mtu + ETH_HLEN + MTK_HDR_LEN + ETH_FCS_LEN;
+	if (length <= 1522) {
+		val |= MAX_RX_PKT_LEN_1522;
+	} else if (length <= 1536) {
+		val |= MAX_RX_PKT_LEN_1536;
+	} else if (length <= 1552) {
+		val |= MAX_RX_PKT_LEN_1552;
+	} else {
+		val &= ~MAX_RX_JUMBO_MASK;
+		val |= MAX_RX_JUMBO(DIV_ROUND_UP(length, 1024));
+		val |= MAX_RX_PKT_LEN_JUMBO;
+	}
+
+	regmap_write(priv->regmap, MT7530_GMACCR, val);
+
+	return 0;
+}
+
+/* If this switch is downstream of another switch that is in passthrough mode,
+ * the "CPU" port is actually a DSA port.
+ */
 static void
 mt753x_cpu_port_enable(struct dsa_switch *ds, int port)
 {
 	struct mt7530_priv *priv = ds->priv;
 
-	/* Enable Mediatek header mode on the cpu port */
-	regmap_write(priv->regmap, MT7530_PVC_P(port), PORT_SPEC_TAG);
+	if (priv->is_passthrough) {
+		/* Disable parsing of the DSA tag, it will be forwarded blindly
+		 * to the downstream switch.
+		 */
+		regmap_write(priv->regmap, MT7530_PVC_P(port),
+			     VLAN_ATTR(MT7530_VLAN_TRANSPARENT) |
+			     PVC_EG_TAG(MT7530_VLAN_EG_DISABLED));
+
+		/* The port is not configured to parse DSA tags, so they are
+		 * liable to be confused for length fields, so length check is
+		 * disabled.
+		 */
+		regmap_clear_bits(priv->regmap, MT753X_AGC, AGC_L2LEN_CHK);
+
+		/* In passthrough mode, MTU is only enforced downstream */
+		mt7530_port_change_mtu(ds, port, MT7530_MAX_MTU);
+
+		/* Loop detection has no value in passthrough mode */
+		regmap_set_bits(priv->regmap, MT753X_MTRAP,
+				MT7530_LOOP_DET_DISABLE);
+	} else {
+		/* Not passthrough, enable DSA tag handling on CPU port. */
+		regmap_write(priv->regmap, MT7530_PVC_P(port), PORT_SPEC_TAG);
+	}
 
 	/* Enable flooding on the CPU port */
 	regmap_set_bits(priv->regmap, MT753X_MFC,
@@ -1318,12 +1397,36 @@ mt753x_cpu_port_enable(struct dsa_switch *ds, int port)
 			   PCR_PORT_VLAN_MASK, MT7530_PORT_FALLBACK_MODE);
 }
 
+/**
+ * mt753x_upstream_port_index - get the index of the upstream port.
+ *
+ * If the CPU port is local then this is the upstream port, but in the case of
+ * hierarchy the CPU port may be on another switch and the upstream port is
+ * then the DSA port pointing toward that CPU port. Note that
+ * dsa_switch_upstream_port() is not reliable because the conduit for a given
+ * port can be customized.
+ */
+static int
+mt753x_upstream_port_index(struct dsa_port *dp)
+{
+	struct dsa_port *cpu_dp = dp->cpu_dp;
+
+	/* Early port_enable on CPU port happens before cpu_dp is set. */
+	if (!cpu_dp)
+		return dsa_switch_upstream_port(dp->ds);
+
+	return dsa_towards_port(dp->ds, cpu_dp->ds->index, cpu_dp->index);
+}
+
 static int
 mt7530_port_enable(struct dsa_switch *ds, int port,
 		   struct phy_device *phy)
 {
 	struct dsa_port *dp = dsa_to_port(ds, port);
 	struct mt7530_priv *priv = ds->priv;
+	int upstream_pt;
+
+	upstream_pt = mt753x_upstream_port_index(dp);
 
 	mutex_lock(&priv->reg_mutex);
 
@@ -1332,13 +1435,38 @@ mt7530_port_enable(struct dsa_switch *ds, int port,
 	 * bridge.
 	 */
 	if (dsa_port_is_user(dp)) {
-		struct dsa_port *cpu_dp = dp->cpu_dp;
+		priv->ports[port].pm |= PCR_MATRIX(BIT(upstream_pt));
+
+	} else if (dsa_port_is_dsa(dp) && dp->index != upstream_pt) {
+		priv->ports[port].pm |= PCR_MATRIX(BIT(upstream_pt));
+
+		/* Should not happen */
+		WARN_ON_ONCE(!priv->is_passthrough);
 
-		priv->ports[port].pm |= PCR_MATRIX(BIT(cpu_dp->index));
+		/* We are passing through to a downstream switch so we set both
+		 * CPU and downstream link to pass traffic untouched so that
+		 * the STAG from the downstream switch will pass to the upstream.
+		 */
+		regmap_write(priv->regmap, MT7530_PVC_P(port),
+			     VLAN_ATTR(MT7530_VLAN_TRANSPARENT) |
+			     PVC_EG_TAG(MT7530_VLAN_EG_DISABLED));
+
+		/* We let the downstream switch flood */
+		regmap_set_bits(priv->regmap, MT753X_MFC, BC_FFP(BIT(port)) |
+				UNM_FFP(BIT(port)) | UNU_FFP(BIT(port)));
+
+		/* Make the upstream port able to connect to the DSA port.
+		 * This must be explicit because PORT_SPEC_TAG is unset.
+		 */
+		regmap_write(priv->regmap, MT7530_PCR_P(upstream_pt),
+			     PCR_MATRIX(BIT(port)));
 	}
 	priv->ports[port].enable = true;
-	regmap_update_bits(priv->regmap, MT7530_PCR_P(port), PCR_MATRIX_MASK,
-			   priv->ports[port].pm);
+
+	/* In passthrough mode, CPU port mask is set above. */
+	if (!(priv->is_passthrough && dp->index == upstream_pt))
+		regmap_update_bits(priv->regmap, MT7530_PCR_P(port),
+				   PCR_MATRIX_MASK, priv->ports[port].pm);
 
 	mutex_unlock(&priv->reg_mutex);
 
@@ -1380,45 +1508,14 @@ mt7530_port_disable(struct dsa_switch *ds, int port)
 }
 
 static int
-mt7530_port_change_mtu(struct dsa_switch *ds, int port, int new_mtu)
+mt7530_port_max_mtu(struct dsa_switch *ds, int port)
 {
-	struct mt7530_priv *priv = ds->priv;
-	int length;
-	u32 val;
-
-	/* When a new MTU is set, DSA always set the CPU port's MTU to the
-	 * largest MTU of the user ports. Because the switch only has a global
-	 * RX length register, only allowing CPU port here is enough.
-	 */
-	if (!dsa_is_cpu_port(ds, port))
-		return 0;
-
-	regmap_read(priv->regmap, MT7530_GMACCR, &val);
-	val &= ~MAX_RX_PKT_LEN_MASK;
-
-	/* RX length also includes Ethernet header, MTK tag, and FCS length */
-	length = new_mtu + ETH_HLEN + MTK_HDR_LEN + ETH_FCS_LEN;
-	if (length <= 1522) {
-		val |= MAX_RX_PKT_LEN_1522;
-	} else if (length <= 1536) {
-		val |= MAX_RX_PKT_LEN_1536;
-	} else if (length <= 1552) {
-		val |= MAX_RX_PKT_LEN_1552;
-	} else {
-		val &= ~MAX_RX_JUMBO_MASK;
-		val |= MAX_RX_JUMBO(DIV_ROUND_UP(length, 1024));
-		val |= MAX_RX_PKT_LEN_JUMBO;
-	}
-
-	regmap_write(priv->regmap, MT7530_GMACCR, val);
-
-	return 0;
+	return MT7530_MAX_MTU;
 }
 
-static int
-mt7530_port_max_mtu(struct dsa_switch *ds, int port)
+static void
+mt7530_passthrough_stp_state_set(struct dsa_switch *ds, int port, u8 state)
 {
-	return MT7530_MAX_MTU;
 }
 
 static void
@@ -1456,9 +1553,8 @@ static void mt7530_update_port_member(struct mt7530_priv *priv, int port,
 				      bool join) __must_hold(&priv->reg_mutex)
 {
 	struct dsa_port *dp = dsa_to_port(priv->ds, port), *other_dp;
+	u32 port_bitmap = BIT(mt753x_upstream_port_index(dp));
 	struct mt7530_port *p = &priv->ports[port], *other_p;
-	struct dsa_port *cpu_dp = dp->cpu_dp;
-	u32 port_bitmap = BIT(cpu_dp->index);
 	int other_port;
 	bool isolated;
 
@@ -1514,6 +1610,14 @@ mt7530_port_pre_bridge_flags(struct dsa_switch *ds, int port,
 	return 0;
 }
 
+static int
+mt7530_passthrough_port_bridge_flags(struct dsa_switch *ds, int port,
+				     struct switchdev_brport_flags flags,
+				     struct netlink_ext_ack *extack)
+{
+	return 0;
+}
+
 static int
 mt7530_port_bridge_flags(struct dsa_switch *ds, int port,
 			 struct switchdev_brport_flags flags,
@@ -1554,6 +1658,15 @@ mt7530_port_bridge_flags(struct dsa_switch *ds, int port,
 	return 0;
 }
 
+static int
+mt7530_passthrough_port_bridge_join(struct dsa_switch *ds, int port,
+				    struct dsa_bridge bridge,
+				    bool *tx_fwd_offload,
+				    struct netlink_ext_ack *extack)
+{
+	return 0;
+}
+
 static int
 mt7530_port_bridge_join(struct dsa_switch *ds, int port,
 			struct dsa_bridge bridge, bool *tx_fwd_offload,
@@ -1708,6 +1821,12 @@ mt7530_port_set_vlan_aware(struct dsa_switch *ds, int port)
 	}
 }
 
+static void
+mt7530_passthrough_port_bridge_leave(struct dsa_switch *ds, int port,
+				     struct dsa_bridge bridge)
+{
+}
+
 static void
 mt7530_port_bridge_leave(struct dsa_switch *ds, int port,
 			 struct dsa_bridge bridge)
@@ -1728,6 +1847,14 @@ mt7530_port_bridge_leave(struct dsa_switch *ds, int port,
 	mutex_unlock(&priv->reg_mutex);
 }
 
+static int
+mt7530_passthrough_port_fdb_add(struct dsa_switch *ds, int port,
+				const unsigned char *addr, u16 vid,
+				struct dsa_db db)
+{
+	return 0;
+}
+
 static int
 mt7530_port_fdb_add(struct dsa_switch *ds, int port,
 		    const unsigned char *addr, u16 vid,
@@ -1745,6 +1872,14 @@ mt7530_port_fdb_add(struct dsa_switch *ds, int port,
 	return ret;
 }
 
+static int
+mt7530_passthrough_port_fdb_del(struct dsa_switch *ds, int port,
+				const unsigned char *addr, u16 vid,
+				struct dsa_db db)
+{
+	return 0;
+}
+
 static int
 mt7530_port_fdb_del(struct dsa_switch *ds, int port,
 		    const unsigned char *addr, u16 vid,
@@ -1797,6 +1932,14 @@ mt7530_port_fdb_dump(struct dsa_switch *ds, int port,
 	return 0;
 }
 
+static int
+mt7530_passthrough_port_mdb_add(struct dsa_switch *ds, int port,
+				const struct switchdev_obj_port_mdb *mdb,
+				struct dsa_db db)
+{
+	return 0;
+}
+
 static int
 mt7530_port_mdb_add(struct dsa_switch *ds, int port,
 		    const struct switchdev_obj_port_mdb *mdb,
@@ -1826,6 +1969,14 @@ mt7530_port_mdb_add(struct dsa_switch *ds, int port,
 	return ret;
 }
 
+static int
+mt7530_passthrough_port_mdb_del(struct dsa_switch *ds, int port,
+				const struct switchdev_obj_port_mdb *mdb,
+				struct dsa_db db)
+{
+	return 0;
+}
+
 static int
 mt7530_port_mdb_del(struct dsa_switch *ds, int port,
 		    const struct switchdev_obj_port_mdb *mdb,
@@ -1856,12 +2007,19 @@ mt7530_port_mdb_del(struct dsa_switch *ds, int port,
 	return ret;
 }
 
+static int
+mt7530_passthrough_port_vlan_filtering(struct dsa_switch *ds, int port,
+				       bool vlan_filtering,
+				       struct netlink_ext_ack *extack)
+{
+	return 0;
+}
+
 static int
 mt7530_port_vlan_filtering(struct dsa_switch *ds, int port, bool vlan_filtering,
 			   struct netlink_ext_ack *extack)
 {
 	struct dsa_port *dp = dsa_to_port(ds, port);
-	struct dsa_port *cpu_dp = dp->cpu_dp;
 
 	if (vlan_filtering) {
 		/* The port is being kept as VLAN-unaware port when bridge is
@@ -1870,7 +2028,7 @@ mt7530_port_vlan_filtering(struct dsa_switch *ds, int port, bool vlan_filtering,
 		 * for becoming a VLAN-aware port.
 		 */
 		mt7530_port_set_vlan_aware(ds, port);
-		mt7530_port_set_vlan_aware(ds, cpu_dp->index);
+		mt7530_port_set_vlan_aware(ds, mt753x_upstream_port_index(dp));
 	} else {
 		mt7530_port_set_vlan_unaware(ds, port);
 	}
@@ -1902,7 +2060,7 @@ mt7530_hw_vlan_add(struct mt7530_priv *priv,
 	 * that VLAN tags would be appended after hardware special tag used as
 	 * DSA tag.
 	 */
-	if (dsa_port_is_cpu(dp))
+	if (dp->index == mt753x_upstream_port_index(dp))
 		val = MT7530_VLAN_EGRESS_STACK;
 	else if (entry->untagged)
 		val = MT7530_VLAN_EGRESS_UNTAG;
@@ -1960,6 +2118,14 @@ mt7530_hw_vlan_update(struct mt7530_priv *priv, u16 vid,
 	mt7530_vlan_cmd(priv, MT7530_VTCR_WR_VID, vid);
 }
 
+static int
+mt7530_passthrough_port_vlan_add(struct dsa_switch *ds, int port,
+				 const struct switchdev_obj_port_vlan *vlan,
+				 struct netlink_ext_ack *extack)
+{
+	return 0;
+}
+
 static int
 mt7530_port_vlan_add(struct dsa_switch *ds, int port,
 		     const struct switchdev_obj_port_vlan *vlan,
@@ -2015,6 +2181,13 @@ mt7530_port_vlan_add(struct dsa_switch *ds, int port,
 	return 0;
 }
 
+static int
+mt7530_passthrough_port_vlan_del(struct dsa_switch *ds, int port,
+				 const struct switchdev_obj_port_vlan *vlan)
+{
+	return 0;
+}
+
 static int
 mt7530_port_vlan_del(struct dsa_switch *ds, int port,
 		     const struct switchdev_obj_port_vlan *vlan)
@@ -2055,6 +2228,14 @@ mt7530_port_vlan_del(struct dsa_switch *ds, int port,
 	return 0;
 }
 
+static int
+mt753x_passthrough_port_mirror_add(struct dsa_switch *ds, int port,
+				   struct dsa_mall_mirror_tc_entry *mirror,
+				   bool ingress, struct netlink_ext_ack *extack)
+{
+	return 0;
+}
+
 static int mt753x_port_mirror_add(struct dsa_switch *ds, int port,
 				  struct dsa_mall_mirror_tc_entry *mirror,
 				  bool ingress, struct netlink_ext_ack *extack)
@@ -2093,6 +2274,11 @@ static int mt753x_port_mirror_add(struct dsa_switch *ds, int port,
 	return 0;
 }
 
+static void mt753x_passthrough_port_mirror_del(struct dsa_switch *ds, int port,
+					       struct dsa_mall_mirror_tc_entry *mirror)
+{
+}
+
 static void mt753x_port_mirror_del(struct dsa_switch *ds, int port,
 				   struct dsa_mall_mirror_tc_entry *mirror)
 {
@@ -2405,11 +2591,6 @@ mt7530_setup(struct dsa_switch *ds)
 		break;
 	}
 
-	if (!dn) {
-		dev_err(ds->dev, "parent OF node of DSA conduit not found");
-		return -EINVAL;
-	}
-
 	ds->assisted_learning_on_cpu_port = true;
 	ds->untag_vlan_aware_bridge_pvid = true;
 	ds->mtu_enforcement_ingress = true;
@@ -2491,7 +2672,8 @@ mt7530_setup(struct dsa_switch *ds)
 	if ((val & MT7530_XTAL_MASK) == MT7530_XTAL_40MHZ)
 		mt7530_pll_setup(priv);
 
-	mt753x_trap_frames(priv);
+	if (!priv->is_passthrough)
+		mt753x_trap_frames(priv);
 
 	/* Enable and reset MIB counters */
 	mt7530_mib_reset(ds);
@@ -2511,7 +2693,7 @@ mt7530_setup(struct dsa_switch *ds)
 		/* Disable learning by default on all ports */
 		regmap_set_bits(priv->regmap, MT7530_PSC_P(i), SA_DIS);
 
-		if (dsa_is_cpu_port(ds, i)) {
+		if (dsa_is_upstream_port(ds, i)) {
 			mt753x_cpu_port_enable(ds, i);
 		} else {
 			mt7530_port_disable(ds, i);
@@ -2535,7 +2717,7 @@ mt7530_setup(struct dsa_switch *ds)
 		return ret;
 
 	/* Check for PHY muxing on port 5 */
-	if (dsa_is_unused_port(ds, 5)) {
+	if (dn && dsa_is_unused_port(ds, 5)) {
 		/* Scan the ethernet nodes. Look for GMAC1, lookup the used PHY.
 		 * Set priv->p5_mode to the appropriate value if PHY muxing is
 		 * detected.
@@ -2608,7 +2790,8 @@ mt7531_setup_common(struct dsa_switch *ds)
 	ds->ageing_time_min = 2 * 1000;
 	ds->ageing_time_max = (AGE_CNT_MAX + 1) * (AGE_UNIT_MAX + 1) * 1000;
 
-	mt753x_trap_frames(priv);
+	if (!priv->is_passthrough)
+		mt753x_trap_frames(priv);
 
 	/* Enable and reset MIB counters */
 	mt7530_mib_reset(ds);
@@ -2635,7 +2818,7 @@ mt7531_setup_common(struct dsa_switch *ds)
 		regmap_set_bits(priv->regmap, MT7531_DBG_CNT(i),
 				MT7531_DIS_CLR);
 
-		if (dsa_is_cpu_port(ds, i)) {
+		if (dsa_is_upstream_port(ds, i)) {
 			mt753x_cpu_port_enable(ds, i);
 		} else {
 			mt7530_port_disable(ds, i);
@@ -3255,6 +3438,14 @@ static int mt753x_set_mac_eee(struct dsa_switch *ds, int port,
 	return 0;
 }
 
+static int
+mt753x_passthrough_port_change_conduit(struct dsa_switch *ds, int port,
+				       struct net_device *conduit,
+				       struct netlink_ext_ack *extack)
+{
+	return 0;
+}
+
 static int
 mt753x_port_change_conduit(struct dsa_switch *ds, int port,
 			   struct net_device *conduit,
@@ -3365,6 +3556,13 @@ static int mt753x_tc_setup_qdisc_tbf(struct dsa_switch *ds, int port,
 	return 0;
 }
 
+static int mt753x_passthrough_setup_tc(struct dsa_switch *ds, int port,
+				       enum tc_setup_type type,
+				       void *type_data)
+{
+	return 0;
+}
+
 static int mt753x_setup_tc(struct dsa_switch *ds, int port,
 			   enum tc_setup_type type, void *type_data)
 {
@@ -3402,6 +3600,96 @@ static int mt7988_setup(struct dsa_switch *ds)
 	return mt7531_setup_common(ds);
 }
 
+/* 1 if passthrough, negative if error. */
+static int mt753x_check_passthrough(struct device *dev)
+{
+	struct device_node *ports, *port;
+	int ethernet_ports = 0;
+	int enabled_ports = 0;
+	int link_ports = 0;
+
+	ports = of_get_child_by_name(dev->of_node, "ports");
+	if (!ports)
+		ports = of_get_child_by_name(dev->of_node, "ethernet-ports");
+
+	if (!ports) {
+		dev_err(dev, "no ports child node found\n");
+		return -EINVAL;
+	}
+
+	for_each_available_child_of_node(ports, port) {
+		struct device_node *pt_node;
+
+		enabled_ports++;
+
+		pt_node = of_parse_phandle(port, "ethernet", 0);
+
+		if (pt_node) {
+			ethernet_ports++;
+			of_node_put(pt_node);
+			continue;
+		}
+
+		pt_node = of_parse_phandle(port, "link", 0);
+		if (pt_node) {
+			link_ports++;
+			of_node_put(pt_node);
+		}
+	}
+
+	of_node_put(ports);
+
+	/*
+	 * A switch is considered passthrough if exactly two available
+	 * ports have an "ethernet" or "link" phandle.
+	 */
+	return link_ports == 1 && ethernet_ports == 1 && enabled_ports == 2;
+}
+
+/* No manipulation of forwarding rules allowed in passthrough mode */
+static const struct dsa_switch_ops mt7530_passthrough_switch_ops = {
+	.get_tag_protocol       = mtk_get_tag_protocol,
+	.setup                  = mt753x_setup,
+	.teardown               = mt753x_teardown,
+	.preferred_default_local_cpu_port = mt753x_preferred_default_local_cpu_port,
+	.port_change_conduit	= mt753x_passthrough_port_change_conduit,
+	.get_strings            = mt7530_get_strings,
+	.get_ethtool_stats      = mt7530_get_ethtool_stats,
+	.get_sset_count         = mt7530_get_sset_count,
+	.get_eth_mac_stats      = mt7530_get_eth_mac_stats,
+	.get_rmon_stats         = mt7530_get_rmon_stats,
+	.get_eth_ctrl_stats     = mt7530_get_eth_ctrl_stats,
+	.get_stats64            = mt7530_get_stats64,
+	.set_ageing_time	= mt7530_passthrough_set_ageing_time,
+	.port_enable            = mt7530_port_enable,
+	.port_disable           = mt7530_port_disable,
+	.port_change_mtu	= mt7530_passthrough_port_change_mtu,
+	.port_max_mtu		= mt7530_port_max_mtu,
+	.port_stp_state_set	= mt7530_passthrough_stp_state_set,
+	.port_pre_bridge_flags	= mt7530_port_pre_bridge_flags,
+	.port_bridge_flags	= mt7530_passthrough_port_bridge_flags,
+	.port_bridge_join	= mt7530_passthrough_port_bridge_join,
+	.port_bridge_leave	= mt7530_passthrough_port_bridge_leave,
+	.port_fast_age		= mt7530_passthrough_port_fast_age,
+	.port_fdb_add		= mt7530_passthrough_port_fdb_add,
+	.port_fdb_del		= mt7530_passthrough_port_fdb_del,
+	.port_fdb_dump		= mt7530_port_fdb_dump,
+	.port_mdb_add		= mt7530_passthrough_port_mdb_add,
+	.port_mdb_del		= mt7530_passthrough_port_mdb_del,
+	.port_vlan_filtering	= mt7530_passthrough_port_vlan_filtering,
+	.port_vlan_add		= mt7530_passthrough_port_vlan_add,
+	.port_vlan_del		= mt7530_passthrough_port_vlan_del,
+	.port_mirror_add	= mt753x_passthrough_port_mirror_add,
+	.port_mirror_del	= mt753x_passthrough_port_mirror_del,
+	.phylink_get_caps       = mt753x_phylink_get_caps,
+	.support_eee            = dsa_supports_eee,
+	.set_mac_eee            = mt753x_set_mac_eee,
+	.conduit_state_change   = mt753x_conduit_state_change,
+	.port_setup_tc		= mt753x_passthrough_setup_tc,
+	.port_hsr_join		= dsa_port_simple_hsr_join,
+	.port_hsr_leave		= dsa_port_simple_hsr_leave,
+};
+
 static const struct dsa_switch_ops mt7530_switch_ops = {
 	.get_tag_protocol	= mtk_get_tag_protocol,
 	.setup			= mt753x_setup,
@@ -3534,8 +3822,12 @@ EXPORT_SYMBOL_GPL(mt753x_table);
 int
 mt7530_probe_common(struct mt7530_priv *priv)
 {
+	int passthrough = mt753x_check_passthrough(priv->dev);
 	struct device *dev = priv->dev;
 
+	if (passthrough < 0)
+		return passthrough;
+
 	priv->ds = devm_kzalloc_obj(dev, *priv->ds);
 	if (!priv->ds)
 		return -ENOMEM;
@@ -3553,7 +3845,14 @@ mt7530_probe_common(struct mt7530_priv *priv)
 	priv->id = priv->info->id;
 	priv->dev = dev;
 	priv->ds->priv = priv;
-	priv->ds->ops = &mt7530_switch_ops;
+
+	priv->is_passthrough = passthrough;
+
+	if (passthrough)
+		priv->ds->ops = &mt7530_passthrough_switch_ops;
+	else
+		priv->ds->ops = &mt7530_switch_ops;
+
 	priv->ds->phylink_mac_ops = &mt753x_phylink_mac_ops;
 	mutex_init(&priv->reg_mutex);
 	spin_lock_init(&priv->stats_lock);
diff --git a/drivers/net/dsa/mt7530.h b/drivers/net/dsa/mt7530.h
index 3dabbc99fbbc..108c831dd012 100644
--- a/drivers/net/dsa/mt7530.h
+++ b/drivers/net/dsa/mt7530.h
@@ -40,6 +40,7 @@ enum mt753x_id {
 /* Register for ARL global control */
 #define MT753X_AGC			0xc
 #define  LOCAL_EN			BIT(7)
+#define  AGC_L2LEN_CHK			BIT(4)
 
 /* Register for MAC forward control */
 #define MT753X_MFC			0x10
@@ -583,6 +584,7 @@ enum mt7531_clk_skew {
 #define MT753X_MTRAP			0x7804
 #define  MT7530_P5_PHY0_SEL		BIT(20)
 #define  MT7530_CHG_TRAP		BIT(16)
+#define  MT7530_LOOP_DET_DISABLE	BIT(14)
 #define  MT7530_P5_MAC_SEL		BIT(13)
 #define  MT7530_P6_DIS			BIT(8)
 #define  MT7530_P5_RGMII_MODE		BIT(7)
@@ -897,6 +899,9 @@ struct mt753x_info {
  * @p5_mode:		Holding the current mode of port 5 of the MT7530 switch
  * @p5_sgmii:		Flag for distinguishing if port 5 of the MT7531 switch
  *			has got SGMII
+ * @is_passthrough:	If this switch is to pass traffic between the upstream
+ *			(CPU) port and a second downstream switch, without
+ *			altering the DSA tag.
  * @irq_domain:		IRQ domain of the switch irq_chip
  * @create_sgmii:	Pointer to function creating SGMII PCS instance(s)
  * @active_cpu_ports:	Holding the active CPU ports
@@ -921,6 +926,7 @@ struct mt7530_priv {
 	bool			p5_sgmii;
 	u8			mirror_rx;
 	u8			mirror_tx;
+	bool			is_passthrough;
 	struct mt7530_port	ports[MT7530_NUM_PORTS];
 	struct mt753x_pcs	pcs[MT7530_NUM_PORTS];
 	/* protect among processes for registers access*/
-- 
2.39.5


^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [net-next v5 4/7] net: dsa: mediatek: support PLL setup on MMIO MT7530
  2026-11-16 18:33 [net-next v5 0/7] net: dsa: mt7530: support EcoNet EN751221 Caleb James DeLisle
                   ` (2 preceding siblings ...)
  2026-11-16 18:33 ` [net-next v5 3/7] net: dsa: mediatek: add support for passthrough mode Caleb James DeLisle
@ 2026-11-16 18:33 ` Caleb James DeLisle
  2026-11-17 18:35   ` sashiko-bot
  2026-11-16 18:33 ` [net-next v5 5/7] net: dsa: mediatek: support MDIO switch downstream of MMIO switch Caleb James DeLisle
                   ` (2 subsequent siblings)
  6 siblings, 1 reply; 14+ messages in thread
From: Caleb James DeLisle @ 2026-11-16 18:33 UTC (permalink / raw)
  To: netdev
  Cc: andrew, olteanv, davem, edumazet, kuba, pabeni, robh, krzk+dt,
	conor+dt, matthias.bgg, angelogioacchino.delregno, chester.a.unal,
	daniel, linux, arinc.unal, Landen.Chao, dqfext, sean.wang,
	devicetree, linux-kernel, linux-arm-kernel, linux-mediatek,
	naseefkm, b.larsson, Caleb James DeLisle

On MT7530 and MT7531, PHYs are an integral part of the switch. However,
on MT7530, certain configuration such as PLL setup is done via special
registers on one of the PHYs.

In an MMIO implementation, the MDIO bus is part of the switch itself.
This bus is already setup for PHY calibration so begin using it for
core switch PLL setup.

Signed-off-by: Caleb James DeLisle <cjd@cjdns.fr>
---
 drivers/net/dsa/mt7530.c | 15 +++++++++++++++
 drivers/net/dsa/mt7530.h |  4 ++++
 2 files changed, 19 insertions(+)

diff --git a/drivers/net/dsa/mt7530.c b/drivers/net/dsa/mt7530.c
index 09b7e9d2d025..53ac692d5ba9 100644
--- a/drivers/net/dsa/mt7530.c
+++ b/drivers/net/dsa/mt7530.c
@@ -77,6 +77,12 @@ core_write(struct mt7530_priv *priv, u32 reg, u32 val)
 	struct mii_bus *bus = priv->bus;
 	int ret;
 
+	if (!bus)
+		bus = priv->child_bus;
+
+	if (WARN_ON_ONCE(!bus))
+		return;
+
 	mt7530_mutex_lock(priv);
 
 	/* Write the desired MMD Devad */
@@ -112,6 +118,12 @@ core_rmw(struct mt7530_priv *priv, u32 reg, u32 mask, u32 set)
 	u32 val;
 	int ret;
 
+	if (!bus)
+		bus = priv->child_bus;
+
+	if (WARN_ON_ONCE(!bus))
+		return;
+
 	mt7530_mutex_lock(priv);
 
 	/* Write the desired MMD Devad */
@@ -2555,8 +2567,11 @@ mt7530_setup_mdio(struct mt7530_priv *priv)
 	if (priv->irq_domain && !mnp)
 		mt7530_setup_mdio_irq(priv);
 
+	priv->child_bus = bus;
+
 	ret = devm_of_mdiobus_register(dev, bus, mnp);
 	if (ret) {
+		priv->child_bus = NULL;
 		dev_err(dev, "failed to register MDIO bus: %d\n", ret);
 		if (priv->irq_domain && !mnp)
 			mt7530_free_mdio_irq(priv);
diff --git a/drivers/net/dsa/mt7530.h b/drivers/net/dsa/mt7530.h
index 108c831dd012..5b7394f6383c 100644
--- a/drivers/net/dsa/mt7530.h
+++ b/drivers/net/dsa/mt7530.h
@@ -886,6 +886,9 @@ struct mt753x_info {
  * @dev:		The device pointer
  * @ds:			The pointer to the dsa core structure
  * @bus:		The bus used for the device and built-in PHY
+ * @child_bus:		The bus created by the device, on MDIO implementations
+ *			this is bus indirectly accesses `bus`, on MMIO
+ *			implementations this bus is part of the switch.
  * @regmap:		The regmap instance representing all switch registers
  * @rstc:		The pointer to reset control used by MCM
  * @core_pwr:		The power supplied into the core
@@ -914,6 +917,7 @@ struct mt7530_priv {
 	struct device		*dev;
 	struct dsa_switch	*ds;
 	struct mii_bus		*bus;
+	struct mii_bus		*child_bus;
 	struct regmap		*regmap;
 	struct reset_control	*rstc;
 	struct regulator	*core_pwr;
-- 
2.39.5


^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [net-next v5 5/7] net: dsa: mediatek: support MDIO switch downstream of MMIO switch
  2026-11-16 18:33 [net-next v5 0/7] net: dsa: mt7530: support EcoNet EN751221 Caleb James DeLisle
                   ` (3 preceding siblings ...)
  2026-11-16 18:33 ` [net-next v5 4/7] net: dsa: mediatek: support PLL setup on MMIO MT7530 Caleb James DeLisle
@ 2026-11-16 18:33 ` Caleb James DeLisle
  2026-11-17 18:35   ` sashiko-bot
  2026-11-16 18:33 ` [net-next v5 6/7] dt-bindings: net: dsa: mediatek,mt7530: add EcoNet EN751221 switches Caleb James DeLisle
  2026-11-16 18:33 ` [net-next v5 7/7] net: dsa: mediatek: support EN751221 switch Caleb James DeLisle
  6 siblings, 1 reply; 14+ messages in thread
From: Caleb James DeLisle @ 2026-11-16 18:33 UTC (permalink / raw)
  To: netdev
  Cc: andrew, olteanv, davem, edumazet, kuba, pabeni, robh, krzk+dt,
	conor+dt, matthias.bgg, angelogioacchino.delregno, chester.a.unal,
	daniel, linux, arinc.unal, Landen.Chao, dqfext, sean.wang,
	devicetree, linux-kernel, linux-arm-kernel, linux-mediatek,
	naseefkm, b.larsson, Caleb James DeLisle

The MT7530 / MT7531 can connect via either MDIO or MMIO. In MMIO mode
the switch provides its own MDIO bus which connects to its integrated
PHYs, but also can be connected to other things, such as another
switch.

If the MDIO bus contains another switch, then the upstream switch
will register but it will not setup the DSA tree because the
downstream switch is missing. Without the complete DSA tree,
mt753x_setup() will not be called on the switch and therefore
mt7530_setup_mdio() is never called so the downstream switch never
registers.

However, the call to mt7530_setup_mdio() from mt753x_setup() must
also be kept because all PHYs are expected to be operational after
mt753x_setup() returns.

1. Move TOP_SIG_CTRL_NORMAL bit set to mt7530_setup() so it will only
be called after switch reset, make it unconditional since mt7530_setup
is MT7530 only.
2. Move mt7530_setup_irq() to mt7530_setup_mdio() so it can be called
early.
3. Make mt7530_setup_mdio() able to be called a second time without
side-effects.
4. Call mt7530_setup_mdio() early from mt7988_probe() if "mdio" child
DT node is present and dsa_register_switch() returns 0 (not all
switches probed yet)
5. Add lockdep classes to mutex because MDIO switch under MMIO switch
will cause one lock to be taken after the other.

Signed-off-by: Caleb James DeLisle <cjd@cjdns.fr>
---
 drivers/net/dsa/mt7530-mmio.c | 23 ++++++++++++++++++-
 drivers/net/dsa/mt7530.c      | 42 ++++++++++++++++++++++++++---------
 drivers/net/dsa/mt7530.h      | 10 +++++++++
 3 files changed, 64 insertions(+), 11 deletions(-)

diff --git a/drivers/net/dsa/mt7530-mmio.c b/drivers/net/dsa/mt7530-mmio.c
index 5d467be2a32c..ab6d92ab3ec0 100644
--- a/drivers/net/dsa/mt7530-mmio.c
+++ b/drivers/net/dsa/mt7530-mmio.c
@@ -30,6 +30,7 @@ static int
 mt7988_probe(struct platform_device *pdev)
 {
 	struct mt7530_priv *priv;
+	struct device_node *mnp;
 	void __iomem *base_addr;
 	int ret;
 
@@ -61,7 +62,27 @@ mt7988_probe(struct platform_device *pdev)
 	if (IS_ERR(priv->regmap))
 		return PTR_ERR(priv->regmap);
 
-	return dsa_register_switch(priv->ds);
+	ret = dsa_register_switch(priv->ds);
+
+	if (ret)
+		return ret;
+
+	/*
+	 * If not all switches in the hierarchy have been probed,
+	 * dsa_register_switch() returns 0 without calling mt753x_setup().
+	 * Call mt7530_setup_mdio() because there's a chance that the missing
+	 * switch is on the MDIO bus. If "mdio" node is not present then there
+	 * is definitely no MDIO switch in the DT, and also if "mdio" is not
+	 * present then phys_mii_mask is relevant and that is not set until
+	 * dsa_switch_setup.
+	 */
+	mnp = of_get_child_by_name(pdev->dev.of_node, "mdio");
+	if (mnp) {
+		of_node_put(mnp);
+		ret = mt7530_setup_mdio(priv);
+	}
+
+	return ret;
 }
 
 static void mt7988_remove(struct platform_device *pdev)
diff --git a/drivers/net/dsa/mt7530.c b/drivers/net/dsa/mt7530.c
index 53ac692d5ba9..4390982a5e22 100644
--- a/drivers/net/dsa/mt7530.c
+++ b/drivers/net/dsa/mt7530.c
@@ -2497,11 +2497,6 @@ mt7530_setup_irq(struct mt7530_priv *priv)
 		return irq ? : -EINVAL;
 	}
 
-	/* This register must be set for MT7530 to properly fire interrupts */
-	if (priv->id == ID_MT7530 || priv->id == ID_MT7621)
-		regmap_set_bits(priv->regmap, MT7530_TOP_SIG_CTRL,
-				TOP_SIG_CTRL_NORMAL);
-
 	ret = devm_regmap_add_irq_chip_fwnode(dev, dev_fwnode(dev),
 					      priv->regmap, irq,
 					      IRQF_ONESHOT,
@@ -2530,7 +2525,7 @@ mt7530_free_mdio_irq(struct mt7530_priv *priv)
 	}
 }
 
-static int
+int
 mt7530_setup_mdio(struct mt7530_priv *priv)
 {
 	struct device_node *mnp, *np = priv->dev->of_node;
@@ -2540,6 +2535,14 @@ mt7530_setup_mdio(struct mt7530_priv *priv)
 	static int idx;
 	int ret = 0;
 
+	/* Already done */
+	if (priv->child_bus)
+		return 0;
+
+	ret = mt7530_setup_irq(priv);
+	if (ret)
+		return ret;
+
 	mnp = of_get_child_by_name(np, "mdio");
 
 	if (mnp && !of_device_is_available(mnp))
@@ -2581,6 +2584,7 @@ mt7530_setup_mdio(struct mt7530_priv *priv)
 	of_node_put(mnp);
 	return ret;
 }
+EXPORT_SYMBOL_GPL(mt7530_setup_mdio);
 
 static int
 mt7530_setup(struct dsa_switch *ds)
@@ -2684,6 +2688,10 @@ mt7530_setup(struct dsa_switch *ds)
 			   MT7530_CHG_TRAP | MT7530_PHY_INDIRECT_ACCESS,
 			   MT7530_CHG_TRAP);
 
+	/* This register must be set for MT7530 to properly fire interrupts */
+	regmap_set_bits(priv->regmap, MT7530_TOP_SIG_CTRL,
+			TOP_SIG_CTRL_NORMAL);
+
 	if ((val & MT7530_XTAL_MASK) == MT7530_XTAL_40MHZ)
 		mt7530_pll_setup(priv);
 
@@ -3405,10 +3413,10 @@ mt753x_setup(struct dsa_switch *ds)
 	if (ret)
 		return ret;
 
-	ret = mt7530_setup_irq(priv);
-	if (ret)
-		return ret;
-
+	/*
+	 * This must be called before mt753x_setup() returns because the DSA
+	 * core synchronously sets up ports and expects PHYs to be operational.
+	 */
 	ret = mt7530_setup_mdio(priv);
 	if (ret)
 		return ret;
@@ -3834,6 +3842,15 @@ const struct mt753x_info mt753x_table[] = {
 };
 EXPORT_SYMBOL_GPL(mt753x_table);
 
+/*
+ * An MMIO switch can have another MDIO switch connected to its
+ * MDIO interface and in that case, actions on the MDIO switch will call
+ * through to mt7531_ind_c(22|45)_phy_(read|write) making a lock
+ * dependency.
+ */
+static struct lock_class_key mt7530_mmio_mutex_key;
+static struct lock_class_key mt7530_mdio_mutex_key;
+
 int
 mt7530_probe_common(struct mt7530_priv *priv)
 {
@@ -3873,6 +3890,11 @@ mt7530_probe_common(struct mt7530_priv *priv)
 	spin_lock_init(&priv->stats_lock);
 	INIT_DELAYED_WORK(&priv->stats_work, mt7530_stats_poll);
 
+	if (priv->bus)
+		lockdep_set_class(&priv->reg_mutex, &mt7530_mdio_mutex_key);
+	else
+		lockdep_set_class(&priv->reg_mutex, &mt7530_mmio_mutex_key);
+
 	dev_set_drvdata(dev, priv);
 
 	return 0;
diff --git a/drivers/net/dsa/mt7530.h b/drivers/net/dsa/mt7530.h
index 5b7394f6383c..c86bc4bca29b 100644
--- a/drivers/net/dsa/mt7530.h
+++ b/drivers/net/dsa/mt7530.h
@@ -969,6 +969,16 @@ struct mt7530_hw_stats {
 int mt7530_probe_common(struct mt7530_priv *priv);
 void mt7530_remove_common(struct mt7530_priv *priv);
 
+/*
+ * When an MMIO based switch has an MDIO bus which contains a downstream MDIO
+ * switch, the MDIO bus is not normally setup until mt753x_setup() has been
+ * called. But mt753x_setup() is not called until DSA sees that every switch in
+ * the tree has been probed. Calling mt7530_setup_mdio() after at the end of
+ * the MMIO probe function allows the downstream switch to register, completing
+ * the tree.
+ */
+int mt7530_setup_mdio(struct mt7530_priv *priv);
+
 extern const struct mt753x_info mt753x_table[];
 
 #endif /* __MT7530_H */
-- 
2.39.5


^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [net-next v5 6/7] dt-bindings: net: dsa: mediatek,mt7530: add EcoNet EN751221 switches
  2026-11-16 18:33 [net-next v5 0/7] net: dsa: mt7530: support EcoNet EN751221 Caleb James DeLisle
                   ` (4 preceding siblings ...)
  2026-11-16 18:33 ` [net-next v5 5/7] net: dsa: mediatek: support MDIO switch downstream of MMIO switch Caleb James DeLisle
@ 2026-11-16 18:33 ` Caleb James DeLisle
  2026-11-17 18:35   ` sashiko-bot
  2026-11-16 18:33 ` [net-next v5 7/7] net: dsa: mediatek: support EN751221 switch Caleb James DeLisle
  6 siblings, 1 reply; 14+ messages in thread
From: Caleb James DeLisle @ 2026-11-16 18:33 UTC (permalink / raw)
  To: netdev
  Cc: andrew, olteanv, davem, edumazet, kuba, pabeni, robh, krzk+dt,
	conor+dt, matthias.bgg, angelogioacchino.delregno, chester.a.unal,
	daniel, linux, arinc.unal, Landen.Chao, dqfext, sean.wang,
	devicetree, linux-kernel, linux-arm-kernel, linux-mediatek,
	naseefkm, b.larsson, Caleb James DeLisle

The EcoNet EN751221 MIPS SoC integrates an MT7530 switch memory-mapped
in the SoC register space. It is similar to the econet,en7528-switch
except that ports 0..3 are 10/100 only, port 4 has a gigabit PHY, and
port 5 has no PHY, but is in some implementations connected to a
downstream MT7530 multi-chip module via a TRGMII link.

The downstream MT7530 is similar to the MT7621 multi-chip module and
has all gigabit ports.

Add the econet,en751221-switch compatible with the same constraints as
the other built-in switches and also add the econet,en751221-gswitch
multi-chip-module switch whose port 6 is configured as a DSA link port.

Signed-off-by: Caleb James DeLisle <cjd@cjdns.fr>
---
 .../bindings/net/dsa/mediatek,mt7530.yaml     | 43 ++++++++++++++++++-
 1 file changed, 41 insertions(+), 2 deletions(-)

diff --git a/Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml b/Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml
index 590eb39d6b93..e4e81ed64136 100644
--- a/Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml
+++ b/Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml
@@ -29,6 +29,12 @@ description: |
   and the switch registers are directly mapped into SoC's memory map rather than
   using MDIO. The DSA driver currently doesn't support MT7620 variants.
 
+  EcoNet EN751221 SoCs have a memory mapped MT7530 with 3x 10/100 PHYs and 1x
+  gigabit PHY. Some EN751221 chips such as EN7513G and EN7526G have a multi-chip
+  module implementation of the MT7530 as well as the on-die switch. In these
+  packages, the multi-chip module is connected to port 5 of the on-die switch
+  via a TRGMII link and allows for 5 gigabit ports.
+
   There is only the standalone version of MT7531.
 
   Port 5 on MT7530 supports various configurations:
@@ -110,6 +116,14 @@ properties:
           Built-in switch of the EcoNet EN7528 SoC
         const: econet,en7528-switch
 
+      - description:
+          Built-in switch of EcoNet EN751221 SoC
+        const: econet,en751221-switch
+
+      - description:
+          Multi-chip module gigabit MT7530 in EN751221 SoC
+        const: econet,en751221-gswitch
+
   reg:
     maxItems: 1
 
@@ -159,8 +173,8 @@ properties:
   mediatek,mcm:
     type: boolean
     description:
-      Used for MT7621AT, MT7621DAT, MT7621ST and MT7623AI SoCs which the MT7530
-      switch is a part of the multi-chip module.
+      Used for MT7621AT, MT7621DAT, MT7621ST, MT7623AI and EN751221 SoCs which
+      the MT7530 switch is a part of the multi-chip module.
 
   reset-gpios:
     description: |
@@ -222,6 +236,20 @@ $defs:
                 phy-mode:
                   const: internal
 
+  mt7530-passthrough-dsa-port:
+    patternProperties:
+      "^(ethernet-)?ports$":
+        patternProperties:
+          "^(ethernet-)?port@[0-6]$":
+            if:
+              required: [ link ]
+            then:
+              properties:
+                reg:
+                  const: 6
+                phy-mode:
+                  const: trgmii
+
   mt7530-dsa-port:
     patternProperties:
       "^(ethernet-)?ports$":
@@ -329,6 +357,7 @@ allOf:
             - airoha,en7581-switch
             - airoha,an7583-switch
             - econet,en7528-switch
+            - econet,en751221-switch
     then:
       $ref: "#/$defs/builtin-dsa-port"
       properties:
@@ -336,6 +365,16 @@ allOf:
         mediatek,mcm: false
         reset-names: false
 
+  - if:
+      properties:
+        compatible:
+          enum:
+            - econet,en751221-gswitch
+    then:
+      $ref: "#/$defs/mt7530-passthrough-dsa-port"
+      required:
+        - mediatek,mcm
+
 unevaluatedProperties: false
 
 examples:
-- 
2.39.5


^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [net-next v5 7/7] net: dsa: mediatek: support EN751221 switch
  2026-11-16 18:33 [net-next v5 0/7] net: dsa: mt7530: support EcoNet EN751221 Caleb James DeLisle
                   ` (5 preceding siblings ...)
  2026-11-16 18:33 ` [net-next v5 6/7] dt-bindings: net: dsa: mediatek,mt7530: add EcoNet EN751221 switches Caleb James DeLisle
@ 2026-11-16 18:33 ` Caleb James DeLisle
  2026-11-17 18:35   ` sashiko-bot
  6 siblings, 1 reply; 14+ messages in thread
From: Caleb James DeLisle @ 2026-11-16 18:33 UTC (permalink / raw)
  To: netdev
  Cc: andrew, olteanv, davem, edumazet, kuba, pabeni, robh, krzk+dt,
	conor+dt, matthias.bgg, angelogioacchino.delregno, chester.a.unal,
	daniel, linux, arinc.unal, Landen.Chao, dqfext, sean.wang,
	devicetree, linux-kernel, linux-arm-kernel, linux-mediatek,
	naseefkm, b.larsson, Caleb James DeLisle

The EcoNet EN751221 has either one, or two, onboard MT7530 switches.
Every implementation of this SoC has one switch on die with the CPU,
but some chips - notably those with a "G" in the name, have a second
MT7530 as an MCM module.

The on-die MT7530 has 4 FE ports and 1 GE port. The MCM switch has all
gigabit ports.

The MCM switch connects to the SoC switch via a TRGMII link from port
5 on the SoC switch to port 6 on the MCM switch. This link undergoes
calibration on startup.

All known devices with the MCM present do not make any use of the ports
on the on-die switch, it is put into "passthrough" mode in which all
traffic is shuttled between port 6 and port 5 without alteration of the
DSA tags.

Add support for both the on-die and the MCM switch, and calibration of
the TRGMII link between them.

Signed-off-by: Caleb James DeLisle <cjd@cjdns.fr>
---
 drivers/net/dsa/mt7530-mdio.c |   1 +
 drivers/net/dsa/mt7530-mmio.c |   1 +
 drivers/net/dsa/mt7530.c      | 344 +++++++++++++++++++++++++++++++++-
 drivers/net/dsa/mt7530.h      |  24 +++
 4 files changed, 366 insertions(+), 4 deletions(-)

diff --git a/drivers/net/dsa/mt7530-mdio.c b/drivers/net/dsa/mt7530-mdio.c
index e85ef2aceee5..7ab6b5521143 100644
--- a/drivers/net/dsa/mt7530-mdio.c
+++ b/drivers/net/dsa/mt7530-mdio.c
@@ -138,6 +138,7 @@ mt7531_create_sgmii(struct mt7530_priv *priv)
 }
 
 static const struct of_device_id mt7530_of_match[] = {
+	{ .compatible = "econet,en751221-gswitch", .data = &mt753x_table[ID_EN751221_EXT], },
 	{ .compatible = "mediatek,mt7621", .data = &mt753x_table[ID_MT7621], },
 	{ .compatible = "mediatek,mt7530", .data = &mt753x_table[ID_MT7530], },
 	{ .compatible = "mediatek,mt7531", .data = &mt753x_table[ID_MT7531], },
diff --git a/drivers/net/dsa/mt7530-mmio.c b/drivers/net/dsa/mt7530-mmio.c
index ab6d92ab3ec0..989fe95ec4f3 100644
--- a/drivers/net/dsa/mt7530-mmio.c
+++ b/drivers/net/dsa/mt7530-mmio.c
@@ -12,6 +12,7 @@
 static const struct of_device_id mt7988_of_match[] = {
 	{ .compatible = "airoha,an7583-switch", .data = &mt753x_table[ID_AN7583], },
 	{ .compatible = "airoha,en7581-switch", .data = &mt753x_table[ID_EN7581], },
+	{ .compatible = "econet,en751221-switch", .data = &mt753x_table[ID_EN751221], },
 	{ .compatible = "econet,en7528-switch", .data = &mt753x_table[ID_EN7528], },
 	{ .compatible = "mediatek,mt7988-switch", .data = &mt753x_table[ID_MT7988], },
 	{ /* sentinel */ }
diff --git a/drivers/net/dsa/mt7530.c b/drivers/net/dsa/mt7530.c
index 4390982a5e22..701e6b3b928f 100644
--- a/drivers/net/dsa/mt7530.c
+++ b/drivers/net/dsa/mt7530.c
@@ -49,6 +49,9 @@ static const struct mt7530_mib_desc mt7530_mib[] = {
 static int
 mt753x_ctrl_phy_addr(struct mt7530_priv *priv)
 {
+	if (priv->id == ID_EN751221)
+		return 12;
+
 	if (WARN_ON_ONCE(!priv->mdiodev))
 		return 0;
 
@@ -349,12 +352,19 @@ mt7530_setup_port6(struct dsa_switch *ds, phy_interface_t interface)
 	regmap_read(priv->regmap, MT753X_MTRAP, &xtal);
 	xtal &= MT7530_XTAL_MASK;
 
+	/* EN751221 on-die does not report clock speed in MTRAP */
+	if (priv->id == ID_EN751221)
+		xtal = MT7530_XTAL_25MHZ;
+
 	if (xtal == MT7530_XTAL_25MHZ)
 		ssc_delta = 0x57;
 	else
 		ssc_delta = 0x87;
 
-	if (priv->id == ID_MT7621) {
+	if (priv->id == ID_EN751221_EXT || priv->id == ID_EN751221) {
+		/* PLL frequency: 362.5Mhz */
+		ncpo1 = 0x1d00;
+	} else if (priv->id == ID_MT7621) {
 		/* PLL frequency: 125MHz: 1.0GBit */
 		if (xtal == MT7530_XTAL_40MHZ)
 			ncpo1 = 0x0640;
@@ -471,6 +481,251 @@ mt7531_pll_setup(struct mt7530_priv *priv)
 	usleep_range(25, 35);
 }
 
+static bool
+en751221_trgmii_cal_ok(struct mt7530_priv *rx, u32 reg)
+{
+	u32 val = 0;
+
+	regmap_read(rx->regmap, reg, &val);
+	regmap_write(rx->regmap, reg, val | EDGE_CHK);
+	regmap_write(rx->regmap, reg, val & ~EDGE_CHK);
+	regmap_read(rx->regmap, reg, &val);
+
+	return FIELD_GET(RD_VALUE_MASK, val) == TGMII_TD_PAT &&
+	       !FIELD_GET(RD_ERR_MASK, val);
+}
+
+static void
+en751221_trgmii_calibrate_direction(struct mt7530_priv *tx,
+				    struct mt7530_priv *rx,
+				    u8 *default_taps)
+{
+	int channel;
+
+	regmap_set_bits(tx->regmap, MT7530_TRGMII_TXCTRL, TRAIN_TXEN);
+
+	/* Put fail pattern on every channel */
+	for (channel = 0; channel < NUM_TRGMII_CTRL; channel++)
+		regmap_update_bits(tx->regmap, EN7530_TRGMII_TD_CTRL(channel),
+				   TGMII_TD_PAT_MASK,
+				   FIELD_PREP(TGMII_TD_PAT_MASK,
+					      TGMII_TD_FAIL_PAT));
+
+	for (channel = 0; channel < NUM_TRGMII_CTRL; channel++) {
+		u32 rx_reg = MT7530_TRGMII_RD(channel);
+		int best_tap = -1, best_range = -1;
+		int first = -1;
+		u8 dac;
+		char log[TD_TAP_MAX + 1];
+
+		/* Put test pattern on correct channel */
+		regmap_update_bits(tx->regmap, EN7530_TRGMII_TD_CTRL(channel),
+				   TGMII_TD_PAT_MASK,
+				   FIELD_PREP(TGMII_TD_PAT_MASK, TGMII_TD_PAT));
+
+		for (dac = 0; dac < TD_TAP_MAX; dac++) {
+			/* Set TAP */
+			regmap_update_bits(rx->regmap, rx_reg, RD_TAP_MASK,
+					   RD_TAP(dac));
+
+			/* Check if we can get a good read */
+			if (en751221_trgmii_cal_ok(rx, rx_reg)) {
+				log[dac] = '+';
+
+				if (first < 0)
+					first = dac;
+
+				if ((dac - first) > best_range) {
+					best_tap = (first + dac) / 2;
+					best_range = dac - first;
+				}
+			} else {
+				log[dac] = '.';
+				first = -1;
+			}
+		}
+
+		log[TD_TAP_MAX] = '\0';
+
+		if (best_tap > -1) {
+			regmap_update_bits(rx->regmap, rx_reg, RD_TAP_MASK,
+					   RD_TAP(best_tap));
+
+			log[best_tap] = 'X';
+
+			dev_info(rx->dev,
+				 "TRGMII lane %d: %s tap %d old %d\n",
+				 channel, log, best_tap, default_taps[channel]);
+		} else {
+			regmap_update_bits(rx->regmap, rx_reg, RD_TAP_MASK,
+					   RD_TAP(default_taps[channel]));
+
+			dev_warn(rx->dev,
+				 "TRGMII lane %d: %s calibration failed, preserving tap %u\n",
+				 channel, log, default_taps[channel]);
+		}
+
+		/* Return channel to failure pattern */
+		regmap_update_bits(tx->regmap, EN7530_TRGMII_TD_CTRL(channel),
+				   TGMII_TD_PAT_MASK,
+				   FIELD_PREP(TGMII_TD_PAT_MASK,
+					      TGMII_TD_FAIL_PAT));
+	}
+
+	regmap_clear_bits(tx->regmap, MT7530_TRGMII_TXCTRL, TRAIN_TXEN);
+}
+
+static void
+en751221_set_tx_drive(struct mt7530_priv *priv, u8 drvp, u8 drvn, u8 clk_drvp,
+		      u8 clk_drvn)
+{
+	int channel;
+
+	/* Tx driving for TRGMII path on SoC */
+	for (channel = 0; channel < NUM_TRGMII_CTRL; channel++)
+		regmap_write(priv->regmap, MT7530_TRGMII_TD_ODT(channel),
+			     TD_DM_DRVP(drvp) | TD_DM_DRVN(drvn));
+
+	/* Undocumented 6th channel, probably drive strength for clock line. */
+	regmap_write(priv->regmap, MT7530_TRGMII_TD_ODT(5), TD_DM_DRVP(clk_drvp) |
+		     TD_DM_DRVN(clk_drvn));
+}
+
+static void
+en751221_trgmii_pair_setup(struct mt7530_priv *ext, int ext_port,
+			   struct mt7530_priv *ondie, int ondie_port)
+{
+	u8 default_taps_ondie[NUM_TRGMII_CTRL];
+	u8 default_taps_ext[NUM_TRGMII_CTRL];
+	u32 mcr_down, mcr_up;
+	int channel;
+	int reg_val;
+
+	/* BOTH: Put interfaces in a downed state */
+	mcr_down = PMCR_IFG_XMIT(PMCR_IFG_XMIT_64) | PMCR_MAC_MODE |
+		   MT7530_FORCE_MODE | PMCR_MAC_RX_EN | PMCR_BACKOFF_EN |
+		   PMCR_BACKPR_EN | PMCR_FORCE_SPEED_1000 | PMCR_FORCE_FDX;
+	regmap_write(ondie->regmap,  MT753X_PMCR_P(ondie_port), mcr_down);
+	regmap_write(ext->regmap, MT753X_PMCR_P(ext_port), mcr_down);
+	usleep_range(5000, 6000);
+
+	/* BOTH: Reset TX */
+	regmap_set_bits(ext->regmap, MT7530_TRGMII_TXCTRL, TX_RST);
+	regmap_set_bits(ondie->regmap, MT7530_TRGMII_TXCTRL, TX_RST);
+	usleep_range(5000, 6000);
+	regmap_clear_bits(ext->regmap, MT7530_TRGMII_TXCTRL, TX_RST);
+	regmap_clear_bits(ondie->regmap, MT7530_TRGMII_TXCTRL, TX_RST);
+
+	/* BOTH: Reset RX controllers down */
+	regmap_set_bits(ext->regmap, MT7530_TRGMII_RCK_CTRL, RX_RST);
+	regmap_set_bits(ondie->regmap, MT7530_TRGMII_RCK_CTRL, RX_RST);
+
+	/* BOTH: Set TX drive strength, MCM uses more */
+	en751221_set_tx_drive(ondie, 8, 8, 7, 7);
+	en751221_set_tx_drive(ext, 11, 11, 15, 15);
+
+	/* BOTH: Reset RX controllers up */
+	regmap_clear_bits(ext->regmap, MT7530_TRGMII_RCK_CTRL, RX_RST);
+	regmap_clear_bits(ondie->regmap, MT7530_TRGMII_RCK_CTRL, RX_RST);
+
+	/* BOTH: Ports up */
+	mcr_up = mcr_down | PMCR_MAC_TX_EN | PMCR_FORCE_LNK;
+	regmap_write(ondie->regmap, MT753X_PMCR_P(ondie_port), mcr_up);
+	regmap_write(ext->regmap, MT753X_PMCR_P(ext_port), mcr_up);
+
+	/* MCM: Set Ext->SoC TX delay to 0 */
+	for (channel = 0; channel < NUM_TRGMII_CTRL; channel++)
+		regmap_clear_bits(ext->regmap, EN7530_TRGMII_TD_CTRL(channel),
+				  TGMII_TD_TAP_MASK);
+
+	/* SOC: ODT */
+	regmap_set_bits(ondie->regmap, MT7530_TRGMII_RCK_RTT,
+			DQS1_GATE | DQS0_GATE | EN751221_B17);
+
+	/* SOC: Undocumented */
+	for (channel = 0; channel < NUM_TRGMII_CTRL; channel++)
+		regmap_write(ondie->regmap,  (0x7a14 + channel * 8),
+			     0x3227700);
+
+	/* MCM: Spread spectrum clock*/
+	core_clear(ext, CORE_PLL_GROUP8, RG_LCDDS_SSC_EN);
+
+	/* BOTH: Zero clock delay */
+	regmap_clear_bits(ext->regmap, MT7530_TRGMII_RCK_CTRL,
+			  DQSI0_TAP_MASK);
+	regmap_clear_bits(ondie->regmap, MT7530_TRGMII_RCK_CTRL,
+			  DQSI0_TAP_MASK);
+
+	/* BOTH: Collect and then zero every RX TAP */
+	for (channel = 0; channel < NUM_TRGMII_CTRL; channel++) {
+		reg_val = 0;
+		regmap_read(ext->regmap, MT7530_TRGMII_RD(channel), &reg_val);
+		default_taps_ext[channel] = FIELD_GET(RD_TAP_MASK, reg_val);
+		regmap_clear_bits(ext->regmap, MT7530_TRGMII_RD(channel),
+				  RD_TAP_MASK);
+
+		reg_val = 0;
+		regmap_read(ondie->regmap, MT7530_TRGMII_RD(channel), &reg_val);
+		default_taps_ondie[channel] = FIELD_GET(RD_TAP_MASK, reg_val);
+		regmap_clear_bits(ondie->regmap, MT7530_TRGMII_RD(channel),
+				  RD_TAP_MASK);
+	}
+
+	en751221_trgmii_calibrate_direction(ondie, ext, default_taps_ext);
+	en751221_trgmii_calibrate_direction(ext, ondie, default_taps_ondie);
+
+	dev_info(ondie->dev, "TRGMII inter-switch link initialized\n");
+}
+
+static void
+mt7530_cal_interswitch_trgmii(struct dsa_port *dp)
+{
+	struct dsa_switch *ds = dp->ds;
+	struct dsa_switch *peer_ds;
+	struct dsa_port *peer_dp;
+	struct mt7530_priv *peer;
+	struct mt7530_priv *priv;
+	struct dsa_link *dl;
+	u32 pmsr = 0;
+
+	priv = ds->priv;
+
+	if (priv->id != ID_EN751221_EXT)
+		return;
+
+	if (dp->type != DSA_PORT_TYPE_DSA)
+		return;
+
+	regmap_read(priv->regmap, MT7530_PMSR_P(dp->index), &pmsr);
+
+	if (!(pmsr & PMSR_LINK))
+		return;
+
+	list_for_each_entry(dl, &ds->dst->rtable, list) {
+		if (dl->dp != dp)
+			continue;
+
+		peer_dp = dl->link_dp;
+
+		if (peer_dp->type != DSA_PORT_TYPE_DSA)
+			continue;
+
+		peer_ds = dl->link_dp->ds;
+
+		if (!of_device_is_compatible(peer_ds->dev->of_node,
+					     "econet,en751221-switch"))
+			continue;
+
+		peer = peer_ds->priv;
+
+		if (peer->id != ID_EN751221)
+			continue;
+
+		en751221_trgmii_pair_setup(priv, dp->index, peer,
+					   peer_dp->index);
+	}
+}
+
 static void
 mt7530_mib_reset(struct dsa_switch *ds)
 {
@@ -1482,7 +1737,8 @@ mt7530_port_enable(struct dsa_switch *ds, int port,
 
 	mutex_unlock(&priv->reg_mutex);
 
-	if (priv->id != ID_MT7530 && priv->id != ID_MT7621)
+	if (priv->id != ID_MT7530 && priv->id != ID_MT7621 &&
+	    priv->id != ID_EN751221 && priv->id != ID_EN751221_EXT)
 		return 0;
 
 	if (port == 5)
@@ -1509,7 +1765,8 @@ mt7530_port_disable(struct dsa_switch *ds, int port)
 
 	mutex_unlock(&priv->reg_mutex);
 
-	if (priv->id != ID_MT7530 && priv->id != ID_MT7621)
+	if (priv->id != ID_MT7530 && priv->id != ID_MT7621 &&
+	    priv->id != ID_EN751221 && priv->id != ID_EN751221_EXT)
 		return;
 
 	/* Do not set MT7530_P5_DIS when port 5 is being used for PHY muxing. */
@@ -2692,6 +2949,12 @@ mt7530_setup(struct dsa_switch *ds)
 	regmap_set_bits(priv->regmap, MT7530_TOP_SIG_CTRL,
 			TOP_SIG_CTRL_NORMAL);
 
+	/* EN751221 MCM starts on the wrong frequency */
+	if (priv->id == ID_EN751221_EXT)
+		regmap_update_bits(priv->regmap, MT753X_MTRAP,
+				   MT7530_CHG_TRAP | MT7530_CK_SEL,
+				   MT7530_CHG_TRAP);
+
 	if ((val & MT7530_XTAL_MASK) == MT7530_XTAL_40MHZ)
 		mt7530_pll_setup(priv);
 
@@ -3114,6 +3377,44 @@ static void en7528_mac_port_get_caps(struct dsa_switch *ds, int port,
 	}
 }
 
+static void en751221_mac_port_get_caps(struct dsa_switch *ds, int port,
+				       struct phylink_config *config)
+{
+	switch (port) {
+	/* EN751221 ports 0..3 are connected to the integrated FE PHYs. */
+	case 0 ... 3:
+		__set_bit(PHY_INTERFACE_MODE_INTERNAL,
+			  config->supported_interfaces);
+
+		config->mac_capabilities |= MAC_10 | MAC_100;
+		break;
+
+	/* Port 4 is connected to the standalone EN7512/EN7521 GPHY. */
+	case 4:
+		__set_bit(PHY_INTERFACE_MODE_INTERNAL,
+			  config->supported_interfaces);
+
+		config->mac_capabilities |= MAC_10 | MAC_100 | MAC_1000FD;
+		break;
+
+	/* Port 5 is the 1 Gbit/s TRGMII cascade to the external MT7530. */
+	case 5:
+		__set_bit(PHY_INTERFACE_MODE_TRGMII,
+			  config->supported_interfaces);
+
+		config->mac_capabilities |= MAC_1000FD;
+		break;
+
+	/* Port 6 is the 1 Gbit/s CPU link to GDM1. */
+	case 6:
+		__set_bit(PHY_INTERFACE_MODE_INTERNAL,
+			  config->supported_interfaces);
+
+		config->mac_capabilities |= MAC_1000FD;
+		break;
+	}
+}
+
 static void
 mt7530_mac_config(struct dsa_switch *ds, int port, unsigned int mode,
 		  phy_interface_t interface)
@@ -3263,6 +3564,9 @@ static void mt753x_phylink_mac_link_up(struct phylink_config *config,
 	}
 
 	regmap_set_bits(priv->regmap, MT753X_PMCR_P(dp->index), mcr);
+
+	if (interface == PHY_INTERFACE_MODE_TRGMII)
+		mt7530_cal_interswitch_trgmii(dp);
 }
 
 static void mt753x_phylink_mac_disable_tx_lpi(struct phylink_config *config)
@@ -3524,7 +3828,8 @@ mt753x_conduit_state_change(struct dsa_switch *ds,
 	 */
 	if (priv->id != ID_MT7530 && priv->id != ID_MT7621 &&
 	    priv->id != ID_EN7528 &&
-	    priv->id != ID_EN7581 && priv->id != ID_AN7583)
+	    priv->id != ID_EN7581 && priv->id != ID_AN7583 &&
+	    priv->id != ID_EN751221 && priv->id != ID_EN751221_EXT)
 		return;
 
 	mask = BIT(cpu_dp->index);
@@ -3617,6 +3922,15 @@ static int mt7988_setup(struct dsa_switch *ds)
 				   AN7583_CSR_PHY_CORE_REG_CLK_SEL |
 				   FIELD_PREP(AN7583_CSR_ETHER_AFE_PWD, 0));
 
+	/*
+	 * EN751221 is an MT7530 but it is MMIO so setup is largely the same
+	 * as the MMIO MT7531, but CHG_TRAP and INDIRECT_ACCESS must be set.
+	 */
+	if (priv->id == ID_EN751221)
+		regmap_update_bits(priv->regmap, MT753X_MTRAP,
+				   MT7530_CHG_TRAP | MT7530_PHY_INDIRECT_ACCESS,
+				   MT7530_CHG_TRAP);
+
 	/* Reset the switch PHYs */
 	regmap_write(priv->regmap, MT7530_SYS_CTRL, SYS_CTRL_PHY_RST);
 
@@ -3839,6 +4153,28 @@ const struct mt753x_info mt753x_table[] = {
 		.phy_write_c45 = mt7531_ind_c45_phy_write,
 		.mac_port_get_caps = en7528_mac_port_get_caps,
 	},
+	[ID_EN751221] = {
+		.id = ID_EN751221,
+		.pcs_ops = &mt7530_pcs_ops,
+		.sw_setup = mt7988_setup,
+		.phy_read_c22 = mt7531_ind_c22_phy_read,
+		.phy_write_c22 = mt7531_ind_c22_phy_write,
+		.phy_read_c45 = mt7531_ind_c45_phy_read,
+		.phy_write_c45 = mt7531_ind_c45_phy_write,
+		.mac_port_get_caps = en751221_mac_port_get_caps,
+		.mac_port_config = mt7530_mac_config,
+	},
+	[ID_EN751221_EXT] = {
+		.id = ID_EN751221_EXT,
+		.pcs_ops = &mt7530_pcs_ops,
+		.sw_setup = mt7530_setup,
+		.phy_read_c22 = mt7530_phy_read_c22,
+		.phy_write_c22 = mt7530_phy_write_c22,
+		.phy_read_c45 = mt7530_phy_read_c45,
+		.phy_write_c45 = mt7530_phy_write_c45,
+		.mac_port_get_caps = mt7530_mac_port_get_caps,
+		.mac_port_config = mt7530_mac_config,
+	},
 };
 EXPORT_SYMBOL_GPL(mt753x_table);
 
diff --git a/drivers/net/dsa/mt7530.h b/drivers/net/dsa/mt7530.h
index c86bc4bca29b..1a4329749c0f 100644
--- a/drivers/net/dsa/mt7530.h
+++ b/drivers/net/dsa/mt7530.h
@@ -24,6 +24,8 @@ enum mt753x_id {
 	ID_EN7581 = 4,
 	ID_AN7583 = 5,
 	ID_EN7528 = 6,
+	ID_EN751221 = 7,
+	ID_EN751221_EXT = 8,
 };
 
 #define	NUM_TRGMII_CTRL			5
@@ -356,6 +358,9 @@ enum mt7530_vlan_port_acc_frm {
 #define MT753X_PMCR_P(x)		(0x3000 + ((x) * 0x100))
 #define  PMCR_IFG_XMIT_MASK		GENMASK(19, 18)
 #define  PMCR_IFG_XMIT(x)		FIELD_PREP(PMCR_IFG_XMIT_MASK, x)
+#define    PMCR_IFG_XMIT_96		0
+#define    PMCR_IFG_XMIT_RAND		1
+#define    PMCR_IFG_XMIT_64		2
 #define  PMCR_EXT_PHY			BIT(17)
 #define  PMCR_MAC_MODE			BIT(16)
 #define  MT7530_FORCE_MODE		BIT(15)
@@ -584,6 +589,7 @@ enum mt7531_clk_skew {
 #define MT753X_MTRAP			0x7804
 #define  MT7530_P5_PHY0_SEL		BIT(20)
 #define  MT7530_CHG_TRAP		BIT(16)
+#define  MT7530_CK_SEL			BIT(15)
 #define  MT7530_LOOP_DET_DISABLE	BIT(14)
 #define  MT7530_P5_MAC_SEL		BIT(13)
 #define  MT7530_P6_DIS			BIT(8)
@@ -601,6 +607,8 @@ enum mt7531_xtal_fsel {
 /* Register for TOP signal control */
 #define MT7530_TOP_SIG_CTRL		0x7808
 #define  TOP_SIG_CTRL_NORMAL		(BIT(17) | BIT(16))
+/* Undocumented */
+#define  TOP_SIG_CTRL_B0		BIT(0)
 
 #define MT7531_TOP_SIG_SR		0x780c
 #define  PAD_DUAL_SGMII_EN		BIT(1)
@@ -647,18 +655,31 @@ enum mt7531_xtal_fsel {
 #define MT7530_TRGMII_RCK_RTT		0x7a04
 #define  DQS1_GATE			BIT(31)
 #define  DQS0_GATE			BIT(30)
+/* Undocumented */
+#define  EN751221_B17			BIT(17)
 
 #define MT7530_TRGMII_RD(x)		(0x7a10 + (x) * 8)
 #define  BSLIP_EN			BIT(31)
 #define  EDGE_CHK			BIT(30)
+#define  RD_VALUE_MASK			GENMASK(23, 16)
+#define  RD_ERR_MASK			GENMASK(11, 8)
 #define  RD_TAP_MASK			GENMASK(6, 0)
 #define  RD_TAP(x)			FIELD_PREP(RD_TAP_MASK, x)
+/* Training does not try anything beyond this */
+#define  TD_TAP_MAX			64
 
 #define MT7530_TRGMII_TXCTRL		0x7a40
 #define  TRAIN_TXEN			BIT(31)
 #define  TXC_INV			BIT(30)
 #define  TX_RST				BIT(28)
 
+#define EN7530_TRGMII_TD_CTRL(x)	(0x7a50 + (x) * 8)
+#define   TGMII_TD_TAP_MASK		GENMASK(11, 8)
+#define   TGMII_TD_PAT_MASK		GENMASK(7, 0)
+/* Use a 01010101 bit pattern */
+#define   TGMII_TD_PAT			0x55
+#define   TGMII_TD_FAIL_PAT		0xaa
+
 #define MT7530_TRGMII_TD_ODT(i)		(0x7a54 + 8 * (i))
 #define  TD_DM_DRVP_MASK		GENMASK(3, 0)
 #define  TD_DM_DRVP(x)			FIELD_PREP(TD_DM_DRVP_MASK, x)
@@ -764,6 +785,9 @@ enum mt7531_xtal_fsel {
 #define  RG_LCCDS_C(x)			FIELD_PREP(RG_LCCDS_C_MASK, x)
 #define  RG_LCDDS_PCW_NCPO_CHG		BIT(3)
 
+#define CORE_PLL_GROUP8			0x407
+#define  RG_LCDDS_SSC_EN		BIT(10)
+
 #define CORE_PLL_GROUP10		0x409
 #define  RG_LCDDS_SSC_DELTA_MASK	GENMASK(11, 0)
 #define  RG_LCDDS_SSC_DELTA(x)		FIELD_PREP(RG_LCDDS_SSC_DELTA_MASK, x)
-- 
2.39.5


^ permalink raw reply related	[flat|nested] 14+ messages in thread

* Re: [net-next v5 3/7] net: dsa: mediatek: add support for passthrough mode
  2026-11-16 18:33 ` [net-next v5 3/7] net: dsa: mediatek: add support for passthrough mode Caleb James DeLisle
@ 2026-11-17  0:30   ` kernel test robot
  2026-11-17 18:35   ` sashiko-bot
  1 sibling, 0 replies; 14+ messages in thread
From: kernel test robot @ 2026-11-17  0:30 UTC (permalink / raw)
  To: Caleb James DeLisle, netdev
  Cc: llvm, oe-kbuild-all, andrew, olteanv, davem, edumazet, kuba,
	pabeni, robh, krzk+dt, conor+dt, matthias.bgg,
	angelogioacchino.delregno, chester.a.unal, daniel, linux,
	arinc.unal, Landen.Chao, dqfext, sean.wang, devicetree,
	linux-kernel, linux-arm-kernel, linux-mediatek, naseefkm,
	b.larsson, Caleb James DeLisle

Hi Caleb,

kernel test robot noticed the following build warnings:

[auto build test WARNING on 7ccc5e05043b1bb84326b19a2b05938d8f7a2ae6]

url:    https://github.com/intel-lab-lkp/linux/commits/Caleb-James-DeLisle/net-dsa-mt7530-get-ctrl-phy-addr-using-a-function/20261116-183326
base:   7ccc5e05043b1bb84326b19a2b05938d8f7a2ae6
patch link:    https://lore.kernel.org/r/20261116183332.168858-4-cjd%40cjdns.fr
patch subject: [net-next v5 3/7] net: dsa: mediatek: add support for passthrough mode
config: arm-randconfig-1003-20261117 (https://download.01.org/0day-ci/archive/20261117/202611170845.l4X9RRsI-lkp@intel.com/config)
compiler: clang version 17.0.6 (https://github.com/llvm/llvm-project 6009708b4367171ccdbf4b5905cb6a803753fe18)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20261117/202611170845.l4X9RRsI-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202611170845.l4X9RRsI-lkp@intel.com/

All warnings (new ones prefixed by >>):

>> Warning: drivers/net/dsa/mt7530.c:1410 function parameter 'dp' not described in 'mt753x_upstream_port_index'
>> Warning: drivers/net/dsa/mt7530.c:1410 function parameter 'dp' not described in 'mt753x_upstream_port_index'

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [net-next v5 3/7] net: dsa: mediatek: add support for passthrough mode
  2026-11-16 18:33 ` [net-next v5 3/7] net: dsa: mediatek: add support for passthrough mode Caleb James DeLisle
  2026-11-17  0:30   ` kernel test robot
@ 2026-11-17 18:35   ` sashiko-bot
  1 sibling, 0 replies; 14+ messages in thread
From: sashiko-bot @ 2026-11-17 18:35 UTC (permalink / raw)
  To: Caleb James DeLisle; +Cc: devicetree, robh, conor+dt

Thank you for your contribution! Sashiko AI review found 5 potential
issues to consider:
- [Medium] net: dsa: mt7530: wrong upstream port in
  mt753x_conduit_state_change()
- [Medium] net: dsa: mt7530: broken CPU port fallback in
  mt753x_upstream_port_index()
- [Medium] net: dsa: mt7530: NULL dp->user dereference in
  mt7531_mac_config() on DSA port
- [Medium] net: dsa: mt7530: unchecked MT753X_MTRAP write in
  mt753x_cpu_port_enable()
- [Low] net: dsa: mt7530: dead no-op callbacks in
  mt7530_passthrough_switch_ops
--

commit c217d406c794dac728f46979f906b1ad1d787a4d
Author: Caleb James DeLisle <cjd@cjdns.fr>

net: dsa: mediatek: add support for passthrough mode

This commit adds passthrough mode support to the mt7530 DSA driver so an
upstream MediaTek switch can forward traffic unaltered to and from a
downstream MediaTek switch.

> diff --git a/drivers/net/dsa/mt7530.c b/drivers/net/dsa/mt7530.c
> index 3bfe29b3b93e2..09b7e9d2d0253 100644
> --- a/drivers/net/dsa/mt7530.c
> +++ b/drivers/net/dsa/mt7530.c

[ ... ]

> @@ -1286,13 +1297,81 @@ mt753x_trap_frames(struct mt7530_priv *priv)
> +/* If this switch is downstream of another switch that is in passthrough mode,
> + * the "CPU" port is actually a DSA port.
> + */
>  static void
>  mt753x_cpu_port_enable(struct dsa_switch *ds, int port)
>  {
>  	struct mt7530_priv *priv = ds->priv;
>  
> -	/* Enable Mediatek header mode on the cpu port */
> -	regmap_write(priv->regmap, MT7530_PVC_P(port), PORT_SPEC_TAG);
> +	if (priv->is_passthrough) {
> +		/* Disable parsing of the DSA tag, it will be forwarded blindly
> +		 * to the downstream switch.
> +		 */
> +		regmap_write(priv->regmap, MT7530_PVC_P(port),
> +			     VLAN_ATTR(MT7530_VLAN_TRANSPARENT) |
> +			     PVC_EG_TAG(MT7530_VLAN_EG_DISABLED));
> +
> +		/* The port is not configured to parse DSA tags, so they are
> +		 * liable to be confused for length fields, so length check is
> +		 * disabled.
> +		 */
> +		regmap_clear_bits(priv->regmap, MT753X_AGC, AGC_L2LEN_CHK);
> +
> +		/* In passthrough mode, MTU is only enforced downstream */
> +		mt7530_port_change_mtu(ds, port, MT7530_MAX_MTU);
> +
> +		/* Loop detection has no value in passthrough mode */
> +		regmap_set_bits(priv->regmap, MT753X_MTRAP,
> +				MT7530_LOOP_DET_DISABLE);

[Severity: Medium]
Should this MT753X_MTRAP write be guarded by a priv->id check?

mt753x_cpu_port_enable() runs from both mt7530_setup() and
mt7531_setup_common(), and MT753X_MTRAP (0x7804) has a different bit layout
on MT7531-family switches (where other MT7530_* trap accesses in
mt7530_port_enable() and mt7530_port_disable() check priv->id first).  Also,
on ID_EN7528 (an MT7530 core initialized via mt7988_setup()),
MT7530_CHG_TRAP is never set before modifying MT753X_MTRAP.

[ ... ]

> @@ -1318,12 +1397,36 @@ mt753x_cpu_port_enable(struct dsa_switch *ds, int port)
>  			   PCR_PORT_VLAN_MASK, MT7530_PORT_FALLBACK_MODE);
>  }
>  
> +/**
> + * mt753x_upstream_port_index - get the index of the upstream port.
> + *
> + * If the CPU port is local then this is the upstream port, but in the case of
> + * hierarchy the CPU port may be on another switch and the upstream port is
> + * then the DSA port pointing toward that CPU port. Note that
> + * dsa_switch_upstream_port() is not reliable because the conduit for a given
> + * port can be customized.
> + */
> +static int
> +mt753x_upstream_port_index(struct dsa_port *dp)
> +{
> +	struct dsa_port *cpu_dp = dp->cpu_dp;
> +
> +	/* Early port_enable on CPU port happens before cpu_dp is set. */
> +	if (!cpu_dp)
> +		return dsa_switch_upstream_port(dp->ds);
> +
> +	return dsa_towards_port(dp->ds, cpu_dp->ds->index, cpu_dp->index);
> +}

[Severity: Medium]
Does mt753x_upstream_port_index() return the wrong port when called on a
non-default CPU port?

In DSA, dp->cpu_dp is only populated on user and DSA ports and remains NULL
on CPU ports.  On a switch with multiple CPU ports (such as MT7531 with
ports 5 and 6), calling mt753x_upstream_port_index() on CPU port 5 hits the
!cpu_dp branch and returns dsa_switch_upstream_port(dp->ds) (port 6).  In
mt7530_hw_vlan_add(), the check:

	if (dp->index == mt753x_upstream_port_index(dp))
		val = MT7530_VLAN_EGRESS_STACK;

then evaluates to false for CPU port 5, configuring it as untagged or
tagged instead of MT7530_VLAN_EGRESS_STACK.

dsa_upstream_port(ds, port) and dsa_is_upstream_port(ds, port) in
include/net/dsa.h already handle both per-port dp->cpu_dp routing and
returning port directly when dp->cpu_dp is NULL, so using those helpers
avoids this regression.  Also, the /** kernel-doc comment on
mt753x_upstream_port_index() omits @dp, which triggers a W=1 kernel-doc
warning.

[ ... ]

> @@ -2635,7 +2818,7 @@ mt7531_setup_common(struct dsa_switch *ds)
>  		regmap_set_bits(priv->regmap, MT7531_DBG_CNT(i),
>  				MT7531_DIS_CLR);
>  
> -		if (dsa_is_cpu_port(ds, i)) {
> +		if (dsa_is_upstream_port(ds, i)) {
>  			mt753x_cpu_port_enable(ds, i);
>  		} else {
>  			mt7530_port_disable(ds, i);

[Severity: Medium]
Can enabling a DSA cascade port on MT7531 cause a NULL pointer dereference
in mt7531_mac_config()?

When port 5 on an MT7531 switch is configured in RGMII mode as an upstream
or downstream DSA link port (DSA_PORT_TYPE_DSA), dp->user is NULL, but
mt7531_mac_config() unconditionally dereferences it during phylink startup:

drivers/net/dsa/mt7530.c:mt7531_mac_config() {
	...
	if (phy_interface_mode_is_rgmii(interface)) {
		dp = dsa_to_port(ds, port);
		phydev = dp->user->phydev;
		mt7531_rgmii_setup(priv, interface, phydev);
	}
	...
}

[ ... ]

> @@ -3402,6 +3600,96 @@ static int mt7988_setup(struct dsa_switch *ds)
> +/* No manipulation of forwarding rules allowed in passthrough mode */
> +static const struct dsa_switch_ops mt7530_passthrough_switch_ops = {
> +	.get_tag_protocol       = mtk_get_tag_protocol,
> +	.setup                  = mt753x_setup,
> +	.teardown               = mt753x_teardown,
> +	.preferred_default_local_cpu_port = mt753x_preferred_default_local_cpu_port,
> +	.port_change_conduit	= mt753x_passthrough_port_change_conduit,
> +	.get_strings            = mt7530_get_strings,
> +	.get_ethtool_stats      = mt7530_get_ethtool_stats,
> +	.get_sset_count         = mt7530_get_sset_count,
> +	.get_eth_mac_stats      = mt7530_get_eth_mac_stats,
> +	.get_rmon_stats         = mt7530_get_rmon_stats,
> +	.get_eth_ctrl_stats     = mt7530_get_eth_ctrl_stats,
> +	.get_stats64            = mt7530_get_stats64,
> +	.set_ageing_time	= mt7530_passthrough_set_ageing_time,
> +	.port_enable            = mt7530_port_enable,
> +	.port_disable           = mt7530_port_disable,
> +	.port_change_mtu	= mt7530_passthrough_port_change_mtu,
> +	.port_max_mtu		= mt7530_port_max_mtu,
> +	.port_stp_state_set	= mt7530_passthrough_stp_state_set,
> +	.port_pre_bridge_flags	= mt7530_port_pre_bridge_flags,
> +	.port_bridge_flags	= mt7530_passthrough_port_bridge_flags,
> +	.port_bridge_join	= mt7530_passthrough_port_bridge_join,
> +	.port_bridge_leave	= mt7530_passthrough_port_bridge_leave,
> +	.port_fast_age		= mt7530_passthrough_port_fast_age,
> +	.port_fdb_add		= mt7530_passthrough_port_fdb_add,
> +	.port_fdb_del		= mt7530_passthrough_port_fdb_del,
> +	.port_fdb_dump		= mt7530_port_fdb_dump,
> +	.port_mdb_add		= mt7530_passthrough_port_mdb_add,
> +	.port_mdb_del		= mt7530_passthrough_port_mdb_del,
> +	.port_vlan_filtering	= mt7530_passthrough_port_vlan_filtering,
> +	.port_vlan_add		= mt7530_passthrough_port_vlan_add,
> +	.port_vlan_del		= mt7530_passthrough_port_vlan_del,
> +	.port_mirror_add	= mt753x_passthrough_port_mirror_add,
> +	.port_mirror_del	= mt753x_passthrough_port_mirror_del,
> +	.phylink_get_caps       = mt753x_phylink_get_caps,
> +	.support_eee            = dsa_supports_eee,
> +	.set_mac_eee            = mt753x_set_mac_eee,

[Severity: Low]
This isn't a bug, but most of the new no-op callbacks in
mt7530_passthrough_switch_ops appear unnecessary.  Because
mt753x_check_passthrough() requires the switch to have only one CPU port
and one DSA link port (and no user ports), only the tree-wide notifier
callbacks (.port_change_mtu, .port_fdb_add, .port_fdb_del, .port_mdb_add,
.port_mdb_del, .port_vlan_add, and .port_vlan_del) need no-op stubs to
avoid returning -EOPNOTSUPP.

.set_ageing_time, .port_stp_state_set, and .port_fast_age already default
to no-ops in the DSA core when left NULL, while .port_bridge_join,
.port_bridge_leave, .port_bridge_flags, .port_vlan_filtering,
.port_mirror_add, .port_mirror_del, .port_change_conduit, and
.port_setup_tc (along with user-port-only callbacks like
.port_pre_bridge_flags, .port_fdb_dump, .port_max_mtu, .support_eee,
.set_mac_eee, .port_hsr_join, and .port_hsr_leave) are never called on a
switch with no user ports.

> +	.conduit_state_change   = mt753x_conduit_state_change,

[Severity: Medium]
Does mt753x_conduit_state_change() program the wrong CPU port on a
downstream switch?

DSA broadcasts DSA_NOTIFIER_CONDUIT_STATE_CHANGE to every switch in the
tree, with cpu_dp = conduit->dsa_ptr pointing to the CPU port on the
upstream switch:

drivers/net/dsa/mt7530.c:mt753x_conduit_state_change() {
	...
	mask = BIT(cpu_dp->index);

	if (operational)
		priv->active_cpu_ports |= mask;
	else
		priv->active_cpu_ports &= ~mask;

	if (priv->active_cpu_ports) {
		val = MT7530_CPU_EN |
		      MT7530_CPU_PORT(__ffs(priv->active_cpu_ports));
	}

	regmap_update_bits(priv->regmap, MT753X_MFC,
			   MT7530_CPU_EN | MT7530_CPU_PORT_MASK, val);
	...
}

When a downstream switch's local upstream DSA port index differs from the
upstream switch's CPU port index (for example, upstream CPU port 6 wired to
downstream port 5), MT7530_CPU_PORT is set to cpu_dp->index instead of
dsa_towards_port(ds, cpu_dp->ds->index, cpu_dp->index), sending trapped
control frames (BPDUs, PAE, LLDP, LACP) to the wrong port on the downstream
switch.  In addition, wiring mt753x_conduit_state_change() in
mt7530_passthrough_switch_ops sets MT7530_CPU_EN on the passthrough switch
even though trapping is disabled in passthrough mode.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261116183332.168858-1-cjd@cjdns.fr?part=3

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [net-next v5 4/7] net: dsa: mediatek: support PLL setup on MMIO MT7530
  2026-11-16 18:33 ` [net-next v5 4/7] net: dsa: mediatek: support PLL setup on MMIO MT7530 Caleb James DeLisle
@ 2026-11-17 18:35   ` sashiko-bot
  0 siblings, 0 replies; 14+ messages in thread
From: sashiko-bot @ 2026-11-17 18:35 UTC (permalink / raw)
  To: Caleb James DeLisle; +Cc: devicetree, robh, conor+dt

Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Medium] net: dsa: mt7530: missing child_bus mdio_lock in core_write()
  and core_rmw()
--

commit 6d735d3a6c864581e5a423bea72209587b069abd
Author: Caleb James DeLisle <cjd@cjdns.fr>

net: dsa: mediatek: support PLL setup on MMIO MT7530

This commit saves the switch's child MDIO bus in priv->child_bus and falls
back to it in core_write() and core_rmw() when priv->bus is NULL so MMIO
MT7530 switches can configure core PLL registers via MDIO.

> diff --git a/drivers/net/dsa/mt7530.c b/drivers/net/dsa/mt7530.c
> index 09b7e9d2d0253..53ac692d5ba93 100644
> --- a/drivers/net/dsa/mt7530.c
> +++ b/drivers/net/dsa/mt7530.c
> @@ -77,6 +77,12 @@ core_write(struct mt7530_priv *priv, u32 reg, u32 val)
>  	struct mii_bus *bus = priv->bus;
>  	int ret;
>  
> +	if (!bus)
> +		bus = priv->child_bus;
> +
> +	if (WARN_ON_ONCE(!bus))
> +		return;
> +
>  	mt7530_mutex_lock(priv);
>  
>  	/* Write the desired MMD Devad */
> @@ -112,6 +118,12 @@ core_rmw(struct mt7530_priv *priv, u32 reg, u32 mask, u32 set)
>  	u32 val;
>  	int ret;
>  
> +	if (!bus)
> +		bus = priv->child_bus;
> +
> +	if (WARN_ON_ONCE(!bus))
> +		return;
> +
>  	mt7530_mutex_lock(priv);
>  
>  	/* Write the desired MMD Devad */

[Severity: Medium]
Does falling back to priv->child_bus in core_write() and core_rmw() leave
the multi-step Clause 22 MMD sequence unlocked when priv->bus is NULL?

mt7530_mutex_lock() and mt7530_mutex_unlock() only lock priv->bus->mdio_lock:

drivers/net/dsa/mt7530.c:mt7530_mutex_lock() {
	if (priv->bus)
		mutex_lock_nested(&priv->bus->mdio_lock, MDIO_MUTEX_NESTED);
}

When priv->bus is NULL on an MMIO MT7530 switch, mt7530_mutex_lock() is a
no-op, and core_write() and core_rmw() invoke raw bus->write() and
bus->read() callbacks across four or five MII_MMD_CTRL and MII_MMD_DATA
transfers without holding priv->child_bus->mdio_lock.  Although each
individual Clause 22 transfer takes priv->reg_mutex inside
mt7531_ind_c22_phy_read() and mt7531_ind_c22_phy_write(), priv->reg_mutex is
dropped between transfers, so phylib polling or other activity on
priv->child_bus can interleave between MII_MMD_CTRL and MII_MMD_DATA and
corrupt the MMD register access (for example during mt7530_mac_config() ->
mt7530_setup_port6()).

Locking bus->mdio_lock when falling back to priv->child_bus will not
deadlock because core_write() and core_rmw() call bus->write() and
bus->read() directly rather than mdiobus_write() or mdiobus_read(), and the
underlying MMIO callbacks only acquire priv->reg_mutex.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261116183332.168858-1-cjd@cjdns.fr?part=4

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [net-next v5 5/7] net: dsa: mediatek: support MDIO switch downstream of MMIO switch
  2026-11-16 18:33 ` [net-next v5 5/7] net: dsa: mediatek: support MDIO switch downstream of MMIO switch Caleb James DeLisle
@ 2026-11-17 18:35   ` sashiko-bot
  0 siblings, 0 replies; 14+ messages in thread
From: sashiko-bot @ 2026-11-17 18:35 UTC (permalink / raw)
  To: Caleb James DeLisle; +Cc: devicetree, robh, conor+dt

Thank you for your contribution! Sashiko AI review found 3 potential
issues to consider:
- [High] net: dsa: mt7530: missing dsa_unregister_switch() on probe MDIO
  setup error
- [High] net: dsa: mt7530: duplicate mt7530_setup_irq() call in
  mt7530_setup_mdio()
- [High] net: dsa: mt7530: premature and re-entrant mt7530_setup_mdio()
  in mt7988_probe()
--

commit ef65040817a2e220996466f22eb74590c98e4476
Author: Caleb James DeLisle <cjd@cjdns.fr>

net: dsa: mediatek: support MDIO switch downstream of MMIO switch

This commit enables probing an MDIO switch connected to the MDIO bus of
an upstream MMIO switch by calling mt7530_setup_mdio() from
mt7988_probe() and assigning separate lockdep classes to MMIO and MDIO
reg_mutex instances.

> diff --git a/drivers/net/dsa/mt7530-mmio.c b/drivers/net/dsa/mt7530-mmio.c
> index 5d467be2a32c8..ab6d92ab3ec0b 100644
> --- a/drivers/net/dsa/mt7530-mmio.c
> +++ b/drivers/net/dsa/mt7530-mmio.c
> @@ -61,7 +62,27 @@ mt7988_probe(struct platform_device *pdev)
>  	if (IS_ERR(priv->regmap))
>  		return PTR_ERR(priv->regmap);
>  
> -	return dsa_register_switch(priv->ds);
> +	ret = dsa_register_switch(priv->ds);
> +
> +	if (ret)
> +		return ret;
> +
> +	/*
> +	 * If not all switches in the hierarchy have been probed,
> +	 * dsa_register_switch() returns 0 without calling mt753x_setup().
> +	 * Call mt7530_setup_mdio() because there's a chance that the missing
> +	 * switch is on the MDIO bus. If "mdio" node is not present then there
> +	 * is definitely no MDIO switch in the DT, and also if "mdio" is not
> +	 * present then phys_mii_mask is relevant and that is not set until
> +	 * dsa_switch_setup.
> +	 */
> +	mnp = of_get_child_by_name(pdev->dev.of_node, "mdio");
> +	if (mnp) {
> +		of_node_put(mnp);
> +		ret = mt7530_setup_mdio(priv);
> +	}

[Severity: High]
Does calling mt7530_setup_mdio() here before mt7988_setup() has run cause
the later switch setup to wipe out the IRQ and PHY state, and break PHY
attachment for ports listed after the downstream switch in DT?

When the DSA tree is incomplete, dsa_register_switch() returns 0 without
running mt753x_setup() -> mt7988_setup().  Calling mt7530_setup_mdio() at
that point registers the IRQ chip (programming MT7530_SYS_INT_EN) and the
MDIO bus before mt7988_setup() has deasserted priv->rstc or configured
PHY clocks.  When the downstream switch probes on that MDIO bus and
completes the tree, dsa_tree_setup() runs mt7988_setup() on the upstream
switch:

drivers/net/dsa/mt7530.c:mt7988_setup() {
	/* Reset the switch */
	reset_control_assert(priv->rstc);
	usleep_range(20, 50);
	reset_control_deassert(priv->rstc);
	...
	/* Reset the switch PHYs */
	regmap_write(priv->regmap, MT7530_SYS_CTRL, SYS_CTRL_PHY_RST);
}

Asserting priv->rstc and SYS_CTRL_PHY_RST resets the upstream switch and
its PHYs after the IRQ controller and MDIO devices have already been
configured, and the subsequent mt7530_setup_mdio() call in mt753x_setup()
is a no-op because priv->child_bus is already set.

In addition, devm_of_mdiobus_register() probes the downstream switch
synchronously while __of_mdiobus_parse_phys() is still iterating over the
children of the "mdio" node:

mt7988_probe()
  mt7530_setup_mdio()
    priv->child_bus = bus;
    devm_of_mdiobus_register()
      __of_mdiobus_parse_phys()
        of_mdiobus_register_device() [downstream switch]
          ...
            dsa_register_switch()
              dsa_tree_setup()
                dsa_tree_setup_switches()
                  mt753x_setup()
                    mt7530_setup_mdio()  <-- returns 0 (priv->child_bus set)
                dsa_tree_setup_ports()
                  phylink_of_phy_connect()  <-- -ENODEV for later PHY nodes

Any PHY child nodes appearing after the downstream switch node in the
"mdio" DT node have not been registered yet when dsa_tree_setup_ports()
runs, so phylink_of_phy_connect() fails with -ENODEV and DSA disables
those ports via dsa_port_setup_as_unused().

> +
> +	return ret;
>  }

[Severity: High]
If mt7530_setup_mdio() fails here (for instance with -EPROBE_DEFER from
of_irq_get()), does returning ret without calling dsa_unregister_switch()
leave dangling pointers to priv->ds in dst->ports?

priv->ds is allocated with devm_kzalloc_obj() on &pdev->dev, whereas
dsa_register_switch() allocates non-devm dsa_port structures linked into
dst->ports with dp->ds pointing to priv->ds.  When probe fails, devres
frees priv->ds without running mt7988_remove(), leaking the dsa_port
allocations and conduit reference and causing a use-after-free when a
subsequent probe or peer switch registration walks dst->ports in
dsa_switch_find() and dereferences dp->ds->index.

> diff --git a/drivers/net/dsa/mt7530.c b/drivers/net/dsa/mt7530.c
> index 53ac692d5ba93..4390982a5e225 100644
> --- a/drivers/net/dsa/mt7530.c
> +++ b/drivers/net/dsa/mt7530.c
[ ... ]
> @@ -2530,7 +2525,7 @@ mt7530_free_mdio_irq(struct mt7530_priv *priv)
>  	}
>  }
>  
> -static int
> +int
>  mt7530_setup_mdio(struct mt7530_priv *priv)
>  {
>  	struct device_node *mnp, *np = priv->dev->of_node;
> @@ -2540,6 +2535,14 @@ mt7530_setup_mdio(struct mt7530_priv *priv)
>  	static int idx;
>  	int ret = 0;
>  
> +	/* Already done */
> +	if (priv->child_bus)
> +		return 0;
> +
> +	ret = mt7530_setup_irq(priv);
> +	if (ret)
> +		return ret;
> +
>  	mnp = of_get_child_by_name(np, "mdio");
>  
>  	if (mnp && !of_device_is_available(mnp))

[Severity: High]
Can mt7530_setup_irq() be called twice if the "mdio" child node is
disabled in DT?

When the "mdio" node has status = "disabled", the first call to
mt7530_setup_mdio() from mt753x_setup() runs mt7530_setup_irq() and then
jumps to out before setting priv->child_bus.  In mt7988_probe(),
of_get_child_by_name() still returns the disabled "mdio" node and calls
mt7530_setup_mdio() a second time.  Because priv->child_bus is still NULL,
mt7530_setup_irq() runs again and devm_regmap_add_irq_chip_fwnode() fails
with -EBUSY when requesting the non-shared IRQF_ONESHOT interrupt a
second time.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261116183332.168858-1-cjd@cjdns.fr?part=5

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [net-next v5 6/7] dt-bindings: net: dsa: mediatek,mt7530: add EcoNet EN751221 switches
  2026-11-16 18:33 ` [net-next v5 6/7] dt-bindings: net: dsa: mediatek,mt7530: add EcoNet EN751221 switches Caleb James DeLisle
@ 2026-11-17 18:35   ` sashiko-bot
  0 siblings, 0 replies; 14+ messages in thread
From: sashiko-bot @ 2026-11-17 18:35 UTC (permalink / raw)
  To: Caleb James DeLisle; +Cc: devicetree, robh, conor+dt

Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Low] dt-bindings: net: dsa: mt7530: unaddressed v4 review on en751221
  compatibles
--

commit 2cadfb1e611919345d0f3bc419d5f43f6b58423f
Author: Caleb James DeLisle <cjd@cjdns.fr>

dt-bindings: net: dsa: mediatek,mt7530: add EcoNet EN751221 switches

This commit adds the econet,en751221-switch and econet,en751221-gswitch
compatible strings and schema constraints for EcoNet EN751221 switches to
the MediaTek MT7530 DSA binding.

> diff --git a/Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml b/Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml
> index 590eb39d6b93a..e4e81ed64136b 100644
> --- a/Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml
> +++ b/Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml

[ ... ]

> @@ -110,6 +116,14 @@ properties:
>            Built-in switch of the EcoNet EN7528 SoC
>          const: econet,en7528-switch
>  
> +      - description:
> +          Built-in switch of EcoNet EN751221 SoC
> +        const: econet,en751221-switch
> +
> +      - description:
> +          Multi-chip module gigabit MT7530 in EN751221 SoC
> +        const: econet,en751221-gswitch

[Severity: Low]
As reported by Krzysztof Kozlowski on v4 [1], the description for
econet,en751221-switch repeats the compatible string instead of
distinguishing the on-die switch from the multi-chip module switch, the
description for econet,en751221-gswitch is split across multiple lines, and
it remains unclear why two EN751221 compatibles are added for hardware
described as MT7530.

[1] https://lore.kernel.org/r/20261103-soft-lyrical-squid-c5a108@quoll

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261116183332.168858-1-cjd@cjdns.fr?part=6

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [net-next v5 7/7] net: dsa: mediatek: support EN751221 switch
  2026-11-16 18:33 ` [net-next v5 7/7] net: dsa: mediatek: support EN751221 switch Caleb James DeLisle
@ 2026-11-17 18:35   ` sashiko-bot
  0 siblings, 0 replies; 14+ messages in thread
From: sashiko-bot @ 2026-11-17 18:35 UTC (permalink / raw)
  To: Caleb James DeLisle; +Cc: devicetree, robh, conor+dt

Thank you for your contribution! Sashiko AI review found 5 potential
issues to consider:
- [High] net: dsa: mt7530: missing dsa_unregister_switch() in
  mt7988_probe()
- [High] net: dsa: mt7530: premature mt7530_setup_mdio() before switch
  reset in mt7988_setup()
- [Medium] net: dsa: mt7530: peer phylink race and PMCR clobber in
  TRGMII calibration
- [Medium] net: dsa: mt7530: missing child_bus mdio_lock in core_write()
  and core_rmw()
- [Low] net: dsa: mt7530: comment and bit update mismatch in
  mt7988_setup()
--

commit 86fcc48d199eaeddf4405613e3b2f52247299102
Author: Caleb James DeLisle <cjd@cjdns.fr>

net: dsa: mediatek: support EN751221 switch

This commit adds support for the EcoNet EN751221 on-die MMIO MT7530 switch
and external MDIO MCM MT7530 switch, along with TRGMII calibration for the
inter-switch link between them.

> diff --git a/drivers/net/dsa/mt7530-mmio.c b/drivers/net/dsa/mt7530-mmio.c
> index ab6d92ab3ec0b..989fe95ec4f36 100644
> --- a/drivers/net/dsa/mt7530-mmio.c
> +++ b/drivers/net/dsa/mt7530-mmio.c
> @@ -12,6 +12,7 @@
>  static const struct of_device_id mt7988_of_match[] = {
>  	{ .compatible = "airoha,an7583-switch", .data = &mt753x_table[ID_AN7583], },
>  	{ .compatible = "airoha,en7581-switch", .data = &mt753x_table[ID_EN7581], },
> +	{ .compatible = "econet,en751221-switch", .data = &mt753x_table[ID_EN751221], },
>  	{ .compatible = "econet,en7528-switch", .data = &mt753x_table[ID_EN7528], },
>  	{ .compatible = "mediatek,mt7988-switch", .data = &mt753x_table[ID_MT7988], },
>  	{ /* sentinel */ }

[Severity: High]
When econet,en751221-switch is paired with the downstream MDIO switch
econet,en751221-gswitch, can a failure in mt7530_setup_mdio() leave priv->ds
registered in the DSA tree after probe fails?

drivers/net/dsa/mt7530-mmio.c:mt7988_probe() {
    ...
	ret = dsa_register_switch(priv->ds);

	if (ret)
		return ret;
    ...
	mnp = of_get_child_by_name(pdev->dev.of_node, "mdio");
	if (mnp) {
		of_node_put(mnp);
		ret = mt7530_setup_mdio(priv);
	}

	return ret;
}

When mt7988_probe() runs before the downstream MDIO switch has been probed,
dsa_register_switch() links the switch's ports into dst->ports and returns 0
without calling mt753x_setup().  mt7988_probe() then calls
mt7530_setup_mdio(priv) for the first time, as introduced in commit "net: dsa:
mediatek: support MDIO switch downstream of MMIO switch".  If
mt7530_setup_mdio() fails (for example, if of_irq_get() in mt7530_setup_irq()
returns -EPROBE_DEFER), mt7988_probe() returns the error without calling
dsa_unregister_switch(priv->ds).  The driver core then frees the devm-managed
priv and priv->ds while dst->ports retains dangling dp->ds pointers and a
leaked reference on the conduit net_device, causing a use-after-free on the
next dsa_switch_find() walk during a probe retry.

> diff --git a/drivers/net/dsa/mt7530.c b/drivers/net/dsa/mt7530.c
> index 4390982a5e225..701e6b3b928f2 100644
> --- a/drivers/net/dsa/mt7530.c
> +++ b/drivers/net/dsa/mt7530.c
> @@ -49,6 +49,9 @@ static const struct mt7530_mib_desc mt7530_mib[] = {
>  static int
>  mt753x_ctrl_phy_addr(struct mt7530_priv *priv)
>  {
> +	if (priv->id == ID_EN751221)
> +		return 12;
> +
>  	if (WARN_ON_ONCE(!priv->mdiodev))
>  		return 0;
>  
> @@ -349,12 +352,19 @@ mt7530_setup_port6(struct dsa_switch *ds, phy_interface_t interface)
>  	regmap_read(priv->regmap, MT753X_MTRAP, &xtal);
>  	xtal &= MT7530_XTAL_MASK;
>  
> +	/* EN751221 on-die does not report clock speed in MTRAP */
> +	if (priv->id == ID_EN751221)
> +		xtal = MT7530_XTAL_25MHZ;
> +
>  	if (xtal == MT7530_XTAL_25MHZ)
>  		ssc_delta = 0x57;
>  	else
>  		ssc_delta = 0x87;
>  
> -	if (priv->id == ID_MT7621) {
> +	if (priv->id == ID_EN751221_EXT || priv->id == ID_EN751221) {
> +		/* PLL frequency: 362.5Mhz */
> +		ncpo1 = 0x1d00;
> +	} else if (priv->id == ID_MT7621) {

[Severity: Medium]
When mt7530_setup_port6() runs on the MMIO-based ID_EN751221 switch, do
core_write() and core_rmw() perform multi-step MMD sequences on
priv->child_bus without holding priv->child_bus->mdio_lock?

drivers/net/dsa/mt7530.c:mt7530_mutex_lock() {
	if (priv->bus)
		mutex_lock_nested(&priv->bus->mdio_lock, MDIO_MUTEX_NESTED);
}

drivers/net/dsa/mt7530.c:core_write() {
    ...
	if (!bus)
		bus = priv->child_bus;

	if (WARN_ON_ONCE(!bus))
		return;

	mt7530_mutex_lock(priv);

	/* Write the desired MMD Devad */
	ret = bus->write(bus, ctl_phy, MII_MMD_CTRL, MDIO_MMD_VEND2);
    ...
}

On ID_EN751221, priv->bus is NULL, so core_write() and core_rmw() fall back
to priv->child_bus, while mt7530_mutex_lock() is a no-op because it only
checks priv->bus.  Each bus->write() and bus->read() call only acquires
priv->reg_mutex for a single Clause 22 transfer, so concurrent MDIO traffic
on priv->child_bus (such as phylib polling PHY 12 or regmap accesses to the
downstream ID_EN751221_EXT switch) can interleave between the MII_MMD_CTRL
and MII_MMD_DATA transfers and corrupt the MMD register access:

CPU0                                  CPU1
mt7530_setup_port6()
  core_write(ondie, ...)
    mt7530_mutex_lock(ondie) [no-op]
    bus->write(..., MII_MMD_CTRL, ...)
    bus->write(..., MII_MMD_DATA, reg)
                                      phy_state_machine() / ext regmap
                                        mdiobus_read(ondie->child_bus, ...)
    bus->write(..., MII_MMD_CTRL, ...)
    bus->write(..., MII_MMD_DATA, val)  <-- interleaved MMD sequence

Locking and unlocking bus->mdio_lock on whichever bus (priv->bus or
priv->child_bus) is selected would serialize the full MMD sequence.

> @@ -471,6 +481,251 @@ mt7531_pll_setup(struct mt7530_priv *priv)
[ ... ]
> +static void
> +en751221_trgmii_pair_setup(struct mt7530_priv *ext, int ext_port,
> +			   struct mt7530_priv *ondie, int ondie_port)
> +{
> +	u8 default_taps_ondie[NUM_TRGMII_CTRL];
> +	u8 default_taps_ext[NUM_TRGMII_CTRL];
> +	u32 mcr_down, mcr_up;
> +	int channel;
> +	int reg_val;
> +
> +	/* BOTH: Put interfaces in a downed state */
> +	mcr_down = PMCR_IFG_XMIT(PMCR_IFG_XMIT_64) | PMCR_MAC_MODE |
> +		   MT7530_FORCE_MODE | PMCR_MAC_RX_EN | PMCR_BACKOFF_EN |
> +		   PMCR_BACKPR_EN | PMCR_FORCE_SPEED_1000 | PMCR_FORCE_FDX;
> +	regmap_write(ondie->regmap,  MT753X_PMCR_P(ondie_port), mcr_down);
> +	regmap_write(ext->regmap, MT753X_PMCR_P(ext_port), mcr_down);
> +	usleep_range(5000, 6000);
> +
> +	/* BOTH: Reset TX */
> +	regmap_set_bits(ext->regmap, MT7530_TRGMII_TXCTRL, TX_RST);
> +	regmap_set_bits(ondie->regmap, MT7530_TRGMII_TXCTRL, TX_RST);
> +	usleep_range(5000, 6000);
> +	regmap_clear_bits(ext->regmap, MT7530_TRGMII_TXCTRL, TX_RST);
> +	regmap_clear_bits(ondie->regmap, MT7530_TRGMII_TXCTRL, TX_RST);
> +
> +	/* BOTH: Reset RX controllers down */
> +	regmap_set_bits(ext->regmap, MT7530_TRGMII_RCK_CTRL, RX_RST);
> +	regmap_set_bits(ondie->regmap, MT7530_TRGMII_RCK_CTRL, RX_RST);
> +
> +	/* BOTH: Set TX drive strength, MCM uses more */
> +	en751221_set_tx_drive(ondie, 8, 8, 7, 7);
> +	en751221_set_tx_drive(ext, 11, 11, 15, 15);
> +
> +	/* BOTH: Reset RX controllers up */
> +	regmap_clear_bits(ext->regmap, MT7530_TRGMII_RCK_CTRL, RX_RST);
> +	regmap_clear_bits(ondie->regmap, MT7530_TRGMII_RCK_CTRL, RX_RST);
> +
> +	/* BOTH: Ports up */
> +	mcr_up = mcr_down | PMCR_MAC_TX_EN | PMCR_FORCE_LNK;
> +	regmap_write(ondie->regmap, MT753X_PMCR_P(ondie_port), mcr_up);
> +	regmap_write(ext->regmap, MT753X_PMCR_P(ext_port), mcr_up);
[ ... ]
> +static void
> +mt7530_cal_interswitch_trgmii(struct dsa_port *dp)
> +{
> +	struct dsa_switch *ds = dp->ds;
> +	struct dsa_switch *peer_ds;
> +	struct dsa_port *peer_dp;
> +	struct mt7530_priv *peer;
> +	struct mt7530_priv *priv;
> +	struct dsa_link *dl;
> +	u32 pmsr = 0;
> +
> +	priv = ds->priv;
> +
> +	if (priv->id != ID_EN751221_EXT)
> +		return;
> +
> +	if (dp->type != DSA_PORT_TYPE_DSA)
> +		return;
> +
> +	regmap_read(priv->regmap, MT7530_PMSR_P(dp->index), &pmsr);
> +
> +	if (!(pmsr & PMSR_LINK))
> +		return;
[ ... ]
> @@ -3263,6 +3564,9 @@ static void mt753x_phylink_mac_link_up(struct phylink_config *config,
>  	}
>  
>  	regmap_set_bits(priv->regmap, MT753X_PMCR_P(dp->index), mcr);
> +
> +	if (interface == PHY_INTERFACE_MODE_TRGMII)
> +		mt7530_cal_interswitch_trgmii(dp);
>  }

[Severity: Medium]
Does en751221_trgmii_pair_setup() clobber the flow-control bits in
MT753X_PMCR_P and race with the peer port's phylink_resolve() work item?

mt753x_phylink_mac_link_up() sets PMCR_FORCE_TX_FC_EN and PMCR_FORCE_RX_FC_EN
in MT753X_PMCR_P(dp->index) before calling mt7530_cal_interswitch_trgmii(dp),
which then overwrites MT753X_PMCR_P on both ondie_port and ext_port using
regmap_write(..., mcr_up), dropping both flow-control bits.

In addition, each port's phylink_resolve() work item is only serialized by its
own pl->state_mutex, and mt7530_cal_interswitch_trgmii() checks PMSR_LINK on
priv->regmap (which was just forced up) rather than on peer->regmap, and only
runs when priv->id == ID_EN751221_EXT.  While en751221_trgmii_pair_setup()
sleeps in usleep_range(5000, 6000) with both ports forced down for TRGMII
reset, on-die port 5's phylink_resolve() can run concurrently and re-enable
MT753X_PMCR_P(ondie_port) mid-reset, or resolve after external port 6 when
mt7530_cal_interswitch_trgmii() is skipped because priv->id != ID_EN751221_EXT:

kworker (ext port 6)                  kworker (ondie port 5)
mt753x_phylink_mac_link_up()
  regmap_set_bits(..., mcr)
  mt7530_cal_interswitch_trgmii()
    en751221_trgmii_pair_setup()
      regmap_write(ondie, PMCR, mcr_down)
      usleep_range(5000, 6000)
                                      mt753x_phylink_mac_link_up()
                                        regmap_set_bits(ondie, PMCR, mcr)
                                          <-- brings port up during reset
      regmap_set_bits(..., TX_RST)
      ...
      regmap_write(..., PMCR, mcr_up) <-- overwrites TX/RX flow control

[ ... ]

> @@ -3617,6 +3922,15 @@ static int mt7988_setup(struct dsa_switch *ds)
>  				   AN7583_CSR_PHY_CORE_REG_CLK_SEL |
>  				   FIELD_PREP(AN7583_CSR_ETHER_AFE_PWD, 0));
>  
> +	/*
> +	 * EN751221 is an MT7530 but it is MMIO so setup is largely the same
> +	 * as the MMIO MT7531, but CHG_TRAP and INDIRECT_ACCESS must be set.
> +	 */
> +	if (priv->id == ID_EN751221)
> +		regmap_update_bits(priv->regmap, MT753X_MTRAP,
> +				   MT7530_CHG_TRAP | MT7530_PHY_INDIRECT_ACCESS,
> +				   MT7530_CHG_TRAP);
> +
>  	/* Reset the switch PHYs */
>  	regmap_write(priv->regmap, MT7530_SYS_CTRL, SYS_CTRL_PHY_RST);

[Severity: High]
When ID_EN751221 has the downstream ID_EN751221_EXT switch on its MDIO bus,
does mt7988_setup() reset the on-die switch after mt7988_probe() has already
initialized its IRQ chip and MDIO bus?

During mt7988_probe() for ID_EN751221, dsa_register_switch() returns 0
without calling mt753x_setup() -> mt7988_setup() because ID_EN751221_EXT has
not been probed yet.  mt7988_probe() then calls mt7530_setup_mdio(priv),
which runs mt7530_setup_irq() (programming MT7530_SYS_INT_EN) and registers
the MDIO bus to probe ID_EN751221_EXT before priv->rstc has been deasserted
or MT753X_MTRAP has been configured.  Once ID_EN751221_EXT registers with DSA,
dsa_tree_setup_switches() runs mt7988_setup() on ID_EN751221, which asserts
and deasserts priv->rstc and writes SYS_CTRL_PHY_RST, wiping out the
interrupt controller state configured by mt7530_setup_irq(), while the second
mt7530_setup_mdio() call returns early because priv->child_bus is already
set.  Also, if the mdio child node is marked disabled in Device Tree,
mt7530_setup_mdio() leaves priv->child_bus NULL after calling
mt7530_setup_irq(), so the second mt7530_setup_mdio() call invokes
mt7530_setup_irq() a second time.

[Severity: Low]
The comment in mt7988_setup() says that both CHG_TRAP and INDIRECT_ACCESS
must be set, whereas the regmap_update_bits() call passes
MT7530_CHG_TRAP | MT7530_PHY_INDIRECT_ACCESS as the mask and only
MT7530_CHG_TRAP as the value, which clears MT7530_PHY_INDIRECT_ACCESS.  Was
MT7530_PHY_INDIRECT_ACCESS meant to be cleared here (as in mt7530_setup()) or
set?

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261116183332.168858-1-cjd@cjdns.fr?part=7

^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2026-11-17 18:35 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-16 18:33 [net-next v5 0/7] net: dsa: mt7530: support EcoNet EN751221 Caleb James DeLisle
2026-11-16 18:33 ` [net-next v5 1/7] net: dsa: mt7530: get ctrl phy addr using a function Caleb James DeLisle
2026-11-16 18:33 ` [net-next v5 2/7] dt-bindings: net: dsa: mediatek,mt7530: describe 'passthrough' hierarchy Caleb James DeLisle
2026-11-16 18:33 ` [net-next v5 3/7] net: dsa: mediatek: add support for passthrough mode Caleb James DeLisle
2026-11-17  0:30   ` kernel test robot
2026-11-17 18:35   ` sashiko-bot
2026-11-16 18:33 ` [net-next v5 4/7] net: dsa: mediatek: support PLL setup on MMIO MT7530 Caleb James DeLisle
2026-11-17 18:35   ` sashiko-bot
2026-11-16 18:33 ` [net-next v5 5/7] net: dsa: mediatek: support MDIO switch downstream of MMIO switch Caleb James DeLisle
2026-11-17 18:35   ` sashiko-bot
2026-11-16 18:33 ` [net-next v5 6/7] dt-bindings: net: dsa: mediatek,mt7530: add EcoNet EN751221 switches Caleb James DeLisle
2026-11-17 18:35   ` sashiko-bot
2026-11-16 18:33 ` [net-next v5 7/7] net: dsa: mediatek: support EN751221 switch Caleb James DeLisle
2026-11-17 18:35   ` sashiko-bot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox