Skip to contentSkip to conversation

Add minimal boot support for Raspberry Pi 5

PATCH Applied Andrea della Porta 5 participants 12 messages May 30, 2024 – Jun 5, 2024

Subsystems (7)
lore
Share & tools
lore
#0 lore raw

v5 cover Add minimal boot support for Raspberry Pi 5

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 V5:

DTS:
- axi node merged into soc node
- redefined the mapping ranges of the soc node to have proper translation, and a narrower address and size cell number for child nodes.Child nodes reg properties adjusted accordingly
- augemented the comment in 'gio_aon' node

sdhci-brcmstb.c:
- removed unused 'base_clk_mhz' variable

Changes in V4:

sdhci-brcmstb.c:
- dropped the last 4 lines of sdhci_brcmstb_cfginit_2712() function to avoid setting the SDIO_CFG_CQ_CAPABILITY register. The rationale behind this can be found in [4] and subsequent comments

DT-bindings:
- simplified the compatible item list for 'brcm,bcm2712-sdhci' as per [5]

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:
[1] - Link to V1: https://lore.kernel.org/all/[email protected]/
[2] - Link to V2: https://lore.kernel.org/all/[email protected]/
[3] - Link to V3: https://lore.kernel.org/all/[email protected]/
[4] - https://lore.kernel.org/all/ZlF5dQbNpZ921e66@apocalypse/
[5] - https://lore.kernel.org/all/[email protected]/#t

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 minimal support for Raspberry Pi 5

 .../devicetree/bindings/arm/bcm/bcm2835.yaml  |   6 +
 .../bindings/mmc/brcm,sdhci-brcmstb.yaml      |   1 +
 arch/arm64/boot/dts/broadcom/Makefile         |   1 +
 .../boot/dts/broadcom/bcm2712-rpi-5-b.dts     |  64 ++++
 arch/arm64/boot/dts/broadcom/bcm2712.dtsi     | 283 ++++++++++++++++++
 drivers/mmc/host/sdhci-brcmstb.c              |  60 ++++
 6 files changed, 415 insertions(+)
 create mode 100644 arch/arm64/boot/dts/broadcom/bcm2712-rpi-5-b.dts
 create mode 100644 arch/arm64/boot/dts/broadcom/bcm2712.dtsi
Signature · 1 line
2.35.3
#1 lore raw

PATCH v5 1/4 dt-bindings: arm: bcm: Add BCM2712 SoC support

The BCM2712 SoC is found on Raspberry Pi 5. Add compatible string to acknowledge its new chipset.

---
 Documentation/devicetree/bindings/arm/bcm/bcm2835.yaml | 6 ++++++
 1 file changed, 6 insertions(+)
Documentation/devicetree/bindings/arm/bcm/bcm2835.yaml +6 -0
index 162a39dab218..e4ff71f006b8 100644
@@ -23,6 +23,12 @@ properties:
               - raspberrypi,4-model-b
           - const: brcm,bcm2711
 
+      - description: BCM2712 based Boards
+        items:
+          - enum:
+              - raspberrypi,5-model-b
+          - const: brcm,bcm2712
+
       - description: BCM2835 based Boards
         items:
           - enum:
Signature · 1 line
2.35.3
#2 lore raw

PATCH v5 2/4 dt-bindings: mmc: Add support for BCM2712 SD host controller

In reply to Andrea della Porta

The BCM2712 has an SDHCI capable host interface similar to the one found in other STB chipsets. Add the relevant compatible string.

---
 Documentation/devicetree/bindings/mmc/brcm,sdhci-brcmstb.yaml | 1 +
 1 file changed, 1 insertion(+)
Documentation/devicetree/bindings/mmc/brcm,sdhci-brcmstb.yaml +1 -0
index cbd3d6c6c77f..eee6be7a7867 100644
@@ -20,6 +20,7 @@ properties:
           - const: brcm,sdhci-brcmstb
       - items:
           - enum:
+              - brcm,bcm2712-sdhci
               - brcm,bcm74165b0-sdhci
               - brcm,bcm7445-sdhci
               - brcm,bcm7425-sdhci
Signature · 1 line
2.35.3
#3 lore raw

PATCH v5 3/4 mmc: sdhci-brcmstb: Add BCM2712 support

In reply to Andrea della Porta

Broadcom BCM2712 SoC has an SDHCI card controller using the SDIO CFG register block present on other STB chips. Add support for BCM2712 SD capabilities of this chipset.
The silicon is SD Express capable but this driver port does not currently include that feature yet.
Based on downstream driver by raspberry foundation maintained kernel.

---
 drivers/mmc/host/sdhci-brcmstb.c | 60 ++++++++++++++++++++++++++++++++
 1 file changed, 60 insertions(+)
drivers/mmc/host/sdhci-brcmstb.c +60 -0
index 9053526fa212..db1c7f5cd5fd 100644
@@ -30,6 +30,21 @@
 
 #define SDHCI_ARASAN_CQE_BASE_ADDR		0x200
 
+#define SDIO_CFG_CQ_CAPABILITY			0x4c
+#define SDIO_CFG_CQ_CAPABILITY_FMUL		GENMASK(13, 12)
+
+#define SDIO_CFG_CTRL				0x0
+#define SDIO_CFG_CTRL_SDCD_N_TEST_EN		BIT(31)
+#define SDIO_CFG_CTRL_SDCD_N_TEST_LEV		BIT(30)
+
+#define SDIO_CFG_MAX_50MHZ_MODE			0x1ac
+#define SDIO_CFG_MAX_50MHZ_MODE_STRAP_OVERRIDE	BIT(31)
+#define SDIO_CFG_MAX_50MHZ_MODE_ENABLE		BIT(0)
+
+#define MMC_CAP_HSE_MASK	(MMC_CAP2_HSX00_1_2V | MMC_CAP2_HSX00_1_8V)
+/* Select all SD UHS type I SDR speed above 50MB/s */
+#define MMC_CAP_UHS_I_SDR_MASK	(MMC_CAP_UHS_SDR50 | MMC_CAP_UHS_SDR104)
+
 struct sdhci_brcmstb_priv {
 	void __iomem *cfg_regs;
 	unsigned int flags;
@@ -38,6 +53,7 @@ struct sdhci_brcmstb_priv {
 };
 
 struct brcmstb_match_priv {
+	void (*cfginit)(struct sdhci_host *host);
 	void (*hs400es)(struct mmc_host *mmc, struct mmc_ios *ios);
 	struct sdhci_ops *ops;
 	const unsigned int flags;
@@ -168,6 +184,33 @@ static void sdhci_brcmstb_set_uhs_signaling(struct sdhci_host *host,
 	sdhci_writew(host, ctrl_2, SDHCI_HOST_CONTROL2);
 }
 
+static void sdhci_brcmstb_cfginit_2712(struct sdhci_host *host)
+{
+	struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
+	struct sdhci_brcmstb_priv *brcmstb_priv = sdhci_pltfm_priv(pltfm_host);
+	u32 reg;
+
+	/*
+	 * If we support a speed that requires tuning,
+	 * then select the delay line PHY as the clock source.
+	 */
+	if ((host->mmc->caps & MMC_CAP_UHS_I_SDR_MASK) || (host->mmc->caps2 & MMC_CAP_HSE_MASK)) {
+		reg = readl(brcmstb_priv->cfg_regs + SDIO_CFG_MAX_50MHZ_MODE);
+		reg &= ~SDIO_CFG_MAX_50MHZ_MODE_ENABLE;
+		reg |= SDIO_CFG_MAX_50MHZ_MODE_STRAP_OVERRIDE;
+		writel(reg, brcmstb_priv->cfg_regs + SDIO_CFG_MAX_50MHZ_MODE);
+	}
+
+	if ((host->mmc->caps & MMC_CAP_NONREMOVABLE) ||
+	    (host->mmc->caps & MMC_CAP_NEEDS_POLL)) {
+		/* Force presence */
+		reg = readl(brcmstb_priv->cfg_regs + SDIO_CFG_CTRL);
+		reg &= ~SDIO_CFG_CTRL_SDCD_N_TEST_LEV;
+		reg |= SDIO_CFG_CTRL_SDCD_N_TEST_EN;
+		writel(reg, brcmstb_priv->cfg_regs + SDIO_CFG_CTRL);
+	}
+}
+
 static void sdhci_brcmstb_dumpregs(struct mmc_host *mmc)
 {
 	sdhci_dumpregs(mmc_priv(mmc));
@@ -200,6 +243,14 @@ static struct sdhci_ops sdhci_brcmstb_ops = {
 	.set_uhs_signaling = sdhci_set_uhs_signaling,
 };
 
+static struct sdhci_ops sdhci_brcmstb_ops_2712 = {
+	.set_clock = sdhci_set_clock,
+	.set_power = sdhci_set_power_and_bus_voltage,
+	.set_bus_width = sdhci_set_bus_width,
+	.reset = sdhci_reset,
+	.set_uhs_signaling = sdhci_set_uhs_signaling,
+};
+
 static struct sdhci_ops sdhci_brcmstb_ops_7216 = {
 	.set_clock = sdhci_brcmstb_set_clock,
 	.set_bus_width = sdhci_set_bus_width,
@@ -214,6 +265,11 @@ static struct sdhci_ops sdhci_brcmstb_ops_74165b0 = {
 	.set_uhs_signaling = sdhci_brcmstb_set_uhs_signaling,
 };
 
+static const struct brcmstb_match_priv match_priv_2712 = {
+	.cfginit = sdhci_brcmstb_cfginit_2712,
+	.ops = &sdhci_brcmstb_ops_2712,
+};
+
 static struct brcmstb_match_priv match_priv_7425 = {
 	.flags = BRCMSTB_MATCH_FLAGS_NO_64BIT |
 	BRCMSTB_MATCH_FLAGS_BROKEN_TIMEOUT,
@@ -238,6 +294,7 @@ static struct brcmstb_match_priv match_priv_74165b0 = {
 };
 
 static const struct of_device_id __maybe_unused sdhci_brcm_of_match[] = {
+	{ .compatible = "brcm,bcm2712-sdhci", .data = &match_priv_2712 },
 	{ .compatible = "brcm,bcm7425-sdhci", .data = &match_priv_7425 },
 	{ .compatible = "brcm,bcm7445-sdhci", .data = &match_priv_7445 },
 	{ .compatible = "brcm,bcm7216-sdhci", .data = &match_priv_7216 },
@@ -370,6 +427,9 @@ static int sdhci_brcmstb_probe(struct platform_device *pdev)
 	    (host->mmc->caps2 & MMC_CAP2_HS400_ES))
 		host->mmc_host_ops.hs400_enhanced_strobe = match_priv->hs400es;
 
+	if (match_priv->cfginit)
+		match_priv->cfginit(host);
+
 	/*
 	 * Supply the existing CAPS, but clear the UHS modes. This
 	 * will allow these modes to be specified by device tree
Signature · 1 line
2.35.3
#4 lore raw

PATCH v5 4/4 arm64: dts: broadcom: Add minimal support for Raspberry Pi 5

In reply to Andrea della Porta

The BCM2712 SoC family can be found on Raspberry Pi 5. Add minimal SoC and board (Rpi5 specific) dts file to be able to boot from SD card and use console on debug UART.

---
 arch/arm64/boot/dts/broadcom/Makefile         |   1 +
 .../boot/dts/broadcom/bcm2712-rpi-5-b.dts     |  64 ++++
 arch/arm64/boot/dts/broadcom/bcm2712.dtsi     | 283 ++++++++++++++++++
 3 files changed, 348 insertions(+)
 create mode 100644 arch/arm64/boot/dts/broadcom/bcm2712-rpi-5-b.dts
 create mode 100644 arch/arm64/boot/dts/broadcom/bcm2712.dtsi
arch/arm64/boot/dts/broadcom/Makefile +1 -0
index 8b4591ddd27c..92565e9781ad 100644
@@ -6,6 +6,7 @@ DTC_FLAGS := -@
 dtb-$(CONFIG_ARCH_BCM2835) += bcm2711-rpi-400.dtb \
 			      bcm2711-rpi-4-b.dtb \
 			      bcm2711-rpi-cm4-io.dtb \
+			      bcm2712-rpi-5-b.dtb \
 			      bcm2837-rpi-3-a-plus.dtb \
 			      bcm2837-rpi-3-b.dtb \
 			      bcm2837-rpi-3-b-plus.dtb \
arch/arm64/boot/dts/broadcom/bcm2712-rpi-5-b.dts new file +64 -0

64 lines not on this page · raw message

arch/arm64/boot/dts/broadcom/bcm2712.dtsi new file +283 -0

283 lines not on this page · raw message

Signature · 1 line
2.35.3
#7 lore raw
In reply to Andrea della Porta
Quoted 125 lines · Andrea della Porta

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 V5:

DTS:
- axi node merged into soc node
- redefined the mapping ranges of the soc node to have proper translation, and a narrower address and size cell number for child nodes.Child nodes reg properties adjusted accordingly
- augemented the comment in 'gio_aon' node

sdhci-brcmstb.c:
- removed unused 'base_clk_mhz' variable

Changes in V4:

sdhci-brcmstb.c:
- dropped the last 4 lines of sdhci_brcmstb_cfginit_2712() function to avoid setting the SDIO_CFG_CQ_CAPABILITY register. The rationale behind this can be found in [4] and subsequent comments

DT-bindings:
- simplified the compatible item list for 'brcm,bcm2712-sdhci' as per [5]

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:
[1] - Link to V1: https://lore.kernel.org/all/[email protected]/
[2] - Link to V2: https://lore.kernel.org/all/[email protected]/
[3] - Link to V3: https://lore.kernel.org/all/[email protected]/
[4] - https://lore.kernel.org/all/ZlF5dQbNpZ921e66@apocalypse/
[5] - https://lore.kernel.org/all/[email protected]/#t

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 minimal support for Raspberry Pi 5

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

--
2.35.3

My bot found new DTB warnings on the .dts files added or changed in this series.

Some warnings may be from an existing SoC .dtsi. Or perhaps the warnings are fixed by another series. Ultimately, it is up to the platform maintainer whether these warnings are acceptable or not. No need to reply unless the platform maintainer has comments.

If you already ran DT checks and didn't see these error(s), then make sure dt-schema is up to date:

  pip3 install dtschema --upgrade

New warnings running 'make CHECK_DTBS=y broadcom/bcm2712-rpi-5-b.dtb' for [email protected]:

arch/arm64/boot/dts/broadcom/bcm2712-rpi-5-b.dtb: /soc@107c000000/timer@7c003000: failed to match any schema with compatible: ['brcm,bcm2835-system-timer'] arch/arm64/boot/dts/broadcom/bcm2712-rpi-5-b.dtb: /soc@107c000000/local-intc@7cd00000: failed to match any schema with compatible: ['brcm,bcm2836-l1-intc']

#8 lore raw
In reply to Andrea della Porta

Hi Andrea,

Am 30.05.24 um 12:11 schrieb Andrea della Porta:

Quoted 25 lines

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:

Quoted 5 lines
   # 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.

was this an issue since the beginning of this series?

What kind of SD issues?

Is there a downstream reference?

#9 lore raw

Hi Stefan,

Quoted 33 lines · Stefan Wahren

Hi Andrea,

Am 30.05.24 um 12:11 schrieb Andrea della Porta:

Quoted 25 lines

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:

Quoted 5 lines
   # 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.
Quoted 2 lines

was this an issue since the beginning of this series?

I experienced this even during early testing, using the complete downstream driver. It seems that when initual_turbo != 0, the fw can throttle the clock to reduce the boot time and it (directly or indirectly) may affect SD functionality. I believe that the probability of this to happen is likely a function of SD card speed, whether it requires timing tuning, initial_turbo exact value and whether you are booting the kernel directly or chainloading u-boot + grub (or whatever combination of secondary stage bootloader). For example, your boot setup may have a timeout in the grub boot menu that is large enough for the clocks to settle and the boot process to end successfully, while faster boot time can lead to the issue described. Since this behaviour seems to depend on all of this factors and does not necessarily arise in practice, disabling initial_turbo is just a suggestion in case things go haywire.

Quoted 2 lines

What kind of SD issues?

I wasn't able to boot from SD card due to clock issues.

Quoted 1 line

Is there a downstream reference?

Some (old) reference e.g.:
https://forums.raspberrypi.com/viewtopic.php?t=112480#:~:text=It%20sets%20turbo%20mode%20from,have%20turbo%20during%20the%20boot.

but there are probably more.

Many thanks,
Andrea

#10 lore raw

Hi Andrea,

Am 31.05.24 um 14:59 schrieb Andrea della Porta:

Quoted 38 lines

Hi Stefan,

Quoted 33 lines · Stefan Wahren

Hi Andrea,

Am 30.05.24 um 12:11 schrieb Andrea della Porta:

Quoted 22 lines

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).

Quoted 8 lines

- 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.

Quoted 2 lines

was this an issue since the beginning of this series?

Quoted 12 lines

I experienced this even during early testing, using the complete downstream driver. It seems that when initual_turbo != 0, the fw can throttle the clock to reduce the boot time and it (directly or indirectly) may affect SD functionality. I believe that the probability of this to happen is likely a function of SD card speed, whether it requires timing tuning, initial_turbo exact value and whether you are booting the kernel directly or chainloading u-boot + grub (or whatever combination of secondary stage bootloader). For example, your boot setup may have a timeout in the grub boot menu that is large enough for the clocks to settle and the boot process to end successfully, while faster boot time can lead to the issue described. Since this behaviour seems to depend on all of this factors and does not necessarily arise in practice, disabling initial_turbo is just a suggestion in case things go haywire.

yes in case the VPU changes the SD clock or one of the parent while the ARM cores tries to boot, they won't be informed about these changes which could ends up with the wrong SD clock frequency.

Thanks for your explanations

Quoted 13 lines
Quoted 3 lines

What kind of SD issues?

I wasn't able to boot from SD card due to clock issues.

Quoted 1 line

Is there a downstream reference?

Some (old) reference e.g.:
https://forums.raspberrypi.com/viewtopic.php?t=112480#:~:text=It%20sets%20turbo%20mode%20from,have%20turbo%20during%20the%20boot.

but there are probably more.

Many thanks,
Andrea

Reviewed-by on v5 4/4
#5 lore raw

Re: [PATCH v5 4/4] arm64: dts: broadcom: Add minimal support for Raspberry Pi 5

In reply to Andrea della Porta

Am 30.05.24 um 12:12 schrieb Andrea della Porta:

Quoted 5 lines

The BCM2712 SoC family can be found on Raspberry Pi 5. Add minimal SoC and board (Rpi5 specific) dts file to be able to boot from SD card and use console on debug UART.

#11 lore raw
In reply to Andrea della Porta
Quoted 42 lines · Andrea della Porta

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 V5:

DTS:
- axi node merged into soc node
- redefined the mapping ranges of the soc node to have proper translation, and a narrower address and size cell number for child nodes.Child nodes reg properties adjusted accordingly
- augemented the comment in 'gio_aon' node

Quoted 2 lines

sdhci-brcmstb.c:
- removed unused 'base_clk_mhz' variable

Patch 1 ->3 from v5 applied for next, thanks!

[...]

Kind regards
Uffe

maintainer Applied
#6 lore raw

Re: [PATCH v5 4/4] arm64: dts: broadcom: Add minimal support for Raspberry Pi 5

In reply to Andrea della Porta

From: Florian Fainelli <[email protected]>

Quoted 6 lines · Andrea della Porta

The BCM2712 SoC family can be found on Raspberry Pi 5. Add minimal SoC and board (Rpi5 specific) dts file to be able to boot from SD card and use console on debug UART.

---

Applied to https://github.com/Broadcom/stblinux/commits/devicetree-arm64/next, thanks! --
Florian

_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel