diff options
author | Randall Spangler <rspangler@chromium.org> | 2012-01-23 14:53:20 -0800 |
---|---|---|
committer | Randall Spangler <rspangler@chromium.org> | 2012-01-23 14:58:56 -0800 |
commit | cdc3fbf2cfe5a14c04d3a1454aef98d8be73f201 (patch) | |
tree | e8d8d0da443e1c54a2350ca348c3c38f3e38dae6 /chip/lm4/clock.c | |
parent | 51df9457f41e0dab55372684d98eef3ec4a4a79c (diff) | |
download | chrome-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 'chip/lm4/clock.c')
-rw-r--r-- | chip/lm4/clock.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/chip/lm4/clock.c b/chip/lm4/clock.c index c9afa57760..fcf0da99e1 100644 --- a/chip/lm4/clock.c +++ b/chip/lm4/clock.c @@ -169,6 +169,14 @@ static void clock_init_pll(uint32_t value) /* Enable main and precision internal oscillators */ LM4_SYSTEM_RCC &= ~0x3; + + /* Perform an auto calibration of the internal oscillator, using the + * 32.768KHz hibernate clock. */ + /* TODO: (crosbug.com/p/7693) This is only needed on early chips which + * aren't factory trimmed. */ + LM4_SYSTEM_PIOSCCAL = 0x80000000; + LM4_SYSTEM_PIOSCCAL = 0x80000200; + /* wait 1 million CPU cycles */ wait_cycles(512 * 1024); |