public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Paul Kocialkowski <contact@paulk.fr>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 07/12] sniper: Serial number support, obtained from die ID
Date: Tue, 04 Aug 2015 20:02:40 +0200	[thread overview]
Message-ID: <1438711360.2585.5.camel@collins> (raw)
In-Reply-To: <20150804020807.GP25532@bill-the-cat>

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 <contact@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!

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: <http://lists.denx.de/pipermail/u-boot/attachments/20150804/dcbfc15c/attachment.sig>

  reply	other threads:[~2015-08-04 18:02 UTC|newest]

Thread overview: 49+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-07-20 13:17 [U-Boot] [PATCH 00/12] LG Optimus Black (P970) codename sniper support series (and driver-model issue) Paul Kocialkowski
2015-07-20 13:17 ` [U-Boot] [PATCH 01/12] power: twl4030: Power off support Paul Kocialkowski
2015-08-04  2:07   ` Tom Rini
2015-08-04 17:59     ` Paul Kocialkowski
2015-08-04  3:13   ` Fabio Estevam
2015-08-04 14:29   ` Przemyslaw Marczak
2015-08-13 13:18   ` [U-Boot] [U-Boot,01/12] " Tom Rini
2015-07-20 13:17 ` [U-Boot] [PATCH 02/12] input: TWL4030 input support for power button, USB and charger Paul Kocialkowski
2015-08-04  2:07   ` Tom Rini
2015-08-04 17:58     ` Paul Kocialkowski
2015-08-13 13:18   ` [U-Boot] [U-Boot, " Tom Rini
2015-07-20 13:17 ` [U-Boot] [PATCH 03/12] input: twl4030: Keypad scan and input Paul Kocialkowski
2015-08-04  2:07   ` Tom Rini
2015-08-13 13:18   ` [U-Boot] [U-Boot,03/12] " Tom Rini
2015-07-20 13:17 ` [U-Boot] [PATCH 04/12] omap3: Reboot mode support Paul Kocialkowski
2015-08-04  2:07   ` Tom Rini
2015-08-13 13:18   ` [U-Boot] [U-Boot,04/12] " Tom Rini
2015-07-20 13:17 ` [U-Boot] [PATCH 05/12] LG Optimus Black (P970) codename sniper support Paul Kocialkowski
2015-08-04  2:08   ` Tom Rini
2015-08-13 13:18   ` [U-Boot] [U-Boot, " Tom Rini
2015-07-20 13:17 ` [U-Boot] [PATCH 06/12] sniper: OMAP3 reboot mode support Paul Kocialkowski
2015-08-04  2:08   ` Tom Rini
2015-08-13 13:18   ` [U-Boot] [U-Boot,06/12] " Tom Rini
2015-07-20 13:17 ` [U-Boot] [PATCH 07/12] sniper: Serial number support, obtained from die ID Paul Kocialkowski
2015-08-04  2:08   ` Tom Rini
2015-08-04 18:02     ` Paul Kocialkowski [this message]
2015-08-04 18:16       ` Tom Rini
2015-08-04 18:22         ` Paul Kocialkowski
2015-08-04 18:27           ` Tom Rini
2015-08-07  9:44             ` Paul Kocialkowski
2015-08-13 12:13               ` Tom Rini
2015-08-16 17:07                 ` Paul Kocialkowski
2015-08-13 13:18   ` [U-Boot] [U-Boot, " Tom Rini
2015-07-20 13:17 ` [U-Boot] [PATCH 08/12] sniper: Pass serial number through ATAG Paul Kocialkowski
2015-08-04  2:08   ` Tom Rini
2015-08-13 13:18   ` [U-Boot] [U-Boot, " Tom Rini
2015-07-20 13:17 ` [U-Boot] [PATCH 09/12] sniper: Fastboot support Paul Kocialkowski
2015-08-04  2:08   ` Tom Rini
2015-08-13 13:18   ` [U-Boot] [U-Boot,09/12] " Tom Rini
2015-07-20 13:17 ` [U-Boot] [PATCH 10/12] sniper: Power button reset support Paul Kocialkowski
2015-08-04  2:08   ` Tom Rini
2015-08-13 13:18   ` [U-Boot] [U-Boot,10/12] " Tom Rini
2015-07-20 13:17 ` [U-Boot] [PATCH 11/12] sniper: Power off when the power on reason is not a valid one Paul Kocialkowski
2015-08-04  2:08   ` Tom Rini
2015-08-13 13:18   ` [U-Boot] [U-Boot, " Tom Rini
2015-07-20 13:17 ` [U-Boot] [PATCH 12/12] sniper: Keypad support, with recovery and fastboot key combinations Paul Kocialkowski
2015-08-04  2:08   ` Tom Rini
2015-08-13 13:19   ` [U-Boot] [U-Boot, " Tom Rini
2015-07-26 16:34 ` [U-Boot] [PATCH 00/12] LG Optimus Black (P970) codename sniper support series (and driver-model issue) Paul Kocialkowski

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1438711360.2585.5.camel@collins \
    --to=contact@paulk.fr \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox