mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Sascha Hauer <s.hauer@pengutronix.de>
To: Stefan Riedmueller <s.riedmueller@phytec.de>
Cc: barebox@lists.infradead.org
Subject: Re: [PATCH] ARM: mach-imx: imx6: Read and print the UID of i.MX6 SOCs
Date: Thu, 4 Jul 2019 08:47:49 +0200	[thread overview]
Message-ID: <20190704064749.ggkmh7c2gbo27y4h@pengutronix.de> (raw)
In-Reply-To: <1562049397-215232-1-git-send-email-s.riedmueller@phytec.de>

Hi Stefan,

On Tue, Jul 02, 2019 at 08:36:37AM +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>
> ---
>  arch/arm/mach-imx/imx6.c | 19 +++++++++++++++++++
>  1 file changed, 19 insertions(+)
> 
> diff --git a/arch/arm/mach-imx/imx6.c b/arch/arm/mach-imx/imx6.c
> index e898be9ab545..66f3d22a68a7 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;
>  }
>  
> +static 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;
> +}

I think this function should be exported in case somebody wants to
actually do something with this value other than printing it during
boot.

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

      reply	other threads:[~2019-07-04  6:47 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-02  6:36 Stefan Riedmueller
2019-07-04  6:47 ` Sascha Hauer [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190704064749.ggkmh7c2gbo27y4h@pengutronix.de \
    --to=s.hauer@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    --cc=s.riedmueller@phytec.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox