diff options
author | Kevin K Wong <kevin.k.wong@intel.com> | 2014-07-01 15:38:39 -0700 |
---|---|---|
committer | chrome-internal-fetch <chrome-internal-fetch@google.com> | 2014-12-29 19:04:38 +0000 |
commit | 850ef52982b92afbcb3eacb2f69a597731303ed3 (patch) | |
tree | 53a1f8eae8f30501e7af9842f4656182739be1c3 /chip | |
parent | 8bd44bf4d5616bd6d476cbea99829059fe11dc68 (diff) | |
download | chrome-ec-850ef52982b92afbcb3eacb2f69a597731303ed3.tar.gz |
mec1322: Added support to use crystal vs oscillator based on board's clock circuitry.
BUG=None
TEST=make -j buildall
BRANCH=None
Change-Id: I88fa219cd9e573c1544400d24d00c4fdec93840f
Signed-off-by: Kevin K Wong <kevin.k.wong@intel.com>
Reviewed-on: https://chromium-review.googlesource.com/237272
Reviewed-by: Vic Yang <victoryang@chromium.org>
Diffstat (limited to 'chip')
-rw-r--r-- | chip/mec1322/clock.c | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/chip/mec1322/clock.c b/chip/mec1322/clock.c index 512627b184..f838dd0197 100644 --- a/chip/mec1322/clock.c +++ b/chip/mec1322/clock.c @@ -30,9 +30,20 @@ int clock_get_freq(void) void clock_init(void) { - /* XOSEL = Single ended clock source */ +#ifdef CONFIG_CLOCK_CRYSTAL + /* XOSEL: 0 = Parallel resonant crystal */ + MEC1322_VBAT_CE &= ~0x1; +#else + /* XOSEL: 1 = Single ended clock source */ MEC1322_VBAT_CE |= 0x1; +#endif /* 32K clock enable */ MEC1322_VBAT_CE |= 0x2; + +#ifdef CONFIG_CLOCK_CRYSTAL + /* Wait for crystal to stabilize (OSC_LOCK == 1) */ + while (!(MEC1322_PCR_CHIP_OSC_ID & 0x100)) + ; +#endif } |