diff options
author | Randall Spangler <rspangler@chromium.org> | 2012-04-06 09:33:41 -0700 |
---|---|---|
committer | Randall Spangler <rspangler@chromium.org> | 2012-04-09 10:33:35 -0700 |
commit | e9328ac4f63351b4282916034270aa86b7e74922 (patch) | |
tree | d0fde5840594c33709927a5a4d1fabfe0f858c26 /include/clock.h | |
parent | 1a9a415cf68c6e8e3b31972c072c81ed886290ab (diff) | |
download | chrome-ec-e9328ac4f63351b4282916034270aa86b7e74922.tar.gz |
Support dynamically changing the system clock
Add nopll command to turn off the PLL, reducing the system clock to 16Mhz.
Signed-off-by: Randall Spangler <rspangler@chromium.org>
BUG=chrome-os-partner:8798
TEST=manual
boot system
press power button to boot x86
temps // should print all temperatures
timerinfo
timerinfo
timerinfo // convince yourself this is counting up at about 1MHz
nopll // this drops the system clock to 16MHz
temps // should still print all temperatures
timerinfo
timerinfo
timerinfo // should still be counting up at about 1MHz
Change-Id: Ie29ceb17af348148bffadf63d60c1b731f4c3f6d
Diffstat (limited to 'include/clock.h')
-rw-r--r-- | include/clock.h | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/include/clock.h b/include/clock.h index c4008672ef..081c9c95a9 100644 --- a/include/clock.h +++ b/include/clock.h @@ -1,14 +1,23 @@ -/* 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. */ /* Clocks and power management settings */ -#ifndef __CLOCK_H -#define __CLOCK_H +#ifndef __CROS_EC_CLOCK_H +#define __CROS_EC_CLOCK_H -/* set the CPU clocks and PLLs */ +#include "common.h" + +/* Set the CPU clocks and PLLs. */ int clock_init(void); -#endif /* __CLOCK_H */ +/* Returns the current clock frequency in Hz. */ +int clock_get_freq(void); + +/* Wait <cycles> system clock cycles. Simple busy waiting for before + * clocks/timers are initialized. */ +void clock_wait_cycles(uint32_t cycles); + +#endif /* __CROS_EC_CLOCK_H */ |