imx8m: fix rom version check to unbreak some B0 chips
authorPatrick Wildt <patrick@blueri.se>
Tue, 19 Nov 2019 08:42:06 +0000 (09:42 +0100)
committerStefano Babic <sbabic@denx.de>
Mon, 9 Dec 2019 10:52:06 +0000 (11:52 +0100)
Recently the version check was improved to be able to determine that
we're running on SoC revision 2.1.  A check for B0 was tightened so
that it now must equal 0x20 instead of being bigger than 0x20.  On
some B0 chips the value returned is 0x1020 instead of 0x20.  This
means even though it's B0, the check will fail and code relying on
the correct chip revision will make wrong decisions.  There is no
documentation of those bits, but it seems that NXP always uses a
byte to encode the revision.  Thus remove the upper bits to fix the
regression.

Signed-off-by: Patrick Wildt <patrick@blueri.se>
arch/arm/mach-imx/imx8m/soc.c

index 181c715be33d000ba1d9fdd6e18e4845815f9277..5ce5a180e80148556a11d5909537a831b4f235b1 100644 (file)
@@ -217,6 +217,7 @@ u32 get_cpu_rev(void)
                                        readl((void __iomem *)ROM_VERSION_A0);
                                if (rom_version != CHIP_REV_1_0) {
                                        rom_version = readl((void __iomem *)ROM_VERSION_B0);
+                                       rom_version &= 0xff;
                                        if (rom_version == CHIP_REV_2_0)
                                                reg = CHIP_REV_2_0;
                                }