diff options
author | Shawn Nematbakhsh <shawnn@chromium.org> | 2016-02-08 15:39:11 -0800 |
---|---|---|
committer | chrome-bot <chrome-bot@chromium.org> | 2016-02-09 19:51:00 -0800 |
commit | 9c053ea898fa2ed890df4f60064dcfee465b6e0f (patch) | |
tree | d588fbf32188a36e832f72c2824b1cf58980d1b9 | |
parent | c7b96d514d18697762696715f79cfbea3d7afa84 (diff) | |
download | chrome-ec-9c053ea898fa2ed890df4f60064dcfee465b6e0f.tar.gz |
mec1322: clock: Use full-speed 48MHz processor clock during EC boot
EC boot / hash computing can be a bottleneck for system boot time.
Reduce this bottleneck by running our processor at 48 MHz through boot,
until vboot hashing of RW completes.
BUG=chrome-os-partner:49583
TEST=Boot chell, verify vboot hash completes within 1 sec of EC boot and
'cbmem' delta between 'vboot select&load kernel' and 'finished EC
verification' is reduced to ~250 ms (which includes sysjump time).
BRANCH=glados
Change-Id: I18d87e685b89decef761e51517bfcfc43dcf8ef0
Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/326792
Commit-Ready: Shawn N <shawnn@chromium.org>
Tested-by: Shawn N <shawnn@chromium.org>
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
-rw-r--r-- | board/chell/board.h | 2 | ||||
-rw-r--r-- | board/glados/board.h | 2 | ||||
-rw-r--r-- | board/kunimitsu/board.h | 2 | ||||
-rw-r--r-- | chip/mec1322/clock.c | 19 | ||||
-rw-r--r-- | chip/mec1322/lfw/ec_lfw.c | 3 | ||||
-rw-r--r-- | common/vboot_hash.c | 2 | ||||
-rw-r--r-- | include/hooks.h | 2 |
7 files changed, 28 insertions, 4 deletions
diff --git a/board/chell/board.h b/board/chell/board.h index 6160e3e199..c143c48aa7 100644 --- a/board/chell/board.h +++ b/board/chell/board.h @@ -134,7 +134,7 @@ #undef CONFIG_CONSOLE_CMDHELP #undef DEFERRABLE_MAX_COUNT -#define DEFERRABLE_MAX_COUNT 14 +#define DEFERRABLE_MAX_COUNT 15 #ifndef __ASSEMBLER__ diff --git a/board/glados/board.h b/board/glados/board.h index 537126c765..c1891cb0d9 100644 --- a/board/glados/board.h +++ b/board/glados/board.h @@ -145,7 +145,7 @@ #undef CONFIG_CONSOLE_CMDHELP #undef DEFERRABLE_MAX_COUNT -#define DEFERRABLE_MAX_COUNT 15 +#define DEFERRABLE_MAX_COUNT 16 #ifndef __ASSEMBLER__ diff --git a/board/kunimitsu/board.h b/board/kunimitsu/board.h index 5603638bd1..63a6cf2243 100644 --- a/board/kunimitsu/board.h +++ b/board/kunimitsu/board.h @@ -134,7 +134,7 @@ #define I2C_PORT_USB_CHARGER_2 MEC1322_I2C0_0 #undef DEFERRABLE_MAX_COUNT -#define DEFERRABLE_MAX_COUNT 15 +#define DEFERRABLE_MAX_COUNT 16 #define CONFIG_ALS #define CONFIG_ALS_OPT3001 diff --git a/chip/mec1322/clock.c b/chip/mec1322/clock.c index 9cef11686f..ba46e4e1a2 100644 --- a/chip/mec1322/clock.c +++ b/chip/mec1322/clock.c @@ -9,6 +9,7 @@ #include "common.h" #include "console.h" #include "cpu.h" +#include "hooks.h" #include "hwtimer.h" #include "registers.h" #include "shared_mem.h" @@ -17,6 +18,7 @@ #include "timer.h" #include "uart.h" #include "util.h" +#include "vboot_hash.h" /* Console output macros */ #define CPUTS(outstr) cputs(CC_CLOCK, outstr) @@ -74,6 +76,23 @@ void clock_init(void) #endif } +/** + * Speed through boot + vboot hash calculation, dropping our processor clock + * only after vboot hashing is completed. + */ +static void clock_turbo_disable(void) +{ +#ifdef CONFIG_VBOOT_HASH + if (vboot_hash_in_progress()) + hook_call_deferred(clock_turbo_disable, 100 * MSEC); + else +#endif + /* Use 12 MHz processor clock for power savings */ + MEC1322_PCR_PROC_CLK_CTL = 4; +} +DECLARE_HOOK(HOOK_INIT, clock_turbo_disable, HOOK_PRIO_INIT_VBOOT_HASH + 1); +DECLARE_DEFERRED(clock_turbo_disable); + #ifdef CONFIG_LOW_POWER_IDLE /** * initialization of Hibernation timer diff --git a/chip/mec1322/lfw/ec_lfw.c b/chip/mec1322/lfw/ec_lfw.c index 3bb3e31398..6824d10686 100644 --- a/chip/mec1322/lfw/ec_lfw.c +++ b/chip/mec1322/lfw/ec_lfw.c @@ -235,6 +235,9 @@ void lfw_main() /* install vector table */ *((uintptr_t *) 0xe000ed08) = (uintptr_t) &hdr_int_vect; + /* Use 48 MHz processor clock to power through boot */ + MEC1322_PCR_PROC_CLK_CTL = 1; + #ifdef CONFIG_WATCHDOG /* Reload watchdog which may be running in case of sysjump */ MEC1322_WDG_KICK = 1; diff --git a/common/vboot_hash.c b/common/vboot_hash.c index c200d15ba2..01af769ebf 100644 --- a/common/vboot_hash.c +++ b/common/vboot_hash.c @@ -235,7 +235,7 @@ static void vboot_hash_init(void) NULL, 0); } } -DECLARE_HOOK(HOOK_INIT, vboot_hash_init, HOOK_PRIO_DEFAULT); +DECLARE_HOOK(HOOK_INIT, vboot_hash_init, HOOK_PRIO_INIT_VBOOT_HASH); #ifdef CONFIG_SAVE_VBOOT_HASH diff --git a/include/hooks.h b/include/hooks.h index c2b48ccd6c..3a7af06f3c 100644 --- a/include/hooks.h +++ b/include/hooks.h @@ -33,6 +33,8 @@ enum hook_priority { HOOK_PRIO_INIT_PWM = HOOK_PRIO_FIRST + 6, /* Extpower inits before modules which might use it (battery, LEDs) */ HOOK_PRIO_INIT_EXTPOWER = HOOK_PRIO_FIRST + 7, + /* Init VBOOT hash later, since it depends on deferred functions */ + HOOK_PRIO_INIT_VBOOT_HASH = HOOK_PRIO_FIRST + 8, /* Specific values to lump temperature-related hooks together */ HOOK_PRIO_TEMP_SENSOR = 6000, |