[PATCH v3 0/4] Add minimal boot support for Raspberry Pi 5

From: Andrea della Porta
Date: Tue May 21 2024 - 04:35:47 EST


Hi,

This patchset adds minimal support for the Broadcom BCM2712 SoC and for
the on-board SDHCI controller on Broadcom BCM2712 in order to make it
possible to boot (particularly) a Raspberry Pi 5 from SD card and get a
console through uart.
Changes to arm64/defconfig are not needed since the actual options work
as they are.
This work is heavily based on downstream contributions.

Tested on Tumbleweed substituting the stock kernel with upstream one,
either chainloading uboot+grub+kernel or directly booting the kernel
from 1st stage bootloader. Steps to reproduce:
- prepare an SD card from a Raspberry enabled raw image, mount the first
FAT partition.
- make sure the FAT partition is big enough to contain the kernel,
anything bigger than 64Mb is usually enough, depending on your kernel
config options.
- build the kernel and dtbs making sure that the support for your root
fs type is compiled as builtin.
- copy the kernel image in your FAT partition overwriting the older one
(e.g. kernel*.img for Raspberry Pi OS or u-boot.bin for Tumbleweed).
- copy arch/arm64/boot/dts/broadcom/bcm2712-rpi-5-b.dtb on FAT partition.
- make sure you have a cmdline.txt file in FAT partition with the
following content:
# cat /boot/efi/cmdline.txt
root=/dev/mmcblk0p3 rootwait rw console=tty ignore_loglevel earlycon
console=ttyAMA10,115200
- if you experience random SD issues during boot, try to set
initial_turbo=0 in config.txt.

Changes in V3:

DTS:
- uart0 renamed to uart10 to reflect the current indexing (ttyAMA10
and serial10)
- updated the license to (GPL-2.0 OR MIT)
- sd_io_1v8_reg 'states' property have second cells as decimal instead
of hex.
- root node has size-cells=<2> now to accommodate for the DRAM controller
and the address bus mapping that goes beyond 4GB. As a consequence,
memory, axi and reserved-memory nodes have also size-cells=<2> and
subnodes reg and ranges properties have been updated accordingly
- ranges property in 'axi' node has been fixed, reg properties of sdio1
and gicv2 subnodes have been adjusted according to the new mapping
- 'interrupt-controller@7d517000' node is now enabled by default
- dropped 'arm,cpu-registers-not-fw-configured' as it is no longer
relevant on A76 core
- l2 cache nodes moved under respective cpus, since they are per-cpu
- dropped psci cpu functions properties
- added the hypervisor EL2 virtual timer interrupt to the 'timer' node
- splitted-lines url are now on a single line

sdhci-brcmstb.c:
- simplified MMC_CAP_HSE_MASK leveraging already existing definitions
- MMC_CAP_UHS_MASK renamed to MMC_CAP_UHS_I_SDR_MASK to better reflect
its purpose. Added also a comment.
- sdhci_brcmstb_set_power() replaced with the already existing (and
equivalent) sdhci_set_power_and_bus_voltage()

DT-bindings:
- removed the BCM2712 specific example, as per Rob's request.


Changes in V2:

- the patchshet has been considerably simplified, both in terms of dts and
driver code. Notably, the pinctrl/pinmux driver (and associated binding)
was not strictly needed to use the SD card so it has been dropped
- dropped the optional SD express support patch
- the patches order has been revisited
- pass all checks (binding, dtb, checkpatch)


Many thanks,
Andrea

References:
- Link to V1: https://lore.kernel.org/all/cover.1713036964.git.andrea.porta@xxxxxxxx/
- Link to V2: https://lore.kernel.org/all/cover.1715332922.git.andrea.porta@xxxxxxxx/

Andrea della Porta (4):
dt-bindings: arm: bcm: Add BCM2712 SoC support
dt-bindings: mmc: Add support for BCM2712 SD host controller
mmc: sdhci-brcmstb: Add BCM2712 support
arm64: dts: broadcom: Add support for BCM2712

.../devicetree/bindings/arm/bcm/bcm2835.yaml | 6 +
.../bindings/mmc/brcm,sdhci-brcmstb.yaml | 4 +
arch/arm64/boot/dts/broadcom/Makefile | 1 +
.../boot/dts/broadcom/bcm2712-rpi-5-b.dts | 64 ++++
arch/arm64/boot/dts/broadcom/bcm2712.dtsi | 292 ++++++++++++++++++
drivers/mmc/host/sdhci-brcmstb.c | 65 ++++
6 files changed, 432 insertions(+)
create mode 100644 arch/arm64/boot/dts/broadcom/bcm2712-rpi-5-b.dts
create mode 100644 arch/arm64/boot/dts/broadcom/bcm2712.dtsi

--
2.35.3