From mboxrd@z Thu Jan 1 00:00:00 1970 From: Tom Rix Date: Wed, 10 Jun 2009 07:53:51 -0500 Subject: [U-Boot] [PATCH 3/4] ZOOM2 Add power reset button In-Reply-To: <1244638432-30893-3-git-send-email-Tom.Rix@windriver.com> References: <1244638432-30893-1-git-send-email-Tom.Rix@windriver.com> <1244638432-30893-2-git-send-email-Tom.Rix@windriver.com> <1244638432-30893-3-git-send-email-Tom.Rix@windriver.com> Message-ID: <1244638432-30893-4-git-send-email-Tom.Rix@windriver.com> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de The power reset button is on the top right side of the main board. Press and hold for about to 8 seconds to completely reset the board. Some of the beta boards have a hardware problem that prevents using this feature. If is difficult to further characterize the boards that fail. So disable resetting for all beta boards. Signed-off-by: Tom Rix --- board/omap3/zoom2/zoom2.c | 13 +++++++++++++ drivers/i2c/twl4030_i2c.c | 22 ++++++++++++++++++++++ include/configs/omap3_zoom2.h | 1 + include/twl4030.h | 10 ++++++++++ 4 files changed, 46 insertions(+), 0 deletions(-) diff --git a/board/omap3/zoom2/zoom2.c b/board/omap3/zoom2/zoom2.c index 08fdafb..d5da920 100644 --- a/board/omap3/zoom2/zoom2.c +++ b/board/omap3/zoom2/zoom2.c @@ -32,6 +32,7 @@ #ifdef CONFIG_STATUS_LED #include #endif +#include #include #include #include @@ -141,6 +142,18 @@ int board_init (void) /* boot param addr */ gd->bd->bi_boot_params = (OMAP34XX_SDRC_CS0 + 0x100); + /* + * Board Reset + * The board is reset by holding the the large button + * on the top right side of the main board for + * eight seconds. + * + * There are reported problems of some beta boards + * continously resetting. For those boards, disable resetting. + */ + if (ZOOM2_REVISION_PRODUCTION <= zoom2_get_revision()) + twl4030_power_reset_init(); + #if defined(CONFIG_STATUS_LED) && defined(STATUS_LED_BOOT) status_led_set (STATUS_LED_BOOT, STATUS_LED_ON); #endif diff --git a/drivers/i2c/twl4030_i2c.c b/drivers/i2c/twl4030_i2c.c index 774f813..549f974 100644 --- a/drivers/i2c/twl4030_i2c.c +++ b/drivers/i2c/twl4030_i2c.c @@ -35,3 +35,25 @@ static inline int twl4030_i2c_read_u8(u8 chip_no, u8 *val, u8 reg) return i2c_read(chip_no, reg, 1, val, 1); } +/* + * Power Reset + */ +void twl4030_power_reset_init(void) +{ +#ifdef CONFIG_OMAP3_ZOOM2 + u8 val = 0; + if (twl4030_i2c_read_u8(TWL4030_CHIP_PM_MASTER, &val, + TWL4030_PM_MASTER_P1_SW_EVENTS)) { + printf("Error:TWL4030: failed to read the power register\n"); + printf("Could not initialize hardware reset\n"); + } else { + val |= TWL4030_PM_MASTER_SW_EVENTS_STOPON_PWRON; + if (twl4030_i2c_write_u8(TWL4030_CHIP_PM_MASTER, val, + TWL4030_PM_MASTER_P1_SW_EVENTS)) { + printf("Error:TWL4030: failed to write the power register\n"); + printf("Could not initialize hardware reset\n"); + } + } +#endif +} + diff --git a/include/configs/omap3_zoom2.h b/include/configs/omap3_zoom2.h index c2ad5bf..e69c5f1 100644 --- a/include/configs/omap3_zoom2.h +++ b/include/configs/omap3_zoom2.h @@ -145,6 +145,7 @@ #define CONFIG_SYS_I2C_BUS 0 #define CONFIG_SYS_I2C_BUS_SELECT 1 #define CONFIG_DRIVER_OMAP34XX_I2C 1 +#define CONFIG_DRIVER_TWL4030_I2C 1 /* * Board NAND Info. diff --git a/include/twl4030.h b/include/twl4030.h index d17fea5..bb07036 100644 --- a/include/twl4030.h +++ b/include/twl4030.h @@ -218,4 +218,14 @@ #define TWL4030_USB_PHY_CLK_CTRL_STS (0xFF) #define TWL4030_USB_PHY_DPLL_CLK (1 << 0) +#ifdef CONFIG_DRIVER_TWL4030_I2C + +/* Power Reset, use to initialize system wide resetting */ +void twl4030_power_reset_init(void); + +#else +/* stubs */ +#define twl4030_power_reset_init() + +#endif /* CONFIG_DRIVER_TWL4030_I2C */ #endif /* TWL4030_H */ -- 1.6.0.5