Sunday, November 27, 2022

Re: U-Boot 2022.10 and dtb from Linux 6.0.8

Mark Kettenis wrote:
> > As I understand the driver, cpsw0 will always have a zero address if
> > the "ti,cpsw" device tree node has either no child nodes at all or
> > none named "local-mac-address".
> >
> > If a "local-mac-address" child node exists then that address is used.
>
> Small correction, you mean a "local-mac-address" property instead of a
> node.

Ah yes, thanks!


> > (if_cpsw.c:364 cpsw_attach() calling cpsw_get_port_config() ff.)
> >
> > Neither the snapshot dtb nor Patrick's dtb contain "local-mac-address" so
> > is U-Boot modifying only the older dtb (why!?) or what is going on here?
>
> Yes U-Boot will update the FDT with "local-mac-address" properties.
> U-Boot typically uses "ethernetN" properties under /aliases to decide
> where to place the "local-mac-address" properties. So if those
> aliases aren't there you end up without "local-mac-address"
> properties.

Aha!


Patrick Wildt wrote:
> > > Working on the cpsw driver I was silently wondering where the nonzero
> > > MAC on my beaglebone black comes from and I still don't know the answer.
> >
> > Either local-mac-address or from hardware registers. For cpsw(4) it's
> > local-mac-address. U-Boot configures those on bootup.

May cpsw(4) access the control module registers? If yes I'd rather
make the driver read the fused address(es) instead of local-mac-address,
to completely avoid any problems.

At the very least do so when local-mac-address is zero or not found.

It seems unneccessary to depend on another software (U-Boot) when the
information is available in the hardware.


> > Usually there needs to be a /aliases/ethernet0 or so pointing to
> > the correct node for U-Boot to set it correctly. It's possible
> > that this changes as well. I will have a look.
>
> And that is exactly what happened, this should be reverted as well:
>
> - ethernet0 = &cpsw_emac0;
> - ethernet1 = &cpsw_emac1;
> + ethernet0 = &cpsw_port1;
> + ethernet1 = &cpsw_port2;

Good find!


> Can you give this a shot?

Sure: U-Boot 2022.10 + new dtb-6.0.8 boots both 7.2 and Nov 1 snapshot
kernels on BeagleBone Black with nonzero cpsw0 address and ping -f
works fine.


//Peter

No comments:

Post a Comment