diff mbox series

[3/4] dt-bindings: net: phy: mscc: vsc8531: fix missing "/bits/ 8" in example

Message ID 20180730130236.3837-3-quentin.schulz@bootlin.com
State Not Applicable, archived
Headers show
Series None | expand

Commit Message

Quentin Schulz July 30, 2018, 1:02 p.m. UTC
The "vsc8531,led-N-mode" property is read as a u8 in the driver and
there aren't a lot of modes anyway.

Without the "/bits/ 8" in front of the value of the property, the
value is stored as an u32 resulting in of_read_property_u8 to always
return 0.

Fix the example so that people using the property can actually use it.

Signed-off-by: Quentin Schulz <quentin.schulz@bootlin.com>
---
 Documentation/devicetree/bindings/net/mscc-phy-vsc8531.txt | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Andrew Lunn July 30, 2018, 1:58 p.m. UTC | #1
On Mon, Jul 30, 2018 at 03:02:35PM +0200, Quentin Schulz wrote:
> The "vsc8531,led-N-mode" property is read as a u8 in the driver and
> there aren't a lot of modes anyway.
> 
> Without the "/bits/ 8" in front of the value of the property, the
> value is stored as an u32 resulting in of_read_property_u8 to always
> return 0.

Hi Quentin

on big endian systems. I'm expect this worked on little endian ARM. I
think the development work was done on a hacked RPi, if i remember
correctly.

> 
> Fix the example so that people using the property can actually use it.
> 
> Signed-off-by: Quentin Schulz <quentin.schulz@bootlin.com>
> ---
>  Documentation/devicetree/bindings/net/mscc-phy-vsc8531.txt | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/Documentation/devicetree/bindings/net/mscc-phy-vsc8531.txt b/Documentation/devicetree/bindings/net/mscc-phy-vsc8531.txt
> index 664d9d0543fc..4c7d1d384df0 100644
> --- a/Documentation/devicetree/bindings/net/mscc-phy-vsc8531.txt
> +++ b/Documentation/devicetree/bindings/net/mscc-phy-vsc8531.txt
> @@ -63,6 +63,6 @@ Example:
>                  compatible = "ethernet-phy-id0007.0570";
>                  vsc8531,vddmac		= <3300>;
>                  vsc8531,edge-slowdown	= <7>;
> -                vsc8531,led-0-mode	= <LINK_1000_ACTIVITY>;
> -                vsc8531,led-1-mode	= <LINK_100_ACTIVITY>;
> +                vsc8531,led-0-mode	= /bits/ 8 <LINK_1000_ACTIVITY>;
> +                vsc8531,led-1-mode	= /bits/ 8 <LINK_100_ACTIVITY>;

I don't know the device tree language well enough...

Would this work?

vsc8531,led-1-mode	= < /bits/ 8  LINK_100_ACTIVITY>;

If so, you can make it part of the #define.

   Andrew
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Quentin Schulz July 31, 2018, 9:11 a.m. UTC | #2
Hi Andrew,

On Mon, Jul 30, 2018 at 03:58:13PM +0200, Andrew Lunn wrote:
> On Mon, Jul 30, 2018 at 03:02:35PM +0200, Quentin Schulz wrote:
> > The "vsc8531,led-N-mode" property is read as a u8 in the driver and
> > there aren't a lot of modes anyway.
> > 
> > Without the "/bits/ 8" in front of the value of the property, the
> > value is stored as an u32 resulting in of_read_property_u8 to always
> > return 0.
> 
> Hi Quentin
> 
> on big endian systems. I'm expect this worked on little endian ARM. I
> think the development work was done on a hacked RPi, if i remember
> correctly.
> 
> > 
> > Fix the example so that people using the property can actually use it.
> > 
> > Signed-off-by: Quentin Schulz <quentin.schulz@bootlin.com>
> > ---
> >  Documentation/devicetree/bindings/net/mscc-phy-vsc8531.txt | 4 ++--
> >  1 file changed, 2 insertions(+), 2 deletions(-)
> > 
> > diff --git a/Documentation/devicetree/bindings/net/mscc-phy-vsc8531.txt b/Documentation/devicetree/bindings/net/mscc-phy-vsc8531.txt
> > index 664d9d0543fc..4c7d1d384df0 100644
> > --- a/Documentation/devicetree/bindings/net/mscc-phy-vsc8531.txt
> > +++ b/Documentation/devicetree/bindings/net/mscc-phy-vsc8531.txt
> > @@ -63,6 +63,6 @@ Example:
> >                  compatible = "ethernet-phy-id0007.0570";
> >                  vsc8531,vddmac		= <3300>;
> >                  vsc8531,edge-slowdown	= <7>;
> > -                vsc8531,led-0-mode	= <LINK_1000_ACTIVITY>;
> > -                vsc8531,led-1-mode	= <LINK_100_ACTIVITY>;
> > +                vsc8531,led-0-mode	= /bits/ 8 <LINK_1000_ACTIVITY>;
> > +                vsc8531,led-1-mode	= /bits/ 8 <LINK_100_ACTIVITY>;
> 
> I don't know the device tree language well enough...
> 
> Would this work?
> 
> vsc8531,led-1-mode	= < /bits/ 8  LINK_100_ACTIVITY>;
> 
> If so, you can make it part of the #define.

