Skip to contentSkip to conversation

board: spacemit: k1: accept the "m1-x_" TLV product name prefix

PATCH Applied Bruno Banelli 3 participants 7 messages Aug 25 – Nov 13 RISC-V SpacemiT SoC Support

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 board: spacemit: k1: accept the "m1-x_" TLV product name prefix

board_fit_config_name_match() derives the device tree name from the TLV product name held in the board EEPROM, and only recognises boards whose product name starts with "k1-x_".

Boards fitted with the higher-binned M1 part report an "m1-x_" prefix instead. On those, fdt_name is left empty and the function silently falls back to "k1-musepi-pro", so an M1 board selects the wrong device tree with no error or warning.

A Milk-V Jupiter fitted with an M1 reads, from the 24c04 at i2c2 0x50:

00: 54 6c 76 49 6e 66 6f 00 01 00 1a 21 12 6d 31 2d TlvInfo....!.m1- 10: 78 5f 6d 69 6c 6b 76 2d 6a 75 70 69 74 65 72 fe x_milkv-jupiter.

i.e. TLV code 0x21 (product name), length 0x12, "m1-x_milkv-jupiter".

The device trees are named for the K1 in both cases, so accept either prefix and keep deriving a "k1-" name.

---
 board/spacemit/k1/spl.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)
board/spacemit/k1/spl.c +8 -1
index d749e21a..e82fad23 100644
@@ -367,7 +367,14 @@ int board_fit_config_name_match(const char *name)
 	int i;
 
 	memset(fdt_name, 0, I2C_BUF_SIZE);
