From: Caleb James DeLisle <cjd@cjdns.fr>
To: netdev@vger.kernel.org
Cc: andrew@lunn.ch, olteanv@gmail.com, davem@davemloft.net,
edumazet@google.com, kuba@kernel.org, pabeni@redhat.com,
robh@kernel.org, krzk+dt@kernel.org, conor+dt@kernel.org,
matthias.bgg@gmail.com, angelogioacchino.delregno@collabora.com,
chester.a.unal@arinc9.com, daniel@makrotopia.org,
linux@armlinux.org.uk, arinc.unal@arinc9.com,
Landen.Chao@mediatek.com, dqfext@gmail.com,
sean.wang@mediatek.com, devicetree@vger.kernel.org,
linux-kernel@vger.kernel.org,
linux-arm-kernel@lists.infradead.org,
linux-mediatek@lists.infradead.org, naseefkm@gmail.com,
b.larsson@gmx.com, Caleb James DeLisle <cjd@cjdns.fr>
Subject: [PATCH v3 4/7] net: dsa: mediatek: support PLL setup on MMIO MT7530
Date: Wed, 28 Oct 2026 01:13:14 +0000 [thread overview]
Message-ID: <20261028011317.1557238-5-cjd@cjdns.fr> (raw)
In-Reply-To: <20261028011317.1557238-1-cjd@cjdns.fr>
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 3eb2e11d6985..d09ff207e2df 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 */
@@ -2472,8 +2484,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
next prev parent reply other threads:[~2026-10-28 1:13 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-28 1:13 [PATCH v3 0/7] net: dsa: mt7530: support EcoNet EN751221 Caleb James DeLisle
2026-10-28 1:13 ` [PATCH v3 1/7] net: dsa: mt7530: get ctrl phy addr using a function Caleb James DeLisle
2026-10-28 1:13 ` [PATCH v3 2/7] dt-bindings: net: dsa: mediatek,mt7530: add passthrough mode Caleb James DeLisle
2026-10-28 2:04 ` Andrew Lunn
2026-10-28 11:27 ` Caleb James DeLisle
2026-10-28 12:28 ` Andrew Lunn
2026-10-28 13:52 ` Caleb James DeLisle
2026-10-28 1:13 ` [PATCH v3 3/7] net: dsa: mediatek: add support for " Caleb James DeLisle
2026-10-28 2:07 ` Andrew Lunn
2026-10-28 12:11 ` Caleb James DeLisle
2026-10-28 2:15 ` Andrew Lunn
2026-10-28 11:08 ` Caleb James DeLisle
2026-10-28 12:35 ` Andrew Lunn
2026-10-28 1:13 ` Caleb James DeLisle [this message]
2026-10-28 1:13 ` [PATCH v3 5/7] net: dsa: mediatek: support MDIO switch downstream of MMIO switch Caleb James DeLisle
2026-10-28 2:20 ` Andrew Lunn
2026-10-28 11:59 ` Caleb James DeLisle
2026-10-28 12:50 ` Andrew Lunn
2026-10-28 15:04 ` Caleb James DeLisle
2026-10-28 1:13 ` [PATCH v3 6/7] dt-bindings: net: dsa: mediatek,mt7530: add econet,en751221 Caleb James DeLisle
2026-10-28 2:26 ` Andrew Lunn
2026-10-28 11:19 ` Caleb James DeLisle
2026-10-28 1:13 ` [PATCH v3 7/7] net: dsa: mediatek: support EN751221 switch Caleb James DeLisle
2026-10-28 16:03 ` [PATCH v3 0/7] net: dsa: mt7530: support EcoNet EN751221 Cristian Papa
2026-10-28 16:33 ` Caleb James DeLisle
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261028011317.1557238-5-cjd@cjdns.fr \
--to=cjd@cjdns.fr \
--cc=Landen.Chao@mediatek.com \
--cc=andrew@lunn.ch \
--cc=angelogioacchino.delregno@collabora.com \
--cc=arinc.unal@arinc9.com \
--cc=b.larsson@gmx.com \
--cc=chester.a.unal@arinc9.com \
--cc=conor+dt@kernel.org \
--cc=daniel@makrotopia.org \
--cc=davem@davemloft.net \
--cc=devicetree@vger.kernel.org \
--cc=dqfext@gmail.com \
--cc=edumazet@google.com \
--cc=krzk+dt@kernel.org \
--cc=kuba@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mediatek@lists.infradead.org \
--cc=linux@armlinux.org.uk \
--cc=matthias.bgg@gmail.com \
--cc=naseefkm@gmail.com \
--cc=netdev@vger.kernel.org \
--cc=olteanv@gmail.com \
--cc=pabeni@redhat.com \
--cc=robh@kernel.org \
--cc=sean.wang@mediatek.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®