devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH RFC] net: of_mdio: Scan PHYs which have device_type set to ethernet-phy
@ 2013-11-14 15:05 Srinivas Kandagatla
       [not found] ` <1384441556-20674-1-git-send-email-srinivas.kandagatla-qxv4g6HH51o@public.gmane.org>
  2013-12-11  7:15 ` Florian Fainelli
  0 siblings, 2 replies; 4+ messages in thread
From: Srinivas Kandagatla @ 2013-11-14 15:05 UTC (permalink / raw)
  To: devicetree-u79uwXL29TY76Z2rM5mHXA
  Cc: Grant Likely, Rob Herring, linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	srinivas.kandagatla-qxv4g6HH51o

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.kandagatla-qxv4g6HH51o@public.gmane.org>
---
 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 devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH RFC] net: of_mdio: Scan PHYs which have device_type set to ethernet-phy
       [not found] ` <1384441556-20674-1-git-send-email-srinivas.kandagatla-qxv4g6HH51o@public.gmane.org>
@ 2013-11-15  1:35   ` Grant Likely
  0 siblings, 0 replies; 4+ messages in thread
From: Grant Likely @ 2013-11-15  1:35 UTC (permalink / raw)
  To: devicetree-u79uwXL29TY76Z2rM5mHXA
  Cc: Rob Herring, linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	srinivas.kandagatla-qxv4g6HH51o

On Thu, 14 Nov 2013 15:05:56 +0000, Srinivas Kandagatla <srinivas.kandagatla-qxv4g6HH51o@public.gmane.org> 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.kandagatla-qxv4g6HH51o@public.gmane.org>

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.likely-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>

g.

> ---
>  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 devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH RFC] net: of_mdio: Scan PHYs which have device_type set to ethernet-phy
  2013-11-14 15:05 [PATCH RFC] net: of_mdio: Scan PHYs which have device_type set to ethernet-phy Srinivas Kandagatla
       [not found] ` <1384441556-20674-1-git-send-email-srinivas.kandagatla-qxv4g6HH51o@public.gmane.org>
@ 2013-12-11  7:15 ` Florian Fainelli
  2013-12-11  9:15   ` Grant Likely
  1 sibling, 1 reply; 4+ messages in thread
From: Florian Fainelli @ 2013-12-11  7:15 UTC (permalink / raw)
  To: Srinivas Kandagatla
  Cc: devicetree, Grant Likely, Rob Herring, linux-kernel, netdev

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 netdev@vger.kernel.org as there might be networking folks not 
actively following devicetree-discuss.

> 
> Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH RFC] net: of_mdio: Scan PHYs which have device_type set to ethernet-phy
  2013-12-11  7:15 ` Florian Fainelli
@ 2013-12-11  9:15   ` Grant Likely
  0 siblings, 0 replies; 4+ messages in thread
From: Grant Likely @ 2013-12-11  9:15 UTC (permalink / raw)
  To: Florian Fainelli, Srinivas Kandagatla
  Cc: devicetree, Rob Herring, linux-kernel, netdev

On Wed, 11 Dec 2013 07:15:54 +0000, Florian Fainelli <f.fainelli@gmail.com> wrote:
> 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 netdev@vger.kernel.org as there might be networking folks not 
> actively following devicetree-discuss.
> 
> > 
> > Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@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. 

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.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2013-12-11  9:15 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-11-14 15:05 [PATCH RFC] net: of_mdio: Scan PHYs which have device_type set to ethernet-phy Srinivas Kandagatla
     [not found] ` <1384441556-20674-1-git-send-email-srinivas.kandagatla-qxv4g6HH51o@public.gmane.org>
2013-11-15  1:35   ` Grant Likely
2013-12-11  7:15 ` Florian Fainelli
2013-12-11  9:15   ` Grant Likely

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).