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

Sascha Hauer s.hauer at pengutronix.de
Thu Jul 19 14:12:52 EDT 2012


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.

>  	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)

Sascha


-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |



More information about the barebox mailing list