msm8960: Add support to shutdown device.
Add support to shutdown target after configuring PM8921.
Change-Id: I7e2173fc1e46d8f2c6780f1bb0765f8153a2afa9
diff --git a/target/msm8960/init.c b/target/msm8960/init.c
index 30023e3..e31d958 100644
--- a/target/msm8960/init.c
+++ b/target/msm8960/init.c
@@ -58,6 +58,18 @@
static const uint8_t uart_gsbi_id = GSBI_ID_5;
+void shutdown_device(void)
+{
+ dprintf(CRITICAL, "Shutdown system.\n");
+ pm8921_config_reset_pwr_off(0);
+
+ /* Actually reset the chip */
+ writel(0, MSM_PSHOLD_CTL_SU);
+ mdelay(5000);
+
+ dprintf (CRITICAL, "Shutdown failed.\n");
+}
+
void target_init(void)
{
unsigned base_addr;
@@ -69,7 +81,6 @@
pmic.write = pa1_ssbi2_write_bytes;
pm8921_init(&pmic);
-
/* Keypad init */
keys_init();
keypad_init();
@@ -138,24 +149,11 @@
void reboot_device(unsigned reboot_reason)
{
- /* Disable WDG0 */
- writel(0,MSM_WDT0_EN);
-
/* Actually reset the chip */
+ pm8921_config_reset_pwr_off(1);
writel(0, MSM_PSHOLD_CTL_SU);
- mdelay(5000);
-
- /* Fall back to watchdog */
- /* Reset WDG0 counter */
- writel(1,MSM_WDT0_RST);
- /* Set WDG0 bark time */
- writel(0x31F3,MSM_WDT0_BT);
- /* Enable WDG0 */
- writel(3,MSM_WDT0_EN);
- dmb();
- /* Enable WDG output */
- writel(3,MSM_TCSR_BASE + TCSR_WDOG_CFG);
mdelay(10000);
+
dprintf (CRITICAL, "Rebooting failed\n");
return;
}