Commit 9e094455495081979cd20ac730a42508717e37b5

Authored by Peng Fan
Committed by Stefano Babic
1 parent cde421cfc8

imx8m: imx8mq: get chip rev for B1 revision

The i.MX8MQ B1 uses OCOTP_HW_OCOTP_READ_FUSE_DATA register for chip id.
It returns a magic number 0xff0055aa. update get_cpu_rev to support it,
and enable ocotp clock to access ocotp.

Signed-off-by: Peng Fan <peng.fan@nxp.com>

Showing 2 changed files with 15 additions and 7 deletions Side-by-side Diff

arch/arm/mach-imx/imx8m/clock_imx8mq.c
... ... @@ -804,6 +804,7 @@
804 804  
805 805 init_wdog_clk();
806 806 clock_enable(CCGR_TSENSOR, 1);
  807 + clock_enable(CCGR_OCOTP, 1);
807 808  
808 809 return 0;
809 810 }
arch/arm/mach-imx/imx8m/soc.c
... ... @@ -202,14 +202,21 @@
202 202 } else {
203 203 if (reg == CHIP_REV_1_0) {
204 204 /*
205   - * For B0 chip, the DIGPROG is not updated, still TO1.0.
206   - * we have to check ROM version further
  205 + * For B0 chip, the DIGPROG is not updated,
  206 + * it is still TO1.0. we have to check ROM
  207 + * version or OCOTP_READ_FUSE_DATA.
  208 + * 0xff0055aa is magic number for B1.
207 209 */
208   - rom_version = readl((void __iomem *)ROM_VERSION_A0);
209   - if (rom_version != CHIP_REV_1_0) {
210   - rom_version = readl((void __iomem *)ROM_VERSION_B0);
211   - if (rom_version >= CHIP_REV_2_0)
212   - reg = CHIP_REV_2_0;
  210 + if (readl((void __iomem *)(OCOTP_BASE_ADDR + 0x40)) == 0xff0055aa) {
  211 + reg = CHIP_REV_2_1;
  212 + } else {
  213 + rom_version =
  214 + readl((void __iomem *)ROM_VERSION_A0);
  215 + if (rom_version != CHIP_REV_1_0) {
  216 + rom_version = readl((void __iomem *)ROM_VERSION_B0);
  217 + if (rom_version == CHIP_REV_2_0)
  218 + reg = CHIP_REV_2_0;
  219 + }
213 220 }
214 221 }
215 222 }