Skip to contentSkip to conversation

board/raspberry: add FDT for bcm2712d0

PATCH In review Filip Kokosiński 2 participants 8 messages Feb 16 – Mar 12 Broadcom BCM2711/BCM2835 Arm architecture

lore
Share & tools
lore
#0 lore raw

cover board/raspberry: add FDT for bcm2712d0

This series adds the FDT for the d0 stepping of the BCM2712 SoC. The v1.1 revision of the Raspberry Pi 5 board can't boot Linux properly without additional changes specific to the d0 stepping.

The d0 specific changes can be seen here:
https://github.com/raspberrypi/linux/blob/rpi-6.12.y/arch/arm64/boot/dts/broadcom/bcm2712d0-rpi-5-b.dts

To do that, this series introduces support for multiple FDT entries for a single device type (bits 4-11 from the new-style revision code).

The rpi_model struct is modified by:
* changing fdtfile to fdtfiles (const char * const *)
* adding fdtcount (size_t)

Adding fdtcount is motivated by wanting to keep FDT selection O(1), and avoid relying on NULL terminating fdtfiles array.

A new FDTFILES macro is added to initialize fdtfile and fdtcount.

In case only a single FDT is provided, or the board revision code doesn't match, the selected FDT defaults to the first entry in fdtfiles.

Filip Kokosiński (2):
board/raspberrypi: add multi-FDT support board/raspberrypi: add bcm2712d0-rpi-5-b for Raspberry Pi 5

 board/raspberrypi/rpi/rpi.c | 96 +++++++++++++++++++++----------------
 1 file changed, 55 insertions(+), 41 deletions(-)
Signature · 1 line
2.51.2
#1 lore raw

PATCH 1/2 board/raspberrypi: add multi-FDT support

This patch adds support for multiple FDT files per board model. This is done by adding the FDTFILES macro, which initializes two rpi_model struct members: fdtfiles and fdtcount.

The new-style revision codes designate LSB bits as board revision; this value is used to choose between provided FDTs. The first element of the fdtfiles list is used should no revision match.

---
 board/raspberrypi/rpi/rpi.c | 93 +++++++++++++++++++++----------------
 1 file changed, 52 insertions(+), 41 deletions(-)
board/raspberrypi/rpi/rpi.c +52 -41
index f9b643555dd..1b404b448f3 100644
@@ -94,120 +94,125 @@ struct efi_capsule_update_info update_info = {
  */
 struct rpi_model {
 	const char *name;
-	const char *fdtfile;
+	const char * const *fdtfiles;
+	size_t fdtcount;
 	bool has_onboard_eth;
 };
 
+#define FDTFILES(...) \
+	(const char *[]){ __VA_ARGS__ }, \
+	sizeof((const char *[]){ __VA_ARGS__ }) / sizeof(const char *)
+
 static const struct rpi_model rpi_model_unknown = {
 	"Unknown model",
-	DTB_DIR "bcm283x-rpi-other.dtb",
+	FDTFILES(DTB_DIR "bcm283x-rpi-other.dtb"),
 	false,
 };
 
 static const struct rpi_model rpi_models_new_scheme[] = {
 	[0x0] = {
 		"Model A",
-		DTB_DIR "bcm2835-rpi-a.dtb",
+		FDTFILES(DTB_DIR "bcm2835-rpi-a.dtb"),
 		false,
 	},
 	[0x1] = {
 		"Model B",
-		DTB_DIR "bcm2835-rpi-b.dtb",
+		FDTFILES(DTB_DIR "bcm2835-rpi-b.dtb"),
 		true,
 	},
 	[0x2] = {
 		"Model A+",
-		DTB_DIR "bcm2835-rpi-a-plus.dtb",
+		FDTFILES(DTB_DIR "bcm2835-rpi-a-plus.dtb"),
 		false,
 	},
 	[0x3] = {
 		"Model B+",
-		DTB_DIR "bcm2835-rpi-b-plus.dtb",
+		FDTFILES(DTB_DIR "bcm2835-rpi-b-plus.dtb"),
 		true,
 	},
 	[0x4] = {
 		"2 Model B",
-		DTB_DIR "bcm2836-rpi-2-b.dtb",
+		FDTFILES(DTB_DIR "bcm2836-rpi-2-b.dtb"),
 		true,
 	},
 	[0x6] = {
 		"Compute Module",
-		DTB_DIR "bcm2835-rpi-cm.dtb",
+		FDTFILES(DTB_DIR "bcm2835-rpi-cm.dtb"),
 		false,
 	},
 	[0x8] = {
 		"3 Model B",
-		DTB_DIR "bcm2837-rpi-3-b.dtb",
+		FDTFILES(DTB_DIR "bcm2837-rpi-3-b.dtb"),
 		true,
 	},
 	[0x9] = {
 		"Zero",
-		DTB_DIR "bcm2835-rpi-zero.dtb",
+		FDTFILES(DTB_DIR "bcm2835-rpi-zero.dtb"),
 		false,
 	},
 	[0xA] = {
 		"Compute Module 3",
-		DTB_DIR "bcm2837-rpi-cm3.dtb",
+		FDTFILES(DTB_DIR "bcm2837-rpi-cm3.dtb"),
 		false,
 	},
 	[0xC] = {
 		"Zero W",
-		DTB_DIR "bcm2835-rpi-zero-w.dtb",
+		FDTFILES(DTB_DIR "bcm2835-rpi-zero-w.dtb"),
 		false,
 	},
 	[0xD] = {
 		"3 Model B+",
-		DTB_DIR "bcm2837-rpi-3-b-plus.dtb",
+		FDTFILES(DTB_DIR "bcm2837-rpi-3-b-plus.dtb"),
 		true,
 	},
 	[0xE] = {
 		"3 Model A+",
-		DTB_DIR "bcm2837-rpi-3-a-plus.dtb",
+		FDTFILES(DTB_DIR "bcm2837-rpi-3-a-plus.dtb"),
 		false,
 	},
 	[0x10] = {
 		"Compute Module 3+",
-		DTB_DIR "bcm2837-rpi-cm3.dtb",
+		FDTFILES(DTB_DIR "bcm2837-rpi-cm3.dtb"),
 		false,
 	},
 	[0x11] = {
 		"4 Model B",
-		DTB_DIR "bcm2711-rpi-4-b.dtb",
+		FDTFILES(DTB_DIR "bcm2711-rpi-4-b.dtb"),
 		true,
 	},
 	[0x12] = {
 		"Zero 2 W",
-		DTB_DIR "bcm2837-rpi-zero-2-w.dtb",
+		FDTFILES(DTB_DIR "bcm2837-rpi-zero-2-w.dtb"),
 		false,
 	},
 	[0x13] = {
 		"400",
-		DTB_DIR "bcm2711-rpi-400.dtb",
+		FDTFILES(DTB_DIR "bcm2711-rpi-400.dtb"),
 		true,
 	},
 	[0x14] = {
 		"Compute Module 4",
-		DTB_DIR "bcm2711-rpi-cm4.dtb",
+		FDTFILES(DTB_DIR "bcm2711-rpi-cm4.dtb"),
 		true,
 	},
 	[0x17] = {
 		"5 Model B",
-		DTB_DIR "bcm2712-rpi-5-b.dtb",
+		FDTFILES(DTB_DIR "bcm2712-rpi-5-b.dtb"),
 		true,
 	},
 	[0x18] = {
 		"Compute Module 5",
-		DTB_DIR "bcm2712-rpi-cm5-cm5io.dtb",
+		FDTFILES(DTB_DIR "bcm2712-rpi-cm5-cm5io.dtb"),
 		true,
 	},
 	[0x19] = {
 		"500",
-		DTB_DIR "bcm2712-rpi-500.dtb",
+		FDTFILES(DTB_DIR "bcm2712-rpi-500.dtb"),
 		true,
 	},
 	[0x1A] = {
 		"Compute Module 5 Lite",
-		DTB_DIR "bcm2712-rpi-cm5l-cm5io.dtb",
+		FDTFILES(DTB_DIR "bcm2712-rpi-cm5l-cm5io.dtb"),
 		true,
 	},
 };
@@ -215,87 +220,87 @@ static const struct rpi_model rpi_models_new_scheme[] = {
 static const struct rpi_model rpi_models_old_scheme[] = {
 	[0x2] = {
 		"Model B",
-		DTB_DIR "bcm2835-rpi-b.dtb",
+		FDTFILES(DTB_DIR "bcm2835-rpi-b.dtb"),
 		true,
 	},
 	[0x3] = {
 		"Model B",
-		DTB_DIR "bcm2835-rpi-b.dtb",
+		FDTFILES(DTB_DIR "bcm2835-rpi-b.dtb"),
 		true,
 	},
 	[0x4] = {
 		"Model B rev2",
-		DTB_DIR "bcm2835-rpi-b-rev2.dtb",
+		FDTFILES(DTB_DIR "bcm2835-rpi-b-rev2.dtb"),
 		true,
 	},
 	[0x5] = {
 		"Model B rev2",
-		DTB_DIR "bcm2835-rpi-b-rev2.dtb",
+		FDTFILES(DTB_DIR "bcm2835-rpi-b-rev2.dtb"),
 		true,
 	},
 	[0x6] = {
 		"Model B rev2",
-		DTB_DIR "bcm2835-rpi-b-rev2.dtb",
+		FDTFILES(DTB_DIR "bcm2835-rpi-b-rev2.dtb"),
 		true,
 	},
 	[0x7] = {
 		"Model A",
-		DTB_DIR "bcm2835-rpi-a.dtb",
+		FDTFILES(DTB_DIR "bcm2835-rpi-a.dtb"),
 		false,
 	},
 	[0x8] = {
 		"Model A",
-		DTB_DIR "bcm2835-rpi-a.dtb",
+		FDTFILES(DTB_DIR "bcm2835-rpi-a.dtb"),
 		false,
 	},
 	[0x9] = {
 		"Model A",
-		DTB_DIR "bcm2835-rpi-a.dtb",
+		FDTFILES(DTB_DIR "bcm2835-rpi-a.dtb"),
 		false,
 	},
 	[0xd] = {
 		"Model B rev2",
-		DTB_DIR "bcm2835-rpi-b-rev2.dtb",
+		FDTFILES(DTB_DIR "bcm2835-rpi-b-rev2.dtb"),
 		true,
 	},
 	[0xe] = {
 		"Model B rev2",
-		DTB_DIR "bcm2835-rpi-b-rev2.dtb",
+		FDTFILES(DTB_DIR "bcm2835-rpi-b-rev2.dtb"),
 		true,
 	},
 	[0xf] = {
 		"Model B rev2",
-		DTB_DIR "bcm2835-rpi-b-rev2.dtb",
+		FDTFILES(DTB_DIR "bcm2835-rpi-b-rev2.dtb"),
 		true,
 	},
 	[0x10] = {
 		"Model B+",
-		DTB_DIR "bcm2835-rpi-b-plus.dtb",
+		FDTFILES(DTB_DIR "bcm2835-rpi-b-plus.dtb"),
 		true,
 	},
 	[0x11] = {
 		"Compute Module",
-		DTB_DIR "bcm2835-rpi-cm.dtb",
+		FDTFILES(DTB_DIR "bcm2835-rpi-cm.dtb"),
 		false,
 	},
 	[0x12] = {
 		"Model A+",
-		DTB_DIR "bcm2835-rpi-a-plus.dtb",
+		FDTFILES(DTB_DIR "bcm2835-rpi-a-plus.dtb"),
 		false,
 	},
 	[0x13] = {
 		"Model B+",
-		DTB_DIR "bcm2835-rpi-b-plus.dtb",
+		FDTFILES(DTB_DIR "bcm2835-rpi-b-plus.dtb"),
 		true,
 	},
 	[0x14] = {
 		"Compute Module",
-		DTB_DIR "bcm2835-rpi-cm.dtb",
+		FDTFILES(DTB_DIR "bcm2835-rpi-cm.dtb"),
 		false,
 	},
 	[0x15] = {
 		"Model A+",
-		DTB_DIR "bcm2835-rpi-a-plus.dtb",
+		FDTFILES(DTB_DIR "bcm2835-rpi-a-plus.dtb"),
 		false,
 	},
 };
@@ -361,11 +366,17 @@ int dram_init_banksize(void)
 static void set_fdtfile(void)
 {
 	const char *fdtfile;
+	int rev = revision & 0x0f;
 
 	if (env_get("fdtfile"))
 		return;
 
-	fdtfile = model->fdtfile;
+	/* set the first entry as default */
+	fdtfile = model->fdtfiles[0];
+
+	if (rev < model->fdtcount)
+		fdtfile = model->fdtfiles[rev];
+
 	env_set("fdtfile", fdtfile);
 }
 
Signature · 1 line
2.51.2
Reviewed-by Tested-by on v1 1/2
#2 lore raw

Re: [PATCH 1/2] board/raspberrypi: add multi-FDT support

Quoted 10 lines · Filip Kokosiński

This patch adds support for multiple FDT files per board model. This is done by adding the FDTFILES macro, which initializes two rpi_model struct members: fdtfiles and fdtcount.

The new-style revision codes designate LSB bits as board revision; this value is used to choose between provided FDTs. The first element of the fdtfiles list is used should no revision match.

Quoted 284 lines
---
 board/raspberrypi/rpi/rpi.c | 93 +++++++++++++++++++++----------------
 1 file changed, 52 insertions(+), 41 deletions(-)
board/raspberrypi/rpi/rpi.c +52 -42
index f9b643555dd..1b404b448f3 100644
@@ -94,120 +94,125 @@ struct efi_capsule_update_info update_info = {
  */
 struct rpi_model {
        const char *name;
-       const char *fdtfile;
+       const char * const *fdtfiles;
+       size_t fdtcount;
        bool has_onboard_eth;
 };
 
+#define FDTFILES(...) \
+       (const char *[]){ __VA_ARGS__ }, \
+       sizeof((const char *[]){ __VA_ARGS__ }) / sizeof(const char *)
+
 static const struct rpi_model rpi_model_unknown = {
        "Unknown model",
-       DTB_DIR "bcm283x-rpi-other.dtb",
+       FDTFILES(DTB_DIR "bcm283x-rpi-other.dtb"),
        false,
 };
 
 static const struct rpi_model rpi_models_new_scheme[] = {
        [0x0] = {
                "Model A",
-               DTB_DIR "bcm2835-rpi-a.dtb",
+               FDTFILES(DTB_DIR "bcm2835-rpi-a.dtb"),
                false,
        },
        [0x1] = {
                "Model B",
-               DTB_DIR "bcm2835-rpi-b.dtb",
+               FDTFILES(DTB_DIR "bcm2835-rpi-b.dtb"),
                true,
        },
        [0x2] = {
                "Model A+",
-               DTB_DIR "bcm2835-rpi-a-plus.dtb",
+               FDTFILES(DTB_DIR "bcm2835-rpi-a-plus.dtb"),
                false,
        },
        [0x3] = {
                "Model B+",
-               DTB_DIR "bcm2835-rpi-b-plus.dtb",
+               FDTFILES(DTB_DIR "bcm2835-rpi-b-plus.dtb"),
                true,
        },
        [0x4] = {
                "2 Model B",
-               DTB_DIR "bcm2836-rpi-2-b.dtb",
+               FDTFILES(DTB_DIR "bcm2836-rpi-2-b.dtb"),
                true,
        },
        [0x6] = {
                "Compute Module",
-               DTB_DIR "bcm2835-rpi-cm.dtb",
+               FDTFILES(DTB_DIR "bcm2835-rpi-cm.dtb"),
                false,
        },
        [0x8] = {
                "3 Model B",
-               DTB_DIR "bcm2837-rpi-3-b.dtb",
+               FDTFILES(DTB_DIR "bcm2837-rpi-3-b.dtb"),
                true,
        },
        [0x9] = {
                "Zero",
-               DTB_DIR "bcm2835-rpi-zero.dtb",
+               FDTFILES(DTB_DIR "bcm2835-rpi-zero.dtb"),
                false,
        },
        [0xA] = {
                "Compute Module 3",
-               DTB_DIR "bcm2837-rpi-cm3.dtb",
+               FDTFILES(DTB_DIR "bcm2837-rpi-cm3.dtb"),
                false,
        },
        [0xC] = {
                "Zero W",
-               DTB_DIR "bcm2835-rpi-zero-w.dtb",
+               FDTFILES(DTB_DIR "bcm2835-rpi-zero-w.dtb"),
                false,
        },
        [0xD] = {
                "3 Model B+",
-               DTB_DIR "bcm2837-rpi-3-b-plus.dtb",
+               FDTFILES(DTB_DIR "bcm2837-rpi-3-b-plus.dtb"),
                true,
        },
        [0xE] = {
                "3 Model A+",
-               DTB_DIR "bcm2837-rpi-3-a-plus.dtb",
+               FDTFILES(DTB_DIR "bcm2837-rpi-3-a-plus.dtb"),
                false,
        },
        [0x10] = {
                "Compute Module 3+",
-               DTB_DIR "bcm2837-rpi-cm3.dtb",
+               FDTFILES(DTB_DIR "bcm2837-rpi-cm3.dtb"),
                false,
        },
        [0x11] = {
                "4 Model B",
-               DTB_DIR "bcm2711-rpi-4-b.dtb",
+               FDTFILES(DTB_DIR "bcm2711-rpi-4-b.dtb"),
                true,
        },
        [0x12] = {
                "Zero 2 W",
-               DTB_DIR "bcm2837-rpi-zero-2-w.dtb",
+               FDTFILES(DTB_DIR "bcm2837-rpi-zero-2-w.dtb"),
                false,
        },
        [0x13] = {
                "400",
-               DTB_DIR "bcm2711-rpi-400.dtb",
+               FDTFILES(DTB_DIR "bcm2711-rpi-400.dtb"),
                true,
        },
        [0x14] = {
                "Compute Module 4",
-               DTB_DIR "bcm2711-rpi-cm4.dtb",
+               FDTFILES(DTB_DIR "bcm2711-rpi-cm4.dtb"),
                true,
        },
        [0x17] = {
                "5 Model B",
-               DTB_DIR "bcm2712-rpi-5-b.dtb",
+               FDTFILES(DTB_DIR "bcm2712-rpi-5-b.dtb"),
                true,
        },
        [0x18] = {
                "Compute Module 5",
-               DTB_DIR "bcm2712-rpi-cm5-cm5io.dtb",
+               FDTFILES(DTB_DIR "bcm2712-rpi-cm5-cm5io.dtb"),
                true,
        },
        [0x19] = {
                "500",
-               DTB_DIR "bcm2712-rpi-500.dtb",
+               FDTFILES(DTB_DIR "bcm2712-rpi-500.dtb"),
                true,
        },
        [0x1A] = {
                "Compute Module 5 Lite",
-               DTB_DIR "bcm2712-rpi-cm5l-cm5io.dtb",
+               FDTFILES(DTB_DIR "bcm2712-rpi-cm5l-cm5io.dtb"),
                true,
        },
 };
@@ -215,87 +220,87 @@ static const struct rpi_model rpi_models_new_scheme[] = {
 static const struct rpi_model rpi_models_old_scheme[] = {
        [0x2] = {
                "Model B",
-               DTB_DIR "bcm2835-rpi-b.dtb",
+               FDTFILES(DTB_DIR "bcm2835-rpi-b.dtb"),
                true,
        },
        [0x3] = {
                "Model B",
-               DTB_DIR "bcm2835-rpi-b.dtb",
+               FDTFILES(DTB_DIR "bcm2835-rpi-b.dtb"),
                true,
        },
        [0x4] = {
                "Model B rev2",
-               DTB_DIR "bcm2835-rpi-b-rev2.dtb",
+               FDTFILES(DTB_DIR "bcm2835-rpi-b-rev2.dtb"),
                true,
        },
        [0x5] = {
                "Model B rev2",
-               DTB_DIR "bcm2835-rpi-b-rev2.dtb",
+               FDTFILES(DTB_DIR "bcm2835-rpi-b-rev2.dtb"),
                true,
        },
        [0x6] = {
                "Model B rev2",
-               DTB_DIR "bcm2835-rpi-b-rev2.dtb",
+               FDTFILES(DTB_DIR "bcm2835-rpi-b-rev2.dtb"),
                true,
        },
        [0x7] = {
                "Model A",
-               DTB_DIR "bcm2835-rpi-a.dtb",
+               FDTFILES(DTB_DIR "bcm2835-rpi-a.dtb"),
                false,
        },
        [0x8] = {
                "Model A",
-               DTB_DIR "bcm2835-rpi-a.dtb",
+               FDTFILES(DTB_DIR "bcm2835-rpi-a.dtb"),
                false,
        },
        [0x9] = {
                "Model A",
-               DTB_DIR "bcm2835-rpi-a.dtb",
+               FDTFILES(DTB_DIR "bcm2835-rpi-a.dtb"),
                false,
        },
        [0xd] = {
                "Model B rev2",
-               DTB_DIR "bcm2835-rpi-b-rev2.dtb",
+               FDTFILES(DTB_DIR "bcm2835-rpi-b-rev2.dtb"),
                true,
        },
        [0xe] = {
                "Model B rev2",
-               DTB_DIR "bcm2835-rpi-b-rev2.dtb",
+               FDTFILES(DTB_DIR "bcm2835-rpi-b-rev2.dtb"),
                true,
        },
        [0xf] = {
                "Model B rev2",
-               DTB_DIR "bcm2835-rpi-b-rev2.dtb",
+               FDTFILES(DTB_DIR "bcm2835-rpi-b-rev2.dtb"),
                true,
        },
        [0x10] = {
                "Model B+",
-               DTB_DIR "bcm2835-rpi-b-plus.dtb",
+               FDTFILES(DTB_DIR "bcm2835-rpi-b-plus.dtb"),
                true,
        },
        [0x11] = {
                "Compute Module",
-               DTB_DIR "bcm2835-rpi-cm.dtb",
+               FDTFILES(DTB_DIR "bcm2835-rpi-cm.dtb"),
                false,
        },
        [0x12] = {
                "Model A+",
-               DTB_DIR "bcm2835-rpi-a-plus.dtb",
+               FDTFILES(DTB_DIR "bcm2835-rpi-a-plus.dtb"),
                false,
        },
        [0x13] = {
                "Model B+",
-               DTB_DIR "bcm2835-rpi-b-plus.dtb",
+               FDTFILES(DTB_DIR "bcm2835-rpi-b-plus.dtb"),
                true,
        },
        [0x14] = {
                "Compute Module",
-               DTB_DIR "bcm2835-rpi-cm.dtb",
+               FDTFILES(DTB_DIR "bcm2835-rpi-cm.dtb"),
                false,
        },
        [0x15] = {
                "Model A+",
-               DTB_DIR "bcm2835-rpi-a-plus.dtb",
+               FDTFILES(DTB_DIR "bcm2835-rpi-a-plus.dtb"),
                false,
        },
 };
@@ -361,11 +366,17 @@ int dram_init_banksize(void)
 static void set_fdtfile(void)
 {
        const char *fdtfile;
+       int rev = revision & 0x0f;
 
        if (env_get("fdtfile"))
                return;
 
-       fdtfile = model->fdtfile;
+       /* set the first entry as default */
+       fdtfile = model->fdtfiles[0];
+
+       if (rev < model->fdtcount)
+               fdtfile = model->fdtfiles[rev];
+
        env_set("fdtfile", fdtfile);
 }
 
--

2.51.2

#3 lore raw

PATCH 2/2 board/raspberrypi: add bcm2712d0-rpi-5-b for Raspberry Pi 5

In reply to Filip Kokosiński

This commit adds an FDT entry for the d0 stepping of the BCM2712 SoC. This entry is used by the v1.1 revision of the board (revision & 0x0f == 1).

---
 board/raspberrypi/rpi/rpi.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
board/raspberrypi/rpi/rpi.c +4 -1
index 1b404b448f3..3d61d08f3a4 100644
@@ -197,7 +197,10 @@ static const struct rpi_model rpi_models_new_scheme[] = {
 	},
 	[0x17] = {
 		"5 Model B",
-		FDTFILES(DTB_DIR "bcm2712-rpi-5-b.dtb"),
+		FDTFILES(
+			[0] = DTB_DIR "bcm2712-rpi-5-b.dtb",
+			[1] = DTB_DIR "bcm2712d0-rpi-5-b.dtb"
+		),
 		true,
 	},
 	[0x18] = {
Signature · 1 line
2.51.2
Reviewed-by Tested-by on v1 2/2
#4 lore raw

Re: [PATCH 2/2] board/raspberrypi: add bcm2712d0-rpi-5-b for Raspberry Pi 5

Quoted 6 lines · Filip Kokosiński

This commit adds an FDT entry for the d0 stepping of the BCM2712 SoC. This entry is used by the v1.1 revision of the board (revision & 0x0f == 1).

Quoted 23 lines
---
 board/raspberrypi/rpi/rpi.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
board/raspberrypi/rpi/rpi.c +4 -2
index 1b404b448f3..3d61d08f3a4 100644
@@ -197,7 +197,10 @@ static const struct rpi_model rpi_models_new_scheme[] = {
        },
        [0x17] = {
                "5 Model B",
-               FDTFILES(DTB_DIR "bcm2712-rpi-5-b.dtb"),
+               FDTFILES(
+                       [0] = DTB_DIR "bcm2712-rpi-5-b.dtb",
+                       [1] = DTB_DIR "bcm2712d0-rpi-5-b.dtb"
+               ),
                true,
        },
        [0x18] = {
--

2.51.2

#5 lore raw
In reply to Filip Kokosiński

Hey Filip,

Quoted 9 lines

This series adds the FDT for the d0 stepping of the BCM2712 SoC. The v1.1 revision of the Raspberry Pi 5 board can't boot Linux properly without additional changes specific to the d0 stepping.

The d0 specific changes can be seen here:
https://github.com/raspberrypi/linux/blob/rpi-6.12.y/arch/arm64/boot/dts/broadcom/bcm2712d0-rpi-5-b.dts

To do that, this series introduces support for multiple FDT entries for a single device type (bits 4-11 from the new-style revision code).

I started to look at that last week to see what was needed so this is good timing.

Quoted 11 lines

The rpi_model struct is modified by:
* changing fdtfile to fdtfiles (const char * const *)
* adding fdtcount (size_t)

Adding fdtcount is motivated by wanting to keep FDT selection O(1), and avoid relying on NULL terminating fdtfiles array.

A new FDTFILES macro is added to initialize fdtfile and fdtcount.

In case only a single FDT is provided, or the board revision code doesn't match, the selected FDT defaults to the first entry in fdtfiles.

I tested this very briefly on my RPi5s and the good news is it continues to boot.

The problem was I see no output from U-Boot on the serial console at all, I get the early RPi FW output and then I get the Linux kernel.

I think there may well be more details we need to deal with here, there's at least some difference in the console serial port [1] and I suspect we might need to deal with other pinmux nuances possibly around the sdhci interfaces.

Can you also provide details of which revisions of rpi devices you tested this on?

I have an 8gb v1.0, and I thought I had a v1.1 2Gb but looking closer it looks like that's the old c1 SoC rev (I read their original announcement for the 2Gb variant as they were all 1.1, it appears not). I have ordered the new 1Gb variant so I have a revD I can test against.

Peter

[1] https://github.com/raspberrypi/linux/blob/rpi-6.12.y/arch/arm64/boot/dts/broadcom/bcm2712d0-rpi-5-b.dts#L93

Quoted 10 lines

Filip Kokosiński (2):
board/raspberrypi: add multi-FDT support board/raspberrypi: add bcm2712d0-rpi-5-b for Raspberry Pi 5

 board/raspberrypi/rpi/rpi.c | 96 +++++++++++++++++++++----------------
 1 file changed, 55 insertions(+), 41 deletions(-)

--
2.51.2

#6 lore raw

Hi Peter,

Thanks for taking a look at these patches and taking them for a spin!

Quoted 2 lines

Can you also provide details of which revisions of rpi devices you tested this on?

I've tested this on the 16gb v1.1 -- it's the only bcm2712 device I've got, unfortunately.

The EEPROM bootloader reports:

    4.07 BOOTMODE: 0x06 partition 0 build-ts BUILD_TIMESTAMP=1756339608 serial b36eabd9 boardrev e04171 stc 4076083

The board_revision from environment is set to:

    U-Boot> printenv board_revision
    board_revision=0xE04171

Which matches what I can see in the dtb:

    U-Boot> fdt print /system
    system {
        linux,serial = <0xf849b6d5 0xb36eabd9>;
        linux,revision = <0x00e04171>;
    };

In Linux, /proc/cpuinfo reports:

    Serial        : f849b6d5b36eabd9
    Model        : Raspberry Pi 5 Model B Rev 1.1

Additionally, I can see that the EEPROM bootloader lists these dtbos, even though I don't have them on my boot partition:

    9.15  /overlays/overlay_map.dtb
    9.16  /overlays/bcm2712d0.dtbo

I wonder what it lists for the c1 variant.

Quoted 4 lines

I have an 8gb v1.0, and I thought I had a v1.1 2Gb but looking closer it looks like that's the old c1 SoC rev (I read their original announcement for the 2Gb variant as they were all 1.1, it appears not).

Do I understand correctly that the c1 reports as v1.1 as well, which causes the bcm2712d0-rpi-5-b.dtb to match? If that's the case, I wonder how the EEPROM bootloader differentiates between c1 and d0, as both have the 0x17 type.

Quoted 2 lines

I have ordered the new 1Gb variant so I have a revD I can test against.

Looking forward to hearing about that from you!

Best
FK

#7 lore raw
In reply to Peter Robinson
Quoted 25 lines · Peter Robinson

Hey Filip,

Quoted 9 lines

This series adds the FDT for the d0 stepping of the BCM2712 SoC. The v1.1 revision of the Raspberry Pi 5 board can't boot Linux properly without additional changes specific to the d0 stepping.

The d0 specific changes can be seen here:
https://github.com/raspberrypi/linux/blob/rpi-6.12.y/arch/arm64/boot/dts/broadcom/bcm2712d0-rpi-5-b.dts

To do that, this series introduces support for multiple FDT entries for a single device type (bits 4-11 from the new-style revision code).

I started to look at that last week to see what was needed so this is good timing.

Quoted 9 lines

The rpi_model struct is modified by:
* changing fdtfile to fdtfiles (const char * const *)
* adding fdtcount (size_t)

Adding fdtcount is motivated by wanting to keep FDT selection O(1), and avoid relying on NULL terminating fdtfiles array.

A new FDTFILES macro is added to initialize fdtfile and fdtcount.

Quoted 8 lines
Quoted 2 lines

In case only a single FDT is provided, or the board revision code doesn't match, the selected FDT defaults to the first entry in fdtfiles.

I tested this very briefly on my RPi5s and the good news is it continues to boot.

The problem was I see no output from U-Boot on the serial console at all, I get the early RPi FW output and then I get the Linux kernel.

FYI This was an issue with downstream breaking the pl022 uart compatible in their DT :-/

Quoted 5 lines

I think there may well be more details we need to deal with here, there's at least some difference in the console serial port [1] and I suspect we might need to deal with other pinmux nuances possibly around the sdhci interfaces.

Quoted 8 lines

Can you also provide details of which revisions of rpi devices you tested this on?

I have an 8gb v1.0, and I thought I had a v1.1 2Gb but looking closer it looks like that's the old c1 SoC rev (I read their original announcement for the 2Gb variant as they were all 1.1, it appears not). I have ordered the new 1Gb variant so I have a revD I can test against.

I've now tested this on both a revC and revD.

I suspect we'll need to tweak this further when the d0 DTs land upstream but it works with the downstream options.

Quoted 14 lines

Peter

[1] https://github.com/raspberrypi/linux/blob/rpi-6.12.y/arch/arm64/boot/dts/broadcom/bcm2712d0-rpi-5-b.dts#L93

Quoted 10 lines

Filip Kokosiński (2):
board/raspberrypi: add multi-FDT support board/raspberrypi: add bcm2712d0-rpi-5-b for Raspberry Pi 5

 board/raspberrypi/rpi/rpi.c | 96 +++++++++++++++++++++----------------
 1 file changed, 55 insertions(+), 41 deletions(-)

--
2.51.2