MLK-18243-11 arm: imx8m: get cpu chip id for i.MX8MM
authorYe Li <ye.li@nxp.com>
Wed, 9 May 2018 05:37:22 +0000 (13:37 +0800)
committerYe Li <ye.li@nxp.com>
Fri, 24 May 2019 09:31:08 +0000 (02:31 -0700)
Using the cpu chip id in DIGPROG registers 0x824110

Signed-off-by: Ye Li <ye.li@nxp.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
(cherry picked from commit 330051b4fbcdda201b67a94e72345ec47bd85a96)
(cherry picked from commit dcc51cc1fe69b0dcdc6a6e4f76743f927fe49b47)

arch/arm/mach-imx/imx8m/soc.c

index 68af92d..7bac959 100644 (file)
@@ -149,24 +149,31 @@ u32 get_cpu_rev(void)
        struct anamix_pll *ana_pll = (struct anamix_pll *)ANATOP_BASE_ADDR;
        u32 reg = readl(&ana_pll->digprog);
        u32 type = (reg >> 16) & 0xff;
+       u32 major_low = (reg >> 8) & 0xff;
        u32 rom_version;
 
        reg &= 0xff;
 
-       if (reg == CHIP_REV_1_0) {
-               /*
-                * For B0 chip, the DIGPROG is not updated, still TO1.0.
-                * we have to check ROM version further
-                */
-               rom_version = readl((void __iomem *)ROM_VERSION_A0);
-               if (rom_version != CHIP_REV_1_0) {
-                       rom_version = readl((void __iomem *)ROM_VERSION_B0);
-                       if (rom_version >= CHIP_REV_2_0)
-                               reg = CHIP_REV_2_0;
+       /* iMX8MM */
+        if (major_low == 0x41) {
+               return ((type + 1) << 12) | reg;
+       } else {
+               /* iMX8MQ */
+               if (reg == CHIP_REV_1_0) {
+                       /*
+                        * For B0 chip, the DIGPROG is not updated, still TO1.0.
+                        * we have to check ROM version further
+                        */
+                       rom_version = readl((void __iomem *)ROM_VERSION_A0);
+                       if (rom_version != CHIP_REV_1_0) {
+                               rom_version = readl((void __iomem *)ROM_VERSION_B0);
+                               if (rom_version >= CHIP_REV_2_0)
+                                       reg = CHIP_REV_2_0;
+                       }
                }
-       }
 
-       return (type << 12) | reg;
+               return (type << 12) | reg;
+       }
 }
 
 static void imx_set_wdog_powerdown(bool enable)