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)

Change-Id: I0804a80b2f8583e7ce0abbd6a3605abeaf023b83
diff --git a/arch/arm/cpu/armv8/imx8m/clock.c b/arch/arm/cpu/armv8/imx8m/clock.c
index 7953d59..389a616 100644
--- a/arch/arm/cpu/armv8/imx8m/clock.c
+++ b/arch/arm/cpu/armv8/imx8m/clock.c
@@ -659,6 +659,7 @@
 	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 80531f1..f326562 100644
--- a/arch/arm/cpu/armv8/imx8m/soc.c
+++ b/arch/arm/cpu/armv8/imx8m/soc.c
@@ -218,16 +218,23 @@
 
 	reg &= 0xff;
 
+	/* 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;
+			}
 		}
 	}