summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLouis Yung-Chieh Lo <yjlou@chromium.org>2013-12-18 13:39:25 -0800
committerchrome-internal-fetch <chrome-internal-fetch@google.com>2013-12-20 00:38:20 +0000
commit9a11fab20e1e55fadcdcb748db02b84f938a68d1 (patch)
tree42086c56f227612336e6d147412a1fa4fe247b5e
parent8711d7644a67aac6396cb8ff0c983ee581910d7a (diff)
downloadchrome-ec-9a11fab20e1e55fadcdcb748db02b84f938a68d1.tar.gz
nyan: wait 225ms for PMIC RTC start-up
The first time the PMIC sees power (AC or battery) it needs 200ms (+/-12% oscillator tolerance) for the RTC startup. In addition there is a startup time of approx. 0.5msec until V2_5 regulator starts up. BUG=None BRANCH=nyan TEST=verified on rev 3.12 with AC/battery replug * 10. Power button on/off and 'power on/off' are not effected. Change-Id: I706829017a53c549601a925cb18d33b21c50eb76 Signed-off-by: Louis Yung-Chieh Lo <yjlou@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/180677 Reviewed-by: Randall Spangler <rspangler@chromium.org>
-rw-r--r--power/tegra.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/power/tegra.c b/power/tegra.c
index 28f3a892b5..b00ceb498e 100644
--- a/power/tegra.c
+++ b/power/tegra.c
@@ -81,6 +81,12 @@
*/
#define PMIC_WARM_RESET_L_HOLD_TIME (4 * MSEC)
+/*
+ * The first time the PMIC sees power (AC or battery) it needs 200ms (+/-12%
+ * oscillator tolerance) for the RTC startup. In addition there is a startup
+ * time of approx. 0.5msec until V2_5 regulator starts up. */
+#define PMIC_RTC_STARTUP (225 * MSEC)
+
/* Application processor power state */
static int ap_on;
static int ap_suspended;
@@ -453,10 +459,24 @@ static int check_for_power_on_event(void)
*/
static int power_on(void)
{
+ uint64_t t;
+
/* Make sure we de-assert the PMI_THERM_L and AP_RESET_L pin. */
set_pmic_therm(0);
set_ap_reset(0);
+ /*
+ * Before we push PMIC power button, wait for the PMI RTC ready, which
+ * takes PMIC_RTC_STARTUP from the AC/battery is plugged in.
+ */
+ t = get_time().val;
+ if (t < PMIC_RTC_STARTUP) {
+ uint32_t wait = PMIC_RTC_STARTUP - t;
+ CPRINTF("[%T wait for %dms for PMIC RTC start-up]\n",
+ wait / MSEC);
+ usleep(wait);
+ }
+
/* Push the power button */
set_pmic_pwron(1);
usleep(PMIC_PWRON_DEBOUNCE_TIME);