summaryrefslogtreecommitdiff
path: root/common/main.c
diff options
context:
space:
mode:
authorRandall Spangler <rspangler@chromium.org>2012-01-23 14:53:20 -0800
committerRandall Spangler <rspangler@chromium.org>2012-01-23 14:58:56 -0800
commitcdc3fbf2cfe5a14c04d3a1454aef98d8be73f201 (patch)
treee8d8d0da443e1c54a2350ca348c3c38f3e38dae6 /common/main.c
parent51df9457f41e0dab55372684d98eef3ec4a4a79c (diff)
downloadchrome-ec-cdc3fbf2cfe5a14c04d3a1454aef98d8be73f201.tar.gz
Calibrate internal oscillator using hibernate clock
This works around a chip errata where the internal oscillator on early EC parts (as used on proto0) is untrimmed. Signed-off-by: Randall Spangler <rspangler@chromium.org> BUG=chrome-os-partner:7693 TEST=if it runs, it works Change-Id: Ie82a524543f4cf25efd0de7998dbdae103bd126b
Diffstat (limited to 'common/main.c')
-rw-r--r--common/main.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/common/main.c b/common/main.c
index e400dfde7d..30faa87066 100644
--- a/common/main.c
+++ b/common/main.c
@@ -1,9 +1,8 @@
-/* Copyright (c) 2011 The Chromium OS Authors. All rights reserved.
+/* Copyright (c) 2012 The Chromium OS Authors. All rights reserved.
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
- * Copyright 2011 Google Inc.
*
- * Example of EC main loop
+ * Main routine for Chrome EC
*/
#include "registers.h"
@@ -36,6 +35,7 @@
#include "usb_charge.h"
/* example task blinking the user LED */
+/* TODO: This also kicks the watchdog, so MUST be present! */
void UserLedBlink(void)
{
while (1) {
@@ -58,6 +58,11 @@ int main(void)
/* Configure the pin multiplexers */
configure_board();
jtag_pre_init();
+
+ /* Initialize the system module. This enables the hibernate clock
+ * source we need to calibrate the internal oscillator. */
+ system_pre_init();
+
/* Set the CPU clocks / PLLs */
clock_init();
@@ -65,13 +70,9 @@ int main(void)
* another image if necessary. This must be done as early as
* possible, so that the minimum number of components get
* re-initialized if we jump to another image. */
- system_pre_init();
gpio_pre_init();
vboot_pre_init();
- /* TODO (crosbug.com/p/7456)- race condition on enabling
- * interrupts. Module inits should call task_IntEnable(int)
- * when they're ready... */
task_init();
watchdog_init(1100);