summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--board/chell/board.h2
-rw-r--r--board/glados/board.h2
-rw-r--r--board/kunimitsu/board.h2
-rw-r--r--chip/mec1322/clock.c19
-rw-r--r--chip/mec1322/lfw/ec_lfw.c3
-rw-r--r--common/vboot_hash.c2
-rw-r--r--include/hooks.h2
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,