[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ZyosafnNkdqt4JMb@pengutronix.de>
Date: Tue, 5 Nov 2024 15:32:09 +0100
From: Oleksij Rempel <o.rempel@...gutronix.de>
To: Maxime Chevallier <maxime.chevallier@...tlin.com>
Cc: "David S. Miller" <davem@...emloft.net>, Andrew Lunn <andrew@...n.ch>,
Eric Dumazet <edumazet@...gle.com>,
Florian Fainelli <f.fainelli@...il.com>,
Jakub Kicinski <kuba@...nel.org>, Paolo Abeni <pabeni@...hat.com>,
Vladimir Oltean <olteanv@...il.com>,
Woojung Huh <woojung.huh@...rochip.com>,
Arun Ramadoss <arun.ramadoss@...rochip.com>,
Conor Dooley <conor+dt@...nel.org>,
Krzysztof Kozlowski <krzk+dt@...nel.org>,
Rob Herring <robh+dt@...nel.org>, kernel@...gutronix.de,
linux-kernel@...r.kernel.org, netdev@...r.kernel.org,
UNGLinuxDriver@...rochip.com,
"Russell King (Oracle)" <linux@...linux.org.uk>,
devicetree@...r.kernel.org, Marek Vasut <marex@...x.de>
Subject: Re: [PATCH net-next v3 6/6] net: dsa: microchip: parse PHY config
from device tree
Hi Maxime,
On Tue, Nov 05, 2024 at 03:28:05PM +0100, Maxime Chevallier wrote:
> > + dsa_switch_for_each_user_port(dp, dev->ds) {
> > + if (!dev->info->internal_phy[dp->index])
> > + continue;
> > +
> > + phy_node = of_parse_phandle(dp->dn, "phy-handle", 0);
> > + if (!phy_node) {
> > + dev_err(dev->dev, "failed to parse phy-handle for port %d.\n",
> > + dp->index);
> > + phys_are_valid = false;
> > + continue;
> > + }
> > +
> > + phy_parent_node = of_get_parent(phy_node);
> > + if (!phy_parent_node) {
> > + dev_err(dev->dev, "failed to get PHY-parent node for port %d\n",
> > + dp->index);
> > + phys_are_valid = false;
> > + } else if (dev->info->internal_phy[dp->index] &&
> > + phy_parent_node != mdio_np) {
>
> There's a check a few lines above that guarantees that at this point
> dev->info->internal_phy[dp->index] will always evaluate as true,
> so you could simplify that condition a bit :)
good point :)
> > + dev_err(dev->dev, "PHY-parent node mismatch for port %d, expected %pOF, got %pOF\n",
> > + dp->index, mdio_np, phy_parent_node);
> > + phys_are_valid = false;
> > + } else {
> > + ret = of_property_read_u32(phy_node, "reg", &phy_id);
> > + if (ret < 0) {
> > + dev_err(dev->dev, "failed to read PHY ID for port %d. Error %d\n",
> > + dp->index, ret);
> > + phys_are_valid = false;
> > + } else if (phy_id != dev->phy_addr_map[dp->index]) {
> > + dev_err(dev->dev, "PHY ID mismatch for port %d, expected 0x%x, got 0x%x\n",
> > + dp->index, dev->phy_addr_map[dp->index],
> > + phy_id);
>
> In this context, PHY ID might be a bit misleading, as PHY ID usually
> refers to the identifier (OUI + model id used at probe to select the
> driver). May I suggest phy_addr instead ?
ack, will rework it.
--
Pengutronix e.K. | |
Steuerwalder Str. 21 | http://www.pengutronix.de/ |
31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
Powered by blists - more mailing lists