diff options
author | Ye Li <ye.li@nxp.com> | 2018-09-03 00:46:09 -0700 |
---|---|---|
committer | Ye Li <ye.li@nxp.com> | 2018-09-04 19:11:33 -0700 |
commit | 9dba7a4d4387278b0452f2fc93978777d903abb1 (patch) | |
tree | ead7ff8d4aeedad9d278ff398089f83d65b7f866 | |
parent | b7d9a006954251d6218fc9aba4e6cbe7a3747feb (diff) |
MLK-19433-2 imx8mq: Get chip rev for B1 revision
The mscale B1 uses OCOTP_HW_OCOTP_READ_FUSE_DATA register for chip id.
It returns a magic number 0xff0055aa.
Update get_cpu_rev to support this way, also enable OCOTP clock to allow
access OCOTP register.
Signed-off-by: Ye Li <ye.li@nxp.com>
(cherry picked from commit 866631c2140b9352c6f74ec36d1a51fea40c0445)
-rw-r--r-- | arch/arm/cpu/armv8/imx8m/clock_imx8mq.c | 1 | ||||
-rw-r--r-- | arch/arm/cpu/armv8/imx8m/soc.c | 20 |
2 files changed, 14 insertions, 7 deletions
diff --git a/arch/arm/cpu/armv8/imx8m/clock_imx8mq.c b/arch/arm/cpu/armv8/imx8m/clock_imx8mq.c index 7953d59635..389a61666c 100644 --- a/arch/arm/cpu/armv8/imx8m/clock_imx8mq.c +++ b/arch/arm/cpu/armv8/imx8m/clock_imx8mq.c @@ -659,6 +659,7 @@ int clock_init() clock_enable(CCGR_WDOG3, 1); clock_enable(CCGR_TSENSOR, 1); + clock_enable(CCGR_OCOTP, 1); return 0; }; diff --git a/arch/arm/cpu/armv8/imx8m/soc.c b/arch/arm/cpu/armv8/imx8m/soc.c index 9578be616c..68cc01f3b1 100644 --- a/arch/arm/cpu/armv8/imx8m/soc.c +++ b/arch/arm/cpu/armv8/imx8m/soc.c @@ -229,14 +229,20 @@ u32 get_cpu_rev(void) /* iMX8MQ */ if (reg == 0x10) { /* For B0 chip, the DIGPROG is not updated, still TO1.0. - * we have to check ROM version further + * we have to check ROM version or OCOTP_READ_FUSE_DATA */ - uint32_t rom_version; - rom_version = readl((void __iomem *)0x800); - if (rom_version != 0x10) { - rom_version = readl((void __iomem *)0x83c); - if (rom_version >= 0x20) - reg = 0x20; + if (readl((void __iomem *)(OCOTP_BASE_ADDR + 0x40)) + == 0xff0055aa) { + /* 0xff0055aa is magic number for B1 */ + reg = 0x21; + } else { + uint32_t rom_version; + rom_version = readl((void __iomem *)0x800); + if (rom_version != 0x10) { + rom_version = readl((void __iomem *)0x83c); + if (rom_version == 0x20) + reg = 0x20; + } } } |