It does not compile unfortunately. According to the documentation of
DTC[1], /bits/ 8 should prefix the value/array so I guess we're out of
luck for using the same define in the kernel and DTS if we want to
abstract this prefix.

Quentin

[1] https://git.kernel.org/pub/scm/utils/dtc/dtc.git/tree/Documentation/dts-format.txt#n46
Rob Herring Aug. 13, 2018, 10:54 p.m. UTC | #3
On Mon, Jul 30, 2018 at 03:02:35PM +0200, Quentin Schulz wrote:
> The "vsc8531,led-N-mode" property is read as a u8 in the driver and
> there aren't a lot of modes anyway.
> 
> Without the "/bits/ 8" in front of the value of the property, the
> value is stored as an u32 resulting in of_read_property_u8 to always
> return 0.

Humm, I thought this would return an error if the size was wrong, but 
there must have been some reason otherwise.

> Fix the example so that people using the property can actually use it.
> 
> Signed-off-by: Quentin Schulz <quentin.schulz@bootlin.com>
> ---
>  Documentation/devicetree/bindings/net/mscc-phy-vsc8531.txt | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)

Really, the driver should be changed to use u32 if that's what's already 
in use.

Either way,

Reviewed-by: Rob Herring <robh@kernel.org>

> 
> diff --git a/Documentation/devicetree/bindings/net/mscc-phy-vsc8531.txt b/Documentation/devicetree/bindings/net/mscc-phy-vsc8531.txt
> index 664d9d0543fc..4c7d1d384df0 100644
> --- a/Documentation/devicetree/bindings/net/mscc-phy-vsc8531.txt
> +++ b/Documentation/devicetree/bindings/net/mscc-phy-vsc8531.txt
> @@ -63,6 +63,6 @@ Example:
>                  compatible = "ethernet-phy-id0007.0570";
>                  vsc8531,vddmac		= <3300>;
>                  vsc8531,edge-slowdown	= <7>;
> -                vsc8531,led-0-mode	= <LINK_1000_ACTIVITY>;
> -                vsc8531,led-1-mode	= <LINK_100_ACTIVITY>;
> +                vsc8531,led-0-mode	= /bits/ 8 <LINK_1000_ACTIVITY>;
> +                vsc8531,led-1-mode	= /bits/ 8 <LINK_100_ACTIVITY>;
>          };
> -- 
> 2.17.1
>
diff mbox series

Patch

diff --git a/Documentation/devicetree/bindings/net/mscc-phy-vsc8531.txt b/Documentation/devicetree/bindings/net/mscc-phy-vsc8531.txt
index 664d9d0543fc..4c7d1d384df0 100644
--- a/Documentation/devicetree/bindings/net/mscc-phy-vsc8531.txt
+++ b/Documentation/devicetree/bindings/net/mscc-phy-vsc8531.txt
@@ -63,6 +63,6 @@  Example:
                 compatible = "ethernet-phy-id0007.0570";
                 vsc8531,vddmac		= <3300>;
                 vsc8531,edge-slowdown	= <7>;
-                vsc8531,led-0-mode	= <LINK_1000_ACTIVITY>;
-                vsc8531,led-1-mode	= <LINK_100_ACTIVITY>;
+                vsc8531,led-0-mode	= /bits/ 8 <LINK_1000_ACTIVITY>;
+                vsc8531,led-1-mode	= /bits/ 8 <LINK_100_ACTIVITY>;
         };