]> git.sur5r.net Git - u-boot/commitdiff
imx: hab: use read_fuse for secure boot settings
authorAdrian Alonso <aalonso@freescale.com>
Mon, 12 Oct 2015 18:48:14 +0000 (13:48 -0500)
committerStefano Babic <sbabic@denx.de>
Fri, 30 Oct 2015 14:22:37 +0000 (15:22 +0100)
Use read_fuse api fuction call to read secure boot fuse
settings (enabled/disabled).

Signed-off-by: Adrian Alonso <aalonso@freescale.com>
arch/arm/imx-common/hab.c

index 9ee0f12a660650a95411b6de01c3c1a0176d2158..277c81ef67baab3d22d3a2cf02fa050c37ac7e28 100644 (file)
@@ -5,6 +5,8 @@
  */
 
 #include <common.h>
+#include <config.h>
+#include <fuse.h>
 #include <asm/io.h>
 #include <asm/system.h>
 #include <asm/arch/clock.h>
@@ -260,11 +262,16 @@ uint8_t hab_engines[16] = {
 
 bool is_hab_enabled(void)
 {
-       struct ocotp_regs *ocotp = (struct ocotp_regs *)OCOTP_BASE_ADDR;
-       struct fuse_bank *bank = &ocotp->bank[0];
-       struct fuse_bank0_regs *fuse =
-               (struct fuse_bank0_regs *)bank->fuse_regs;
-       uint32_t reg = readl(&fuse->cfg5);
+       struct imx_sec_config_fuse_t *fuse =
+               (struct imx_sec_config_fuse_t *)&imx_sec_config_fuse;
+       uint32_t reg;
+       int ret;
+
+       ret = fuse_read(fuse->bank, fuse->word, &reg);
+       if (ret) {
+               puts("\nSecure boot fuse read error\n");
+               return ret;
+       }
 
        return (reg & 0x2) == 0x2;
 }