From: Torsten Duwe <[email protected]>

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(+)

diff --git a/board/raspberrypi/rpi/rpi.c b/board/raspberrypi/rpi/rpi.c
index 1da5df92351..792aacdacb9 100644
--- a/board/raspberrypi/rpi/rpi.c
+++ b/board/raspberrypi/rpi/rpi.c
@@ -566,6 +566,21 @@ int board_init(void)
        return bcm2835_power_on_module(BCM2835_MBOX_POWER_DEVID_USB_HCD);
 }
 
+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;
+}
+
 /*
  * If the firmware passed a device tree use it for U-Boot.
  */
diff --git a/configs/rpi_arm64_defconfig b/configs/rpi_arm64_defconfig
index fcd37cb4fc9..67b5311d4a6 100644
--- a/configs/rpi_arm64_defconfig
+++ b/configs/rpi_arm64_defconfig
@@ -20,6 +20,7 @@ CONFIG_PREBOOT="pci enum; usb start; nvme scan;"
 CONFIG_SYS_PBSIZE=1049
 # CONFIG_DISPLAY_CPUINFO is not set
 # CONFIG_DISPLAY_BOARDINFO is not set
+CONFIG_BOARD_LATE_INIT=y
 CONFIG_MISC_INIT_R=y
 CONFIG_SYS_PROMPT="U-Boot> "
 CONFIG_CMD_NVEDIT_EFI=y
-- 
2.51.0

Reply via email to