mx53loco: Fix revision of Dialog boards
PATCH 1/1 mx53loco: Fix revision of Dialog boards
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.
--- board/freescale/mx53loco/mx53loco.c | 19 ++++++++++++++++--- 1 files changed, 16 insertions(+), 3 deletions(-)
board/freescale/mx53loco/mx53loco.c +16 -3
@@ -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;
Signature · 1 line
1.7.1
PATCH v2 1/1 mx53loco: Fix revision of Dialog boards
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 all Dialog-based boards to 0.
This fixes a kernel crash when PMIC is accessed in the 2.6.35 kernel for Dialog rev E boards.
---
Changes since v1:
- Fix the PMIC detection. Let I2C probe to work earlier in board_init instead of board_late_init().
board/freescale/mx53loco/mx53loco.c | 19 +++++++------------ include/configs/mx53loco.h | 1 - 2 files changed, 7 insertions(+), 13 deletions(-)
board/freescale/mx53loco/mx53loco.c +7 -12
@@ -71,6 +71,9 @@ u32 get_board_rev(void)int rev =readl (&fuse->gp[6 ]); +if (!i2c_probe (CONFIG_SYS_DIALOG_PMIC_I2C_ADDR )) + rev =0 ; +return (get_cpu_rev () & ~(0xF <<8 )) | (rev &0xF ) <<8 ; }
@@ -424,23 +427,15 @@ int print_cpuinfo(void)return 0 ; } -#ifdef CONFIG_BOARD_LATE_INIT -int board_late_init (void ) -{ -setup_iomux_i2c (); -if (!power_init ()) -clock_1GHz (); -print_cpuinfo (); - -return 0 ; -} -#endif -int board_init (void ) { gd->bd->bi_boot_params =PHYS_SDRAM_1 +0x100 ;mxc_set_sata_internal_clock (); +setup_iomux_i2c (); +if (!power_init ()) +clock_1GHz (); +print_cpuinfo ();return 0 ; }
include/configs/mx53loco.h +0 -1
@@ -41,7 +41,6 @@#define CONFIG_SYS_MALLOC_LEN (CONFIG_ENV_SIZE + 2 * 1024 * 1024)#define CONFIG_BOARD_EARLY_INIT_F -#define CONFIG_BOARD_LATE_INIT #define CONFIG_MXC_GPIO #define CONFIG_REVISION_TAG
Signature · 1 line
1.7.1
PATCH v2 1/1 mx53loco: Fix revision of Dialog boards
Quoted 9 lines · Fabio Estevam
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 all Dialog-based boards to 0.
This fixes a kernel crash when PMIC is accessed in the 2.6.35 kernel for Dialog rev E boards.
Signed-off-by Fabio Estevam <[email protected]>
Quoted 9 lines
---
Changes since v1:
- Fix the PMIC detection. Let I2C probe to work earlier inboard_initinstead ofboard_late_init().board/freescale/mx53loco/mx53loco.c | 19 +++++++------------ include/configs/mx53loco.h | 1 - 2 files changed, 7 insertions(+), 13 deletions(-)
Applied to u-boot-imx, thanks.
Best regards,
Stefano Babic
Signature · 5 lines
===================================================================== DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sbabic at denx.de =====================================================================