Re[2]: [PATCH 6/6] PCM038: Read UID from fuses and pass this value to kernel as serial number

Alexander Shiyan shc_work at mail.ru
Thu Jul 19 14:48:53 EDT 2012


Hello.

Thu, 19 Jul 2012 20:12:52 +0200 от Sascha Hauer <s.hauer at pengutronix.de>:
> On Thu, Jul 19, 2012 at 07:30:17PM +0400, Alexander Shiyan wrote:
> > 
> > Signed-off-by: Alexander Shiyan <shc_work at mail.ru>
> > ---
> >  arch/arm/boards/pcm038/pcm038.c |    4 ++++
> >  1 files changed, 4 insertions(+), 0 deletions(-)
> > 
> > diff --git a/arch/arm/boards/pcm038/pcm038.c b/arch/arm/boards/pcm038/pcm038.c
> > index 5b0afc3..1bdb93c 100644
> > --- a/arch/arm/boards/pcm038/pcm038.c
> > +++ b/arch/arm/boards/pcm038/pcm038.c
> > @@ -40,6 +40,7 @@
> >  #include <mach/spi.h>
> >  #include <mach/iomux-mx27.h>
> >  #include <mach/devices-imx27.h>
> > +#include <mach/iim.h>
> >  #include <mfd/mc13xxx.h>
> >  
> >  #include "pll.h"
> > @@ -193,6 +194,7 @@ mem_initcall(pcm038_mem_init);
> >  static int pcm038_devices_init(void)
> >  {
> >  	int i;
> > +	u64 uid;
> 
> The upper two bytes of uid are used unitialized.
You are right. I'll send updated version for this one patch.

> >  	char *envdev;
> >  
> >  	unsigned int mode[] = {
> > @@ -316,6 +318,8 @@ static int pcm038_devices_init(void)
> >  
> >  	printf("Using environment in %s Flash\n", envdev);
> >  
> > +	if (imx_iim_read(1, 1, &uid, 6) == 6)
> > +		armlinux_set_serial(uid);
> 
> With this patch I just realized that my serial becomes:
> 
> -6345008925011607552
> 
> Having negative numbers here is a bit odd. Looking at it export_env_ull
> does:
> 
>         char *valstr = asprintf("%lld", val);
> 
> Which clearly is a signed number. Maybe this should be changed to "0x%016llx"
> (which of course is not your fault)
I think this will solve the problem. But it's certainly a job for another patch.


More information about the barebox mailing list