diff options
author | Andrey Smirnov <andrew.smirnov@gmail.com> | 2019-09-13 23:02:46 -0700 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2019-09-17 11:48:09 +0200 |
commit | c4d9463d969b6234c86f4045656775212da08508 (patch) | |
tree | 730d8d78dca5ee9f77411abfe1c9187bb6f3ce03 /arch/arm/mach-imx/include | |
parent | cc0801f9f7c25429f0e017ede759d3f0d58cbdc3 (diff) | |
download | barebox-c4d9463d969b6234c86f4045656775212da08508.tar.gz barebox-c4d9463d969b6234c86f4045656775212da08508.tar.xz |
i.MX: Introduce imx_ocotp_read_uid()
UID information in OCOTP is located in the same place on at least
i.MX6, i.MX7 and i.MX8MQ. Create an SoC-agnostic helper to do all the
work and convert i.MX6 to use it.
Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
Cc: Chris Healy <cphealy@gmail.com>
Cc: Lucas Stach <l.stach@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'arch/arm/mach-imx/include')
-rw-r--r-- | arch/arm/mach-imx/include/mach/ocotp.h | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/arch/arm/mach-imx/include/mach/ocotp.h b/arch/arm/mach-imx/include/mach/ocotp.h index e758238cb9..7ba5da156b 100644 --- a/arch/arm/mach-imx/include/mach/ocotp.h +++ b/arch/arm/mach-imx/include/mach/ocotp.h @@ -26,10 +26,24 @@ #define OCOTP_BIT(n) FIELD_PREP(OCOTP_BIT_MASK, n) #define OCOTP_WIDTH(n) FIELD_PREP(OCOTP_WIDTH_MASK, (n) - 1) +#define OCOTP_OFFSET_CFG0 0x410 +#define OCOTP_OFFSET_CFG1 0x420 + int imx_ocotp_read_field(uint32_t field, unsigned *value); int imx_ocotp_write_field(uint32_t field, unsigned value); int imx_ocotp_permanent_write(int enable); bool imx_ocotp_sense_enable(bool enable); +static inline u64 imx_ocotp_read_uid(void __iomem *ocotp) +{ + u64 uid; + + uid = readl(ocotp + OCOTP_OFFSET_CFG0); + uid <<= 32; + uid |= readl(ocotp + OCOTP_OFFSET_CFG1); + + return uid; +} + #endif /* __MACH_IMX_OCOTP_H */ |