Skip to contentSkip to conversation

board: am335x: Set serial# variable

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

lore
Share & tools
lore
#0 lore raw

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

serial# variable is needed to show the 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.

We can't use omap_die_id_serial() for this, because AM335x lacks DIE_ID, as can be seen from AM335x TRM. Let's do next:
- reuse board_serial variable (obtained from EEPROM in set_board_info_env() function) to set serial#
- if board_serial is "unknown", reuse ethaddr variable to set serial#

---
 board/ti/am335x/board.c | 10 ++++++++++
 1 file changed, 10 insertions(+)
board/ti/am335x/board.c +10 -0
index 1a52bffc00..6a0ff5a93e 100644
@@ -767,6 +767,16 @@ int board_late_init(void)
 	}
 #endif
 
+	if (!env_get("serial#")) {
+		char *board_serial = env_get("board_serial");
+		char *ethaddr = env_get("ethaddr");
+
+		if (!board_serial || !strncmp(board_serial, "unknown", 7))
+			env_set("serial#", ethaddr);
+		else
+			env_set("serial#", board_serial);
+	}
+
 	return 0;
 }
 #endif
Signature · 1 line
2.16.1
#1 lore raw

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

Quoted 11 lines · Sam Protsenko

serial# variable is needed to show the 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.

We can't use omap_die_id_serial() for this, because AM335x lacks DIE_ID, as can be seen from AM335x TRM. Let's do next:
- reuse board_serial variable (obtained from EEPROM in set_board_info_env() function) to set serial#
- if board_serial is "unknown", reuse ethaddr variable to set serial#

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/aaea6a3e/attachment.sig>
#2 lore raw

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

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

serial# variable is needed to show the 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.

We can't use omap_die_id_serial() for this, because AM335x lacks DIE_ID, as can be seen from AM335x TRM. Let's do next:
- reuse board_serial variable (obtained from EEPROM in set_board_info_env() function) to set serial#
- if board_serial is "unknown", reuse ethaddr variable to set serial#

Quoted 4 lines
Quoted 1 line

Bump. Please merge it if it's ok.

Thanks.

Quoted 2 lines

--
Tom

#3 lore raw

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

In reply to Sam Protsenko
Quoted 11 lines · Sam Protsenko

serial# variable is needed to show the 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.

We can't use omap_die_id_serial() for this, because AM335x lacks DIE_ID, as can be seen from AM335x TRM. Let's do next:
- reuse board_serial variable (obtained from EEPROM in set_board_info_env() function) to set serial#
- if board_serial is "unknown", reuse ethaddr variable to set serial#

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/be796b33/attachment.sig>
#4 lore raw

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

In reply to Sam Protsenko
Quoted 10 lines · Sam Protsenko

serial# variable is needed to show the 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.

We can't use omap_die_id_serial() for this, because AM335x lacks DIE_ID, as can be seen from AM335x TRM. Let's do next:
- reuse board_serial variable (obtained from EEPROM in set_board_info_env() function) to set serial#
- if board_serial is "unknown", reuse ethaddr variable to set serial#

Quoted 3 lines

Applied to u-boot/master, 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/20180316/713a6cfc/attachment.sig>