arm/imx: serial number / UID support
Subsystems (3)
cover arm/imx: serial number / UID support
This patch series adds support for the serial ATAG, and uses this functionality to pass the i.MX25 chip UID as a serial number to the Linux kernel.
Baruch Siach (3):
arm: add support for the serial ATAG
imx25: add support for UID read from eFuse
mx25 3ds: set CPU UID
arch/arm/boards/freescale-mx25-3-stack/3stack.c | 2 ++ arch/arm/include/asm/armlinux.h | 4 ++++ arch/arm/lib/armlinux.c | 19 +++++++++++++++++++ arch/arm/mach-imx/imx25.c | 12 ++++++++++++ arch/arm/mach-imx/include/mach/generic.h | 1 + arch/arm/mach-imx/include/mach/imx25-regs.h | 3 +++ 6 files changed, 41 insertions(+), 0 deletions(-)
_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
PATCH 1/3 arm: add support for the serial ATAG
--- arch/arm/include/asm/armlinux.h | 4 ++++ arch/arm/lib/armlinux.c | 19 +++++++++++++++++++ 2 files changed, 23 insertions(+), 0 deletions(-)
arch/arm/include/asm/armlinux.h +4 -0
@@ -7,6 +7,7 @@ void armlinux_set_bootparams(void *params);void armlinux_set_architecture (int architecture);void armlinux_add_dram (struct device_d *dev);void armlinux_set_revision (unsigned int ); +void armlinux_set_serial (u64 );#else static inline void armlinux_set_bootparams (void *params) {
@@ -24,6 +25,9 @@ static inline void armlinux_set_revision(unsigned int) { } +void armlinux_set_serial (u64 ) +{ +}#endif #endif /* __ARCH_ARMLINUX_H */
arch/arm/lib/armlinux.c +19 -0
@@ -46,6 +46,7 @@ static int armlinux_architecture = 0;static void *armlinux_bootparams =NULL ;static unsigned int system_rev; +static u64 system_serial;static void setup_start_tag (void ) {
@@ -121,6 +122,19 @@ static void setup_revision_tag(void) } } +static void setup_serial_tag (void ) +{ +if (system_serial) { + params->hdr.tag =ATAG_SERIAL ; + params->hdr.size =tag_size (tag_serialnr); + + params->u.serialnr.low = system_serial &0xffffffff ; + params->u.serialnr.high = system_serial >>32 ; + + params =tag_next (params); + } +} +#if 0 static void setup_initrd_tag (ulong initrd_start,ulong initrd_end) {
@@ -155,6 +169,7 @@ static void setup_tags(void)setup_initrd_tag (initrd_start, initrd_end);#endif setup_revision_tag (); +setup_serial_tag ();setup_end_tag (); printf("commandline: %s\n"
@@ -186,6 +201,10 @@ void armlinux_set_revision(unsigned int rev) system_rev = rev; } +void armlinux_set_serial (u64 serial) +{ + system_serial = serial; +}#ifdef CONFIG_CMD_BOOTM int do_bootm_linux (struct image_data *data)
Signature · 7 lines
1.7.1 _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
Re: [PATCH 1/3] arm: add support for the serial ATAG
Hi Baruch,
Quoted 6 lines
Signed-off-by Baruch Siach <[email protected]>--- arch/arm/include/asm/armlinux.h | 4 ++++ arch/arm/lib/armlinux.c | 19 +++++++++++++++++++ 2 files changed, 23 insertions(+), 0 deletions(-)
I like it. Last time I was tempted to implement this myself I would have added a command to set the serial from the shell as in my case the serial number was saved in env and passed to Linux via a kernel parameter.
So you can count that as an Ack.
Thanks
Uwe
Signature · 7 lines
Pengutronix e.K. | Uwe Kleine-König | Industrial Linux Solutions | http://www.pengutronix.de/ | _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
PATCH 2/3 imx25: add support for UID read from eFuse
In reply to Baruch Siach--- arch/arm/mach-imx/imx25.c | 12 ++++++++++++ arch/arm/mach-imx/include/mach/generic.h | 1 + arch/arm/mach-imx/include/mach/imx25-regs.h | 3 +++ 3 files changed, 16 insertions(+), 0 deletions(-)
arch/arm/mach-imx/imx25.c +12 -0
@@ -16,6 +16,8 @@*/ #include <common.h> +#include <mach/imx-regs.h> +#include <asm/io.h> #include "gpio.h"
@@ -28,3 +30,13 @@ void *imx_gpio_base[] = {int imx_gpio_count =ARRAY_SIZE (imx_gpio_base) *32 ; +u64 imx_uid (void ) +{ +u64 uid =0 ; +int i; + +for (i =0 ; i <8 ; i++) + uid = (uid <<8 ) |readb (IMX_IIM_BASE +IIM_UID + i*4 ); + +return uid; +}
arch/arm/mach-imx/include/mach/generic.h +1 -0
@@ -6,6 +6,7 @@ int imx_silicon_revision(void);#define IMX35_CHIP_REVISION_1_0 0x10#define IMX35_CHIP_REVISION_2_0 0x20 +u64 imx_uid (void );#ifdef CONFIG_ARCH_IMX1
arch/arm/mach-imx/include/mach/imx25-regs.h +3 -0
@@ -140,5 +140,8 @@/* important definition of some bits of WCR */ #define WCR_WDE 0x04 +/* IIM fuse definitions */ +#define IIM_UID 0x820 +#endif /* __ASM_ARCH_MX25_REGS_H */
Signature · 7 lines
1.7.1 _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
PATCH 3/3 mx25 3ds: set CPU UID
In reply to Baruch Siach--- arch/arm/boards/freescale-mx25-3-stack/3stack.c | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-)
arch/arm/boards/freescale-mx25-3-stack/3stack.c +2 -0
@@ -36,6 +36,7 @@#include <nand.h> #include <mach/imx-flash-header.h> #include <mach/iomux-mx25.h> +#include <mach/generic.h> #include <linux/err.h> #include <i2c/i2c.h> #include <i2c/mc34704.h>
@@ -275,6 +276,7 @@ static int imx25_devices_init(void)armlinux_add_dram (&sdram0_dev);armlinux_set_bootparams ((void *)0x80000100 );armlinux_set_architecture (MACH_TYPE_MX25_3DS ); +armlinux_set_serial (imx_uid ());return 0 ; }
Signature · 7 lines
1.7.1 _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
Hi,
serial number is more for board ref than CPU ref as you can easly read it from the register.
So why pass it via the ATAG?
Best Regards,
J.
Quoted 17 lines · Baruch Siach
This patch series adds support for the serial ATAG, and uses this functionality to pass the i.MX25 chip UID as a serial number to the Linux kernel.
Baruch Siach (3):
arm: add support for the serial ATAG
imx25: add support for UID read from eFuse
mx25 3ds: set CPU UIDarch/arm/boards/freescale-mx25-3-stack/3stack.c | 2 ++ arch/arm/include/asm/armlinux.h | 4 ++++ arch/arm/lib/armlinux.c | 19 +++++++++++++++++++ arch/arm/mach-imx/imx25.c | 12 ++++++++++++ arch/arm/mach-imx/include/mach/generic.h | 1 + arch/arm/mach-imx/include/mach/imx25-regs.h | 3 +++ 6 files changed, 41 insertions(+), 0 deletions(-)
Quoted 4 lines
_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
Hi Jean-Christophe,
Quoted 4 lines · Jean-Christophe PLAGNIOL-VILLARD
serial number is more for board ref than CPU ref as you can easly read it from the register.
So why pass it via the ATAG?
The point of the serial number ATAG is to uniquely identify the system. Getting this unique ID from the CPU is as good as any other IMO. I'm not aware of any other UID source on the mx25 3DS system. Besides, having the serial number nicely listed in /proc/cpuinfo is far easier than reading registers.
Anyway, patches 1 and 2 in this series are useful on their own, I think. I intend to use this functionality for our own board. I've added the mx25 3ds two lines patch to justify the bloat :).
baruch
Quoted 18 lines
Best Regards,
J.Quoted 15 lines · Baruch Siach
This patch series adds support for the serial ATAG, and uses this functionality to pass the i.MX25 chip UID as a serial number to the Linux kernel.
Baruch Siach (3):
arm: add support for the serial ATAG
imx25: add support for UID read from eFuse
mx25 3ds: set CPU UIDarch/arm/boards/freescale-mx25-3-stack/3stack.c | 2 ++ arch/arm/include/asm/armlinux.h | 4 ++++ arch/arm/lib/armlinux.c | 19 +++++++++++++++++++ arch/arm/mach-imx/imx25.c | 12 ++++++++++++ arch/arm/mach-imx/include/mach/generic.h | 1 + arch/arm/mach-imx/include/mach/imx25-regs.h | 3 +++ 6 files changed, 41 insertions(+), 0 deletions(-)
Signature · 8 lines
~. .~ Tk Open Systems
=}------------------------------------------------ooO--U--Ooo------------{=
- [email protected] - tel: +972.2.679.5364, http://www.tkos.co.il -
_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/bareboxQuoted 8 lines · Baruch Siach
Hi Jean-Christophe,
Quoted 4 lines · Jean-Christophe PLAGNIOL-VILLARD
serial number is more for board ref than CPU ref as you can easly read it from the register.
So why pass it via the ATAG?
Quoted 8 lines
The point of the serial number ATAG is to uniquely identify the system. Getting this unique ID from the CPU is as good as any other IMO. I'm not aware of any other UID source on the mx25 3DS system. Besides, having the serial number nicely listed in
/proc/cpuinfois far easier than reading registers.Anyway, patches 1 and 2 in this series are useful on their own, I think. I intend to use this functionality for our own board. I've added the mx25 3ds two lines patch to justify the bloat :).
I agree about the other patch I just do not think we need to pass the CPUID to the kernel as he can easly get it by himself IMHO
Best Regards,
J.
_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox