Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

[PATCH RFC] net: of_mdio: Scan PHYs which have device_type set to ethernet-phy

9 views
Skip to first unread message

Srinivas Kandagatla

unread,
Nov 14, 2013, 10:10:02 AM11/14/13
to
According to Documentation/devicetree/bindings/net/phy.txt device_type
property of PHY nodes is mandatory, which should be set to
"ethernet-phy". This patch adds check in scanning phys and only scans
node which have device-type set to "ethernet-phy".

Signed-off-by: Srinivas Kandagatla <srinivas....@st.com>
---
drivers/of/of_mdio.c | 7 +++++++
1 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/drivers/of/of_mdio.c b/drivers/of/of_mdio.c
index d5a57a9..78c53c7 100644
--- a/drivers/of/of_mdio.c
+++ b/drivers/of/of_mdio.c
@@ -57,6 +57,9 @@ int of_mdiobus_register(struct mii_bus *mdio, struct device_node *np)

/* Loop over the child nodes and register a phy_device for each one */
for_each_available_child_of_node(np, child) {
+ /* A PHY must have device_type set to "ethernet-phy" */
+ if (of_node_cmp(child->type, "ethernet-phy"))
+ continue;
/* A PHY must have a reg property in the range [0-31] */
paddr = of_get_property(child, "reg", &len);
if (!paddr || len < sizeof(*paddr)) {
@@ -112,6 +115,10 @@ int of_mdiobus_register(struct mii_bus *mdio, struct device_node *np)

/* auto scan for PHYs with empty reg property */
for_each_available_child_of_node(np, child) {
+ /* A PHY must have device_type set to "ethernet-phy" */
+ if (of_node_cmp(child->type, "ethernet-phy"))
+ continue;
+
/* Skip PHYs with reg property set */
paddr = of_get_property(child, "reg", &len);
if (paddr)
--
1.7.6.5

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majo...@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

Grant Likely

unread,
Nov 15, 2013, 10:10:02 AM11/15/13
to
On Thu, 14 Nov 2013 15:05:56 +0000, Srinivas Kandagatla <srinivas....@st.com> wrote:
> According to Documentation/devicetree/bindings/net/phy.txt device_type
> property of PHY nodes is mandatory, which should be set to
> "ethernet-phy". This patch adds check in scanning phys and only scans
> node which have device-type set to "ethernet-phy".
>
> Signed-off-by: Srinivas Kandagatla <srinivas....@st.com>

Hi Srinivas,

Thanks for looking at this. However, there is a high likelyhood that
this patch will break existing platforms since we haven't enforced this
requirement before. Besides, I don't think the ethernet-phy binding is
necessary. The mere fact that it is a child of the MDIO bus node means
that the device is a PHY device for the purposes of the subsystem.

Nacked-by: Grant Likely <grant....@linaro.org>

g.

Florian Fainelli

unread,
Dec 11, 2013, 2:20:02 AM12/11/13
to
Le jeudi 14 novembre 2013, 15:05:56 Srinivas Kandagatla a �crit :
> According to Documentation/devicetree/bindings/net/phy.txt device_type
> property of PHY nodes is mandatory, which should be set to
> "ethernet-phy". This patch adds check in scanning phys and only scans
> node which have device-type set to "ethernet-phy".

Please CC net...@vger.kernel.org as there might be networking folks not
actively following devicetree-discuss.

>
> Signed-off-by: Srinivas Kandagatla <srinivas....@st.com>
> ---
> drivers/of/of_mdio.c | 7 +++++++
> 1 files changed, 7 insertions(+), 0 deletions(-)
>
> diff --git a/drivers/of/of_mdio.c b/drivers/of/of_mdio.c
> index d5a57a9..78c53c7 100644
> --- a/drivers/of/of_mdio.c
> +++ b/drivers/of/of_mdio.c
> @@ -57,6 +57,9 @@ int of_mdiobus_register(struct mii_bus *mdio, struct
> device_node *np)
>
> /* Loop over the child nodes and register a phy_device for each one */
> for_each_available_child_of_node(np, child) {
> + /* A PHY must have device_type set to "ethernet-phy" */
> + if (of_node_cmp(child->type, "ethernet-phy"))
> + continue;

As already stated by Grant this will break quite a lot of platforms out there.
Technically speaking, ePAPR v1.1 only specifies that "cpu" and "memory" nodes
should have a "device_type" property for compatibility. Altough I do agree
that it is nice to have a properly set "device_type", we can't always rely on
that.
--
Florian

Grant Likely

unread,
Dec 11, 2013, 4:20:01 AM12/11/13
to
On Wed, 11 Dec 2013 07:15:54 +0000, Florian Fainelli <f.fai...@gmail.com> wrote:
Actually it is the opposite. device_type is deprecated and has been for
a long time now. Device bindings should not not be using device_type
unless it is there for legacy compatibility.

g.
0 new messages