From: Daniel Golle <daniel@makrotopia.org>
To: David Bauer <mail@david-bauer.net>
Cc: Sean Wang <sean.wang@mediatek.com>,
Landen Chao <Landen.Chao@mediatek.com>,
DENG Qingfang <dqfext@gmail.com>, Andrew Lunn <andrew@lunn.ch>,
Florian Fainelli <f.fainelli@gmail.com>,
Vladimir Oltean <olteanv@gmail.com>,
"David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
Matthias Brugger <matthias.bgg@gmail.com>,
AngeloGioacchino Del Regno
<angelogioacchino.delregno@collabora.com>,
netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-arm-kernel@lists.infradead.org,
linux-mediatek@lists.infradead.org
Subject: Re: [PATCH 1/2] mt7530: register OF node for internal MDIO bus
Date: Sun, 30 Apr 2023 12:42:46 +0100 [thread overview]
Message-ID: <ZE5UNq9QD1tZbHGx@makrotopia.org> (raw)
In-Reply-To: <20230430112834.11520-1-mail@david-bauer.net>
On Sun, Apr 30, 2023 at 01:28:32PM +0200, David Bauer wrote:
> The MT753x switches provide a switch-internal MDIO bus for the embedded
> PHYs.
>
> Register a OF sub-node on the switch OF-node for this internal MDIO bus.
> This allows to configure the embedded PHYs using device-tree.
>
> Signed-off-by: David Bauer <mail@david-bauer.net>
Acked-by: Daniel Golle <daniel@makrotopia.org>
I've got a similar commit in my tree for a while, yours is better
because you care to of_node_put(mnp) ;)
And yes, this will be fine also if mnp is NULL, the MDIO bus will
still be registered (just without the reference to the OF node) and
also of_node_put is fine being called for NULL.
> ---
> drivers/net/dsa/mt7530.c | 7 ++++++-
> 1 file changed, 6 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/net/dsa/mt7530.c b/drivers/net/dsa/mt7530.c
> index c680873819b0..7e8ea5b75c3e 100644
> --- a/drivers/net/dsa/mt7530.c
> +++ b/drivers/net/dsa/mt7530.c
> @@ -2119,10 +2119,13 @@ mt7530_setup_mdio(struct mt7530_priv *priv)
> {
> struct dsa_switch *ds = priv->ds;
> struct device *dev = priv->dev;
> + struct device_node *np, *mnp;
> struct mii_bus *bus;
> static int idx;
> int ret;
>
> + np = priv->dev->of_node;
> +
> bus = devm_mdiobus_alloc(dev);
> if (!bus)
> return -ENOMEM;
> @@ -2141,7 +2144,9 @@ mt7530_setup_mdio(struct mt7530_priv *priv)
> if (priv->irq)
> mt7530_setup_mdio_irq(priv);
>
> - ret = devm_mdiobus_register(dev, bus);
> + mnp = of_get_child_by_name(np, "mdio");
> + ret = devm_of_mdiobus_register(dev, bus, mnp);
> + of_node_put(mnp);
> if (ret) {
> dev_err(dev, "failed to register MDIO bus: %d\n", ret);
> if (priv->irq)
> --
> 2.39.2
>
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next prev parent reply other threads:[~2023-04-30 11:44 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-04-30 11:28 [PATCH 1/2] mt7530: register OF node for internal MDIO bus David Bauer
2023-04-30 11:28 ` [PATCH 2/2] dt-bindings: net: dsa: mediatek,mt7530: document MDIO-bus David Bauer
2023-04-30 12:34 ` Arınç ÜNAL
2023-04-30 12:44 ` Daniel Golle
2023-04-30 12:52 ` Arınç ÜNAL
2023-04-30 16:17 ` Arınç ÜNAL
2023-04-30 17:18 ` Andrew Lunn
2023-04-30 18:28 ` Arınç ÜNAL
2023-04-30 18:48 ` Andrew Lunn
2023-04-30 19:54 ` Arınç ÜNAL
2023-04-30 20:41 ` Andrew Lunn
2023-05-01 9:22 ` David Bauer
2023-05-01 9:28 ` Arınç ÜNAL
2023-04-30 12:53 ` Arınç ÜNAL
2023-04-30 11:42 ` Daniel Golle [this message]
2023-04-30 14:14 ` [PATCH 1/2] mt7530: register OF node for internal MDIO bus Andrew Lunn
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=ZE5UNq9QD1tZbHGx@makrotopia.org \
--to=daniel@makrotopia.org \
--cc=Landen.Chao@mediatek.com \
--cc=andrew@lunn.ch \
--cc=angelogioacchino.delregno@collabora.com \
--cc=davem@davemloft.net \
--cc=dqfext@gmail.com \
--cc=edumazet@google.com \
--cc=f.fainelli@gmail.com \
--cc=kuba@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mediatek@lists.infradead.org \
--cc=mail@david-bauer.net \
--cc=matthias.bgg@gmail.com \
--cc=netdev@vger.kernel.org \
--cc=olteanv@gmail.com \
--cc=pabeni@redhat.com \
--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