Skip to content

rpi: Autodetect the rpi 7inch touchscreen

U-boot does not provide i2c drivers for the Raspberry Pi 4. Therefore, the screen cannot be probed on the i2c bus in u-boot.

Fortunately, the Raspberry Pi bootloader is able to automatically detect if the screen is connected and in that case, load a dtbo from the overlay folder on the firmware partition.

This commit uses that information to detect if the touch screen is connected:

  • RPI bootloader loads the device tree overlay on its fw devicetree if it detects the touchscreen.
  • U-boot checks the fw device tree for the touch screen node added by the overlay (an i2c device on the i2c0 bus with addr 0x38).
  • If the node is in status "okay", u-boot will add the overlay for the touchscreen in the overlay-list to be loaded by PXE boot on the kernel device tree.

The rpi config in u-boot does not specify an overlay load address. To fit the device tree overlay right after the device tree, the start of the initramfs is moved to 0x02800000 and the overlay will be temporarily stored at 0x02700000.

A persistent overlay list is added to let different part of the boot process add fdt overlays to be loaded on the linux fdt when it has been loaded.

https://phabricator.apertis.org/T9334

Edited by Detlev Casanova

Merge request reports