forked from Openwrt/openwrt
dceb5938f8
Changelog: https://cdn.kernel.org/pub/linux/kernel/v6.x/ChangeLog-6.6.29 Removed upstreamed: generic/backport-6.6/740-v6.9-01-netfilter-flowtable-validate-pppoe-header.patch[1] generic/backport-6.6/740-v6.9-02-netfilter-flowtable-incorrect-pppoe-tuple.patch[2] generic/backport-6.6/790-29-v6.9-net-dsa-mt7530-fix-improper-frames-on-all-25MHz-and-.patch[3] generic/backport-6.6/790-31-v6.10-net-dsa-mt7530-fix-enabling-EEE-on-MT7531-switch-on-.patch[4] generic/backport-6.6/790-34-v6.10-net-dsa-mt7530-fix-mirroring-frames-received-on-loca.patch[5] generic/backport-6.6/790-35-v6.10-net-dsa-mt7530-fix-port-mirroring-for-MT7988-SoC-swi.patch[6] mediatek/patches-6.6/963-net-ethernet-mtk_eth_soc-fix-WED-wifi-reset.patch[7] Manually rebased: generic/backport-6.6/790-23-v6.9-net-dsa-mt7530-get-rid-of-priv-info-cpu_port_config.patch All other patches automatically rebased. 1. https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v6.6.29&id=a2471d271042ea18e8a6babc132a8716bb2f08b9 2. https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v6.6.29&id=4ed82dd368ad883dc4284292937b882f044e625d 3. https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v6.6.29&id=21b9d89d93422221cdda1b82fd075fa3c94a11d9 4. https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v6.6.29&id=bd41ee1efd478852a0882ce5f136bc2b5e83eff2 5. https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v6.6.29&id=d1be3960539249a8690ed09a29d0e3bf34189dd2 6. https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v6.6.29&id=f8de1b6208bf71bd3102548d33dd8475573ad2ea 7. https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v6.6.29&id=6855f724f19620c3ddff57c349e0abba797475b1 Build system: x86/64 Build-tested: x86/64/AMD Cezanne, flogic/xiaomi_redmi-router-ax6000-ubootmod, ramips/tplink_archer-a6-v3 Run-tested: x86/64/AMD Cezanne, flogic/xiaomi_redmi-router-ax6000-ubootmod, ramips/tplink_archer-a6-v3 Signed-off-by: John Audia <therealgraysky@proton.me>
117 lines
3.7 KiB
Diff
117 lines
3.7 KiB
Diff
From af26b0d1bf934bbaa7cafb871a51e95087a088a0 Mon Sep 17 00:00:00 2001
|
||
From: =?UTF-8?q?Ar=C4=B1n=C3=A7=20=C3=9CNAL?= <arinc.unal@arinc9.com>
|
||
Date: Mon, 22 Jan 2024 08:34:31 +0300
|
||
Subject: [PATCH 04/30] net: dsa: mt7530: support OF-based registration of
|
||
switch MDIO bus
|
||
MIME-Version: 1.0
|
||
Content-Type: text/plain; charset=UTF-8
|
||
Content-Transfer-Encoding: 8bit
|
||
|
||
Currently the MDIO bus of the switches the MT7530 DSA subdriver controls
|
||
can only be registered as non-OF-based. Bring support for registering the
|
||
bus OF-based.
|
||
|
||
The subdrivers that control switches [with MDIO bus] probed on OF must
|
||
follow this logic to support all cases properly:
|
||
|
||
No switch MDIO bus defined: Populate ds->user_mii_bus, register the MDIO
|
||
bus, set the interrupts for PHYs if "interrupt-controller" is defined at
|
||
the switch node. This case should only be covered for the switches which
|
||
their dt-bindings documentation didn't document the MDIO bus from the
|
||
start. This is to keep supporting the device trees that do not describe the
|
||
MDIO bus on the device tree but the MDIO bus is being used nonetheless.
|
||
|
||
Switch MDIO bus defined: Don't populate ds->user_mii_bus, register the MDIO
|
||
bus, set the interrupts for PHYs if ["interrupt-controller" is defined at
|
||
the switch node and "interrupts" is defined at the PHY nodes under the
|
||
switch MDIO bus node].
|
||
|
||
Switch MDIO bus defined but explicitly disabled: If the device tree says
|
||
status = "disabled" for the MDIO bus, we shouldn't need an MDIO bus at all.
|
||
Instead, just exit as early as possible and do not call any MDIO API.
|
||
|
||
The use of ds->user_mii_bus is inappropriate when the MDIO bus of the
|
||
switch is described on the device tree [1], which is why we don't populate
|
||
ds->user_mii_bus in that case.
|
||
|
||
Link: https://lore.kernel.org/netdev/20231213120656.x46fyad6ls7sqyzv@skbuf/ [1]
|
||
Suggested-by: David Bauer <mail@david-bauer.net>
|
||
Signed-off-by: Arınç ÜNAL <arinc.unal@arinc9.com>
|
||
Reviewed-by: Vladimir Oltean <olteanv@gmail.com>
|
||
Link: https://lore.kernel.org/r/20240122053431.7751-1-arinc.unal@arinc9.com
|
||
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
|
||
---
|
||
drivers/net/dsa/mt7530.c | 34 ++++++++++++++++++++++++++--------
|
||
1 file changed, 26 insertions(+), 8 deletions(-)
|
||
|
||
--- a/drivers/net/dsa/mt7530.c
|
||
+++ b/drivers/net/dsa/mt7530.c
|
||
@@ -2345,24 +2345,40 @@ mt7530_free_irq_common(struct mt7530_pri
|
||
static void
|
||
mt7530_free_irq(struct mt7530_priv *priv)
|
||
{
|
||
- mt7530_free_mdio_irq(priv);
|
||
+ struct device_node *mnp, *np = priv->dev->of_node;
|
||
+
|
||
+ mnp = of_get_child_by_name(np, "mdio");
|
||
+ if (!mnp)
|
||
+ mt7530_free_mdio_irq(priv);
|
||
+ of_node_put(mnp);
|
||
+
|
||
mt7530_free_irq_common(priv);
|
||
}
|
||
|
||
static int
|
||
mt7530_setup_mdio(struct mt7530_priv *priv)
|
||
{
|
||
+ struct device_node *mnp, *np = priv->dev->of_node;
|
||
struct dsa_switch *ds = priv->ds;
|
||
struct device *dev = priv->dev;
|
||
struct mii_bus *bus;
|
||
static int idx;
|
||
- int ret;
|
||
+ int ret = 0;
|
||
+
|
||
+ mnp = of_get_child_by_name(np, "mdio");
|
||
+
|
||
+ if (mnp && !of_device_is_available(mnp))
|
||
+ goto out;
|
||
|
||
bus = devm_mdiobus_alloc(dev);
|
||
- if (!bus)
|
||
- return -ENOMEM;
|
||
+ if (!bus) {
|
||
+ ret = -ENOMEM;
|
||
+ goto out;
|
||
+ }
|
||
+
|
||
+ if (!mnp)
|
||
+ ds->slave_mii_bus = bus;
|
||
|
||
- ds->slave_mii_bus = bus;
|
||
bus->priv = priv;
|
||
bus->name = KBUILD_MODNAME "-mii";
|
||
snprintf(bus->id, MII_BUS_ID_SIZE, KBUILD_MODNAME "-%d", idx++);
|
||
@@ -2373,16 +2389,18 @@ mt7530_setup_mdio(struct mt7530_priv *pr
|
||
bus->parent = dev;
|
||
bus->phy_mask = ~ds->phys_mii_mask;
|
||
|
||
- if (priv->irq)
|
||
+ if (priv->irq && !mnp)
|
||
mt7530_setup_mdio_irq(priv);
|
||
|
||
- ret = devm_mdiobus_register(dev, bus);
|
||
+ ret = devm_of_mdiobus_register(dev, bus, mnp);
|
||
if (ret) {
|
||
dev_err(dev, "failed to register MDIO bus: %d\n", ret);
|
||
- if (priv->irq)
|
||
+ if (priv->irq && !mnp)
|
||
mt7530_free_mdio_irq(priv);
|
||
}
|
||
|
||
+out:
|
||
+ of_node_put(mnp);
|
||
return ret;
|
||
}
|
||
|