Original code was assuming that the fuse revision version for all mx53loco 
boards
based on Dialog PMIC was the same, which is not the case.

Force the revision of Dialog-based boards to 0.

This fixes a kernel crash when Dialog PMIC is accessed in the kernel for rev E 
boards.

Signed-off-by: Fabio Estevam <fabio.este...@freescale.com>
---
 board/freescale/mx53loco/mx53loco.c |   19 ++++++++++++++++---
 1 files changed, 16 insertions(+), 3 deletions(-)

diff --git a/board/freescale/mx53loco/mx53loco.c 
b/board/freescale/mx53loco/mx53loco.c
index dec966d..1db4137 100644
--- a/board/freescale/mx53loco/mx53loco.c
+++ b/board/freescale/mx53loco/mx53loco.c
@@ -41,6 +41,7 @@
 #include <fsl_pmic.h>
 
 DECLARE_GLOBAL_DATA_PTR;
+static u32 system_rev;
 
 int dram_init(void)
 {
@@ -62,16 +63,19 @@ void dram_init_banksize(void)
        gd->bd->bi_dram[1].size = PHYS_SDRAM_2_SIZE;
 }
 
-u32 get_board_rev(void)
+u32 get_board_rev_from_fuse(void)
 {
        struct iim_regs *iim = (struct iim_regs *)IMX_IIM_BASE;
        struct fuse_bank *bank = &iim->bank[0];
        struct fuse_bank0_regs *fuse =
                (struct fuse_bank0_regs *)bank->fuse_regs;
 
-       int rev = readl(&fuse->gp[6]);
+       return readl(&fuse->gp[6]);
+}
 
-       return (get_cpu_rev() & ~(0xF << 8)) | (rev & 0xF) << 8;
+u32 get_board_rev(void)
+{
+       return system_rev;
 }
 
 static void setup_iomux_uart(void)
@@ -329,6 +333,11 @@ static void setup_iomux_i2c(void)
                PAD_CTL_ODE_OPENDRAIN_ENABLE);
 }
 
+static inline void setup_board_rev(int rev)
+{
+       system_rev |= (rev & 0xF) << 8;
+}
+
 static int power_init(void)
 {
        unsigned int val;
@@ -350,6 +359,8 @@ static int power_init(void)
                /* Set Vcc peripheral to 1.30V */
                ret |= pmic_reg_write(p, DA9053_BUCKPRO_REG, 0x62);
                ret |= pmic_reg_write(p, DA9053_SUPPLY_REG, 0x62);
+
+               setup_board_rev(0);
        }
 
        if (!i2c_probe(CONFIG_SYS_FSL_PMIC_I2C_ADDR)) {
@@ -379,6 +390,8 @@ static int power_init(void)
                /* Set SWBST to 5V in auto mode */
                val = SWBST_AUTO;
                ret |= pmic_reg_write(p, SWBST_CTRL, val);
+
+               setup_board_rev(get_board_rev_from_fuse());
        }
 
        return ret;
-- 
1.7.1


_______________________________________________
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot

Reply via email to