[U-Boot] [PATCH 07/12] sniper: Serial number support, obtained from die ID
Tom Rini
trini at konsulko.com
Tue Aug 4 04:08:07 CEST 2015
On Mon, Jul 20, 2015 at 03:17:13PM +0200, Paul Kocialkowski wrote:
> The OMAP3 has some die-specific ID bits that we can use to give the device a
> (more or less) unique serial number. This is particularly useful for e.g. USB.
>
> Signed-off-by: Paul Kocialkowski <contact at paulk.fr>
> ---
> board/lge/sniper/sniper.c | 13 +++++++++++++
> 1 file changed, 13 insertions(+)
>
> diff --git a/board/lge/sniper/sniper.c b/board/lge/sniper/sniper.c
> index 44d422d..f26855d 100644
> --- a/board/lge/sniper/sniper.c
> +++ b/board/lge/sniper/sniper.c
> @@ -70,7 +70,9 @@ int board_init(void)
>
> int misc_init_r(void)
> {
> + char serial_string[17] = { 0 };
> char reboot_mode[2] = { 0 };
> + u32 dieid[4] = { 0 };
>
> /* Reboot mode */
>
> @@ -82,6 +84,17 @@ int misc_init_r(void)
> omap_reboot_mode_clear();
> }
>
> + /* Serial number */
> +
> + get_dieid((u32 *)&dieid);
> +
> + if (!getenv("serial#")) {
> + snprintf(serial_string, sizeof(serial_string),
> + "%08x%08x", dieid[0], dieid[3]);
> +
> + setenv("serial#", serial_string);
> + }
> +
> return 0;
> }
Shouldn't this be in more generic code so everyone gets this set now?
Thanks!
--
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20150803/975b70c6/attachment.sig>
More information about the U-Boot
mailing list