summaryrefslogtreecommitdiff
path: root/power/skylake.c
diff options
context:
space:
mode:
authorFurquan Shaikh <furquan@chromium.org>2017-01-20 11:42:33 -0800
committerchrome-bot <chrome-bot@chromium.org>2017-01-23 03:48:08 -0800
commit0196dc9c1aa170bad826e8d061654ed2144b68bf (patch)
tree98e12feb9e390584f7dcef349087b49f2693f1e9 /power/skylake.c
parent4dba3792ef2023dcd8e8e3766a34d4fde2aca082 (diff)
downloadchrome-ec-0196dc9c1aa170bad826e8d061654ed2144b68bf.tar.gz
power/skylake: Add option to reset pmic using LDO_EN
Add a config option that can be used by chipset to provide PMIC reset using LDO_EN. This is required for ensuring that the AP is power cycled properly. Implement the special pmic reset for skylake chipsets. BUG=chrome-os-partner:61883 BRANCH=None TEST=Verified that reboot on EC console resets the AP and does not get stuck in G3 on poppy. Change-Id: I5f680fede5cb4effa86243f51edfdea09db4d975 Signed-off-by: Furquan Shaikh <furquan@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/431192 Reviewed-by: Duncan Laurie <dlaurie@google.com>
Diffstat (limited to 'power/skylake.c')
-rw-r--r--power/skylake.c37
1 files changed, 37 insertions, 0 deletions
diff --git a/power/skylake.c b/power/skylake.c
index 2e5425a794..3afa94a684 100644
--- a/power/skylake.c
+++ b/power/skylake.c
@@ -8,10 +8,12 @@
#include "chipset.h"
#include "console.h"
#include "gpio.h"
+#include "hooks.h"
#include "intel_x86.h"
#include "lpc.h"
#include "power_button.h"
#include "skylake.h"
+#include "system.h"
#include "timer.h"
/* Console output macros */
@@ -109,3 +111,38 @@ enum power_state power_handle_state(enum power_state state)
return new_state;
}
+
+#ifdef CONFIG_CHIPSET_HAS_PLATFORM_PMIC_RESET
+static void chipset_handle_reboot(void)
+{
+ int flags;
+
+ if (system_jumped_to_this_image())
+ return;
+
+ /* Interrogate current reset flags from previous reboot. */
+ flags = system_get_reset_flags();
+
+ /*
+ * Do not make PMIC re-sequence the power rails if the following reset
+ * conditions are not met.
+ */
+ if (!(flags &
+ (RESET_FLAG_WATCHDOG | RESET_FLAG_SOFT | RESET_FLAG_HARD)))
+ 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_EC_PLATFORM_RST, 1);
+ while (1)
+ ; /* wait here */
+}
+DECLARE_HOOK(HOOK_INIT, chipset_handle_reboot, HOOK_PRIO_FIRST);
+#endif