mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH 0/3] arm/imx: serial number / UID support
@ 2010-08-02 11:58 Baruch Siach
  2010-08-02 11:58 ` [PATCH 1/3] arm: add support for the serial ATAG Baruch Siach
                   ` (3 more replies)
  0 siblings, 4 replies; 8+ messages in thread
From: Baruch Siach @ 2010-08-02 11:58 UTC (permalink / raw)
  To: barebox

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
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH 1/3] arm: add support for the serial ATAG
  2010-08-02 11:58 [PATCH 0/3] arm/imx: serial number / UID support Baruch Siach
@ 2010-08-02 11:58 ` Baruch Siach
  2010-08-02 12:13   ` Uwe Kleine-König
  2010-08-02 11:58 ` [PATCH 2/3] imx25: add support for UID read from eFuse Baruch Siach
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 8+ messages in thread
From: Baruch Siach @ 2010-08-02 11:58 UTC (permalink / raw)
  To: barebox

Signed-off-by: Baruch Siach <baruch@tkos.co.il>
---
 arch/arm/include/asm/armlinux.h |    4 ++++
 arch/arm/lib/armlinux.c         |   19 +++++++++++++++++++
 2 files changed, 23 insertions(+), 0 deletions(-)

diff --git a/arch/arm/include/asm/armlinux.h b/arch/arm/include/asm/armlinux.h
index f4104fb..a92d4c1 100644
--- a/arch/arm/include/asm/armlinux.h
+++ b/arch/arm/include/asm/armlinux.h
@@ -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 */
diff --git a/arch/arm/lib/armlinux.c b/arch/arm/lib/armlinux.c
index 17ae057..040fd34 100644
--- a/arch/arm/lib/armlinux.c
+++ b/arch/arm/lib/armlinux.c
@@ -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)
-- 
1.7.1


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH 2/3] imx25: add support for UID read from eFuse
  2010-08-02 11:58 [PATCH 0/3] arm/imx: serial number / UID support Baruch Siach
  2010-08-02 11:58 ` [PATCH 1/3] arm: add support for the serial ATAG Baruch Siach
@ 2010-08-02 11:58 ` Baruch Siach
  2010-08-02 11:58 ` [PATCH 3/3] mx25 3ds: set CPU UID Baruch Siach
  2010-08-02 12:02 ` [PATCH 0/3] arm/imx: serial number / UID support Jean-Christophe PLAGNIOL-VILLARD
  3 siblings, 0 replies; 8+ messages in thread
From: Baruch Siach @ 2010-08-02 11:58 UTC (permalink / raw)
  To: barebox

Signed-off-by: Baruch Siach <baruch@tkos.co.il>
---
 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(-)

diff --git a/arch/arm/mach-imx/imx25.c b/arch/arm/mach-imx/imx25.c
index 00a1e4e..de70247 100644
--- a/arch/arm/mach-imx/imx25.c
+++ b/arch/arm/mach-imx/imx25.c
@@ -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;
+}
diff --git a/arch/arm/mach-imx/include/mach/generic.h b/arch/arm/mach-imx/include/mach/generic.h
index 48ed336..4b89838 100644
--- a/arch/arm/mach-imx/include/mach/generic.h
+++ b/arch/arm/mach-imx/include/mach/generic.h
@@ -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
diff --git a/arch/arm/mach-imx/include/mach/imx25-regs.h b/arch/arm/mach-imx/include/mach/imx25-regs.h
index e91e7b6..7c2b5f9 100644
--- a/arch/arm/mach-imx/include/mach/imx25-regs.h
+++ b/arch/arm/mach-imx/include/mach/imx25-regs.h
@@ -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 */
 
-- 
1.7.1


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH 3/3] mx25 3ds: set CPU UID
  2010-08-02 11:58 [PATCH 0/3] arm/imx: serial number / UID support Baruch Siach
  2010-08-02 11:58 ` [PATCH 1/3] arm: add support for the serial ATAG Baruch Siach
  2010-08-02 11:58 ` [PATCH 2/3] imx25: add support for UID read from eFuse Baruch Siach
@ 2010-08-02 11:58 ` Baruch Siach
  2010-08-02 12:02 ` [PATCH 0/3] arm/imx: serial number / UID support Jean-Christophe PLAGNIOL-VILLARD
  3 siblings, 0 replies; 8+ messages in thread
From: Baruch Siach @ 2010-08-02 11:58 UTC (permalink / raw)
  To: barebox

Signed-off-by: Baruch Siach <baruch@tkos.co.il>
---
 arch/arm/boards/freescale-mx25-3-stack/3stack.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/arch/arm/boards/freescale-mx25-3-stack/3stack.c b/arch/arm/boards/freescale-mx25-3-stack/3stack.c
index a77a02d..cd228cc 100644
--- a/arch/arm/boards/freescale-mx25-3-stack/3stack.c
+++ b/arch/arm/boards/freescale-mx25-3-stack/3stack.c
@@ -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;
 }
-- 
1.7.1


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 0/3] arm/imx: serial number / UID support
  2010-08-02 11:58 [PATCH 0/3] arm/imx: serial number / UID support Baruch Siach
                   ` (2 preceding siblings ...)
  2010-08-02 11:58 ` [PATCH 3/3] mx25 3ds: set CPU UID Baruch Siach
@ 2010-08-02 12:02 ` Jean-Christophe PLAGNIOL-VILLARD
  2010-08-04  6:46   ` Baruch Siach
  3 siblings, 1 reply; 8+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2010-08-02 12:02 UTC (permalink / raw)
  To: Baruch Siach; +Cc: 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.
On 14:58 Mon 02 Aug     , Baruch Siach wrote:
> 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
> barebox@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/barebox

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 1/3] arm: add support for the serial ATAG
  2010-08-02 11:58 ` [PATCH 1/3] arm: add support for the serial ATAG Baruch Siach
