Hi Torsten,
On 2026-09-25T10:54:32, Torsten Duwe <[email protected]> wrote:
> board: raspberrypi: use board_late_init to probe RP1 chip
>
> During device tree parsing, u-boot finds the PCIe root complexes.
> Thereafter, a pci scan finds the RP1 chip, but does not really
> deal with it properly, while the device tree probably holds the
> description for the RP1 "nexus" or similar. Use board_late_init
> to attach any such FDT fragments to the RP1 found.
>
> Signed-off-by: Torsten Duwe <[email protected]>
> Co-authored-by: Volodymyr Babchuk <[email protected]>
>
> board/raspberrypi/rpi/rpi.c | 15 +++++++++++++++
> configs/rpi_arm64_defconfig | 1 +
> 2 files changed, 16 insertions(+)
Please tighten the commit message. 'u-boot' should be 'U-Boot', and
the description is hand-wavy ('probably holds', 'or similar', 'does
not really deal with it properly'). State it concretely: the RP1 has a
DT node with child nodes (clk, gpio, mfd) but because it is discovered
via PCI enumeration the PCI-generic bind path does not walk those
child nodes, so dm_scan_fdt_dev() is used to bind them.
> diff --git a/board/raspberrypi/rpi/rpi.c b/board/raspberrypi/rpi/rpi.c
> @@ -566,6 +566,21 @@ int board_init(void)
> +int board_late_init(void)
> +{
> + struct udevice *dev;
> + int err;
> +
> + err = dm_pci_find_device(PCI_VENDOR_ID_RPI, PCI_DEVICE_ID_RPI_RP1_C0,
> + 0, &dev);
> + if (err)
> + printf("RPI: RP1 device not found\n");
> + else
> + dm_scan_fdt_dev(dev);
> +
> + return 0;
> +}
This defconfig covers RPi4 too, doesn't it? So we should gate the
lookup on the actual model (get_board_rev()/rpi_model) or demote the
message to log_debug() / drop it when the device is simply absent.
> diff --git a/board/raspberrypi/rpi/rpi.c b/board/raspberrypi/rpi/rpi.c
> @@ -566,6 +566,21 @@ int board_init(void)
> + else
> + dm_scan_fdt_dev(dev);
The return value from dm_scan_fdt_dev() is ignored; if it fails the
user gets no clue why no RP1 children came up. Please check it and log
something useful / return the error.
> diff --git a/board/raspberrypi/rpi/rpi.c b/board/raspberrypi/rpi/rpi.c
> @@ -566,6 +566,21 @@ int board_init(void)
> +int board_late_init(void)
> +{
> + struct udevice *dev;
> + int err;
> +
> + err = dm_pci_find_device(PCI_VENDOR_ID_RPI, PCI_DEVICE_ID_RPI_RP1_C0,
> + 0, &dev);
> + if (err)
> + printf("RPI: RP1 device not found\n");
> + else
> + dm_scan_fdt_dev(dev);
More fundamentally, I think this belongs in the rp1 MFD driver rather
than in board code - the driver already binds via
PCI_DEVICE(PCI_VENDOR_ID_RPI, PCI_DEVICE_ID_RPI_RP1_C0), so calling
dm_scan_fdt_dev(dev) from rp1_probe() (or a post_bind hook) would
achieve the same effect without any board glue and without needing
BOARD_LATE_INIT. Other PCI-attached bridges bind their DT children
from the driver, not from board_late_init(). What do you think?
Regards,
Simon