diff mbox series

[net-next] ARM: dts: imx6qdl: Remove unnecessary mdio #address-cells/#size-cells

Message ID 20210723112835.31743-1-festevam@gmail.com
State New
Headers show
Series [net-next] ARM: dts: imx6qdl: Remove unnecessary mdio #address-cells/#size-cells | expand

Commit Message

Fabio Estevam July 23, 2021, 11:28 a.m. UTC
Since commit dabb5db17c06 ("ARM: dts: imx6qdl: move phy properties into
phy device node") the following W=1 dtc warnings are seen:

arch/arm/boot/dts/imx6qdl-aristainetos2.dtsi:323.7-334.4: Warning (avoid_unnecessary_addr_size): /soc/bus@2100000/ethernet@2188000/mdio: unnecessary #address-cells/#size-cells without "ranges" or child "reg" property

Remove the unnecessary mdio #address-cells/#size-cells to fix it.

Fixes: dabb5db17c06 ("ARM: dts: imx6qdl: move phy properties into phy device node")
Signed-off-by: Fabio Estevam <festevam@gmail.com>
---
Hi,

I am targetting net-next because this is where the offending patch was
applied.

 arch/arm/boot/dts/imx6q-novena.dts           | 3 ---
 arch/arm/boot/dts/imx6qdl-aristainetos2.dtsi | 3 ---
 arch/arm/boot/dts/imx6qdl-nit6xlite.dtsi     | 3 ---
 arch/arm/boot/dts/imx6qdl-nitrogen6_max.dtsi | 3 ---
 arch/arm/boot/dts/imx6qdl-nitrogen6x.dtsi    | 3 ---
 arch/arm/boot/dts/imx6qdl-sabrelite.dtsi     | 3 ---
 6 files changed, 18 deletions(-)

Comments

Fabio Estevam July 23, 2021, 1:15 p.m. UTC | #1
Hi Vladimr,

On Fri, Jul 23, 2021 at 10:08 AM Vladimir Oltean <olteanv@gmail.com> wrote:

> Are you actually sure this is the correct fix? If I look at mdio.yaml, I
> think it is pretty clear that the "ethernet-phy" subnode of the MDIO
> controller must have an "@[0-9a-f]+$" pattern, and a "reg" property. If
> it did, then it wouldn't warn about #address-cells.

Thanks for reviewing it.

After double-checking I realize that the correct fix would be to pass
the phy address, like:

phy: ethernet-phy@1 {
reg = <1>;

Since the Ethernet PHY address is design dependant, I can not make the
fix myself.

I will try to ping the board maintainers for passing the correct phy address.

Thanks
Vladimir Oltean July 23, 2021, 1:35 p.m. UTC | #2
On Fri, Jul 23, 2021 at 10:15:52AM -0300, Fabio Estevam wrote:
> Hi Vladimr,
> 
> On Fri, Jul 23, 2021 at 10:08 AM Vladimir Oltean <olteanv@gmail.com> wrote:
> 
> > Are you actually sure this is the correct fix? If I look at mdio.yaml, I
> > think it is pretty clear that the "ethernet-phy" subnode of the MDIO
> > controller must have an "@[0-9a-f]+$" pattern, and a "reg" property. If
> > it did, then it wouldn't warn about #address-cells.
> 
> Thanks for reviewing it.
> 
> After double-checking I realize that the correct fix would be to pass
> the phy address, like:
> 
> phy: ethernet-phy@1 {
> reg = <1>;
> 
> Since the Ethernet PHY address is design dependant, I can not make the
> fix myself.
> 
> I will try to ping the board maintainers for passing the correct phy address.
> 
> Thanks

Normally you should have been able to make all PHY addresses be 0. That
is the MDIO "broadcast address" and if there's a single PHY on the bus,
it should respond to that.

Citation:

IEEE 802.3-2015:

22.2.4.5.5 PHYAD (PHY Address)

The PHY Address is five bits, allowing 32 unique PHY addresses. The first PHY address bit transmitted and
received is the MSB of the address. A PHY that is connected to the station management entity via the
mechanical interface defined in 22.6 shall always respond to transactions addressed to PHY Address zero
<00000>. A station management entity that is attached to multiple PHYs must have prior knowledge of the
appropriate PHY Address for each PHY.

However, if you google "MDIO broadcast address", you'll find all sorts
of funny reports of buggy PHYs not adhering to that clause, under all
sorts of pretexts...
Joakim Zhang July 24, 2021, 5:21 a.m. UTC | #3
Hi Fabio,

> -----Original Message-----

> From: Fabio Estevam <festevam@gmail.com>

> Sent: 2021年7月23日 21:16

> To: Vladimir Oltean <olteanv@gmail.com>

> Cc: David S. Miller <davem@davemloft.net>; Shawn Guo

> <shawnguo@kernel.org>; moderated list:ARM/FREESCALE IMX / MXC ARM

> ARCHITECTURE <linux-arm-kernel@lists.infradead.org>; Joakim Zhang

> <qiangqing.zhang@nxp.com>; Rob Herring <robh+dt@kernel.org>; netdev

> <netdev@vger.kernel.org>; open list:OPEN FIRMWARE AND FLATTENED

> DEVICE TREE BINDINGS <devicetree@vger.kernel.org>

> Subject: Re: [PATCH net-next] ARM: dts: imx6qdl: Remove unnecessary mdio

> #address-cells/#size-cells

> 

> Hi Vladimr,

> 

> On Fri, Jul 23, 2021 at 10:08 AM Vladimir Oltean <olteanv@gmail.com> wrote:

> 

> > Are you actually sure this is the correct fix? If I look at mdio.yaml,

> > I think it is pretty clear that the "ethernet-phy" subnode of the MDIO

> > controller must have an "@[0-9a-f]+$" pattern, and a "reg" property.

> > If it did, then it wouldn't warn about #address-cells.

> 

> Thanks for reviewing it.

> 

> After double-checking I realize that the correct fix would be to pass the phy

> address, like:

> 

> phy: ethernet-phy@1 {

> reg = <1>;

> 

> Since the Ethernet PHY address is design dependant, I can not make the fix

> myself.

> 

> I will try to ping the board maintainers for passing the correct phy address.


Thanks.

I prepare this patch to fix dtbs_check when convert fec binding into schema.
I realized that we need a "reg" under phy device node, but I also don't know how to add it since
the phy is obviously not on board. And I check the phy code, it supports auto scan for PHYs with empty
"reg" property.

Best Regards,
Joakim Zhang
> Thanks
Fabio Estevam July 24, 2021, 12:48 p.m. UTC | #4
Hi Joakim and Vladimir,

On Sat, Jul 24, 2021 at 2:21 AM Joakim Zhang <qiangqing.zhang@nxp.com> wrote:

> I prepare this patch to fix dtbs_check when convert fec binding into schema.

> I realized that we need a "reg" under phy device node, but I also don't know how to add it since

> the phy is obviously not on board. And I check the phy code, it supports auto scan for PHYs with empty

> "reg" property.


I looked in the U-Boot code for the nitrogenx6x board:
https://source.denx.de/u-boot/u-boot/-/blob/master/board/boundary/nitrogen6x/nitrogen6x.c#L343-356

and it scans for a range of Ethernet PHY addresses.

As we can't pass a reg property in the dts in this case, the patch I
sent that removes the
#address-cells/#size-cells properties looks good, right?

What do you think?
Florian Fainelli July 24, 2021, 4:37 p.m. UTC | #5
On 7/23/2021 6:08 AM, Vladimir Oltean wrote:
> Hi Fabio,

> 

> On Fri, Jul 23, 2021 at 08:28:35AM -0300, Fabio Estevam wrote:

>> Since commit dabb5db17c06 ("ARM: dts: imx6qdl: move phy properties into

>> phy device node") the following W=1 dtc warnings are seen:

>>

>> arch/arm/boot/dts/imx6qdl-aristainetos2.dtsi:323.7-334.4: Warning (avoid_unnecessary_addr_size): /soc/bus@2100000/ethernet@2188000/mdio: unnecessary #address-cells/#size-cells without "ranges" or child "reg" property

>>

>> Remove the unnecessary mdio #address-cells/#size-cells to fix it.

>>

>> Fixes: dabb5db17c06 ("ARM: dts: imx6qdl: move phy properties into phy device node")

>> Signed-off-by: Fabio Estevam <festevam@gmail.com>

>> ---

> 

> Are you actually sure this is the correct fix? If I look at mdio.yaml, I

> think it is pretty clear that the "ethernet-phy" subnode of the MDIO

> controller must have an "@[0-9a-f]+$" pattern, and a "reg" property. If


It is valid to omit the "reg" property of an Ethernet PHY which the 
kernel will then dynamically scan for. If you know the Ethernet PHY 
address it's obviously better to set it so you avoid scanning and the 
time spent in doing that. The boot loader could (should?) also provide 
that information to the kernel for the same reasons.
-- 
Florian
Vladimir Oltean July 24, 2021, 5:03 p.m. UTC | #6
On Sat, Jul 24, 2021 at 09:37:35AM -0700, Florian Fainelli wrote:
> On 7/23/2021 6:08 AM, Vladimir Oltean wrote:

> > Hi Fabio,

> >

> > On Fri, Jul 23, 2021 at 08:28:35AM -0300, Fabio Estevam wrote:

> > > Since commit dabb5db17c06 ("ARM: dts: imx6qdl: move phy properties into

> > > phy device node") the following W=1 dtc warnings are seen:

> > >

> > > arch/arm/boot/dts/imx6qdl-aristainetos2.dtsi:323.7-334.4: Warning (avoid_unnecessary_addr_size): /soc/bus@2100000/ethernet@2188000/mdio: unnecessary #address-cells/#size-cells without "ranges" or child "reg" property

> > >

> > > Remove the unnecessary mdio #address-cells/#size-cells to fix it.

> > >

> > > Fixes: dabb5db17c06 ("ARM: dts: imx6qdl: move phy properties into phy device node")

> > > Signed-off-by: Fabio Estevam <festevam@gmail.com>

> > > ---

> >

> > Are you actually sure this is the correct fix? If I look at mdio.yaml, I

> > think it is pretty clear that the "ethernet-phy" subnode of the MDIO

> > controller must have an "@[0-9a-f]+$" pattern, and a "reg" property. If

>

> It is valid to omit the "reg" property of an Ethernet PHY which the kernel

> will then dynamically scan for. If you know the Ethernet PHY address it's

> obviously better to set it so you avoid scanning and the time spent in doing

> that. The boot loader could (should?) also provide that information to the

> kernel for the same reasons.


Interesting, but brittle I suppose (it only works reliably with a single
PHY on a shared MDIO bus). NXP has "QDS" boards for internal development
and these have multi-port riser cards with various PHYs for various
SERDES protocols, and we have a really hard time describing the hardware
in DT (we currently use overlays applied by U-Boot), so we would like
some sort of auto-detection of PHYs if that was possible, but I think
that for anything except the simplest of cases it isn't. For example
what happens if you unbind and rebind two net devices in a different
order - they will connect to a PHY at a different address, won't they?

Anyway, I was wrong, ok, but I think the point still stands that
according to mdio.yaml this DT description is not valid. So after your
explanation, it is the DT schema that we should update.
Florian Fainelli July 24, 2021, 7:14 p.m. UTC | #7
On 7/24/2021 10:03 AM, Vladimir Oltean wrote:
> On Sat, Jul 24, 2021 at 09:37:35AM -0700, Florian Fainelli wrote:

>> On 7/23/2021 6:08 AM, Vladimir Oltean wrote:

>>> Hi Fabio,

>>>

>>> On Fri, Jul 23, 2021 at 08:28:35AM -0300, Fabio Estevam wrote:

>>>> Since commit dabb5db17c06 ("ARM: dts: imx6qdl: move phy properties into

>>>> phy device node") the following W=1 dtc warnings are seen:

>>>>

>>>> arch/arm/boot/dts/imx6qdl-aristainetos2.dtsi:323.7-334.4: Warning (avoid_unnecessary_addr_size): /soc/bus@2100000/ethernet@2188000/mdio: unnecessary #address-cells/#size-cells without "ranges" or child "reg" property

>>>>

>>>> Remove the unnecessary mdio #address-cells/#size-cells to fix it.

>>>>

>>>> Fixes: dabb5db17c06 ("ARM: dts: imx6qdl: move phy properties into phy device node")

>>>> Signed-off-by: Fabio Estevam <festevam@gmail.com>

>>>> ---

>>>

>>> Are you actually sure this is the correct fix? If I look at mdio.yaml, I

>>> think it is pretty clear that the "ethernet-phy" subnode of the MDIO

>>> controller must have an "@[0-9a-f]+$" pattern, and a "reg" property. If

>>

>> It is valid to omit the "reg" property of an Ethernet PHY which the kernel

>> will then dynamically scan for. If you know the Ethernet PHY address it's

>> obviously better to set it so you avoid scanning and the time spent in doing

>> that. The boot loader could (should?) also provide that information to the

>> kernel for the same reasons.

> 

> Interesting, but brittle I suppose (it only works reliably with a single

> PHY on a shared MDIO bus). NXP has "QDS" boards for internal development

> and these have multi-port riser cards with various PHYs for various

> SERDES protocols, and we have a really hard time describing the hardware

> in DT (we currently use overlays applied by U-Boot), so we would like

> some sort of auto-detection of PHYs if that was possible, but I think

> that for anything except the simplest of cases it isn't. For example

> what happens if you unbind and rebind two net devices in a different

> order - they will connect to a PHY at a different address, won't they?


Oh yes, it is fraught with peril in most cases, however for some simple 
cases like dedicated MDIO bus and single Ethernet PHY on the bus this 
works quite nicely. We have a bunch of reference boards that allow us to 
connect either a MTSIF or RGMII daughter card and we scan the MDIO bus 
in the boot loader if the networking stack is initialized (in which case 
the DT gets patched accordingly), else, we leave it to Linux to probe 
for the PHY.

> 

> Anyway, I was wrong, ok, but I think the point still stands that

> according to mdio.yaml this DT description is not valid. So after your

> explanation, it is the DT schema that we should update.


Yes, the "reg" property is technically optional, however #address-cells 
and #size-cells are not, or rather they only are useful if "reg" is 
provided so it can be checked accordingly, humm.
-- 
Florian
diff mbox series

Patch

diff --git a/arch/arm/boot/dts/imx6q-novena.dts b/arch/arm/boot/dts/imx6q-novena.dts
index 225cf6b7a7a4..909adaf4e544 100644
--- a/arch/arm/boot/dts/imx6q-novena.dts
+++ b/arch/arm/boot/dts/imx6q-novena.dts
@@ -227,9 +227,6 @@  &fec {
 	status = "okay";
 
 	mdio {
-		#address-cells = <1>;
-		#size-cells = <0>;
-
 		ethphy: ethernet-phy {
 			compatible = "ethernet-phy-ieee802.3-c22";
 			rxc-skew-ps = <3000>;
diff --git a/arch/arm/boot/dts/imx6qdl-aristainetos2.dtsi b/arch/arm/boot/dts/imx6qdl-aristainetos2.dtsi
index 563bf9d44fe0..3e13be35b526 100644
--- a/arch/arm/boot/dts/imx6qdl-aristainetos2.dtsi
+++ b/arch/arm/boot/dts/imx6qdl-aristainetos2.dtsi
@@ -321,9 +321,6 @@  &fec {
 	status = "okay";
 
 	mdio {
-		#address-cells = <1>;
-		#size-cells = <0>;
-
 		ethphy: ethernet-phy {
 			compatible = "ethernet-phy-ieee802.3-c22";
 			txd0-skew-ps = <0>;
diff --git a/arch/arm/boot/dts/imx6qdl-nit6xlite.dtsi b/arch/arm/boot/dts/imx6qdl-nit6xlite.dtsi
index ac34709e9741..492eaa4094ff 100644
--- a/arch/arm/boot/dts/imx6qdl-nit6xlite.dtsi
+++ b/arch/arm/boot/dts/imx6qdl-nit6xlite.dtsi
@@ -198,9 +198,6 @@  &fec {
 	status = "okay";
 
 	mdio {
-		#address-cells = <1>;
-		#size-cells = <0>;
-
 		ethphy: ethernet-phy {
 			compatible = "ethernet-phy-ieee802.3-c22";
 			txen-skew-ps = <0>;
diff --git a/arch/arm/boot/dts/imx6qdl-nitrogen6_max.dtsi b/arch/arm/boot/dts/imx6qdl-nitrogen6_max.dtsi
index c96f4d7e1e0d..4e5682211f42 100644
--- a/arch/arm/boot/dts/imx6qdl-nitrogen6_max.dtsi
+++ b/arch/arm/boot/dts/imx6qdl-nitrogen6_max.dtsi
@@ -340,9 +340,6 @@  &fec {
 	status = "okay";
 
 	mdio {
-		#address-cells = <1>;
-		#size-cells = <0>;
-
 		ethphy: ethernet-phy {
 			compatible = "ethernet-phy-ieee802.3-c22";
 			txen-skew-ps = <0>;
diff --git a/arch/arm/boot/dts/imx6qdl-nitrogen6x.dtsi b/arch/arm/boot/dts/imx6qdl-nitrogen6x.dtsi
index 49da30d7510c..c29fbfd87172 100644
--- a/arch/arm/boot/dts/imx6qdl-nitrogen6x.dtsi
+++ b/arch/arm/boot/dts/imx6qdl-nitrogen6x.dtsi
@@ -273,9 +273,6 @@  &fec {
 	status = "okay";
 
 	mdio {
-		#address-cells = <1>;
-		#size-cells = <0>;
-
 		ethphy: ethernet-phy {
 			compatible = "ethernet-phy-ieee802.3-c22";
 			txen-skew-ps = <0>;
diff --git a/arch/arm/boot/dts/imx6qdl-sabrelite.dtsi b/arch/arm/boot/dts/imx6qdl-sabrelite.dtsi
index eb9a0b104f1c..a6f2d6db521f 100644
--- a/arch/arm/boot/dts/imx6qdl-sabrelite.dtsi
+++ b/arch/arm/boot/dts/imx6qdl-sabrelite.dtsi
@@ -329,9 +329,6 @@  &fec {
 	status = "okay";
 
 	mdio {
-		#address-cells = <1>;
-		#size-cells = <0>;
-
 		ethphy: ethernet-phy {
 			compatible = "ethernet-phy-ieee802.3-c22";
 			txen-skew-ps = <0>;