modify live DT with OF_LIVE breaking phy_connect?

Simon Glass sjg at chromium.org
Mon Oct 14 22:20:05 CEST 2024


Hi Tim,

On Thu, 10 Oct 2024 at 16:05, Tim Harvey <tharvey at gateworks.com> wrote:
>
> On Tue, Oct 8, 2024 at 6:56 PM Simon Glass <sjg at chromium.org> wrote:
> >
> > Hi Tim,
> >
> > On Mon, 7 Oct 2024 at 14:16, Tim Harvey <tharvey at gateworks.com> wrote:
> > >
> > > Greetings,
> > >
> > > I have a need to adjust the U-Boot device-tree live with some board
> > > revision specific fixups. It would seem I need to enable OF_LIVE to do
> > > so but when I do this on imx8mm U-Boot proper seems to fail
> > > phy_connect() called from the network device probe.
> > >
> > > The board I'm working with is an imx8mm-venice board and using
> > > imx8mm_venice_defconfig (without OF_LIVE) results in:
> > > U-Boot 2024.10-00735-gc530f6079c70 (Oct 07 2024 - 12:58:38 -0700)
> > >
> > > CPU:   Freescale i.MX8MMQ rev1.0 1600 MHz (running at 1200 MHz)
> > > CPU:   Industrial temperature grade (-40C to 105C) at 44C
> > > Reset cause: POR
> > > Model: Gateworks Venice GW73xx-0x i.MX8MM Development Kit
> > > DRAM:  4 GiB
> > > Core:  226 devices, 32 uclasses, devicetree: separate
> > > WDT:   Started watchdog at 30280000 with servicing every 1000ms (60s timeout)
> > > MMC:   FSL_SDHC: 0, FSL_SDHC: 1, FSL_SDHC: 2
> > > Loading Environment from MMC... Reading from redundant MMC(2)... OK
> > > In:    serial at 30890000
> > > Out:   serial at 30890000
> > > Err:   serial at 30890000
> > > SEC0:  RNG instantiated
> > > Net:   GPY111 eth0: ethernet at 30be0000 [PRIME]
> > > GSC     : boot watchdog disabled
> > > Thermal protection:enabled at 96C
> > > Hit any key to stop autoboot:  0
> > >
> > > Yet as soon as I enable OF_LIVE:
> > >
> > > U-Boot 2024.10-00735-gc530f6079c70 (Oct 07 2024 - 12:59:35 -0700)
> > >
> > > CPU:   Freescale i.MX8MMQ rev1.0 1600 MHz (running at 1200 MHz)
> > > CPU:   Industrial temperature grade (-40C to 105C) at 49C
> > > Reset cause: POR
> > > Model: Gateworks Venice GW73xx-0x i.MX8MM Development Kit
> > > DRAM:  4 GiB
> > > Core:  214 devices, 32 uclasses, devicetree: separate
> > > WDT:   Started watchdog at 30280000 with servicing every 1000ms (60s timeout)
> > > MMC:   FSL_SDHC: 0, FSL_SDHC: 1, FSL_SDHC: 2
> > > Loading Environment from MMC... Reading from redundant MMC(2)... OK
> > > In:    serial at 30890000
> > > Out:   serial at 30890000
> > > Err:   serial at 30890000
> > > SEC0:  RNG instantiated
> > > Net:   Could not get PHY for mdio: addr 0
> > > Could not get PHY for FEC0: addr 0
> > > Could not get PHY for mdio: addr 0
> > > Could not get PHY for FEC0: addr 0
> > > No ethernet found.
> > > ^^^ phy_connect failing
> > >
> > > Any idea what I'm missing here?
> > >
> > > Are there other ways I should be modifying the live dt in U-Boot?
> >
>
> Hi Simon, thanks for the response.
>
> > I am not sure, but the best option would be to debug the PHY stuff and
> > try to see what is going wrong.
> >
> > Since the number of devices is smaller, I suspect that there is some
> > code which doesn't use the ofnode API. But it is hard to say what is
> > going on.
> >
>
> ok, I will look into that
>
> > For modifying the devicetree, you can do it just before relocation
> > using the flattree if you like. The reason livetree is better is that
> > the nodes don't move around when changes are made.
> >
>
> Where is relocation done in this case where I'm using SPL and U-Boot
> proper for imx8m based boards?

It is always done at the end of board_init_f() in U-Boot proper.

>
> If I want to utilize dt overlays in U-Boot proper can you point me to
> what is needed or some examples?

You could use a FIT in SPL and select the correct DT there, avoiding
needing to change it in U-Boot. But if it is really run-time behaviour
and not described by different models, then that won't work.

There is board_fix_fdt() where you can find some examples. We should
really tidy up all the DT stuff...

>
> I'm intending to detect the presence of an add-in card that has a port
> expander on it so as to allow that port expander to be accessed via
> U-Boot. As a bit of a hack I'm currently using flat dt (!OF_LIVE) and
> putting the port expander in the board dt and attempting to disable it
> via dt modification in board_init(). As a better approach I could
> attempt to add it to dt but using an overlay would make so much more
> sense.

Disabling it in board_init() seems OK to me. Unfortunately this is the
sort of problem which can be solved many ways.

Regards,
Simon


More information about the U-Boot mailing list