Commit dcc51cc1fe69b0dcdc6a6e4f76743f927fe49b47

Authored by Ye Li
1 parent f5cfd600cf

MLK-18243-11 arm: imx8m: get cpu chip id for i.MX8MM

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)

Showing 1 changed file with 19 additions and 12 deletions Side-by-side Diff

arch/arm/mach-imx/imx8m/soc.c
... ... @@ -135,24 +135,31 @@
135 135 struct anamix_pll *ana_pll = (struct anamix_pll *)ANATOP_BASE_ADDR;
136 136 u32 reg = readl(&ana_pll->digprog);
137 137 u32 type = (reg >> 16) & 0xff;
  138 + u32 major_low = (reg >> 8) & 0xff;
138 139 u32 rom_version;
139 140  
140 141 reg &= 0xff;
141 142  
142   - if (reg == CHIP_REV_1_0) {
143   - /*
144   - * For B0 chip, the DIGPROG is not updated, still TO1.0.
145   - * we have to check ROM version further
146   - */
147   - rom_version = readl((void __iomem *)ROM_VERSION_A0);
148   - if (rom_version != CHIP_REV_1_0) {
149   - rom_version = readl((void __iomem *)ROM_VERSION_B0);
150   - if (rom_version >= CHIP_REV_2_0)
151   - reg = CHIP_REV_2_0;
  143 + /* iMX8MM */
  144 + if (major_low == 0x41) {
  145 + return ((type + 1) << 12) | reg;
  146 + } else {
  147 + /* iMX8MQ */
  148 + if (reg == CHIP_REV_1_0) {
  149 + /*
  150 + * For B0 chip, the DIGPROG is not updated, still TO1.0.
  151 + * we have to check ROM version further
  152 + */
  153 + rom_version = readl((void __iomem *)ROM_VERSION_A0);
  154 + if (rom_version != CHIP_REV_1_0) {
  155 + rom_version = readl((void __iomem *)ROM_VERSION_B0);
  156 + if (rom_version >= CHIP_REV_2_0)
  157 + reg = CHIP_REV_2_0;
  158 + }
152 159 }
153   - }
154 160  
155   - return (type << 12) | reg;
  161 + return (type << 12) | reg;
  162 + }
156 163 }
157 164  
158 165 static void imx_set_wdog_powerdown(bool enable)