summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVijay Hiremath <vijay.p.hiremath@intel.com>2015-09-15 15:48:44 -0700
committerchrome-bot <chrome-bot@chromium.org>2015-10-13 21:58:01 -0700
commit3dcd8f6e3adbd463e9c643f08352d916d5f87089 (patch)
tree9c49ff7f6a10308778de278fe347823efc479dd3
parente0df5cbaf04d086ad906ef8fc19e31ba2a977590 (diff)
downloadchrome-ec-3dcd8f6e3adbd463e9c643f08352d916d5f87089.tar.gz
Kunimitsu: implement x86 power cycle on EC reset
Ported the patch from Glados. Change-Id: I7e971a03c8894e1cbf20aaad67903db2057aad41 Reviewed-on: https://chromium-review.googlesource.com/295116 BUG=none BRANCH=None TEST=Manually tested on FAB4 prototype. 'reboot' from EC console & 'ectool reboot_ec' from Kernel console cuts the DSW power rail while rebooting. Change-Id: I235c5e4ff8ce77a604632b5d68da05ae31e925e9 Signed-off-by: Vijay Hiremath <vijay.p.hiremath@intel.com> Reviewed-on: https://chromium-review.googlesource.com/305581 Commit-Ready: Vijay P Hiremath <vijay.p.hiremath@intel.com> Tested-by: Vijay P Hiremath <vijay.p.hiremath@intel.com> Reviewed-by: Shawn N <shawnn@chromium.org>
-rw-r--r--board/kunimitsu/board.c31
-rw-r--r--board/kunimitsu/board.h1
-rw-r--r--board/kunimitsu/gpio.inc10
3 files changed, 40 insertions, 2 deletions
diff --git a/board/kunimitsu/board.c b/board/kunimitsu/board.c
index a557d906f3..9c3223c89d 100644
--- a/board/kunimitsu/board.c
+++ b/board/kunimitsu/board.c
@@ -555,3 +555,34 @@ static void board_chipset_shutdown(void)
}
DECLARE_HOOK(HOOK_CHIPSET_SHUTDOWN, board_chipset_shutdown,
HOOK_PRIO_DEFAULT);
+
+#ifndef BOARD_KUNIMITSU_V3
+/* Make the pmic re-sequence the power rails under these conditions. */
+#define PMIC_RESET_FLAGS \
+ (RESET_FLAG_WATCHDOG | RESET_FLAG_SOFT | RESET_FLAG_HARD)
+static void board_handle_reboot(void)
+{
+ int flags;
+
+ if (system_jumped_to_this_image())
+ return;
+
+ /* Interrogate current reset flags from previous reboot. */
+ flags = system_get_reset_flags();
+
+ if (!(flags & PMIC_RESET_FLAGS))
+ return;
+
+ /* Preserve AP off request. */
+ if (flags & RESET_FLAG_AP_OFF)
+ chip_save_reset_flags(RESET_FLAG_AP_OFF);
+
+ ccprintf("Restarting system with PMIC.\n");
+ /* Flush console */
+ cflush();
+
+ /* Bring down all rails but RTC rail (including EC power). */
+ gpio_set_level(GPIO_LDO_EN, 1);
+}
+DECLARE_HOOK(HOOK_INIT, board_handle_reboot, HOOK_PRIO_FIRST);
+#endif
diff --git a/board/kunimitsu/board.h b/board/kunimitsu/board.h
index 707bd10c95..f4436cbc82 100644
--- a/board/kunimitsu/board.h
+++ b/board/kunimitsu/board.h
@@ -46,7 +46,6 @@
/* PSYS register 8.6KOhm */
#define CHARGER_PSYS_REGISTER 8600
#endif
-#define CONFIG_CMD_PSYS
/*
* PSYS gain = 1 / (PYSY register * (1.44 or 0.36) uA/W)
*/
diff --git a/board/kunimitsu/gpio.inc b/board/kunimitsu/gpio.inc
index 372cb0b6f2..6cfb9674eb 100644
--- a/board/kunimitsu/gpio.inc
+++ b/board/kunimitsu/gpio.inc
@@ -14,7 +14,11 @@ GPIO_INT(POWER_BUTTON_L, PIN(35), GPIO_INT_BOTH, power_button_interrupt)
GPIO_INT(RSMRST_L_PGOOD, PIN(63), GPIO_INT_BOTH, power_signal_interrupt)
GPIO_INT(PCH_SLP_S4_L, PIN(200), GPIO_INT_BOTH | GPIO_PULL_UP, power_signal_interrupt)
GPIO_INT(PCH_SLP_S3_L, PIN(206), GPIO_INT_BOTH | GPIO_PULL_UP, power_signal_interrupt)
+#ifdef BOARD_KUNIMITSU_V3
GPIO_INT(PCH_SLP_S0_L, PIN(211), GPIO_INT_BOTH | GPIO_PULL_UP, power_signal_interrupt)
+#else
+GPIO_INT(PCH_SLP_S0_L, PIN(141), GPIO_INT_BOTH, power_signal_interrupt)
+#endif
GPIO_INT(PCH_SLP_SUS_L, PIN(12), GPIO_INT_BOTH | GPIO_PULL_UP, power_signal_interrupt)
GPIO_INT(VOLUME_UP_L, PIN(31), GPIO_INT_BOTH | GPIO_PULL_UP, button_interrupt)
GPIO_INT(VOLUME_DOWN_L, PIN(47), GPIO_INT_BOTH | GPIO_PULL_UP, button_interrupt)
@@ -85,9 +89,13 @@ GPIO(NC_136, PIN(136), GPIO_INPUT | GPIO_PULL_UP) /* Reserved
#ifdef BOARD_KUNIMITSU_V3
GPIO(USB2_OTG_VBUSSENSE, PIN(140), GPIO_ODR_HIGH)
-#endif
/* Sensor input for KB PROX - UNUSED */
GPIO(KB_PROX_INT_L, PIN(141), GPIO_INPUT)
+#endif
+#ifndef BOARD_KUNIMITSU_V3
+/* Bring down all rails but RTC rail */
+GPIO(LDO_EN, PIN(211), GPIO_OUT_LOW)
+#endif
GPIO(PCH_RSMRST_L, PIN(143), GPIO_OUT_LOW)
/* prochot input from devices */
GPIO(PLATFORM_EC_PROCHOT, PIN(151), GPIO_INPUT)