* [PATCH v2] ARM: mach-imx: imx6: Read and print the UID of i.MX6 SOCs
@ 2019-07-04 8:18 Stefan Riedmueller
2019-07-08 7:18 ` Sascha Hauer
0 siblings, 1 reply; 2+ messages in thread
From: Stefan Riedmueller @ 2019-07-04 8:18 UTC (permalink / raw)
To: barebox
Read the unified ID of the i.MX 6 SOCs and print it in the boot log.
Signed-off-by: Stefan Riedmueller <s.riedmueller@phytec.de>
---
Changes in v2:
- Made function available for others through mach-imx/include/mach/imx6.h
---
arch/arm/mach-imx/imx6.c | 19 +++++++++++++++++++
arch/arm/mach-imx/include/mach/imx6.h | 2 ++
2 files changed, 21 insertions(+)
diff --git a/arch/arm/mach-imx/imx6.c b/arch/arm/mach-imx/imx6.c
index e898be9ab545..0fdd9f082fca 100644
--- a/arch/arm/mach-imx/imx6.c
+++ b/arch/arm/mach-imx/imx6.c
@@ -23,6 +23,7 @@
#include <mach/reset-reason.h>
#include <mach/imx6-anadig.h>
#include <mach/imx6-regs.h>
+#include <mach/imx6-fusemap.h>
#include <mach/usb.h>
#include <asm/mmu.h>
#include <asm/cache-l2x0.h>
@@ -38,6 +39,9 @@
#define BM_CLPCR_COSC_PWRDOWN (0x1 << 11)
#define BM_CLPCR_BYP_MMDC_CH1_LPM_HS (0x1 << 21)
+#define MX6_OCOTP_CFG0 0x410
+#define MX6_OCOTP_CFG1 0x420
+
static void imx6_init_lowlevel(void)
{
void __iomem *aips1 = (void *)MX6_AIPS1_ON_BASE_ADDR;
@@ -186,17 +190,30 @@ int imx6_cpu_revision(void)
return soc_revision;
}
+u64 imx6_uid(void)
+{
+ void __iomem *ocotpbase = IOMEM(MX6_OCOTP_BASE_ADDR);
+ u64 uid;
+
+ uid = ((u64)readl(ocotpbase + MX6_OCOTP_CFG0) << 32);
+ uid |= (u64)readl(ocotpbase + MX6_OCOTP_CFG1);
+
+ return uid;
+}
+
int imx6_init(void)
{
const char *cputypestr;
u32 mx6_silicon_revision;
void __iomem *src = IOMEM(MX6_SRC_BASE_ADDR);
+ u64 mx6_uid;
imx6_init_lowlevel();
imx6_boot_save_loc();
mx6_silicon_revision = imx6_cpu_revision();
+ mx6_uid = imx6_uid();
switch (imx6_cpu_type()) {
case IMX6_CPUTYPE_IMX6Q:
@@ -236,6 +253,8 @@ int imx6_init(void)
imx_set_silicon_revision(cputypestr, mx6_silicon_revision);
imx_set_reset_reason(src + IMX_SRC_SRSR, imx_reset_reasons);
+ pr_info("%s unique ID: %llx\n", cputypestr, mx6_uid);
+
imx6_setup_ipu_qos();
imx6ul_enet_clk_init();
diff --git a/arch/arm/mach-imx/include/mach/imx6.h b/arch/arm/mach-imx/include/mach/imx6.h
index 5701bd480c64..f0d20833fd0f 100644
--- a/arch/arm/mach-imx/include/mach/imx6.h
+++ b/arch/arm/mach-imx/include/mach/imx6.h
@@ -124,4 +124,6 @@ static inline int __imx6_cpu_revision(void)
int imx6_cpu_revision(void);
+u64 imx6_uid(void);
+
#endif /* __MACH_IMX6_H */
--
2.7.4
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH v2] ARM: mach-imx: imx6: Read and print the UID of i.MX6 SOCs
2019-07-04 8:18 [PATCH v2] ARM: mach-imx: imx6: Read and print the UID of i.MX6 SOCs Stefan Riedmueller
@ 2019-07-08 7:18 ` Sascha Hauer
0 siblings, 0 replies; 2+ messages in thread
From: Sascha Hauer @ 2019-07-08 7:18 UTC (permalink / raw)
To: Stefan Riedmueller; +Cc: barebox
On Thu, Jul 04, 2019 at 10:18:49AM +0200, Stefan Riedmueller wrote:
> Read the unified ID of the i.MX 6 SOCs and print it in the boot log.
>
> Signed-off-by: Stefan Riedmueller <s.riedmueller@phytec.de>
> ---
> Changes in v2:
> - Made function available for others through mach-imx/include/mach/imx6.h
> ---
> arch/arm/mach-imx/imx6.c | 19 +++++++++++++++++++
> arch/arm/mach-imx/include/mach/imx6.h | 2 ++
> 2 files changed, 21 insertions(+)
Applied, thanks
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 |
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2019-07-08 7:18 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-07-04 8:18 [PATCH v2] ARM: mach-imx: imx6: Read and print the UID of i.MX6 SOCs Stefan Riedmueller
2019-07-08 7:18 ` Sascha Hauer
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox