Skip to contentSkip to conversation

board: starfive: handle compatible property in dynamic DT configuration

PATCH In review Aurelien Jarno 2 participants 3 messages Jan 10, 2024 – Jan 31, 2024

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 board: starfive: handle compatible property in dynamic DT configuration

The difference between the StarFive VisionFive 2 1.2A and 1.3B boards is handled dynamically by looking at the PCB version in the EEPROM in order to have a single u-boot version for both versions of the board. While the "model" property is correctly handled, the "compatible" one is always the the one of version 1.3b.

This patch add support for dynamically configuring that property.

Fixes 9b7060bd15e7 ("riscv: dts: jh7110: Combine the board device tree files of 1.2A and 1.3B")
---
 board/starfive/visionfive2/spl.c | 4 ++++
 1 file changed, 4 insertions(+)
board/starfive/visionfive2/spl.c +4 -0
index 336f0cdfc9..911add429d 100644
@@ -61,11 +61,13 @@ static const struct starfive_vf2_pro starfive_verb[] = {
 
 void spl_fdt_fixup_version_a(void *fdt)
 {
+	static const char compat[] = "starfive,visionfive-2-v1.2a\0starfive,jh7110";
 	u32 phandle;
 	u8 i;
 	int offset;
 	int ret;
 
+	fdt_setprop(fdt, fdt_path_offset(fdt, "/"), "compatible", compat, sizeof(compat));
 	fdt_setprop_string(fdt, fdt_path_offset(fdt, "/"), "model",
 			   "StarFive VisionFive 2 v1.2A");
 
@@ -106,11 +108,13 @@ void spl_fdt_fixup_version_a(void *fdt)
 
 void spl_fdt_fixup_version_b(void *fdt)
 {
+	static const char compat[] = "starfive,visionfive-2-v1.3b\0starfive,jh7110";
 	u32 phandle;
 	u8 i;
 	int offset;
 	int ret;
 
+	fdt_setprop(fdt, fdt_path_offset(fdt, "/"), "compatible", compat, sizeof(compat));
 	fdt_setprop_string(fdt, fdt_path_offset(fdt, "/"), "model",
 			   "StarFive VisionFive 2 v1.3B");
 
Signature · 1 line
2.42.0
#1 lore raw

Gentle ping. Note that the maintainer address bounces, I am not sure it is still valid. Thanks

Quoted 51 lines · Aurelien Jarno

The difference between the StarFive VisionFive 2 1.2A and 1.3B boards is handled dynamically by looking at the PCB version in the EEPROM in order to have a single u-boot version for both versions of the board. While the "model" property is correctly handled, the "compatible" one is always the the one of version 1.3b.

This patch add support for dynamically configuring that property.

Fixes 9b7060bd15e7 ("riscv: dts: jh7110: Combine the board device tree files of 1.2A and 1.3B")
---
 board/starfive/visionfive2/spl.c | 4 ++++
 1 file changed, 4 insertions(+)
board/starfive/visionfive2/spl.c +4 -0
index 336f0cdfc9..911add429d 100644
@@ -61,11 +61,13 @@ static const struct starfive_vf2_pro starfive_verb[] = {
 
 void spl_fdt_fixup_version_a(void *fdt)
 {
+	static const char compat[] = "starfive,visionfive-2-v1.2a\0starfive,jh7110";
 	u32 phandle;
 	u8 i;
 	int offset;
 	int ret;
 
+	fdt_setprop(fdt, fdt_path_offset(fdt, "/"), "compatible", compat, sizeof(compat));
 	fdt_setprop_string(fdt, fdt_path_offset(fdt, "/"), "model",
 			   "StarFive VisionFive 2 v1.2A");
 
@@ -106,11 +108,13 @@ void spl_fdt_fixup_version_a(void *fdt)
 
 void spl_fdt_fixup_version_b(void *fdt)
 {
+	static const char compat[] = "starfive,visionfive-2-v1.3b\0starfive,jh7110";
 	u32 phandle;
 	u8 i;
 	int offset;
 	int ret;
 
+	fdt_setprop(fdt, fdt_path_offset(fdt, "/"), "compatible", compat, sizeof(compat));
 	fdt_setprop_string(fdt, fdt_path_offset(fdt, "/"), "model",
 			   "StarFive VisionFive 2 v1.3B");
 
Signature · 1 line
2.42.0
Signature · 2 lines
Aurelien Jarno                          GPG: 4096R/1DDD8C9B
[email protected]                     http://aurel32.net
Reviewed-by on v1 1/1
#2 lore raw
In reply to Aurelien Jarno
Quoted 6 lines · Aurelien Jarno

The difference between the StarFive VisionFive 2 1.2A and 1.3B boards is handled dynamically by looking at the PCB version in the EEPROM in order to have a single u-boot version for both versions of the board. While the "model" property is correctly handled, the "compatible" one is always the the one of version 1.3b.

Quoted 8 lines

This patch add support for dynamically configuring that property.

Fixes 9b7060bd15e7 ("riscv: dts: jh7110: Combine the board device tree files of 1.2A and 1.3B")
---
 board/starfive/visionfive2/spl.c | 4 ++++
 1 file changed, 4 insertions(+)