Skip to contentSkip to conversation

rpi: Switch to OF_HAS_PRIOR_STAGE by default

PATCH In review Tom Rini 2 participants 2 messages Dec 24, 2021 – Dec 28, 2021

Subsystems (4)
lore
Share & tools
lore

Tom Rini

author
#0 lore raw

PATCH 1/1 rpi: Switch to OF_HAS_PRIOR_STAGE by default

On all Raspberry Pi platforms, we're loaded by a prior stage firmware that has assembled and passed on a device tree binary for us to use. Switch to using this tree by default.

Cc Matthias Brugger <[email protected]>
Cc Simon Glass <[email protected]>
Cc François Ozog <[email protected]>

---
To be clear, this is on top of current -next where I've applied v8 of Simon's series that introduces OF_HAS_PRIOR_STAGE.

I've only been able to test this on my Raspberry Pi 3 boards but this should work everywhere. What may, or may not, be a problem is that arch/arm/dts/bcm283x-u-boot.dtsi is never used now. On the other hand, I believe this should stop the problems we have where changes made to the device tree via config.txt or similar aren't reflected when booting U-Boot or Linux since we will be using that tree for certain now.

---
 arch/arm/Kconfig               | 1 +
 arch/arm/mach-bcm283x/Kconfig  | 3 ---
 configs/rpi_0_w_defconfig      | 1 -
 configs/rpi_2_defconfig        | 1 -
 configs/rpi_3_32b_defconfig    | 1 -
 configs/rpi_3_b_plus_defconfig | 1 -
 configs/rpi_3_defconfig        | 1 -
 configs/rpi_defconfig          | 1 -
 8 files changed, 1 insertion(+), 9 deletions(-)
arch/arm/Kconfig +1 -0
index 85c964b7a182..36a42cf3dc75 100644
@@ -609,6 +609,7 @@ config ARCH_BCM283X
 	select SERIAL_SEARCH_ALL
 	imply CMD_DM
 	imply FAT_WRITE
+	imply OF_HAS_PRIOR_STAGE
 
 config ARCH_BCM63158
 	bool "Broadcom BCM63158 family"
arch/arm/mach-bcm283x/Kconfig +0 -3
index 6ce278c6d296..b3287ce8bcea 100644
@@ -163,7 +163,6 @@ config TARGET_RPI_4_32B
 
 	  This option creates a build targeting the ARMv7/AArch32 ISA.
 	select BCM2711_32B
-	imply OF_HAS_PRIOR_STAGE
 
 config TARGET_RPI_4
 	bool "Raspberry Pi 4 64-bit build"
@@ -189,7 +188,6 @@ config TARGET_RPI_4
 
 	  This option creates a build targeting the ARMv8/AArch64 ISA.
 	select BCM2711_64B
-	imply OF_HAS_PRIOR_STAGE
 
 config TARGET_RPI_ARM64
 	bool "Raspberry Pi one binary 64-bit build"
@@ -197,7 +195,6 @@ config TARGET_RPI_ARM64
 	  Support for all armv8 based Raspberry Pi variants, such as
 	  the RPi 4 model B, in AArch64 (64-bit) mode.
 	select ARM64
-	imply OF_HAS_PRIOR_STAGE
 
 endchoice
 
configs/rpi_0_w_defconfig +0 -1
index 195541c6e765..f056e5783045 100644
@@ -19,7 +19,6 @@ CONFIG_CMD_GPIO=y
 CONFIG_CMD_MMC=y
 CONFIG_CMD_USB=y
 CONFIG_CMD_FS_UUID=y
-CONFIG_OF_EMBED=y
 CONFIG_ENV_FAT_DEVICE_AND_PART="0:1"
 CONFIG_SYS_RELOC_GD_ENV_ADDR=y
 CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG=y
configs/rpi_2_defconfig +0 -1
index eb63fbdd8d9c..45cad3003aba 100644
@@ -20,7 +20,6 @@ CONFIG_CMD_GPIO=y
 CONFIG_CMD_MMC=y
 CONFIG_CMD_USB=y
 CONFIG_CMD_FS_UUID=y
-CONFIG_OF_EMBED=y
 CONFIG_ENV_FAT_DEVICE_AND_PART="0:1"
 CONFIG_SYS_RELOC_GD_ENV_ADDR=y
 CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG=y
configs/rpi_3_32b_defconfig +0 -1
index 46102899f037..71de806fdde3 100644
@@ -21,7 +21,6 @@ CONFIG_CMD_GPIO=y
 CONFIG_CMD_MMC=y
 CONFIG_CMD_USB=y
 CONFIG_CMD_FS_UUID=y
-CONFIG_OF_EMBED=y
 CONFIG_ENV_FAT_DEVICE_AND_PART="0:1"
 CONFIG_SYS_RELOC_GD_ENV_ADDR=y
 CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG=y
configs/rpi_3_b_plus_defconfig +0 -1
index 91b63b62721c..947d4ebdf1a8 100644
@@ -20,7 +20,6 @@ CONFIG_CMD_GPIO=y
 CONFIG_CMD_MMC=y
 CONFIG_CMD_USB=y
 CONFIG_CMD_FS_UUID=y
-CONFIG_OF_EMBED=y
 CONFIG_ENV_FAT_DEVICE_AND_PART="0:1"
 CONFIG_SYS_RELOC_GD_ENV_ADDR=y
 CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG=y
configs/rpi_3_defconfig +0 -1
index 528b12ea5b55..82b38a2da332 100644
@@ -20,7 +20,6 @@ CONFIG_CMD_GPIO=y
 CONFIG_CMD_MMC=y
 CONFIG_CMD_USB=y
 CONFIG_CMD_FS_UUID=y
-CONFIG_OF_EMBED=y
 CONFIG_ENV_FAT_DEVICE_AND_PART="0:1"
 CONFIG_SYS_RELOC_GD_ENV_ADDR=y
 CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG=y
configs/rpi_defconfig +0 -1
index 0baef3b6abfa..f9da96c77567 100644
@@ -19,7 +19,6 @@ CONFIG_CMD_GPIO=y
 CONFIG_CMD_MMC=y
 CONFIG_CMD_USB=y
 CONFIG_CMD_FS_UUID=y
-CONFIG_OF_EMBED=y
 CONFIG_ENV_FAT_DEVICE_AND_PART="0:1"
 CONFIG_SYS_RELOC_GD_ENV_ADDR=y
 CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG=y
Signature · 1 line
2.25.1
Tested-by on v1 1/1
#1 lore raw

Hi Tom,

Quoted 13 lines · Tom Rini

On all Raspberry Pi platforms, we're loaded by a prior stage firmware that has assembled and passed on a device tree binary for us to use. Switch to using this tree by default.

Cc Matthias Brugger <[email protected]>
Cc Simon Glass <[email protected]>
Cc François Ozog <[email protected]>

---
To be clear, this is on top of current -next where I've applied v8 of Simon's series that introduces OF_HAS_PRIOR_STAGE.

Quoted 6 lines

I've only been able to test this on my Raspberry Pi 3 boards but this should work everywhere. What may, or may not, be a problem is that arch/arm/dts/bcm283x-u-boot.dtsi is never used now. On the other hand, I believe this should stop the problems we have where changes made to the device tree via config.txt or similar aren't reflected when booting U-Boot or Linux since we will be using that tree for certain now.

I'm not sure, but it seems we lose the smbios stuff, at least. Matthias should be able to weigh in there.

Quoted 11 lines
---
 arch/arm/Kconfig               | 1 +
 arch/arm/mach-bcm283x/Kconfig  | 3 ---
 configs/rpi_0_w_defconfig      | 1 -
 configs/rpi_2_defconfig        | 1 -
 configs/rpi_3_32b_defconfig    | 1 -
 configs/rpi_3_b_plus_defconfig | 1 -
 configs/rpi_3_defconfig        | 1 -
 configs/rpi_defconfig          | 1 -
 8 files changed, 1 insertion(+), 9 deletions(-)

For me, this works OK on rpi0:

Strangely it does not boot an OS with or without this patch.

U-Boot 2022.01-rc4-00143-g383c3bd4e3b (Dec 28 2021 - 01:50:54 -0700)

DRAM: 448 MiB
RPI Zero W (0x9000c1)

Core:  73 devices, 10 uclasses, devicetree: board
MMC:   mmc@7e202000: 0, mmcnr@7e300000: 1
Loading Environment from FAT... Unable to read "uboot.env" from
mmc0:1... In:    serial
Out:   vidconsole
Err:   vidconsole
Net:   No ethernet found.

starting USB...
Bus usb@7e980000: USB DWC2
scanning bus usb@7e980000 for devices... 1 USB Device(s) found
scanning usb for storage devices... 0 Storage Device(s) found
Hit any key to stop autoboot: 0
switch to partitions #0, OK
mmc0 is current device
Scanning mmc 0:1...
libfdt fdt_check_header(): FDT_ERR_BADMAGIC
Scanning disk [email protected]...
Card did not respond to voltage select! : -110
Scanning disk [email protected]...
Disk [email protected] not ready
Found 3 disks
No EFI system partition
BootOrder not defined
EFI boot manager: Cannot load any image
Card did not respond to voltage select! : -110
MMC Device 2 not found
no mmc device at slot 2

Device 0: unknown device
No ethernet found.
missing environment variable: pxeuuid Retrieving file: pxelinux.cfg/00000000
No ethernet found.
Retrieving file: pxelinux.cfg/0000000
No ethernet found.
Retrieving file: pxelinux.cfg/000000
No ethernet found.
Retrieving file: pxelinux.cfg/00000
No ethernet found.
Retrieving file: pxelinux.cfg/0000
No ethernet found.
Retrieving file: pxelinux.cfg/000
No ethernet found.
Retrieving file: pxelinux.cfg/00
No ethernet found.
Retrieving file: pxelinux.cfg/0
No ethernet found.
Retrieving file: pxelinux.cfg/default-arm-bcm283x-rpi No ethernet found.
Retrieving file: pxelinux.cfg/default-arm-bcm283x No ethernet found.
Retrieving file: pxelinux.cfg/default-arm
No ethernet found.
Retrieving file: pxelinux.cfg/default
No ethernet found.
Config file not found
No ethernet found.
No ethernet found.
U-Boot> part list mmc 0

Partition Map for MMC device 0 -- Partition Type: DOS

Part Start Sector Num Sectors UUID Type

  1 8192      524288    705b0d16-01 0c
  2 532480    30583808  705b0d16-02 83

U-Boot>

My rpi2 is broken but I can probably fix it when I return next week.

Regards,
Simon