[U-Boot] [PATCH 01/10] imx8m: imx8mq: get chip rev for B1 revision

2019-11-04 Thread sbabic
> 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 

Applied to u-boot-imx, master, thanks !

Best regards,
Stefano Babic

-- 
=
DENX Software Engineering GmbH,  Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sba...@denx.de
=

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH 01/10] imx8m: imx8mq: get chip rev for B1 revision

2019-10-16 Thread Peng Fan
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 
---
 arch/arm/mach-imx/imx8m/clock_imx8mq.c |  1 +
 arch/arm/mach-imx/imx8m/soc.c  | 21 ++---
 2 files changed, 15 insertions(+), 7 deletions(-)

diff --git a/arch/arm/mach-imx/imx8m/clock_imx8mq.c 
b/arch/arm/mach-imx/imx8m/clock_imx8mq.c
index feecdb50f6..5c3f780127 100644
--- a/arch/arm/mach-imx/imx8m/clock_imx8mq.c
+++ b/arch/arm/mach-imx/imx8m/clock_imx8mq.c
@@ -804,6 +804,7 @@ int clock_init(void)
 
init_wdog_clk();
clock_enable(CCGR_TSENSOR, 1);
+   clock_enable(CCGR_OCOTP, 1);
 
return 0;
 }
diff --git a/arch/arm/mach-imx/imx8m/soc.c b/arch/arm/mach-imx/imx8m/soc.c
index 3e73ca3cca..9a203e4736 100644
--- a/arch/arm/mach-imx/imx8m/soc.c
+++ b/arch/arm/mach-imx/imx8m/soc.c
@@ -204,14 +204,21 @@ u32 get_cpu_rev(void)
} else {
if (reg == CHIP_REV_1_0) {
/*
-* For B0 chip, the DIGPROG is not updated, still TO1.0.
-* we have to check ROM version further
+* For B0 chip, the DIGPROG is not updated,
+* it is still TO1.0. we have to check ROM
+* version or OCOTP_READ_FUSE_DATA.
+* 0xff0055aa is magic number for B1.
 */
-   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;
+   if (readl((void __iomem *)(OCOTP_BASE_ADDR + 0x40)) == 
0xff0055aa) {
+   reg = CHIP_REV_2_1;
+   } else {
+   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;
+   }
}
}
}
-- 
2.16.4

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot