All of lore.kernel.org
 help / color / mirror / Atom feed
* Re: [PATCH] mx6cuboxi: fix ethernet after synchronise device-tree
       [not found] <20220728070540.28554-1-josua@solid-run.com>
@ 2022-07-28  7:08 ` Josua Mayer
  2022-07-28 11:11   ` Fabio Estevam
                     ` (2 more replies)
  2022-07-28 11:41 ` Tom Rini
  1 sibling, 3 replies; 15+ messages in thread
From: Josua Mayer @ 2022-07-28  7:08 UTC (permalink / raw)
  To: u-boot
  Cc: Yazan Shhady, Tom Rini, Stefano Babic, Fabio Estevam,
	NXP i.MX U-Boot Team, Baruch Siach, Marcel Ziswiler

Please hold off merging this patch until someone tested it, I can not do so
this week.
@Tom Can you confirm if this fixes the networking on your Cubox?
Also note that the phy-handle property may or may not be required, I am not
sure.

sincerely
Josua Mayer

On Thu, Jul 28, 2022 at 7:05 AM Josua Mayer <josua@solid-run.com> wrote:

> The i.MX6 Cubox-i and HummingBoards can have different PHYs at varying
> addresses. U-Boot needs to auto-detect which phy is actually present,
> and at which address it is responding.
>
> Auto-detection from multiple phy nodes specified in device-tree does not
> currently work correct. As a work-around merge all three possible phys
> into one node with the special address 0xffffffff which indicates to the
> generic phy driver to probe all addresses.
> Also fixup this fake address before booting Linux, *if* booting with
> U-Boot's internal dtb.
>
> Signed-off-by: Josua Mayer <josua@solid-run.com>
> Fixes: d0399a46e7cd
> ---
>  arch/arm/dts/imx6qdl-sr-som.dtsi     | 30 +++++++++-------------------
>  board/solidrun/mx6cuboxi/mx6cuboxi.c |  6 +++++-
>  2 files changed, 14 insertions(+), 22 deletions(-)
>
> diff --git a/arch/arm/dts/imx6qdl-sr-som.dtsi
> b/arch/arm/dts/imx6qdl-sr-som.dtsi
> index ce543e325c..2d7cbc26b3 100644
> --- a/arch/arm/dts/imx6qdl-sr-som.dtsi
> +++ b/arch/arm/dts/imx6qdl-sr-som.dtsi
> @@ -53,6 +53,7 @@
>  &fec {
>         pinctrl-names = "default";
>         pinctrl-0 = <&pinctrl_microsom_enet_ar8035>;
> +       phy-handle = <&phy>;
>         phy-mode = "rgmii-id";
>
>         /*
> @@ -68,30 +69,17 @@
>                 #address-cells = <1>;
>                 #size-cells = <0>;
>
> -               /*
> -                * The PHY can appear at either address 0 or 4 due to the
> -                * configuration (LED) pin not being pulled sufficiently.
> -                */
> -               ethernet-phy@0 {
> -                       reg = <0>;
> +               phy: ethernet-phy@0 {
> +                       /*
> +                        * The PHY can appear either:
> +                        * - AR8035: at address 0 or 4
> +                        * - ADIN1300: at address 1
> +                        * Actual address being detected at runtime.
> +                        */
> +                       reg = <0xffffffff>;
>                         qca,clk-out-frequency = <125000000>;
>                         qca,smarteee-tw-us-1g = <24>;
> -               };
> -
> -               ethernet-phy@4 {
> -                       reg = <4>;
> -                       qca,clk-out-frequency = <125000000>;
> -                       qca,smarteee-tw-us-1g = <24>;
> -               };
> -
> -               /*
> -                * ADIN1300 (som rev 1.9 or later) is always at address 1.
> It
> -                * will be enabled automatically by U-Boot if detected.
> -                */
> -               ethernet-phy@1 {
> -                       reg = <1>;
>                         adi,phy-output-clock = "125mhz-free-running";
> -                       status = "disabled";
>                 };
>         };
>  };
> diff --git a/board/solidrun/mx6cuboxi/mx6cuboxi.c
> b/board/solidrun/mx6cuboxi/mx6cuboxi.c
> index debf4f6a3b..52172a03b1 100644
> --- a/board/solidrun/mx6cuboxi/mx6cuboxi.c
> +++ b/board/solidrun/mx6cuboxi/mx6cuboxi.c
> @@ -446,7 +446,7 @@ static int find_ethernet_phy(void)
>   */
>  int ft_board_setup(void *fdt, struct bd_info *bd)
>  {
> -       int node_phy0, node_phy1, node_phy4;
> +       int node_phy, node_phy0, node_phy1, node_phy4;
>         int ret, phy;
>         bool enable_phy0 = false, enable_phy1 = false, enable_phy4 = false;
>         enum board_type board;
> @@ -478,6 +478,10 @@ int ft_board_setup(void *fdt, struct bd_info *bd)
>                 return 0;
>         }
>
> +       // update U-Boot's own unified phy node phy address, if present
> +       node_phy = fdt_path_offset(fdt, "/soc/bus@2100000/ethernet@2188000
> /mdio/phy");
> +       ret = fdt_setprop_u32(fdt, node_phy, "reg", phy);
> +
>         // update all phy nodes status
>         node_phy0 = fdt_path_offset(fdt, "/soc/bus@2100000
> /ethernet@2188000/mdio/ethernet-phy@0");
>         ret = fdt_setprop_string(fdt, node_phy0, "status", enable_phy0 ?
> "okay" : "disabled");
> --
> 2.37.1
>
>

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

* Re: [PATCH] mx6cuboxi: fix ethernet after synchronise device-tree
  2022-07-28  7:08 ` [PATCH] mx6cuboxi: fix ethernet after synchronise device-tree Josua Mayer
@ 2022-07-28 11:11   ` Fabio Estevam
  2022-07-28 11:16   ` Tom Rini
  2024-03-27 12:06   ` Josua Mayer
  2 siblings, 0 replies; 15+ messages in thread
From: Fabio Estevam @ 2022-07-28 11:11 UTC (permalink / raw)
  To: Josua Mayer
  Cc: U-Boot-Denx, Yazan Shhady, Tom Rini, Stefano Babic,
	NXP i.MX U-Boot Team, Baruch Siach, Marcel Ziswiler

Hi Josua,

On Thu, Jul 28, 2022 at 4:08 AM Josua Mayer <josua@solid-run.com> wrote:
>
> Please hold off merging this patch until someone tested it, I can not do so this week.
> @Tom Can you confirm if this fixes the networking on your Cubox?
> Also note that the phy-handle property may or may not be required, I am not sure.
>
> sincerely
> Josua Mayer
>
> On Thu, Jul 28, 2022 at 7:05 AM Josua Mayer <josua@solid-run.com> wrote:
>>
>> The i.MX6 Cubox-i and HummingBoards can have different PHYs at varying
>> addresses. U-Boot needs to auto-detect which phy is actually present,
>> and at which address it is responding.
>>
>> Auto-detection from multiple phy nodes specified in device-tree does not
>> currently work correct. As a work-around merge all three possible phys
>> into one node with the special address 0xffffffff which indicates to the
>> generic phy driver to probe all addresses.
>> Also fixup this fake address before booting Linux, *if* booting with
>> U-Boot's internal dtb.
>>
>> Signed-off-by: Josua Mayer <josua@solid-run.com>
>> Fixes: d0399a46e7cd
>> ---
>>  arch/arm/dts/imx6qdl-sr-som.dtsi     | 30 +++++++++-------------------

Should you patch the u-boot.dtsi variant instead
(arch/arm/dts/imx6qdl-sr-som-u-boot.dtsi) ?

This way the next time the DTS re-sync is done, the problem does not
appear again.

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

* Re: [PATCH] mx6cuboxi: fix ethernet after synchronise device-tree
  2022-07-28  7:08 ` [PATCH] mx6cuboxi: fix ethernet after synchronise device-tree Josua Mayer
  2022-07-28 11:11   ` Fabio Estevam
@ 2022-07-28 11:16   ` Tom Rini
  2024-03-27 12:06   ` Josua Mayer
  2 siblings, 0 replies; 15+ messages in thread
From: Tom Rini @ 2022-07-28 11:16 UTC (permalink / raw)
  To: Josua Mayer
  Cc: u-boot, Yazan Shhady, Stefano Babic, Fabio Estevam,
	NXP i.MX U-Boot Team, Baruch Siach, Marcel Ziswiler

[-- Attachment #1: Type: text/plain, Size: 4798 bytes --]

On Thu, Jul 28, 2022 at 07:08:35AM +0000, Josua Mayer wrote:
> Please hold off merging this patch until someone tested it, I can not do so
> this week.
> @Tom Can you confirm if this fixes the networking on your Cubox?
> Also note that the phy-handle property may or may not be required, I am not
> sure.

Ah, the patch email itself seems to have gotten lost, can you resend and
I'll test?  Thanks.

> 
> sincerely
> Josua Mayer
> 
> On Thu, Jul 28, 2022 at 7:05 AM Josua Mayer <josua@solid-run.com> wrote:
> 
> > The i.MX6 Cubox-i and HummingBoards can have different PHYs at varying
> > addresses. U-Boot needs to auto-detect which phy is actually present,
> > and at which address it is responding.
> >
> > Auto-detection from multiple phy nodes specified in device-tree does not
> > currently work correct. As a work-around merge all three possible phys
> > into one node with the special address 0xffffffff which indicates to the
> > generic phy driver to probe all addresses.
> > Also fixup this fake address before booting Linux, *if* booting with
> > U-Boot's internal dtb.
> >
> > Signed-off-by: Josua Mayer <josua@solid-run.com>
> > Fixes: d0399a46e7cd
> > ---
> >  arch/arm/dts/imx6qdl-sr-som.dtsi     | 30 +++++++++-------------------
> >  board/solidrun/mx6cuboxi/mx6cuboxi.c |  6 +++++-
> >  2 files changed, 14 insertions(+), 22 deletions(-)
> >
> > diff --git a/arch/arm/dts/imx6qdl-sr-som.dtsi
> > b/arch/arm/dts/imx6qdl-sr-som.dtsi
> > index ce543e325c..2d7cbc26b3 100644
> > --- a/arch/arm/dts/imx6qdl-sr-som.dtsi
> > +++ b/arch/arm/dts/imx6qdl-sr-som.dtsi
> > @@ -53,6 +53,7 @@
> >  &fec {
> >         pinctrl-names = "default";
> >         pinctrl-0 = <&pinctrl_microsom_enet_ar8035>;
> > +       phy-handle = <&phy>;
> >         phy-mode = "rgmii-id";
> >
> >         /*
> > @@ -68,30 +69,17 @@
> >                 #address-cells = <1>;
> >                 #size-cells = <0>;
> >
> > -               /*
> > -                * The PHY can appear at either address 0 or 4 due to the
> > -                * configuration (LED) pin not being pulled sufficiently.
> > -                */
> > -               ethernet-phy@0 {
> > -                       reg = <0>;
> > +               phy: ethernet-phy@0 {
> > +                       /*
> > +                        * The PHY can appear either:
> > +                        * - AR8035: at address 0 or 4
> > +                        * - ADIN1300: at address 1
> > +                        * Actual address being detected at runtime.
> > +                        */
> > +                       reg = <0xffffffff>;
> >                         qca,clk-out-frequency = <125000000>;
> >                         qca,smarteee-tw-us-1g = <24>;
> > -               };
> > -
> > -               ethernet-phy@4 {
> > -                       reg = <4>;
> > -                       qca,clk-out-frequency = <125000000>;
> > -                       qca,smarteee-tw-us-1g = <24>;
> > -               };
> > -
> > -               /*
> > -                * ADIN1300 (som rev 1.9 or later) is always at address 1.
> > It
> > -                * will be enabled automatically by U-Boot if detected.
> > -                */
> > -               ethernet-phy@1 {
> > -                       reg = <1>;
> >                         adi,phy-output-clock = "125mhz-free-running";
> > -                       status = "disabled";
> >                 };
> >         };
> >  };
> > diff --git a/board/solidrun/mx6cuboxi/mx6cuboxi.c
> > b/board/solidrun/mx6cuboxi/mx6cuboxi.c
> > index debf4f6a3b..52172a03b1 100644
> > --- a/board/solidrun/mx6cuboxi/mx6cuboxi.c
> > +++ b/board/solidrun/mx6cuboxi/mx6cuboxi.c
> > @@ -446,7 +446,7 @@ static int find_ethernet_phy(void)
> >   */
> >  int ft_board_setup(void *fdt, struct bd_info *bd)
> >  {
> > -       int node_phy0, node_phy1, node_phy4;
> > +       int node_phy, node_phy0, node_phy1, node_phy4;
> >         int ret, phy;
> >         bool enable_phy0 = false, enable_phy1 = false, enable_phy4 = false;
> >         enum board_type board;
> > @@ -478,6 +478,10 @@ int ft_board_setup(void *fdt, struct bd_info *bd)
> >                 return 0;
> >         }
> >
> > +       // update U-Boot's own unified phy node phy address, if present
> > +       node_phy = fdt_path_offset(fdt, "/soc/bus@2100000/ethernet@2188000
> > /mdio/phy");
> > +       ret = fdt_setprop_u32(fdt, node_phy, "reg", phy);
> > +
> >         // update all phy nodes status
> >         node_phy0 = fdt_path_offset(fdt, "/soc/bus@2100000
> > /ethernet@2188000/mdio/ethernet-phy@0");
> >         ret = fdt_setprop_string(fdt, node_phy0, "status", enable_phy0 ?
> > "okay" : "disabled");
> > --
> > 2.37.1
> >
> >

-- 
Tom

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 659 bytes --]

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

* Re: [PATCH] mx6cuboxi: fix ethernet after synchronise device-tree
       [not found] <20220728070540.28554-1-josua@solid-run.com>
  2022-07-28  7:08 ` [PATCH] mx6cuboxi: fix ethernet after synchronise device-tree Josua Mayer
@ 2022-07-28 11:41 ` Tom Rini
  2022-07-28 11:51   ` Fabio Estevam
  1 sibling, 1 reply; 15+ messages in thread
From: Tom Rini @ 2022-07-28 11:41 UTC (permalink / raw)
  To: Josua Mayer
  Cc: u-boot, yazan.shhady, Stefano Babic, Fabio Estevam,
	NXP i.MX U-Boot Team, Baruch Siach, Marcel Ziswiler

[-- Attachment #1: Type: text/plain, Size: 762 bytes --]

On Thu, Jul 28, 2022 at 10:05:40AM +0300, Josua Mayer wrote:

> The i.MX6 Cubox-i and HummingBoards can have different PHYs at varying
> addresses. U-Boot needs to auto-detect which phy is actually present,
> and at which address it is responding.
> 
> Auto-detection from multiple phy nodes specified in device-tree does not
> currently work correct. As a work-around merge all three possible phys
> into one node with the special address 0xffffffff which indicates to the
> generic phy driver to probe all addresses.
> Also fixup this fake address before booting Linux, *if* booting with
> U-Boot's internal dtb.
> 
> Signed-off-by: Josua Mayer <josua@solid-run.com>
> Fixes: d0399a46e7cd

Tested-by: Tom Rini <trini@konsulko.com>

-- 
Tom

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 659 bytes --]

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

* Re: [PATCH] mx6cuboxi: fix ethernet after synchronise device-tree
  2022-07-28 11:41 ` Tom Rini
@ 2022-07-28 11:51   ` Fabio Estevam
  2022-07-28 12:01     ` Tom Rini
  0 siblings, 1 reply; 15+ messages in thread
From: Fabio Estevam @ 2022-07-28 11:51 UTC (permalink / raw)
  To: Tom Rini
  Cc: Josua Mayer, U-Boot-Denx, Yazan Shhady, Stefano Babic,
	NXP i.MX U-Boot Team, Baruch Siach, Marcel Ziswiler

Hi Tom,

On Thu, Jul 28, 2022 at 8:41 AM Tom Rini <trini@konsulko.com> wrote:
>
> On Thu, Jul 28, 2022 at 10:05:40AM +0300, Josua Mayer wrote:
>
> > The i.MX6 Cubox-i and HummingBoards can have different PHYs at varying
> > addresses. U-Boot needs to auto-detect which phy is actually present,
> > and at which address it is responding.
> >
> > Auto-detection from multiple phy nodes specified in device-tree does not
> > currently work correct. As a work-around merge all three possible phys
> > into one node with the special address 0xffffffff which indicates to the
> > generic phy driver to probe all addresses.
> > Also fixup this fake address before booting Linux, *if* booting with
> > U-Boot's internal dtb.
> >
> > Signed-off-by: Josua Mayer <josua@solid-run.com>
> > Fixes: d0399a46e7cd
>
> Tested-by: Tom Rini <trini@konsulko.com>

It's great that it worked, but if we take the patch as-is, then we
will run into issues again in the future
when a new re-sync is done.

I see two alternatives:

1. Make the arch/arm/dts/imx6qdl-sr-som.dtsi changes into
arch/arm/dts/imx6qdl-sr-som-u-boot.dtsi, so that the main dtsi can
still be used from Linux.

2. Make the same dtsi work for both Linux and U-Boot.

What do you think?

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

* Re: [PATCH] mx6cuboxi: fix ethernet after synchronise device-tree
  2022-07-28 11:51   ` Fabio Estevam
@ 2022-07-28 12:01     ` Tom Rini
  0 siblings, 0 replies; 15+ messages in thread
From: Tom Rini @ 2022-07-28 12:01 UTC (permalink / raw)
  To: Fabio Estevam
  Cc: Josua Mayer, U-Boot-Denx, Yazan Shhady, Stefano Babic,
	NXP i.MX U-Boot Team, Baruch Siach, Marcel Ziswiler

[-- Attachment #1: Type: text/plain, Size: 1492 bytes --]

On Thu, Jul 28, 2022 at 08:51:01AM -0300, Fabio Estevam wrote:
> Hi Tom,
> 
> On Thu, Jul 28, 2022 at 8:41 AM Tom Rini <trini@konsulko.com> wrote:
> >
> > On Thu, Jul 28, 2022 at 10:05:40AM +0300, Josua Mayer wrote:
> >
> > > The i.MX6 Cubox-i and HummingBoards can have different PHYs at varying
> > > addresses. U-Boot needs to auto-detect which phy is actually present,
> > > and at which address it is responding.
> > >
> > > Auto-detection from multiple phy nodes specified in device-tree does not
> > > currently work correct. As a work-around merge all three possible phys
> > > into one node with the special address 0xffffffff which indicates to the
> > > generic phy driver to probe all addresses.
> > > Also fixup this fake address before booting Linux, *if* booting with
> > > U-Boot's internal dtb.
> > >
> > > Signed-off-by: Josua Mayer <josua@solid-run.com>
> > > Fixes: d0399a46e7cd
> >
> > Tested-by: Tom Rini <trini@konsulko.com>
> 
> It's great that it worked, but if we take the patch as-is, then we
> will run into issues again in the future
> when a new re-sync is done.

Agreed.

> I see two alternatives:
> 
> 1. Make the arch/arm/dts/imx6qdl-sr-som.dtsi changes into
> arch/arm/dts/imx6qdl-sr-som-u-boot.dtsi, so that the main dtsi can
> still be used from Linux.
> 
> 2. Make the same dtsi work for both Linux and U-Boot.
> 
> What do you think?

If we can make #2 work that would be the best path forward I hope.

-- 
Tom

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 659 bytes --]

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

* Re: [PATCH] mx6cuboxi: fix ethernet after synchronise device-tree
  2022-07-28  7:08 ` [PATCH] mx6cuboxi: fix ethernet after synchronise device-tree Josua Mayer
  2022-07-28 11:11   ` Fabio Estevam
  2022-07-28 11:16   ` Tom Rini
@ 2024-03-27 12:06   ` Josua Mayer
  2024-03-27 12:17     ` Christian Gmeiner
  2024-03-27 19:29     ` Fabio Estevam
  2 siblings, 2 replies; 15+ messages in thread
From: Josua Mayer @ 2024-03-27 12:06 UTC (permalink / raw)
  To: u-boot
  Cc: Yazan Shhady, Tom Rini, Stefano Babic, Fabio Estevam,
	NXP i.MX U-Boot Team, Baruch Siach, Marcel Ziswiler,
	christian.gmeiner

Cc: christian.gmeiner@gmail.com

Hi Christian,

please take a look at this patch, I suspect it will (hack-)fix your
ethernet issue.

Unfortunately I had no time to revisit this yet and implement a correct solution.

sincerely
Josua Mayer

Am 28.07.22 um 09:08 schrieb Josua Mayer:
> Please hold off merging this patch until someone tested it, I can not do so this week.
> @Tom Can you confirm if this fixes the networking on your Cubox?
> Also note that the phy-handle property may or may not be required, I am not sure.
>
> sincerely
> Josua Mayer
>
> On Thu, Jul 28, 2022 at 7:05 AM Josua Mayer <josua@solid-run.com> wrote:
>
>     The i.MX6 Cubox-i and HummingBoards can have different PHYs at varying
>     addresses. U-Boot needs to auto-detect which phy is actually present,
>     and at which address it is responding.
>
>     Auto-detection from multiple phy nodes specified in device-tree does not
>     currently work correct. As a work-around merge all three possible phys
>     into one node with the special address 0xffffffff which indicates to the
>     generic phy driver to probe all addresses.
>     Also fixup this fake address before booting Linux, *if* booting with
>     U-Boot's internal dtb.
>
>     Signed-off-by: Josua Mayer <josua@solid-run.com>
>     Fixes: d0399a46e7cd
>     ---
>      arch/arm/dts/imx6qdl-sr-som.dtsi     | 30 +++++++++-------------------
>      board/solidrun/mx6cuboxi/mx6cuboxi.c |  6 +++++-
>      2 files changed, 14 insertions(+), 22 deletions(-)
>
>     diff --git a/arch/arm/dts/imx6qdl-sr-som.dtsi b/arch/arm/dts/imx6qdl-sr-som.dtsi
>     index ce543e325c..2d7cbc26b3 100644
>     ---_a/arch/arm/dts/imx6qdl-sr-som.dtsi
>     +++ b/arch/arm/dts/imx6qdl-sr-som.dtsi
>     @@ -53,6 +53,7 @@
>      &fec {
>             pinctrl-names = "default";
>             pinctrl-0 = <&pinctrl_microsom_enet_ar8035>;
>     +       phy-handle = <&phy>;
>             phy-mode = "rgmii-id";
>
>             /*
>     @@ -68,30 +69,17 @@
>                     #address-cells = <1>;
>                     #size-cells = <0>;
>
>     -               /*
>     -                * The PHY can appear at either address 0 or 4 due to the
>     -                * configuration (LED) pin not being pulled sufficiently.
>     -                */
>     -               ethernet-phy@0 {
>     -                       reg = <0>;
>     +               phy: ethernet-phy@0 {
>     +                       /*
>     +                        * The PHY can appear either:
>     +                        * - AR8035: at address 0 or 4
>     +                        * - ADIN1300: at address 1
>     +                        * Actual address being detected at runtime.
>     +                        */
>     +                       reg = <0xffffffff>;
>                             qca,clk-out-frequency = <125000000>;
>                             qca,smarteee-tw-us-1g = <24>;
>     -               };
>     -
>     -               ethernet-phy@4 {
>     -                       reg = <4>;
>     -                       qca,clk-out-frequency = <125000000>;
>     -                       qca,smarteee-tw-us-1g = <24>;
>     -               };
>     -
>     -               /*
>     -                * ADIN1300 (som rev 1.9 or later) is always at address 1. It
>     -                * will be enabled automatically by U-Boot if detected.
>     -                */
>     -               ethernet-phy@1 {
>     -                       reg = <1>;
>                             adi,phy-output-clock = "125mhz-free-running";
>     -                       status = "disabled";
>                     };
>             };
>      };
>     diff --git a/board/solidrun/mx6cuboxi/mx6cuboxi.c b/board/solidrun/mx6cuboxi/mx6cuboxi.c
>     index debf4f6a3b..52172a03b1 100644
>     ---_a/board/solidrun/mx6cuboxi/mx6cuboxi.c
>     +++ b/board/solidrun/mx6cuboxi/mx6cuboxi.c
>     @@ -446,7 +446,7 @@ static int find_ethernet_phy(void)
>       */
>      int ft_board_setup(void *fdt, struct bd_info *bd)
>      {
>     -       int node_phy0, node_phy1, node_phy4;
>     +       int node_phy, node_phy0, node_phy1, node_phy4;
>             int ret, phy;
>             bool enable_phy0 = false, enable_phy1 = false, enable_phy4 = false;
>             enum board_type board;
>     @@ -478,6 +478,10 @@ int ft_board_setup(void *fdt, struct bd_info *bd)
>                     return 0;
>             }
>
>     +       // update U-Boot's own unified phy node phy address, if present
>     +       node_phy = fdt_path_offset(fdt, "/soc/bus@2100000/ethernet@2188000/mdio/phy");
>     +       ret = fdt_setprop_u32(fdt, node_phy, "reg", phy);
>     +
>             // update all phy nodes status
>             node_phy0 = fdt_path_offset(fdt, "/soc/bus@2100000/ethernet@2188000/mdio/ethernet-phy@0");
>             ret = fdt_setprop_string(fdt, node_phy0, "status", enable_phy0 ? "okay" : "disabled");
>     --_
>     2.37.1
>

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

* Re: [PATCH] mx6cuboxi: fix ethernet after synchronise device-tree
  2024-03-27 12:06   ` Josua Mayer
@ 2024-03-27 12:17     ` Christian Gmeiner
  2024-03-27 13:20       ` Josua Mayer
  2024-03-27 19:29     ` Fabio Estevam
  1 sibling, 1 reply; 15+ messages in thread
From: Christian Gmeiner @ 2024-03-27 12:17 UTC (permalink / raw)
  To: Josua Mayer
  Cc: u-boot, Yazan Shhady, Tom Rini, Stefano Babic, Fabio Estevam,
	NXP i.MX U-Boot Team, Baruch Siach, Marcel Ziswiler

Hi Josua

My bisect showed me that after a device-tree sync the ethernet broke.

>
> please take a look at this patch, I suspect it will (hack-)fix your
> ethernet issue.
>

Yes.. it fixes the problem I am seeing.

>
> Unfortunately I had no time to revisit this yet and implement a correct solution.
>

Would it be okay for you if I look into a proper solution? I have a
handful of such devices here
that are already or will be used in a CI farm so I am interested in
using the latest U-Boot for them.

> sincerely
> Josua Mayer
>
> Am 28.07.22 um 09:08 schrieb Josua Mayer:
> > Please hold off merging this patch until someone tested it, I can not do so this week.
> > @Tom Can you confirm if this fixes the networking on your Cubox?
> > Also note that the phy-handle property may or may not be required, I am not sure.
> >
> > sincerely
> > Josua Mayer
> >
> > On Thu, Jul 28, 2022 at 7:05 AM Josua Mayer <josua@solid-run.com> wrote:
> >
> >     The i.MX6 Cubox-i and HummingBoards can have different PHYs at varying
> >     addresses. U-Boot needs to auto-detect which phy is actually present,
> >     and at which address it is responding.
> >
> >     Auto-detection from multiple phy nodes specified in device-tree does not
> >     currently work correct. As a work-around merge all three possible phys
> >     into one node with the special address 0xffffffff which indicates to the
> >     generic phy driver to probe all addresses.
> >     Also fixup this fake address before booting Linux, *if* booting with
> >     U-Boot's internal dtb.
> >
> >     Signed-off-by: Josua Mayer <josua@solid-run.com>
> >     Fixes: d0399a46e7cd
> >     ---
> >      arch/arm/dts/imx6qdl-sr-som.dtsi     | 30 +++++++++-------------------
> >      board/solidrun/mx6cuboxi/mx6cuboxi.c |  6 +++++-
> >      2 files changed, 14 insertions(+), 22 deletions(-)
> >
> >     diff --git a/arch/arm/dts/imx6qdl-sr-som.dtsi b/arch/arm/dts/imx6qdl-sr-som.dtsi
> >     index ce543e325c..2d7cbc26b3 100644
> >     ---_a/arch/arm/dts/imx6qdl-sr-som.dtsi
> >     +++ b/arch/arm/dts/imx6qdl-sr-som.dtsi
> >     @@ -53,6 +53,7 @@
> >      &fec {
> >             pinctrl-names = "default";
> >             pinctrl-0 = <&pinctrl_microsom_enet_ar8035>;
> >     +       phy-handle = <&phy>;
> >             phy-mode = "rgmii-id";
> >
> >             /*
> >     @@ -68,30 +69,17 @@
> >                     #address-cells = <1>;
> >                     #size-cells = <0>;
> >
> >     -               /*
> >     -                * The PHY can appear at either address 0 or 4 due to the
> >     -                * configuration (LED) pin not being pulled sufficiently.
> >     -                */
> >     -               ethernet-phy@0 {
> >     -                       reg = <0>;
> >     +               phy: ethernet-phy@0 {
> >     +                       /*
> >     +                        * The PHY can appear either:
> >     +                        * - AR8035: at address 0 or 4
> >     +                        * - ADIN1300: at address 1
> >     +                        * Actual address being detected at runtime.
> >     +                        */
> >     +                       reg = <0xffffffff>;
> >                             qca,clk-out-frequency = <125000000>;
> >                             qca,smarteee-tw-us-1g = <24>;
> >     -               };
> >     -
> >     -               ethernet-phy@4 {
> >     -                       reg = <4>;
> >     -                       qca,clk-out-frequency = <125000000>;
> >     -                       qca,smarteee-tw-us-1g = <24>;
> >     -               };
> >     -
> >     -               /*
> >     -                * ADIN1300 (som rev 1.9 or later) is always at address 1. It
> >     -                * will be enabled automatically by U-Boot if detected.
> >     -                */
> >     -               ethernet-phy@1 {
> >     -                       reg = <1>;
> >                             adi,phy-output-clock = "125mhz-free-running";
> >     -                       status = "disabled";
> >                     };
> >             };
> >      };
> >     diff --git a/board/solidrun/mx6cuboxi/mx6cuboxi.c b/board/solidrun/mx6cuboxi/mx6cuboxi.c
> >     index debf4f6a3b..52172a03b1 100644
> >     ---_a/board/solidrun/mx6cuboxi/mx6cuboxi.c
> >     +++ b/board/solidrun/mx6cuboxi/mx6cuboxi.c
> >     @@ -446,7 +446,7 @@ static int find_ethernet_phy(void)
> >       */
> >      int ft_board_setup(void *fdt, struct bd_info *bd)
> >      {
> >     -       int node_phy0, node_phy1, node_phy4;
> >     +       int node_phy, node_phy0, node_phy1, node_phy4;
> >             int ret, phy;
> >             bool enable_phy0 = false, enable_phy1 = false, enable_phy4 = false;
> >             enum board_type board;
> >     @@ -478,6 +478,10 @@ int ft_board_setup(void *fdt, struct bd_info *bd)
> >                     return 0;
> >             }
> >
> >     +       // update U-Boot's own unified phy node phy address, if present
> >     +       node_phy = fdt_path_offset(fdt, "/soc/bus@2100000/ethernet@2188000/mdio/phy");
> >     +       ret = fdt_setprop_u32(fdt, node_phy, "reg", phy);
> >     +
> >             // update all phy nodes status
> >             node_phy0 = fdt_path_offset(fdt, "/soc/bus@2100000/ethernet@2188000/mdio/ethernet-phy@0");
> >             ret = fdt_setprop_string(fdt, node_phy0, "status", enable_phy0 ? "okay" : "disabled");
> >     --_
> >     2.37.1
> >

-- 
greets
--
Christian Gmeiner, MSc

https://christian-gmeiner.info/privacypolicy

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

* Re: [PATCH] mx6cuboxi: fix ethernet after synchronise device-tree
  2024-03-27 12:17     ` Christian Gmeiner
@ 2024-03-27 13:20       ` Josua Mayer
  2024-03-27 15:55         ` Christian Gmeiner
  0 siblings, 1 reply; 15+ messages in thread
From: Josua Mayer @ 2024-03-27 13:20 UTC (permalink / raw)
  To: Christian Gmeiner
  Cc: u-boot, Yazan Shhady, Tom Rini, Stefano Babic, Fabio Estevam,
	NXP i.MX U-Boot Team, Baruch Siach, Marcel Ziswiler

Am 27.03.24 um 13:17 schrieb Christian Gmeiner:
> Hi Josua
>
> My bisect showed me that after a device-tree sync the ethernet broke.
>
>> please take a look at this patch, I suspect it will (hack-)fix your
>> ethernet issue.
>>
> Yes.. it fixes the problem I am seeing.
>
>> Unfortunately I had no time to revisit this yet and implement a correct solution.
>>
> Would it be okay for you if I look into a proper solution?

Sure. I am swamped by other products at the moment.

However I will provide a rough overview what needs to be done:

Background: i.MX6 SoMs originally had a an atheros phy at unstable address,
either 0 or 4 depending on electrical noise on floating configuration signals.

Linux had solved this by placing 2 phy nodes in device-tree.
During boot the kernel would attempt in order to probe the phys,
then link the successful one to the ethernet netdev.
As a side-effect there is always an error in the kernel log for one of the
addresses.

U-Boot had something similar in that with a special address (I think 0xff)
in device-tree, the code will probe mdio bus for all addresses, but only
for a single phy node in dts.

With release of SoM 2.0 we changed to an analog devices phy at address 1,
which most importantly uses a different driver, and requires a different description
in device-tree.

When adding this new phy, as a third node in device-tree, kernel maintainers
requested a better solution, and we got u-boot to runtime patch dtb to update
status properties of the dtb for linux, after probing mdio bus for phys.


Now - what u-boot needs to do is probe the mdio bus, and then runtime-patch its own DTB.
Either with status properties, or for adding the phy-handle property (not sure which method will work).

This somehow has to happen after probing mdio driver, but before probing ethernet driver.

> I have a
> handful of such devices here
> that are already or will be used in a CI farm so I am interested in
> using the latest U-Boot for them.
>
>> sincerely
>> Josua Mayer
>>
>> Am 28.07.22 um 09:08 schrieb Josua Mayer:
>>> Please hold off merging this patch until someone tested it, I can not do so this week.
>>> @Tom Can you confirm if this fixes the networking on your Cubox?
>>> Also note that the phy-handle property may or may not be required, I am not sure.
>>>
>>> sincerely
>>> Josua Mayer
>>>
>>> On Thu, Jul 28, 2022 at 7:05 AM Josua Mayer <josua@solid-run.com> wrote:
>>>
>>>     The i.MX6 Cubox-i and HummingBoards can have different PHYs at varying
>>>     addresses. U-Boot needs to auto-detect which phy is actually present,
>>>     and at which address it is responding.
>>>
>>>     Auto-detection from multiple phy nodes specified in device-tree does not
>>>     currently work correct. As a work-around merge all three possible phys
>>>     into one node with the special address 0xffffffff which indicates to the
>>>     generic phy driver to probe all addresses.
>>>     Also fixup this fake address before booting Linux, *if* booting with
>>>     U-Boot's internal dtb.
>>>
>>>     Signed-off-by: Josua Mayer <josua@solid-run.com>
>>>     Fixes: d0399a46e7cd
>>>     ---
>>>      arch/arm/dts/imx6qdl-sr-som.dtsi     | 30 +++++++++-------------------
>>>      board/solidrun/mx6cuboxi/mx6cuboxi.c |  6 +++++-
>>>      2 files changed, 14 insertions(+), 22 deletions(-)
>>>
>>>     diff --git a/arch/arm/dts/imx6qdl-sr-som.dtsi b/arch/arm/dts/imx6qdl-sr-som.dtsi
>>>     index ce543e325c..2d7cbc26b3 100644
>>>     ---_a/arch/arm/dts/imx6qdl-sr-som.dtsi
>>>     +++ b/arch/arm/dts/imx6qdl-sr-som.dtsi
>>>     @@ -53,6 +53,7 @@
>>>      &fec {
>>>             pinctrl-names = "default";
>>>             pinctrl-0 = <&pinctrl_microsom_enet_ar8035>;
>>>     +       phy-handle = <&phy>;
>>>             phy-mode = "rgmii-id";
>>>
>>>             /*
>>>     @@ -68,30 +69,17 @@
>>>                     #address-cells = <1>;
>>>                     #size-cells = <0>;
>>>
>>>     -               /*
>>>     -                * The PHY can appear at either address 0 or 4 due to the
>>>     -                * configuration (LED) pin not being pulled sufficiently.
>>>     -                */
>>>     -               ethernet-phy@0 {
>>>     -                       reg = <0>;
>>>     +               phy: ethernet-phy@0 {
>>>     +                       /*
>>>     +                        * The PHY can appear either:
>>>     +                        * - AR8035: at address 0 or 4
>>>     +                        * - ADIN1300: at address 1
>>>     +                        * Actual address being detected at runtime.
>>>     +                        */
>>>     +                       reg = <0xffffffff>;
>>>                             qca,clk-out-frequency = <125000000>;
>>>                             qca,smarteee-tw-us-1g = <24>;
>>>     -               };
>>>     -
>>>     -               ethernet-phy@4 {
>>>     -                       reg = <4>;
>>>     -                       qca,clk-out-frequency = <125000000>;
>>>     -                       qca,smarteee-tw-us-1g = <24>;
>>>     -               };
>>>     -
>>>     -               /*
>>>     -                * ADIN1300 (som rev 1.9 or later) is always at address 1. It
>>>     -                * will be enabled automatically by U-Boot if detected.
>>>     -                */
>>>     -               ethernet-phy@1 {
>>>     -                       reg = <1>;
>>>                             adi,phy-output-clock = "125mhz-free-running";
>>>     -                       status = "disabled";
>>>                     };
>>>             };
>>>      };
>>>     diff --git a/board/solidrun/mx6cuboxi/mx6cuboxi.c b/board/solidrun/mx6cuboxi/mx6cuboxi.c
>>>     index debf4f6a3b..52172a03b1 100644
>>>     ---_a/board/solidrun/mx6cuboxi/mx6cuboxi.c
>>>     +++ b/board/solidrun/mx6cuboxi/mx6cuboxi.c
>>>     @@ -446,7 +446,7 @@ static int find_ethernet_phy(void)
>>>       */
>>>      int ft_board_setup(void *fdt, struct bd_info *bd)
>>>      {
>>>     -       int node_phy0, node_phy1, node_phy4;
>>>     +       int node_phy, node_phy0, node_phy1, node_phy4;
>>>             int ret, phy;
>>>             bool enable_phy0 = false, enable_phy1 = false, enable_phy4 = false;
>>>             enum board_type board;
>>>     @@ -478,6 +478,10 @@ int ft_board_setup(void *fdt, struct bd_info *bd)
>>>                     return 0;
>>>             }
>>>
>>>     +       // update U-Boot's own unified phy node phy address, if present
>>>     +       node_phy = fdt_path_offset(fdt, "/soc/bus@2100000/ethernet@2188000/mdio/phy");
>>>     +       ret = fdt_setprop_u32(fdt, node_phy, "reg", phy);
>>>     +
>>>             // update all phy nodes status
>>>             node_phy0 = fdt_path_offset(fdt, "/soc/bus@2100000/ethernet@2188000/mdio/ethernet-phy@0");
>>>             ret = fdt_setprop_string(fdt, node_phy0, "status", enable_phy0 ? "okay" : "disabled");
>>>     --_
>>>     2.37.1
>>>

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

* Re: [PATCH] mx6cuboxi: fix ethernet after synchronise device-tree
  2024-03-27 13:20       ` Josua Mayer
@ 2024-03-27 15:55         ` Christian Gmeiner
  2024-03-27 16:54           ` Josua Mayer
  0 siblings, 1 reply; 15+ messages in thread
From: Christian Gmeiner @ 2024-03-27 15:55 UTC (permalink / raw)
  To: Josua Mayer
  Cc: u-boot, Yazan Shhady, Tom Rini, Stefano Babic, Fabio Estevam,
	NXP i.MX U-Boot Team, Baruch Siach, Marcel Ziswiler

Hi Josua

> > Hi Josua
> >
> > My bisect showed me that after a device-tree sync the ethernet broke.
> >
> >> please take a look at this patch, I suspect it will (hack-)fix your
> >> ethernet issue.
> >>
> > Yes.. it fixes the problem I am seeing.
> >
> >> Unfortunately I had no time to revisit this yet and implement a correct solution.
> >>
> > Would it be okay for you if I look into a proper solution?
>
> Sure. I am swamped by other products at the moment.
>
> However I will provide a rough overview what needs to be done:
>
> Background: i.MX6 SoMs originally had a an atheros phy at unstable address,
> either 0 or 4 depending on electrical noise on floating configuration signals.
>

Would it be possible to set those configuration signals from the MX6
to a defined state and
then toggle the PHY reset , to force correct PHY address?

> Linux had solved this by placing 2 phy nodes in device-tree.
> During boot the kernel would attempt in order to probe the phys,
> then link the successful one to the ethernet netdev.
> As a side-effect there is always an error in the kernel log for one of the
> addresses.
>
> U-Boot had something similar in that with a special address (I think 0xff)
> in device-tree, the code will probe mdio bus for all addresses, but only
> for a single phy node in dts.
>
> With release of SoM 2.0 we changed to an analog devices phy at address 1,
> which most importantly uses a different driver, and requires a different description
> in device-tree.
>
> When adding this new phy, as a third node in device-tree, kernel maintainers
> requested a better solution, and we got u-boot to runtime patch dtb to update
> status properties of the dtb for linux, after probing mdio bus for phys.
>

Got it.

>
> Now - what u-boot needs to do is probe the mdio bus, and then runtime-patch its own DTB.
> Either with status properties, or for adding the phy-handle property (not sure which method will work).
>

We could patch DTB in SPL for U-Boot proper but doing a mdio scan in
SPL looks like a lot of work. Do
you know if there is a pull up/down resistor etc. that I could use to
detect pre SoM 2.0 and SoM 2.0?

Is this what board_type() does?
Is HummingBoard2 == SoM 2.0?

> This somehow has to happen after probing mdio driver, but before probing ethernet driver.
>
> > I have a
> > handful of such devices here
> > that are already or will be used in a CI farm so I am interested in
> > using the latest U-Boot for them.
> >
> >> sincerely
> >> Josua Mayer
> >>
> >> Am 28.07.22 um 09:08 schrieb Josua Mayer:
> >>> Please hold off merging this patch until someone tested it, I can not do so this week.
> >>> @Tom Can you confirm if this fixes the networking on your Cubox?
> >>> Also note that the phy-handle property may or may not be required, I am not sure.
> >>>
> >>> sincerely
> >>> Josua Mayer
> >>>
> >>> On Thu, Jul 28, 2022 at 7:05 AM Josua Mayer <josua@solid-run.com> wrote:
> >>>
> >>>     The i.MX6 Cubox-i and HummingBoards can have different PHYs at varying
> >>>     addresses. U-Boot needs to auto-detect which phy is actually present,
> >>>     and at which address it is responding.
> >>>
> >>>     Auto-detection from multiple phy nodes specified in device-tree does not
> >>>     currently work correct. As a work-around merge all three possible phys
> >>>     into one node with the special address 0xffffffff which indicates to the
> >>>     generic phy driver to probe all addresses.
> >>>     Also fixup this fake address before booting Linux, *if* booting with
> >>>     U-Boot's internal dtb.
> >>>
> >>>     Signed-off-by: Josua Mayer <josua@solid-run.com>
> >>>     Fixes: d0399a46e7cd
> >>>     ---
> >>>      arch/arm/dts/imx6qdl-sr-som.dtsi     | 30 +++++++++-------------------
> >>>      board/solidrun/mx6cuboxi/mx6cuboxi.c |  6 +++++-
> >>>      2 files changed, 14 insertions(+), 22 deletions(-)
> >>>
> >>>     diff --git a/arch/arm/dts/imx6qdl-sr-som.dtsi b/arch/arm/dts/imx6qdl-sr-som.dtsi
> >>>     index ce543e325c..2d7cbc26b3 100644
> >>>     ---_a/arch/arm/dts/imx6qdl-sr-som.dtsi
> >>>     +++ b/arch/arm/dts/imx6qdl-sr-som.dtsi
> >>>     @@ -53,6 +53,7 @@
> >>>      &fec {
> >>>             pinctrl-names = "default";
> >>>             pinctrl-0 = <&pinctrl_microsom_enet_ar8035>;
> >>>     +       phy-handle = <&phy>;
> >>>             phy-mode = "rgmii-id";
> >>>
> >>>             /*
> >>>     @@ -68,30 +69,17 @@
> >>>                     #address-cells = <1>;
> >>>                     #size-cells = <0>;
> >>>
> >>>     -               /*
> >>>     -                * The PHY can appear at either address 0 or 4 due to the
> >>>     -                * configuration (LED) pin not being pulled sufficiently.
> >>>     -                */
> >>>     -               ethernet-phy@0 {
> >>>     -                       reg = <0>;
> >>>     +               phy: ethernet-phy@0 {
> >>>     +                       /*
> >>>     +                        * The PHY can appear either:
> >>>     +                        * - AR8035: at address 0 or 4
> >>>     +                        * - ADIN1300: at address 1
> >>>     +                        * Actual address being detected at runtime.
> >>>     +                        */
> >>>     +                       reg = <0xffffffff>;
> >>>                             qca,clk-out-frequency = <125000000>;
> >>>                             qca,smarteee-tw-us-1g = <24>;
> >>>     -               };
> >>>     -
> >>>     -               ethernet-phy@4 {
> >>>     -                       reg = <4>;
> >>>     -                       qca,clk-out-frequency = <125000000>;
> >>>     -                       qca,smarteee-tw-us-1g = <24>;
> >>>     -               };
> >>>     -
> >>>     -               /*
> >>>     -                * ADIN1300 (som rev 1.9 or later) is always at address 1. It
> >>>     -                * will be enabled automatically by U-Boot if detected.
> >>>     -                */
> >>>     -               ethernet-phy@1 {
> >>>     -                       reg = <1>;
> >>>                             adi,phy-output-clock = "125mhz-free-running";
> >>>     -                       status = "disabled";
> >>>                     };
> >>>             };
> >>>      };
> >>>     diff --git a/board/solidrun/mx6cuboxi/mx6cuboxi.c b/board/solidrun/mx6cuboxi/mx6cuboxi.c
> >>>     index debf4f6a3b..52172a03b1 100644
> >>>     ---_a/board/solidrun/mx6cuboxi/mx6cuboxi.c
> >>>     +++ b/board/solidrun/mx6cuboxi/mx6cuboxi.c
> >>>     @@ -446,7 +446,7 @@ static int find_ethernet_phy(void)
> >>>       */
> >>>      int ft_board_setup(void *fdt, struct bd_info *bd)
> >>>      {
> >>>     -       int node_phy0, node_phy1, node_phy4;
> >>>     +       int node_phy, node_phy0, node_phy1, node_phy4;
> >>>             int ret, phy;
> >>>             bool enable_phy0 = false, enable_phy1 = false, enable_phy4 = false;
> >>>             enum board_type board;
> >>>     @@ -478,6 +478,10 @@ int ft_board_setup(void *fdt, struct bd_info *bd)
> >>>                     return 0;
> >>>             }
> >>>
> >>>     +       // update U-Boot's own unified phy node phy address, if present
> >>>     +       node_phy = fdt_path_offset(fdt, "/soc/bus@2100000/ethernet@2188000/mdio/phy");
> >>>     +       ret = fdt_setprop_u32(fdt, node_phy, "reg", phy);
> >>>     +
> >>>             // update all phy nodes status
> >>>             node_phy0 = fdt_path_offset(fdt, "/soc/bus@2100000/ethernet@2188000/mdio/ethernet-phy@0");
> >>>             ret = fdt_setprop_string(fdt, node_phy0, "status", enable_phy0 ? "okay" : "disabled");
> >>>     --_
> >>>     2.37.1
> >>>



-- 
greets
--
Christian Gmeiner, MSc

https://christian-gmeiner.info/privacypolicy

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

* Re: [PATCH] mx6cuboxi: fix ethernet after synchronise device-tree
  2024-03-27 15:55         ` Christian Gmeiner
@ 2024-03-27 16:54           ` Josua Mayer
  0 siblings, 0 replies; 15+ messages in thread
From: Josua Mayer @ 2024-03-27 16:54 UTC (permalink / raw)
  To: Christian Gmeiner
  Cc: u-boot, Yazan Shhady, Tom Rini, Stefano Babic, Fabio Estevam,
	NXP i.MX U-Boot Team, Baruch Siach, Marcel Ziswiler

Am 27.03.24 um 16:55 schrieb Christian Gmeiner:
> Hi Josua
>
>>> Hi Josua
>>>
>>> My bisect showed me that after a device-tree sync the ethernet broke.
>>>
>>>> please take a look at this patch, I suspect it will (hack-)fix your
>>>> ethernet issue.
>>>>
>>> Yes.. it fixes the problem I am seeing.
>>>
>>>> Unfortunately I had no time to revisit this yet and implement a correct solution.
>>>>
>>> Would it be okay for you if I look into a proper solution?
>> Sure. I am swamped by other products at the moment.
>>
>> However I will provide a rough overview what needs to be done:
>>
>> Background: i.MX6 SoMs originally had a an atheros phy at unstable address,
>> either 0 or 4 depending on electrical noise on floating configuration signals.
>>
> Would it be possible to set those configuration signals from the MX6
> to a defined state and
> then toggle the PHY reset , to force correct PHY address?
There is no cpu control over the signals responsible for phy address.
>
>> Linux had solved this by placing 2 phy nodes in device-tree.
>> During boot the kernel would attempt in order to probe the phys,
>> then link the successful one to the ethernet netdev.
>> As a side-effect there is always an error in the kernel log for one of the
>> addresses.
>>
>> U-Boot had something similar in that with a special address (I think 0xff)
>> in device-tree, the code will probe mdio bus for all addresses, but only
>> for a single phy node in dts.
>>
>> With release of SoM 2.0 we changed to an analog devices phy at address 1,
>> which most importantly uses a different driver, and requires a different description
>> in device-tree.
>>
>> When adding this new phy, as a third node in device-tree, kernel maintainers
>> requested a better solution, and we got u-boot to runtime patch dtb to update
>> status properties of the dtb for linux, after probing mdio bus for phys.
>>
> Got it.
>
>> Now - what u-boot needs to do is probe the mdio bus, and then runtime-patch its own DTB.
>> Either with status properties, or for adding the phy-handle property (not sure which method will work).
>>
> We could patch DTB in SPL for U-Boot proper but doing a mdio scan in
> SPL looks like a lot of work.
In SPL I agree this would be quite painful.
Maybe it can be done in u-boot proper, at the right moment.
We basically need to intersept the place where ethernet (controller?) driver
is looking for the phy-handle property or probing a phy.

Maybe there is already a call-back for board-specific code,
or one could be added.

> Do
> you know if there is a pull up/down resistor etc. that I could use to
> detect pre SoM 2.0 and SoM 2.0?
>
> Is this what board_type() does?
> Is HummingBoard2 == SoM 2.0?
No, this is carrier-board detection.
For the SoM we have nothing.
PHY mdio address is actually the best indication we have.
>
>> This somehow has to happen after probing mdio driver, but before probing ethernet driver.
>>
>>> I have a
>>> handful of such devices here
>>> that are already or will be used in a CI farm so I am interested in
>>> using the latest U-Boot for them.
>>>
>>>> sincerely
>>>> Josua Mayer
>>>>
>>>> Am 28.07.22 um 09:08 schrieb Josua Mayer:
>>>>> Please hold off merging this patch until someone tested it, I can not do so this week.
>>>>> @Tom Can you confirm if this fixes the networking on your Cubox?
>>>>> Also note that the phy-handle property may or may not be required, I am not sure.
>>>>>
>>>>> sincerely
>>>>> Josua Mayer
>>>>>
>>>>> On Thu, Jul 28, 2022 at 7:05 AM Josua Mayer <josua@solid-run.com> wrote:
>>>>>
>>>>>     The i.MX6 Cubox-i and HummingBoards can have different PHYs at varying
>>>>>     addresses. U-Boot needs to auto-detect which phy is actually present,
>>>>>     and at which address it is responding.
>>>>>
>>>>>     Auto-detection from multiple phy nodes specified in device-tree does not
>>>>>     currently work correct. As a work-around merge all three possible phys
>>>>>     into one node with the special address 0xffffffff which indicates to the
>>>>>     generic phy driver to probe all addresses.
>>>>>     Also fixup this fake address before booting Linux, *if* booting with
>>>>>     U-Boot's internal dtb.
>>>>>
>>>>>     Signed-off-by: Josua Mayer <josua@solid-run.com>
>>>>>     Fixes: d0399a46e7cd
>>>>>     ---
>>>>>      arch/arm/dts/imx6qdl-sr-som.dtsi     | 30 +++++++++-------------------
>>>>>      board/solidrun/mx6cuboxi/mx6cuboxi.c |  6 +++++-
>>>>>      2 files changed, 14 insertions(+), 22 deletions(-)
>>>>>
>>>>>     diff --git a/arch/arm/dts/imx6qdl-sr-som.dtsi b/arch/arm/dts/imx6qdl-sr-som.dtsi
>>>>>     index ce543e325c..2d7cbc26b3 100644
>>>>>     ---_a/arch/arm/dts/imx6qdl-sr-som.dtsi
>>>>>     +++ b/arch/arm/dts/imx6qdl-sr-som.dtsi
>>>>>     @@ -53,6 +53,7 @@
>>>>>      &fec {
>>>>>             pinctrl-names = "default";
>>>>>             pinctrl-0 = <&pinctrl_microsom_enet_ar8035>;
>>>>>     +       phy-handle = <&phy>;
>>>>>             phy-mode = "rgmii-id";
>>>>>
>>>>>             /*
>>>>>     @@ -68,30 +69,17 @@
>>>>>                     #address-cells = <1>;
>>>>>                     #size-cells = <0>;
>>>>>
>>>>>     -               /*
>>>>>     -                * The PHY can appear at either address 0 or 4 due to the
>>>>>     -                * configuration (LED) pin not being pulled sufficiently.
>>>>>     -                */
>>>>>     -               ethernet-phy@0 {
>>>>>     -                       reg = <0>;
>>>>>     +               phy: ethernet-phy@0 {
>>>>>     +                       /*
>>>>>     +                        * The PHY can appear either:
>>>>>     +                        * - AR8035: at address 0 or 4
>>>>>     +                        * - ADIN1300: at address 1
>>>>>     +                        * Actual address being detected at runtime.
>>>>>     +                        */
>>>>>     +                       reg = <0xffffffff>;
>>>>>                             qca,clk-out-frequency = <125000000>;
>>>>>                             qca,smarteee-tw-us-1g = <24>;
>>>>>     -               };
>>>>>     -
>>>>>     -               ethernet-phy@4 {
>>>>>     -                       reg = <4>;
>>>>>     -                       qca,clk-out-frequency = <125000000>;
>>>>>     -                       qca,smarteee-tw-us-1g = <24>;
>>>>>     -               };
>>>>>     -
>>>>>     -               /*
>>>>>     -                * ADIN1300 (som rev 1.9 or later) is always at address 1. It
>>>>>     -                * will be enabled automatically by U-Boot if detected.
>>>>>     -                */
>>>>>     -               ethernet-phy@1 {
>>>>>     -                       reg = <1>;
>>>>>                             adi,phy-output-clock = "125mhz-free-running";
>>>>>     -                       status = "disabled";
>>>>>                     };
>>>>>             };
>>>>>      };
>>>>>     diff --git a/board/solidrun/mx6cuboxi/mx6cuboxi.c b/board/solidrun/mx6cuboxi/mx6cuboxi.c
>>>>>     index debf4f6a3b..52172a03b1 100644
>>>>>     ---_a/board/solidrun/mx6cuboxi/mx6cuboxi.c
>>>>>     +++ b/board/solidrun/mx6cuboxi/mx6cuboxi.c
>>>>>     @@ -446,7 +446,7 @@ static int find_ethernet_phy(void)
>>>>>       */
>>>>>      int ft_board_setup(void *fdt, struct bd_info *bd)
>>>>>      {
>>>>>     -       int node_phy0, node_phy1, node_phy4;
>>>>>     +       int node_phy, node_phy0, node_phy1, node_phy4;
>>>>>             int ret, phy;
>>>>>             bool enable_phy0 = false, enable_phy1 = false, enable_phy4 = false;
>>>>>             enum board_type board;
>>>>>     @@ -478,6 +478,10 @@ int ft_board_setup(void *fdt, struct bd_info *bd)
>>>>>                     return 0;
>>>>>             }
>>>>>
>>>>>     +       // update U-Boot's own unified phy node phy address, if present
>>>>>     +       node_phy = fdt_path_offset(fdt, "/soc/bus@2100000/ethernet@2188000/mdio/phy");
>>>>>     +       ret = fdt_setprop_u32(fdt, node_phy, "reg", phy);
>>>>>     +
>>>>>             // update all phy nodes status
>>>>>             node_phy0 = fdt_path_offset(fdt, "/soc/bus@2100000/ethernet@2188000/mdio/ethernet-phy@0");
>>>>>             ret = fdt_setprop_string(fdt, node_phy0, "status", enable_phy0 ? "okay" : "disabled");
>>>>>     --_
>>>>>     2.37.1
>>>>>
>
>

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

* Re: [PATCH] mx6cuboxi: fix ethernet after synchronise device-tree
  2024-03-27 12:06   ` Josua Mayer
  2024-03-27 12:17     ` Christian Gmeiner
@ 2024-03-27 19:29     ` Fabio Estevam
  2024-03-27 21:04       ` Fabio Estevam
  1 sibling, 1 reply; 15+ messages in thread
From: Fabio Estevam @ 2024-03-27 19:29 UTC (permalink / raw)
  To: Josua Mayer
  Cc: u-boot, Yazan Shhady, Tom Rini, Stefano Babic,
	NXP i.MX U-Boot Team, Baruch Siach, Marcel Ziswiler,
	christian.gmeiner

Hi Christian,

On Wed, Mar 27, 2024 at 9:06 AM Josua Mayer <josua@solid-run.com> wrote:
>
> Cc: christian.gmeiner@gmail.com
>
> Hi Christian,
>
> please take a look at this patch, I suspect it will (hack-)fix your
> ethernet issue.
>
> Unfortunately I had no time to revisit this yet and implement a correct solution.

> >      arch/arm/dts/imx6qdl-sr-som.dtsi     | 30 +++++++++-------------------
> >      board/solidrun/mx6cuboxi/mx6cuboxi.c |  6 +++++-
> >      2 files changed, 14 insertions(+), 22 deletions(-)
> >
> >     diff --git a/arch/arm/dts/imx6qdl-sr-som.dtsi b/arch/arm/dts/imx6qdl-sr-som.dtsi
> >     index ce543e325c..2d7cbc26b3 100644
> >     ---_a/arch/arm/dts/imx6qdl-sr-som.dtsi
> >     +++ b/arch/arm/dts/imx6qdl-sr-som.dtsi

Please make these changes in a new imx6qdl-sr-som-u-boot.dtsi file instead.

This way, the changes will not get lost after a new sync with Linux or
if OF_UPSTREAM is used.

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

* Re: [PATCH] mx6cuboxi: fix ethernet after synchronise device-tree
  2024-03-27 19:29     ` Fabio Estevam
@ 2024-03-27 21:04       ` Fabio Estevam
  2024-03-27 23:17         ` Fabio Estevam
  0 siblings, 1 reply; 15+ messages in thread
From: Fabio Estevam @ 2024-03-27 21:04 UTC (permalink / raw)
  To: Josua Mayer
  Cc: u-boot, Yazan Shhady, Tom Rini, Stefano Babic,
	NXP i.MX U-Boot Team, Baruch Siach, Marcel Ziswiler,
	christian.gmeiner

[-- Attachment #1: Type: text/plain, Size: 263 bytes --]

Hi Christian,

On Wed, Mar 27, 2024 at 4:29 PM Fabio Estevam <festevam@gmail.com> wrote:

> Please make these changes in a new imx6qdl-sr-som-u-boot.dtsi file instead.

I took Josua's patch and modified it a bit.

Does the attached patch fix Ethernet?

[-- Attachment #2: 0001-mx6cuboxi-fix-Ethernet-after-DT-sync-with-Linux.patch --]
[-- Type: text/x-patch, Size: 5864 bytes --]

From 24f57c3cd8b1a2b113bcffad26e2bb1b9b582e35 Mon Sep 17 00:00:00 2001
From: Josua Mayer <josua@solid-run.com>
Date: Wed, 27 Mar 2024 17:58:47 -0300
Subject: [PATCH] mx6cuboxi: Fix Ethernet after DT sync with Linux

The i.MX6 Cubox-i and HummingBoards can have different PHYs at varying
addresses. U-Boot needs to auto-detect which phy is actually present,
and at which address it is responding.

Auto-detection from multiple phy nodes specified in device-tree does not
currently work correct. As a work-around merge all three possible phys
into one node with the special address 0xffffffff which indicates to the
generic phy driver to probe all addresses.
Also fixup this fake address before booting Linux, *if* booting with
U-Boot's internal dtb.

Signed-off-by: Josua Mayer <josua@solid-run.com>
[fabio: Added the changes to imx6qdl-sr-som-u-boot.dtsi.]
Signed-off-by: Fabio Estevam <festevam@gmail.com>
---
 ...qdl-hummingboard2-emmc-som-v15-u-boot.dtsi |  1 +
 arch/arm/dts/imx6qdl-sr-som-u-boot.dtsi       | 76 +++++++++++++++++++
 board/solidrun/mx6cuboxi/mx6cuboxi.c          |  8 +-
 3 files changed, 84 insertions(+), 1 deletion(-)
 create mode 100644 arch/arm/dts/imx6qdl-sr-som-u-boot.dtsi

diff --git a/arch/arm/dts/imx6qdl-hummingboard2-emmc-som-v15-u-boot.dtsi b/arch/arm/dts/imx6qdl-hummingboard2-emmc-som-v15-u-boot.dtsi
index e9b188ed6587..358cf8abc4ff 100644
--- a/arch/arm/dts/imx6qdl-hummingboard2-emmc-som-v15-u-boot.dtsi
+++ b/arch/arm/dts/imx6qdl-hummingboard2-emmc-som-v15-u-boot.dtsi
@@ -1,6 +1,7 @@
 // SPDX-License-Identifier: GPL-2.0+
 
 #include "imx6qdl-u-boot.dtsi"
+#include "imx6qdl-sr-som-u-boot.dtsi"
 
 / {
 	board-detect {
diff --git a/arch/arm/dts/imx6qdl-sr-som-u-boot.dtsi b/arch/arm/dts/imx6qdl-sr-som-u-boot.dtsi
new file mode 100644
index 000000000000..3f2d92be7061
--- /dev/null
+++ b/arch/arm/dts/imx6qdl-sr-som-u-boot.dtsi
@@ -0,0 +1,76 @@
+/*
+ * Copyright (C) 2013,2014 Russell King
+ *
+ * This file is dual-licensed: you can use it either under the terms
+ * of the GPL or the X11 license, at your option. Note that this dual
+ * licensing only applies to this file, and not this project as a
+ * whole.
+ *
+ *  a) This file is free software; you can redistribute it and/or
+ *     modify it under the terms of the GNU General Public License
+ *     version 2 as published by the Free Software Foundation.
+ *
+ *     This file is distributed in the hope that it will be useful,
+ *     but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *     GNU General Public License for more details.
+ *
+ * Or, alternatively,
+ *
+ *  b) Permission is hereby granted, free of charge, to any person
+ *     obtaining a copy of this software and associated documentation
+ *     files (the "Software"), to deal in the Software without
+ *     restriction, including without limitation the rights to use,
+ *     copy, modify, merge, publish, distribute, sublicense, and/or
+ *     sell copies of the Software, and to permit persons to whom the
+ *     Software is furnished to do so, subject to the following
+ *     conditions:
+ *
+ *     The above copyright notice and this permission notice shall be
+ *     included in all copies or substantial portions of the Software.
+ *
+ *     THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ *     EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ *     OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ *     NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ *     HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ *     WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ *     FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ *     OTHER DEALINGS IN THE SOFTWARE.
+ */
+#include <dt-bindings/gpio/gpio.h>
+
+&fec {
+	pinctrl-names = "default";
+	pinctrl-0 = <&pinctrl_microsom_enet_ar8035>;
+	phy-handle = <&phy>;
+	phy-mode = "rgmii-id";
+
+	/*
+	 * The PHY seems to require a long-enough reset duration to avoid
+	 * some rare issues where the PHY gets stuck in an inconsistent and
+	 * non-functional state at boot-up. 10ms proved to be fine .
+	 */
+	phy-reset-duration = <10>;
+	phy-reset-gpios = <&gpio4 15 GPIO_ACTIVE_LOW>;
+	status = "okay";
+
+	mdio {
+		#address-cells = <1>;
+		#size-cells = <0>;
+
+
+		phy: ethernet-phy@0 {
+			/*
+			 * The PHY can appear either:
+			 * - AR8035: at address 0 or 4
+			 * - ADIN1300: at address 1
+			 * Actual address being detected at runtime.
+			 */
+			reg = <0xffffffff>;
+			qca,clk-out-frequency = <125000000>;
+			qca,smarteee-tw-us-1g = <24>;
+			adi,phy-output-clock = "125mhz-free-running";
+		};
+	};
+};
diff --git a/board/solidrun/mx6cuboxi/mx6cuboxi.c b/board/solidrun/mx6cuboxi/mx6cuboxi.c
index 8edabf4404c2..fbab39e800a6 100644
--- a/board/solidrun/mx6cuboxi/mx6cuboxi.c
+++ b/board/solidrun/mx6cuboxi/mx6cuboxi.c
@@ -447,7 +447,7 @@ static int find_ethernet_phy(void)
  */
 int ft_board_setup(void *fdt, struct bd_info *bd)
 {
-	int node_phy0, node_phy1, node_phy4;
+	int node_phy, node_phy0, node_phy1, node_phy4;
 	int ret, phy;
 	bool enable_phy0 = false, enable_phy1 = false, enable_phy4 = false;
 	enum board_type board;
@@ -479,6 +479,12 @@ int ft_board_setup(void *fdt, struct bd_info *bd)
 		return 0;
 	}
 
+	// update U-Boot's own unified phy node phy address, if present
+	node_phy = fdt_path_offset(fdt, "/soc/bus@2100000/ethernet@2188000/mdio/phy");
+	ret = fdt_setprop_u32(fdt, node_phy, "reg", phy);
+	if (ret < 0)
+		pr_err("%s: failed to update unified PHY node address\n", __func__);
+
 	// update all phy nodes status
 	node_phy0 = fdt_path_offset(fdt, "/soc/bus@2100000/ethernet@2188000/mdio/ethernet-phy@0");
 	ret = fdt_setprop_string(fdt, node_phy0, "status", enable_phy0 ? "okay" : "disabled");
-- 
2.34.1


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

* Re: [PATCH] mx6cuboxi: fix ethernet after synchronise device-tree
  2024-03-27 21:04       ` Fabio Estevam
@ 2024-03-27 23:17         ` Fabio Estevam
  2024-03-28  7:08           ` Christian Gmeiner
  0 siblings, 1 reply; 15+ messages in thread
From: Fabio Estevam @ 2024-03-27 23:17 UTC (permalink / raw)
  To: Josua Mayer, christian.gmeiner
  Cc: u-boot, Yazan Shhady, Tom Rini, Stefano Babic,
	NXP i.MX U-Boot Team, Baruch Siach, Marcel Ziswiler

[-- Attachment #1: Type: text/plain, Size: 351 bytes --]

On Wed, Mar 27, 2024 at 6:04 PM Fabio Estevam <festevam@gmail.com> wrote:

> I took Josua's patch and modified it a bit.
>
> Does the attached patch fix Ethernet?

I forgot to delete the old ethernet-phy nodes.

Please try this one instead.

If it works in U-Boot, please also test Ethernet in Linux as we are
touching ft_board_setup().

[-- Attachment #2: 0001-mx6cuboxi-Fix-Ethernet-after-DT-sync-with-Linux.patch --]
[-- Type: text/x-patch, Size: 4033 bytes --]

From 5af15e698ad89fac3cc3433ac4ac87bb10bc014d Mon Sep 17 00:00:00 2001
From: Josua Mayer <josua@solid-run.com>
Date: Wed, 27 Mar 2024 17:58:47 -0300
Subject: [PATCH] mx6cuboxi: Fix Ethernet after DT sync with Linux

The i.MX6 Cubox-i and HummingBoards can have different PHYs at varying
addresses. U-Boot needs to auto-detect which phy is actually present,
and at which address it is responding.

Auto-detection from multiple phy nodes specified in device-tree does not
currently work correct. As a work-around merge all three possible phys
into one node with the special address 0xffffffff which indicates to the
generic phy driver to probe all addresses.
Also fixup this fake address before booting Linux, *if* booting with
U-Boot's internal dtb.

Signed-off-by: Josua Mayer <josua@solid-run.com>
[fabio: Added the changes to imx6qdl-sr-som-u-boot.dtsi.]
Signed-off-by: Fabio Estevam <festevam@gmail.com>
---
 ...qdl-hummingboard2-emmc-som-v15-u-boot.dtsi |  1 +
 arch/arm/dts/imx6qdl-sr-som-u-boot.dtsi       | 40 +++++++++++++++++++
 board/solidrun/mx6cuboxi/mx6cuboxi.c          |  8 +++-
 3 files changed, 48 insertions(+), 1 deletion(-)
 create mode 100644 arch/arm/dts/imx6qdl-sr-som-u-boot.dtsi

diff --git a/arch/arm/dts/imx6qdl-hummingboard2-emmc-som-v15-u-boot.dtsi b/arch/arm/dts/imx6qdl-hummingboard2-emmc-som-v15-u-boot.dtsi
index e9b188ed6587..358cf8abc4ff 100644
--- a/arch/arm/dts/imx6qdl-hummingboard2-emmc-som-v15-u-boot.dtsi
+++ b/arch/arm/dts/imx6qdl-hummingboard2-emmc-som-v15-u-boot.dtsi
@@ -1,6 +1,7 @@
 // SPDX-License-Identifier: GPL-2.0+
 
 #include "imx6qdl-u-boot.dtsi"
+#include "imx6qdl-sr-som-u-boot.dtsi"
 
 / {
 	board-detect {
diff --git a/arch/arm/dts/imx6qdl-sr-som-u-boot.dtsi b/arch/arm/dts/imx6qdl-sr-som-u-boot.dtsi
new file mode 100644
index 000000000000..4c5f043ea92a
--- /dev/null
+++ b/arch/arm/dts/imx6qdl-sr-som-u-boot.dtsi
@@ -0,0 +1,40 @@
+// SPDX-License-Identifier: (GPL-2.0 OR MIT)
+
+#include <dt-bindings/gpio/gpio.h>
+
+&fec {
+	pinctrl-names = "default";
+	pinctrl-0 = <&pinctrl_microsom_enet_ar8035>;
+	phy-handle = <&phy>;
+	phy-mode = "rgmii-id";
+
+	/*
+	 * The PHY seems to require a long-enough reset duration to avoid
+	 * some rare issues where the PHY gets stuck in an inconsistent and
+	 * non-functional state at boot-up. 10ms proved to be fine .
+	 */
+	phy-reset-duration = <10>;
+	phy-reset-gpios = <&gpio4 15 GPIO_ACTIVE_LOW>;
+	status = "okay";
+
+	mdio {
+		#address-cells = <1>;
+		#size-cells = <0>;
+
+		/delete-node/ ethernet-phy@1;
+		/delete-node/ ethernet-phy@4;
+
+		phy: ethernet-phy@0 {
+			/*
+			 * The PHY can appear either:
+			 * - AR8035: at address 0 or 4
+			 * - ADIN1300: at address 1
+			 * Actual address being detected at runtime.
+			 */
+			reg = <0xffffffff>;
+			qca,clk-out-frequency = <125000000>;
+			qca,smarteee-tw-us-1g = <24>;
+			adi,phy-output-clock = "125mhz-free-running";
+		};
+	};
+};
diff --git a/board/solidrun/mx6cuboxi/mx6cuboxi.c b/board/solidrun/mx6cuboxi/mx6cuboxi.c
index 8edabf4404c2..fbab39e800a6 100644
--- a/board/solidrun/mx6cuboxi/mx6cuboxi.c
+++ b/board/solidrun/mx6cuboxi/mx6cuboxi.c
@@ -447,7 +447,7 @@ static int find_ethernet_phy(void)
  */
 int ft_board_setup(void *fdt, struct bd_info *bd)
 {
-	int node_phy0, node_phy1, node_phy4;
+	int node_phy, node_phy0, node_phy1, node_phy4;
 	int ret, phy;
 	bool enable_phy0 = false, enable_phy1 = false, enable_phy4 = false;
 	enum board_type board;
@@ -479,6 +479,12 @@ int ft_board_setup(void *fdt, struct bd_info *bd)
 		return 0;
 	}
 
+	// update U-Boot's own unified phy node phy address, if present
+	node_phy = fdt_path_offset(fdt, "/soc/bus@2100000/ethernet@2188000/mdio/phy");
+	ret = fdt_setprop_u32(fdt, node_phy, "reg", phy);
+	if (ret < 0)
+		pr_err("%s: failed to update unified PHY node address\n", __func__);
+
 	// update all phy nodes status
 	node_phy0 = fdt_path_offset(fdt, "/soc/bus@2100000/ethernet@2188000/mdio/ethernet-phy@0");
 	ret = fdt_setprop_string(fdt, node_phy0, "status", enable_phy0 ? "okay" : "disabled");
-- 
2.34.1


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

* Re: [PATCH] mx6cuboxi: fix ethernet after synchronise device-tree
  2024-03-27 23:17         ` Fabio Estevam
@ 2024-03-28  7:08           ` Christian Gmeiner
  0 siblings, 0 replies; 15+ messages in thread
From: Christian Gmeiner @ 2024-03-28  7:08 UTC (permalink / raw)
  To: Fabio Estevam
  Cc: Josua Mayer, u-boot, Yazan Shhady, Tom Rini, Stefano Babic,
	NXP i.MX U-Boot Team, Baruch Siach, Marcel Ziswiler

Hi Fabio

>
> > I took Josua's patch and modified it a bit.
> >
> > Does the attached patch fix Ethernet?
>
> I forgot to delete the old ethernet-phy nodes.
>
> Please try this one instead.
>
> If it works in U-Boot, please also test Ethernet in Linux as we are
> touching ft_board_setup().

I am able to load kernel and dtb via tftp and ssh into a nfs debian rootfs.

Thanks a lot - all my problems are solved :)

-- 
greets
--
Christian Gmeiner, MSc

https://christian-gmeiner.info/privacypolicy

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

end of thread, other threads:[~2024-03-28  7:08 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <20220728070540.28554-1-josua@solid-run.com>
2022-07-28  7:08 ` [PATCH] mx6cuboxi: fix ethernet after synchronise device-tree Josua Mayer
2022-07-28 11:11   ` Fabio Estevam
2022-07-28 11:16   ` Tom Rini
2024-03-27 12:06   ` Josua Mayer
2024-03-27 12:17     ` Christian Gmeiner
2024-03-27 13:20       ` Josua Mayer
2024-03-27 15:55         ` Christian Gmeiner
2024-03-27 16:54           ` Josua Mayer
2024-03-27 19:29     ` Fabio Estevam
2024-03-27 21:04       ` Fabio Estevam
2024-03-27 23:17         ` Fabio Estevam
2024-03-28  7:08           ` Christian Gmeiner
2022-07-28 11:41 ` Tom Rini
2022-07-28 11:51   ` Fabio Estevam
2022-07-28 12:01     ` Tom Rini

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.