-	if (!strncmp(product_name, "k1-x_", 5)) {
+	/*
+	 * The TLV product name is prefixed with the SoC variant fitted to
+	 * the board: "k1-x_" for a K1, "m1-x_" for the higher-binned M1.
+	 * Device trees are named for the K1 in both cases, so accept
+	 * either prefix and always derive a "k1-" name from it.
+	 */
+	if (!strncmp(product_name, "k1-x_", 5) ||
+	    !strncmp(product_name, "m1-x_", 5)) {
 		snprintf(fdt_name, I2C_BUF_SIZE, "%s-%s", "k1",
 			 &product_name[5]);
 	}

base-commit: 964ad5b5c91b7be56e443e899d7f873e6aa8c9fc

Signature · 1 line
2.43.0
maintainer
#1 lore raw

Hi Bruno,
Cc Guodong's new mail address

Quoted 14 lines · Bruno Banelli

board_fit_config_name_match() derives the device tree name from the TLV product name held in the board EEPROM, and only recognises boards whose product name starts with "k1-x_".

Boards fitted with the higher-binned M1 part report an "m1-x_" prefix instead. On those, fdt_name is left empty and the function silently falls back to "k1-musepi-pro", so an M1 board selects the wrong device tree with no error or warning.

A Milk-V Jupiter fitted with an M1 reads, from the 24c04 at i2c2 0x50:

00: 54 6c 76 49 6e 66 6f 00 01 00 1a 21 12 6d 31 2d TlvInfo....!.m1- 10: 78 5f 6d 69 6c 6b 76 2d 6a 75 70 69 74 65 72 fe x_milkv-jupiter.

Quoted 6 lines

i.e. TLV code 0x21 (product name), length 0x12, "m1-x_milkv-jupiter".

The device trees are named for the K1 in both cases, so accept either prefix and keep deriving a "k1-" name.

Looks good

Signature · 1 line
Yixun Lan (dlan)
maintainer Reviewed-by
#2 lore raw
Quoted 20 lines · Yixun Lan

Hi Bruno,
Cc Guodong's new mail address

Quoted 16 lines · Bruno Banelli

board_fit_config_name_match() derives the device tree name from the TLV product name held in the board EEPROM, and only recognises boards whose product name starts with "k1-x_".

Boards fitted with the higher-binned M1 part report an "m1-x_" prefix instead. On those, fdt_name is left empty and the function silently falls back to "k1-musepi-pro", so an M1 board selects the wrong device tree with no error or warning.

A Milk-V Jupiter fitted with an M1 reads, from the 24c04 at i2c2 0x50:

00: 54 6c 76 49 6e 66 6f 00 01 00 1a 21 12 6d 31 2d TlvInfo....!.m1- 10: 78 5f 6d 69 6c 6b 76 2d 6a 75 70 69 74 65 72 fe x_milkv-jupiter.

i.e. TLV code 0x21 (product name), length 0x12, "m1-x_milkv-jupiter".

Quoted 7 lines
Quoted 4 lines

The device trees are named for the K1 in both cases, so accept either prefix and keep deriving a "k1-" name.

Looks good

sorry, have a typo here ..

Signature · 1 line
Yixun Lan (dlan)
#3 lore raw
In reply to Bruno Banelli

Hi Bruno,

So sorry for the late reply!
Could you rebase your patch against current master and send again. I will merge the patch once you send out the patch.

Best regards,
Leo

Quoted 27 lines · Bruno Banelli

board_fit_config_name_match() derives the device tree name from the TLV product name held in the board EEPROM, and only recognises boards whose product name starts with "k1-x_".

Boards fitted with the higher-binned M1 part report an "m1-x_" prefix instead. On those, fdt_name is left empty and the function silently falls back to "k1-musepi-pro", so an M1 board selects the wrong device tree with no error or warning.

A Milk-V Jupiter fitted with an M1 reads, from the 24c04 at i2c2 0x50:

00: 54 6c 76 49 6e 66 6f 00 01 00 1a 21 12 6d 31 2d TlvInfo....!.m1- 10: 78 5f 6d 69 6c 6b 76 2d 6a 75 70 69 74 65 72 fe x_milkv-jupiter.

i.e. TLV code 0x21 (product name), length 0x12, "m1-x_milkv-jupiter".

The device trees are named for the K1 in both cases, so accept either prefix and keep deriving a "k1-" name.

---
 board/spacemit/k1/spl.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

base-commit: 964ad5b5c91b7be56e443e899d7f873e6aa8c9fc

maintainer
#4 lore raw

Hi Leo, Bruno

Quoted 6 lines · Leo Liang

Hi Bruno,

So sorry for the late reply!
Could you rebase your patch against current master and send again. I will merge the patch once you send out the patch.

Sorry, I've also missed this patch.

But since currently there is a dedicated custodian tree[1] for SpacemiT SoC, let's merge it via there..

[1] https://git.u-boot-project.org/u-boot/custodians/u-boot-spacemit

Quoted 31 lines

Best regards,
Leo

Quoted 27 lines · Bruno Banelli

board_fit_config_name_match() derives the device tree name from the TLV product name held in the board EEPROM, and only recognises boards whose product name starts with "k1-x_".

Boards fitted with the higher-binned M1 part report an "m1-x_" prefix instead. On those, fdt_name is left empty and the function silently falls back to "k1-musepi-pro", so an M1 board selects the wrong device tree with no error or warning.

A Milk-V Jupiter fitted with an M1 reads, from the 24c04 at i2c2 0x50:

00: 54 6c 76 49 6e 66 6f 00 01 00 1a 21 12 6d 31 2d TlvInfo....!.m1- 10: 78 5f 6d 69 6c 6b 76 2d 6a 75 70 69 74 65 72 fe x_milkv-jupiter.

i.e. TLV code 0x21 (product name), length 0x12, "m1-x_milkv-jupiter".

The device trees are named for the K1 in both cases, so accept either prefix and keep deriving a "k1-" name.

---
 board/spacemit/k1/spl.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

base-commit: 964ad5b5c91b7be56e443e899d7f873e6aa8c9fc

Signature · 1 line
Yixun Lan (dlan)
#5 lore raw

Hi Yixun,

Quoted 10 lines · Yixun Lan

Hi Leo, Bruno

Quoted 6 lines · Leo Liang

Hi Bruno,

So sorry for the late reply!
Could you rebase your patch against current master and send again. I will merge the patch once you send out the patch.

Quoted 7 lines

Sorry, I've also missed this patch.

But since currently there is a dedicated custodian tree[1] for SpacemiT SoC, let's merge it via there..

[1] https://git.u-boot-project.org/u-boot/custodians/u-boot-spacemit

Of course! Thanks for your help, Yixun!

Best regards
Leo

Quoted 34 lines
Quoted 31 lines

Best regards,
Leo

Quoted 27 lines · Bruno Banelli

board_fit_config_name_match() derives the device tree name from the TLV product name held in the board EEPROM, and only recognises boards whose product name starts with "k1-x_".

Boards fitted with the higher-binned M1 part report an "m1-x_" prefix instead. On those, fdt_name is left empty and the function silently falls back to "k1-musepi-pro", so an M1 board selects the wrong device tree with no error or warning.

A Milk-V Jupiter fitted with an M1 reads, from the 24c04 at i2c2 0x50:

00: 54 6c 76 49 6e 66 6f 00 01 00 1a 21 12 6d 31 2d TlvInfo....!.m1- 10: 78 5f 6d 69 6c 6b 76 2d 6a 75 70 69 74 65 72 fe x_milkv-jupiter.

i.e. TLV code 0x21 (product name), length 0x12, "m1-x_milkv-jupiter".

The device trees are named for the K1 in both cases, so accept either prefix and keep deriving a "k1-" name.

---
 board/spacemit/k1/spl.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

base-commit: 964ad5b5c91b7be56e443e899d7f873e6aa8c9fc

--
Yixun Lan (dlan)

maintainer Applied
#6 lore raw
In reply to Bruno Banelli
Quoted 10 lines · Bruno Banelli

board_fit_config_name_match() derives the device tree name from the TLV product name held in the board EEPROM, and only recognises boards whose product name starts with "k1-x_".

Boards fitted with the higher-binned M1 part report an "m1-x_" prefix instead. On those, fdt_name is left empty and the function silently falls back to "k1-musepi-pro", so an M1 board selects the wrong device tree with no error or warning.

[...]

Applied, thanks! Queued in SpacemiT custodian tree, for-main branch

[1/1] board: spacemit: k1: accept the "m1-x_" TLV product name prefix

      https://git.u-boot-project.org/u-boot/custodians/u-boot-spacemit/-/commit/74bf93c3f2b2cf67dbddc484daf52dc92941d67b

Best regards,

Signature · 1 line
Yixun Lan <[email protected]>