Skip to contentSkip to conversation

board: am335x: Set serial# variable

PATCH New Sam Protsenko 2 participants 5 messages Feb 27, 2018

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 board: am335x: Set serial# variable

serial# variable is needed to show device correctly in "fastboot devices" output. It's useful when we have several devices (in fastboot mode) connected to single host and want to choose which one to flash.

Reuse board_serial variable (obtained from EEPROM in set_board_info_env() function) to set serial#. We can't use omap_die_id_serial(), because AM335x lacks DIE_ID, as can be seen from AM335x TRM. The other available option would be to reuse ethaddr variable, but using board_serial seems more reasonable for this purpose.

---
 board/ti/am335x/board.c | 4 ++++
 1 file changed, 4 insertions(+)
board/ti/am335x/board.c +4 -0
index 1a52bffc00..4d421697bf 100644
@@ -732,6 +732,10 @@ int board_late_init(void)
 	 */
 	if (get_device_type() == HS_DEVICE)
 		env_set("boot_fit", "1");
+
+	/* Reuse serial number set by set_board_info_env() (from EEPROM) */
+	if (!env_get("serial#"))
+		env_set("serial#", env_get("board_serial"));
 #endif
 
 #if !defined(CONFIG_SPL_BUILD)
Signature · 1 line
2.16.1
#1 lore raw

PATCH 1/1 board: am335x: Set serial# variable

Quoted 11 lines · Sam Protsenko

serial# variable is needed to show device correctly in "fastboot devices" output. It's useful when we have several devices (in fastboot mode) connected to single host and want to choose which one to flash.

Reuse board_serial variable (obtained from EEPROM in set_board_info_env() function) to set serial#. We can't use omap_die_id_serial(), because AM335x lacks DIE_ID, as can be seen from AM335x TRM. The other available option would be to reuse ethaddr variable, but using board_serial seems more reasonable for this purpose.

Does fastboot handle things better or worse than before with board_serial set to "unknown" ? That's a quite likely thing to happen as while serial should be set, but I'm sure there's boards in the wild other than just mine that I might have broken, that do not have the serial field set.

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20180227/dec5e631/attachment.sig>
#2 lore raw

PATCH 1/1 board: am335x: Set serial# variable

Quoted 12 lines · Tom Rini
Quoted 10 lines · Sam Protsenko

serial# variable is needed to show device correctly in "fastboot devices" output. It's useful when we have several devices (in fastboot mode) connected to single host and want to choose which one to flash.

Reuse board_serial variable (obtained from EEPROM in set_board_info_env() function) to set serial#. We can't use omap_die_id_serial(), because AM335x lacks DIE_ID, as can be seen from AM335x TRM. The other available option would be to reuse ethaddr variable, but using board_serial seems more reasonable for this purpose.

Quoted 8 lines
Quoted 1 line

Does fastboot handle things better or worse than before with board_serial set to "unknown" ? That's a quite likely thing to happen as while serial should be set, but I'm sure there's boards in the wild other than just mine that I might have broken, that do not have the serial field set.

Didn't think that on some boards the board_serial can be set to "unknown" (though I saw it in the code). I can see two ways how the patch can be reworked:
1. If board_serial was set to "unknown", reuse ethaddr variable value
for serial#; otherwise use board_serial for serial#
2. Always reuse ethaddr variable value for serial#

Which one seems the best for you? Or maybe I'm missing some better way to set serial#?

Thanks.

Quoted 2 lines

--
Tom

#3 lore raw

PATCH 1/1 board: am335x: Set serial# variable

Quoted 29 lines · Sam Protsenko
Quoted 12 lines · Tom Rini
Quoted 10 lines · Sam Protsenko

serial# variable is needed to show device correctly in "fastboot devices" output. It's useful when we have several devices (in fastboot mode) connected to single host and want to choose which one to flash.

Reuse board_serial variable (obtained from EEPROM in set_board_info_env() function) to set serial#. We can't use omap_die_id_serial(), because AM335x lacks DIE_ID, as can be seen from AM335x TRM. The other available option would be to reuse ethaddr variable, but using board_serial seems more reasonable for this purpose.

Quoted 8 lines
Quoted 1 line

Does fastboot handle things better or worse than before with board_serial set to "unknown" ? That's a quite likely thing to happen as while serial should be set, but I'm sure there's boards in the wild other than just mine that I might have broken, that do not have the serial field set.

Didn't think that on some boards the board_serial can be set to "unknown" (though I saw it in the code). I can see two ways how the patch can be reworked:
1. If board_serial was set to "unknown", reuse ethaddr variable value
for serial#; otherwise use board_serial for serial#
2. Always reuse ethaddr variable value for serial#

Quoted 2 lines

Which one seems the best for you? Or maybe I'm missing some better way to set serial#?

I think a fall-back to ethaddr is best, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20180227/6be9820c/attachment.sig>
#4 lore raw

PATCH 1/1 board: am335x: Set serial# variable

Please review v2.

Thanks.

Quoted 37 lines · Tom Rini
Quoted 29 lines · Sam Protsenko
Quoted 12 lines · Tom Rini
Quoted 10 lines · Sam Protsenko

serial# variable is needed to show device correctly in "fastboot devices" output. It's useful when we have several devices (in fastboot mode) connected to single host and want to choose which one to flash.

Reuse board_serial variable (obtained from EEPROM in set_board_info_env() function) to set serial#. We can't use omap_die_id_serial(), because AM335x lacks DIE_ID, as can be seen from AM335x TRM. The other available option would be to reuse ethaddr variable, but using board_serial seems more reasonable for this purpose.

Quoted 8 lines
Quoted 1 line

Does fastboot handle things better or worse than before with board_serial set to "unknown" ? That's a quite likely thing to happen as while serial should be set, but I'm sure there's boards in the wild other than just mine that I might have broken, that do not have the serial field set.

Didn't think that on some boards the board_serial can be set to "unknown" (though I saw it in the code). I can see two ways how the patch can be reworked:
1. If board_serial was set to "unknown", reuse ethaddr variable value
for serial#; otherwise use board_serial for serial#
2. Always reuse ethaddr variable value for serial#

Quoted 2 lines

Which one seems the best for you? Or maybe I'm missing some better way to set serial#?

I think a fall-back to ethaddr is best, thanks!

--
Tom