From mboxrd@z Thu Jan 1 00:00:00 1970 From: Paul Kocialkowski Date: Tue, 04 Aug 2015 20:02:40 +0200 Subject: [U-Boot] [PATCH 07/12] sniper: Serial number support, obtained from die ID In-Reply-To: <20150804020807.GP25532@bill-the-cat> References: <1437398238-27912-1-git-send-email-contact@paulk.fr> <1437398238-27912-8-git-send-email-contact@paulk.fr> <20150804020807.GP25532@bill-the-cat> Message-ID: <1438711360.2585.5.camel@collins> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Le lundi 03 ao?t 2015 ? 22:08 -0400, Tom Rini a ?crit : > 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 > > --- > > 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! Well, we had a similar discussion for sunxi, and the outcome was that serial number could be obtained from other places on other devices (e.g. EEPROM) or be calculated from the dieid bits in a different way, so I prefer to keep this board-specific instead of omap3-generic for now. This merely matches what is done on Android OMAP devices, but one could do it another way, too. What do you think? -- Paul Kocialkowski, Replicant developer Replicant is a fully free Android distribution running on several devices, a free software mobile operating system putting the emphasis on freedom and privacy/security. Website: http://www.replicant.us/ Blog: http://blog.replicant.us/ Wiki/tracker/forums: http://redmine.replicant.us/ -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 819 bytes Desc: This is a digitally signed message part URL: