From: Sam Protsenko Date: Tue, 27 Feb 2018 22:26:15 +0000 (+0200) Subject: board: am335x: Set serial# variable X-Git-Url: http://git.dujemihanovic.xyz/login.html?a=commitdiff_plain;h=fc228dc96c64674bc6fc85635708eb39708fafc4;p=u-boot.git 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# Signed-off-by: Sam Protsenko Reviewed-by: Tom Rini --- diff --git a/board/ti/am335x/board.c b/board/ti/am335x/board.c index b144fd1821..f802657299 100644 --- a/board/ti/am335x/board.c +++ b/board/ti/am335x/board.c @@ -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