@ 2010-08-02 12:13   ` Uwe Kleine-König
  0 siblings, 0 replies; 8+ messages in thread
From: Uwe Kleine-König @ 2010-08-02 12:13 UTC (permalink / raw)
  To: Baruch Siach; +Cc: barebox

Hi Baruch,

> Signed-off-by: Baruch Siach <baruch@tkos.co.il>
> ---
>  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

-- 
Pengutronix e.K.                           | Uwe Kleine-König            |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 0/3] arm/imx: serial number / UID support
  2010-08-02 12:02 ` [PATCH 0/3] arm/imx: serial number / UID support Jean-Christophe PLAGNIOL-VILLARD
@ 2010-08-04  6:46   ` Baruch Siach
  2010-08-04 10:25     ` Jean-Christophe PLAGNIOL-VILLARD
  0 siblings, 1 reply; 8+ messages in thread
From: Baruch Siach @ 2010-08-04  6:46 UTC (permalink / raw)
  To: Jean-Christophe PLAGNIOL-VILLARD; +Cc: barebox

Hi Jean-Christophe,

On Mon, Aug 02, 2010 at 02:02:13PM +0200, Jean-Christophe PLAGNIOL-VILLARD wrote:
> 	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

> Best Regards,
> J.
> On 14:58 Mon 02 Aug     , Baruch Siach wrote:
> > 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(-)

-- 
                                                     ~. .~   Tk Open Systems
=}------------------------------------------------ooO--U--Ooo------------{=
   - baruch@tkos.co.il - tel: +972.2.679.5364, http://www.tkos.co.il -

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 0/3] arm/imx: serial number / UID support
  2010-08-04  6:46   ` Baruch Siach
@ 2010-08-04 10:25     ` Jean-Christophe PLAGNIOL-VILLARD
  0 siblings, 0 replies; 8+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2010-08-04 10:25 UTC (permalink / raw)
  To: Baruch Siach; +Cc: barebox

On 09:46 Wed 04 Aug     , Baruch Siach wrote:
> Hi Jean-Christophe,
> 
> On Mon, Aug 02, 2010 at 02:02:13PM +0200, Jean-Christophe PLAGNIOL-VILLARD wrote:
> > 	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 :).
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
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2010-08-04 10:30 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-08-02 11:58 [PATCH 0/3] arm/imx: serial number / UID support Baruch Siach
2010-08-02 11:58 ` [PATCH 1/3] arm: add support for the serial ATAG Baruch Siach
2010-08-02 12:13   ` Uwe Kleine-König
2010-08-02 11:58 ` [PATCH 2/3] imx25: add support for UID read from eFuse Baruch Siach
2010-08-02 11:58 ` [PATCH 3/3] mx25 3ds: set CPU UID Baruch Siach
2010-08-02 12:02 ` [PATCH 0/3] arm/imx: serial number / UID support Jean-Christophe PLAGNIOL-VILLARD
2010-08-04  6:46   ` Baruch Siach
2010-08-04 10:25     ` Jean-Christophe PLAGNIOL-VILLARD

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox