diff options
author | CHLin <CHLIN56@nuvoton.com> | 2019-02-15 17:09:45 +0800 |
---|---|---|
committer | chrome-bot <chrome-bot@chromium.org> | 2019-03-13 10:38:57 -0700 |
commit | e7edd0ebedf85c13a1c97deb302c44655f4ca2d9 (patch) | |
tree | 18073b66e14d07fb5faef2c1cc423272b3498811 /chip | |
parent | 9e9a032fa4c345d42fa23dfec7b4fe17e340951a (diff) | |
download | chrome-ec-e7edd0ebedf85c13a1c97deb302c44655f4ca2d9.tar.gz |
clock: define the function clock_enable_module to all EC chips
The API clock_enable_module(MODULE_FAST_CPU, x) allows common layer code
to set the CPU frequency to turbo or normal when it is needed.
However, not all of the EC chips support/implement the function. It
causes build error if this function is added to the common codes which
most of EC chips will use (EX: vboot_hash.) This CL fixes this issue by
defining the function as weak by default.
This CL also implements the clock_enable_module function for NPCX7 chip.
BRANCH=none
BUG=b:77608104
TEST=pass "make buildall"
TEST=on npcx7_evb/yorp, with follow-up CL, check that security
computation becomes faster and the clock goes back to normal frequency
after the computation finishes.
Change-Id: I731fb38f5fc1a4efa5fb331a59f8c3e2803ca30a
Signed-off-by: CHLin <CHLIN56@nuvoton.com>
Reviewed-on: https://chromium-review.googlesource.com/1475097
Commit-Ready: CH Lin <chlin56@nuvoton.com>
Tested-by: CH Lin <chlin56@nuvoton.com>
Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
Reviewed-by: Nicolas Boichat <drinkcat@chromium.org>
Diffstat (limited to 'chip')
-rw-r--r-- | chip/npcx/clock.c | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/chip/npcx/clock.c b/chip/npcx/clock.c index ca3ebf88d8..ecd48197b2 100644 --- a/chip/npcx/clock.c +++ b/chip/npcx/clock.c @@ -163,12 +163,24 @@ void clock_turbo(void) NPCX_HFCBCD = (1 << 4); } -void clock_turbo_disable(void) +void clock_normal(void) { /* Set CORE_CLK (CPU), AHB6_CLK and FIU_CLK back to original values. */ NPCX_HFCGP = ((FPRED << 4) | AHB6DIV); NPCX_HFCBCD = (FIUDIV << 4); } + +void clock_enable_module(enum module_id module, int enable) +{ + /* Assume we have a single task using MODULE_FAST_CPU */ + if (module == MODULE_FAST_CPU) { + if (enable) + clock_turbo(); + else + clock_normal(); + } +} + #endif /** |