[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <b28b5d10-08cd-4e30-9909-f37834d80c81@lunn.ch>
Date: Tue, 28 Nov 2023 01:39:02 +0100
From: Andrew Lunn <andrew@...n.ch>
To: Christian Marangi <ansuelsmth@...il.com>
Cc: "David S. Miller" <davem@...emloft.net>,
Eric Dumazet <edumazet@...gle.com>,
Jakub Kicinski <kuba@...nel.org>, Paolo Abeni <pabeni@...hat.com>,
Rob Herring <robh+dt@...nel.org>,
Krzysztof Kozlowski <krzysztof.kozlowski+dt@...aro.org>,
Conor Dooley <conor+dt@...nel.org>, Andy Gross <agross@...nel.org>,
Bjorn Andersson <andersson@...nel.org>,
Konrad Dybcio <konrad.dybcio@...aro.org>,
Heiner Kallweit <hkallweit1@...il.com>,
Russell King <linux@...linux.org.uk>,
Matthias Brugger <matthias.bgg@...il.com>,
AngeloGioacchino Del Regno <angelogioacchino.delregno@...labora.com>,
Robert Marko <robert.marko@...tura.hr>, netdev@...r.kernel.org,
devicetree@...r.kernel.org, linux-kernel@...r.kernel.org,
linux-arm-msm@...r.kernel.org, linux-arm-kernel@...ts.infradead.org,
linux-mediatek@...ts.infradead.org
Subject: Re: [net-next PATCH RFC v3 2/8] net: phy: add initial support for
PHY package in DT
> +static int of_phy_package(struct phy_device *phydev)
> +{
> + struct device_node *node = phydev->mdio.dev.of_node;
> + struct device_node *package_node;
> + u32 base_addr;
> + int ret;
> +
> + if (!node)
> + return 0;
> +
> + package_node = of_get_parent(node);
> + if (!package_node)
> + return 0;
> +
> + if (!of_device_is_compatible(package_node, "ethernet-phy-package"))
> + return 0;
> +
> + if (of_property_read_u32(package_node, "reg", &base_addr))
> + return -EINVAL;
> +
> + ret = devm_phy_package_join(&phydev->mdio.dev, phydev,
> + base_addr, 0);
No don't do this. It is just going to lead to errors. The PHY driver
knows how many PHYs are in the package. So it can figure out what the
base address is and create the package. It can add each PHY as they
probe. That cannot go wrong.
If you create the package based on DT you have to validate that the DT
is correct. You need the same information, the base address, how many
packages are in the PHY, etc. So DT gains your nothing except more
potential to get it wrong.
Please use DT just for properties for the package, nothing else.
Andrew
Powered by blists - more mailing lists