public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot] [PATCH] mx53loco: Fix revision of Dialog boards
@ 2012-05-28 14:00 Fabio Estevam
  2012-05-29 15:54 ` [U-Boot] [PATCH v2] " Fabio Estevam
  0 siblings, 1 reply; 3+ messages in thread
From: Fabio Estevam @ 2012-05-28 14:00 UTC (permalink / raw)
  To: u-boot

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.estevam@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

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2012-06-12 17:19 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-05-28 14:00 [U-Boot] [PATCH] mx53loco: Fix revision of Dialog boards Fabio Estevam
2012-05-29 15:54 ` [U-Boot] [PATCH v2] " Fabio Estevam
2012-06-12 17:19   ` Stefano Babic

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox