From cd2afc0df034670a83479aded514b22b99124cf5 Mon Sep 17 00:00:00 2001 From: Furquan Shaikh Date: Tue, 15 Nov 2016 20:33:29 -0800 Subject: google/chromeec: Add common infrastructure for boot-mode switches Instead of defining the same functions for reading/clearing boot-mode switches from EC in every mainboard, add a common infrastructure to enable common functions for handling boot-mode switches if GOOGLE_CHROMEEC is being used. Only boards that were not moved to this new infrastructure are those that do not use GOOGLE_CHROMEEC or which rely on some mainboard specific mechanism for reading boot-mode switches. BUG=None BRANCH=None TEST=abuild compiles all boards successfully with and without ChromeOS option. Change-Id: I267aadea9e616464563df04b51a668b877f0d578 Signed-off-by: Furquan Shaikh Reviewed-on: https://review.coreboot.org/17449 Tested-by: build bot (Jenkins) Reviewed-by: Julius Werner --- src/mainboard/google/auron/Kconfig | 1 + src/mainboard/google/auron/chromeos.c | 41 -------------------- src/mainboard/google/auron_paine/Kconfig | 1 + src/mainboard/google/auron_paine/chromeos.c | 41 -------------------- src/mainboard/google/chell/Kconfig | 1 + src/mainboard/google/chell/chromeos.c | 36 ----------------- src/mainboard/google/cyan/Kconfig | 1 + src/mainboard/google/cyan/chromeos.c | 60 ----------------------------- src/mainboard/google/enguarde/Kconfig | 1 + src/mainboard/google/enguarde/chromeos.c | 57 --------------------------- src/mainboard/google/eve/Kconfig | 1 + src/mainboard/google/eve/chromeos.c | 29 -------------- src/mainboard/google/falco/Kconfig | 1 + src/mainboard/google/falco/chromeos.c | 47 ---------------------- src/mainboard/google/glados/Kconfig | 1 + src/mainboard/google/glados/chromeos.c | 37 +----------------- src/mainboard/google/gru/Kconfig | 1 + src/mainboard/google/gru/chromeos.c | 18 +-------- src/mainboard/google/lars/Kconfig | 1 + src/mainboard/google/lars/chromeos.c | 36 ----------------- src/mainboard/google/link/Kconfig | 1 + src/mainboard/google/link/chromeos.c | 36 ----------------- src/mainboard/google/ninja/Kconfig | 1 + src/mainboard/google/ninja/chromeos.c | 45 ---------------------- src/mainboard/google/nyan/Kconfig | 1 + src/mainboard/google/nyan/chromeos.c | 18 --------- src/mainboard/google/nyan_big/Kconfig | 1 + src/mainboard/google/nyan_big/chromeos.c | 18 --------- src/mainboard/google/nyan_blaze/Kconfig | 1 + src/mainboard/google/nyan_blaze/chromeos.c | 24 +----------- src/mainboard/google/oak/Kconfig | 1 + src/mainboard/google/oak/chromeos.c | 19 +-------- src/mainboard/google/peppy/Kconfig | 1 + src/mainboard/google/peppy/chromeos.c | 47 ---------------------- src/mainboard/google/rambi/Kconfig | 1 + src/mainboard/google/rambi/chromeos.c | 58 ---------------------------- src/mainboard/google/reef/Kconfig | 3 +- src/mainboard/google/reef/chromeos.c | 38 ------------------ src/mainboard/google/samus/Kconfig | 1 + src/mainboard/google/samus/chromeos.c | 51 ------------------------ src/mainboard/google/smaug/Kconfig | 1 + src/mainboard/google/smaug/chromeos.c | 24 +----------- 42 files changed, 27 insertions(+), 776 deletions(-) (limited to 'src/mainboard/google') diff --git a/src/mainboard/google/auron/Kconfig b/src/mainboard/google/auron/Kconfig index f1b1719d68..a6fd09cdac 100644 --- a/src/mainboard/google/auron/Kconfig +++ b/src/mainboard/google/auron/Kconfig @@ -16,6 +16,7 @@ config BOARD_SPECIFIC_OPTIONS # dummy config CHROMEOS select CHROMEOS_RAMOOPS_DYNAMIC + select EC_GOOGLE_CHROMEEC_SWITCHES select EC_SOFTWARE_SYNC select LID_SWITCH select VBOOT_VBNV_CMOS diff --git a/src/mainboard/google/auron/chromeos.c b/src/mainboard/google/auron/chromeos.c index 20685c67d1..61b3e4ef1e 100644 --- a/src/mainboard/google/auron/chromeos.c +++ b/src/mainboard/google/auron/chromeos.c @@ -14,14 +14,8 @@ */ #include -#include -#include -#include -#include #include -#include #include -#include "ec.h" /* SPI Write protect is GPIO 16 */ #define CROS_WP_GPIO 58 @@ -43,41 +37,6 @@ void fill_lb_gpios(struct lb_gpios *gpios) } #endif -int get_lid_switch(void) -{ - u8 ec_switches = inb(EC_LPC_ADDR_MEMMAP + EC_MEMMAP_SWITCHES); - - return !!(ec_switches & EC_SWITCH_LID_OPEN); -} - -/* The dev-switch is virtual */ -int get_developer_mode_switch(void) -{ - return 0; -} - -/* There are actually two recovery switches. One is the magic keyboard chord, - * the other is driven by Servo. */ -int get_recovery_mode_switch(void) -{ -#if CONFIG_EC_GOOGLE_CHROMEEC - u8 ec_switches = inb(EC_LPC_ADDR_MEMMAP + EC_MEMMAP_SWITCHES); - u32 ec_events; - - /* If a switch is set, we don't need to look at events. */ - if (ec_switches & (EC_SWITCH_DEDICATED_RECOVERY)) - return 1; - - /* Else check if the EC has posted the keyboard recovery event. */ - ec_events = google_chromeec_get_events_b(); - - return !!(ec_events & - EC_HOST_EVENT_MASK(EC_HOST_EVENT_KEYBOARD_RECOVERY)); -#else - return 0; -#endif -} - int get_write_protect_state(void) { return get_gpio(CROS_WP_GPIO); diff --git a/src/mainboard/google/auron_paine/Kconfig b/src/mainboard/google/auron_paine/Kconfig index 533c3dad1b..774c79355f 100644 --- a/src/mainboard/google/auron_paine/Kconfig +++ b/src/mainboard/google/auron_paine/Kconfig @@ -15,6 +15,7 @@ config BOARD_SPECIFIC_OPTIONS # dummy select INTEL_INT15 config CHROMEOS + select EC_GOOGLE_CHROMEEC_SWITCHES select EC_SOFTWARE_SYNC select CHROMEOS_RAMOOPS_DYNAMIC select LID_SWITCH diff --git a/src/mainboard/google/auron_paine/chromeos.c b/src/mainboard/google/auron_paine/chromeos.c index 20685c67d1..61b3e4ef1e 100644 --- a/src/mainboard/google/auron_paine/chromeos.c +++ b/src/mainboard/google/auron_paine/chromeos.c @@ -14,14 +14,8 @@ */ #include -#include -#include -#include -#include #include -#include #include -#include "ec.h" /* SPI Write protect is GPIO 16 */ #define CROS_WP_GPIO 58 @@ -43,41 +37,6 @@ void fill_lb_gpios(struct lb_gpios *gpios) } #endif -int get_lid_switch(void) -{ - u8 ec_switches = inb(EC_LPC_ADDR_MEMMAP + EC_MEMMAP_SWITCHES); - - return !!(ec_switches & EC_SWITCH_LID_OPEN); -} - -/* The dev-switch is virtual */ -int get_developer_mode_switch(void) -{ - return 0; -} - -/* There are actually two recovery switches. One is the magic keyboard chord, - * the other is driven by Servo. */ -int get_recovery_mode_switch(void) -{ -#if CONFIG_EC_GOOGLE_CHROMEEC - u8 ec_switches = inb(EC_LPC_ADDR_MEMMAP + EC_MEMMAP_SWITCHES); - u32 ec_events; - - /* If a switch is set, we don't need to look at events. */ - if (ec_switches & (EC_SWITCH_DEDICATED_RECOVERY)) - return 1; - - /* Else check if the EC has posted the keyboard recovery event. */ - ec_events = google_chromeec_get_events_b(); - - return !!(ec_events & - EC_HOST_EVENT_MASK(EC_HOST_EVENT_KEYBOARD_RECOVERY)); -#else - return 0; -#endif -} - int get_write_protect_state(void) { return get_gpio(CROS_WP_GPIO); diff --git a/src/mainboard/google/chell/Kconfig b/src/mainboard/google/chell/Kconfig index 38db373031..e563ff1750 100644 --- a/src/mainboard/google/chell/Kconfig +++ b/src/mainboard/google/chell/Kconfig @@ -20,6 +20,7 @@ config BOARD_SPECIFIC_OPTIONS # dummy select SOC_INTEL_SKYLAKE config CHROMEOS + select EC_GOOGLE_CHROMEEC_SWITCHES select LID_SWITCH config DRIVERS_I2C_GENERIC diff --git a/src/mainboard/google/chell/chromeos.c b/src/mainboard/google/chell/chromeos.c index 3ca1872f04..fdd148611e 100644 --- a/src/mainboard/google/chell/chromeos.c +++ b/src/mainboard/google/chell/chromeos.c @@ -14,19 +14,13 @@ * GNU General Public License for more details. */ -#include -#include -#include -#include #include #include #include #include -#include #include #include "gpio.h" -#include "ec.h" #if ENV_RAMSTAGE #include @@ -47,36 +41,6 @@ void fill_lb_gpios(struct lb_gpios *gpios) } #endif /* ENV_RAMSTAGE */ -int get_lid_switch(void) -{ - /* Read lid switch state from the EC. */ - return !!(google_chromeec_get_switches() & EC_SWITCH_LID_OPEN); -} - -int get_developer_mode_switch(void) -{ - /* No physical developer mode switch. */ - return 0; -} - -int get_recovery_mode_switch(void) -{ - /* Check for dedicated recovery switch first. */ - if (google_chromeec_get_switches() & EC_SWITCH_DEDICATED_RECOVERY) - return 1; - - /* Otherwise check if the EC has posted the keyboard recovery event. */ - return !!(google_chromeec_get_events_b() & - EC_HOST_EVENT_MASK(EC_HOST_EVENT_KEYBOARD_RECOVERY)); -} - -int clear_recovery_mode_switch(void) -{ - /* Clear keyboard recovery event. */ - return google_chromeec_clear_events_b( - EC_HOST_EVENT_MASK(EC_HOST_EVENT_KEYBOARD_RECOVERY)); -} - int get_write_protect_state(void) { /* Read PCH_WP GPIO. */ diff --git a/src/mainboard/google/cyan/Kconfig b/src/mainboard/google/cyan/Kconfig index 782a460e4b..d236aa0a59 100644 --- a/src/mainboard/google/cyan/Kconfig +++ b/src/mainboard/google/cyan/Kconfig @@ -16,6 +16,7 @@ config BOARD_SPECIFIC_OPTIONS select PCIEXP_L1_SUB_STATE config CHROMEOS + select EC_GOOGLE_CHROMEEC_SWITCHES select EC_SOFTWARE_SYNC select LID_SWITCH select VBOOT_DYNAMIC_WORK_BUFFER diff --git a/src/mainboard/google/cyan/chromeos.c b/src/mainboard/google/cyan/chromeos.c index f606d09c7d..672bc9708d 100644 --- a/src/mainboard/google/cyan/chromeos.c +++ b/src/mainboard/google/cyan/chromeos.c @@ -15,12 +15,6 @@ */ #include -#include -#include -#if IS_ENABLED(CONFIG_EC_GOOGLE_CHROMEEC) -#include "ec.h" -#include -#endif #include #include #include @@ -50,60 +44,6 @@ void fill_lb_gpios(struct lb_gpios *gpios) } #endif /* ENV_RAMSTAGE */ -int get_lid_switch(void) -{ -#if IS_ENABLED(CONFIG_EC_GOOGLE_CHROMEEC) - u8 ec_switches; - - mec_io_bytes(0, EC_LPC_ADDR_MEMMAP + EC_MEMMAP_SWITCHES, 1, - &ec_switches, NULL); - return !!(ec_switches & EC_SWITCH_LID_OPEN); -#else - /* Default to force open. */ - return 1; -#endif -} - -int get_developer_mode_switch(void) -{ - return 0; -} - -int get_recovery_mode_switch(void) -{ -#if IS_ENABLED(CONFIG_EC_GOOGLE_CHROMEEC) - u8 ec_switches; - u32 ec_events; - - mec_io_bytes(0, EC_LPC_ADDR_MEMMAP + EC_MEMMAP_SWITCHES, 1, - &ec_switches, NULL); - - /* If a switch is set, we don't need to look at events. */ - if (ec_switches & (EC_SWITCH_DEDICATED_RECOVERY)) - return 1; - - /* Else check if the EC has posted the keyboard recovery event. */ - ec_events = google_chromeec_get_events_b(); - - return !!(ec_events & - EC_HOST_EVENT_MASK(EC_HOST_EVENT_KEYBOARD_RECOVERY)); -#else - return 0; -#endif -} - -int clear_recovery_mode_switch(void) -{ -#if IS_ENABLED(CONFIG_EC_GOOGLE_CHROMEEC) - const uint32_t kb_rec_mask = - EC_HOST_EVENT_MASK(EC_HOST_EVENT_KEYBOARD_RECOVERY); - /* Unconditionally clear the EC recovery request. */ - return google_chromeec_clear_events_b(kb_rec_mask); -#else - return 0; -#endif -} - int get_write_protect_state(void) { /* diff --git a/src/mainboard/google/enguarde/Kconfig b/src/mainboard/google/enguarde/Kconfig index ec528a69a0..c2842bb334 100644 --- a/src/mainboard/google/enguarde/Kconfig +++ b/src/mainboard/google/enguarde/Kconfig @@ -15,6 +15,7 @@ config BOARD_SPECIFIC_OPTIONS config CHROMEOS select VBOOT_VBNV_CMOS select LID_SWITCH + select EC_GOOGLE_CHROMEEC_SWITCHES select EC_SOFTWARE_SYNC select VIRTUAL_DEV_SWITCH diff --git a/src/mainboard/google/enguarde/chromeos.c b/src/mainboard/google/enguarde/chromeos.c index e4f2d28689..68fb0a7bc7 100644 --- a/src/mainboard/google/enguarde/chromeos.c +++ b/src/mainboard/google/enguarde/chromeos.c @@ -15,17 +15,9 @@ #include #include -#include -#include -#include #include #include -#if CONFIG_EC_GOOGLE_CHROMEEC -#include "ec.h" -#include -#endif - /* The WP status pin lives on GPIO_SSUS_6 which is pad 36 in the SUS well. */ #define WP_STATUS_PAD 36 @@ -46,55 +38,6 @@ void fill_lb_gpios(struct lb_gpios *gpios) } #endif -int get_lid_switch(void) -{ -#if CONFIG_EC_GOOGLE_CHROMEEC - u8 ec_switches = inb(EC_LPC_ADDR_MEMMAP + EC_MEMMAP_SWITCHES); - - return !!(ec_switches & EC_SWITCH_LID_OPEN); -#else - /* Default to force open. */ - return 1; -#endif -} - -int get_developer_mode_switch(void) -{ - return 0; -} - -int get_recovery_mode_switch(void) -{ -#if CONFIG_EC_GOOGLE_CHROMEEC - u8 ec_switches = inb(EC_LPC_ADDR_MEMMAP + EC_MEMMAP_SWITCHES); - u32 ec_events; - - /* If a switch is set, we don't need to look at events. */ - if (ec_switches & (EC_SWITCH_DEDICATED_RECOVERY)) - return 1; - - /* Else check if the EC has posted the keyboard recovery event. */ - ec_events = google_chromeec_get_events_b(); - - return !!(ec_events & - EC_HOST_EVENT_MASK(EC_HOST_EVENT_KEYBOARD_RECOVERY)); -#else - return 0; -#endif -} - -int clear_recovery_mode_switch(void) -{ -#if CONFIG_EC_GOOGLE_CHROMEEC - const uint32_t kb_rec_mask = - EC_HOST_EVENT_MASK(EC_HOST_EVENT_KEYBOARD_RECOVERY); - /* Unconditionally clear the EC recovery request. */ - return google_chromeec_clear_events_b(kb_rec_mask); -#else - return 0; -#endif -} - int get_write_protect_state(void) { /* diff --git a/src/mainboard/google/eve/Kconfig b/src/mainboard/google/eve/Kconfig index c21d22abf3..0e1bc52cca 100644 --- a/src/mainboard/google/eve/Kconfig +++ b/src/mainboard/google/eve/Kconfig @@ -18,6 +18,7 @@ config BOARD_SPECIFIC_OPTIONS select TPM2 config CHROMEOS + select EC_GOOGLE_CHROMEEC_SWITCHES select LID_SWITCH config DRIVERS_I2C_GENERIC diff --git a/src/mainboard/google/eve/chromeos.c b/src/mainboard/google/eve/chromeos.c index 63615b3a3e..de83eaa637 100644 --- a/src/mainboard/google/eve/chromeos.c +++ b/src/mainboard/google/eve/chromeos.c @@ -14,15 +14,12 @@ * GNU General Public License for more details. */ -#include #include #include #include -#include #include #include "gpio.h" -#include "ec.h" #if ENV_RAMSTAGE #include @@ -43,32 +40,6 @@ void fill_lb_gpios(struct lb_gpios *gpios) } #endif /* ENV_RAMSTAGE */ -int get_lid_switch(void) -{ - /* Read lid switch state from the EC. */ - return !!(google_chromeec_get_switches() & EC_SWITCH_LID_OPEN); -} - -int get_developer_mode_switch(void) -{ - /* No physical developer mode switch. */ - return 0; -} - -int get_recovery_mode_switch(void) -{ - /* Check if the EC has posted the keyboard recovery event. */ - return !!(google_chromeec_get_events_b() & - EC_HOST_EVENT_MASK(EC_HOST_EVENT_KEYBOARD_RECOVERY)); -} - -int clear_recovery_mode_switch(void) -{ - /* Clear keyboard recovery event. */ - return google_chromeec_clear_events_b( - EC_HOST_EVENT_MASK(EC_HOST_EVENT_KEYBOARD_RECOVERY)); -} - int get_write_protect_state(void) { /* Read PCH_WP GPIO. */ diff --git a/src/mainboard/google/falco/Kconfig b/src/mainboard/google/falco/Kconfig index d0b911a512..182a764644 100644 --- a/src/mainboard/google/falco/Kconfig +++ b/src/mainboard/google/falco/Kconfig @@ -21,6 +21,7 @@ config BOARD_SPECIFIC_OPTIONS # dummy select INTEL_INT15 config CHROMEOS + select EC_GOOGLE_CHROMEEC_SWITCHES select EC_SOFTWARE_SYNC select LID_SWITCH select VBOOT_VBNV_CMOS diff --git a/src/mainboard/google/falco/chromeos.c b/src/mainboard/google/falco/chromeos.c index a8cef3279b..22ec0742e2 100644 --- a/src/mainboard/google/falco/chromeos.c +++ b/src/mainboard/google/falco/chromeos.c @@ -15,18 +15,10 @@ #include #include -#include -#include -#include #include #include #include -#if CONFIG_EC_GOOGLE_CHROMEEC -#include "ec.h" -#include -#endif - #ifndef __PRE_RAM__ #include @@ -44,45 +36,6 @@ void fill_lb_gpios(struct lb_gpios *gpios) } #endif -int get_lid_switch(void) -{ -#if CONFIG_EC_GOOGLE_CHROMEEC - u8 ec_switches = inb(EC_LPC_ADDR_MEMMAP + EC_MEMMAP_SWITCHES); - - return !!(ec_switches & EC_SWITCH_LID_OPEN); -#else - return 0; -#endif -} - -/* The dev-switch is virtual */ -int get_developer_mode_switch(void) -{ - return 0; -} - -/* There are actually two recovery switches. One is the magic keyboard chord, - * the other is driven by Servo. */ -int get_recovery_mode_switch(void) -{ -#if CONFIG_EC_GOOGLE_CHROMEEC - u8 ec_switches = inb(EC_LPC_ADDR_MEMMAP + EC_MEMMAP_SWITCHES); - u32 ec_events; - - /* If a switch is set, we don't need to look at events. */ - if (ec_switches & (EC_SWITCH_DEDICATED_RECOVERY)) - return 1; - - /* Else check if the EC has posted the keyboard recovery event. */ - ec_events = google_chromeec_get_events_b(); - - return !!(ec_events & - EC_HOST_EVENT_MASK(EC_HOST_EVENT_KEYBOARD_RECOVERY)); -#else - return 0; -#endif -} - int get_write_protect_state(void) { return get_gpio(58); diff --git a/src/mainboard/google/glados/Kconfig b/src/mainboard/google/glados/Kconfig index e70094fb8b..a315b1cf24 100644 --- a/src/mainboard/google/glados/Kconfig +++ b/src/mainboard/google/glados/Kconfig @@ -20,6 +20,7 @@ config BOARD_SPECIFIC_OPTIONS # dummy select SOC_INTEL_SKYLAKE config CHROMEOS + select EC_GOOGLE_CHROMEEC_SWITCHES select LID_SWITCH config DRIVERS_I2C_GENERIC diff --git a/src/mainboard/google/glados/chromeos.c b/src/mainboard/google/glados/chromeos.c index 3ca1872f04..9ee6e6f564 100644 --- a/src/mainboard/google/glados/chromeos.c +++ b/src/mainboard/google/glados/chromeos.c @@ -14,19 +14,14 @@ * GNU General Public License for more details. */ -#include -#include -#include -#include +#include #include #include #include #include -#include #include #include "gpio.h" -#include "ec.h" #if ENV_RAMSTAGE #include @@ -47,36 +42,6 @@ void fill_lb_gpios(struct lb_gpios *gpios) } #endif /* ENV_RAMSTAGE */ -int get_lid_switch(void) -{ - /* Read lid switch state from the EC. */ - return !!(google_chromeec_get_switches() & EC_SWITCH_LID_OPEN); -} - -int get_developer_mode_switch(void) -{ - /* No physical developer mode switch. */ - return 0; -} - -int get_recovery_mode_switch(void) -{ - /* Check for dedicated recovery switch first. */ - if (google_chromeec_get_switches() & EC_SWITCH_DEDICATED_RECOVERY) - return 1; - - /* Otherwise check if the EC has posted the keyboard recovery event. */ - return !!(google_chromeec_get_events_b() & - EC_HOST_EVENT_MASK(EC_HOST_EVENT_KEYBOARD_RECOVERY)); -} - -int clear_recovery_mode_switch(void) -{ - /* Clear keyboard recovery event. */ - return google_chromeec_clear_events_b( - EC_HOST_EVENT_MASK(EC_HOST_EVENT_KEYBOARD_RECOVERY)); -} - int get_write_protect_state(void) { /* Read PCH_WP GPIO. */ diff --git a/src/mainboard/google/gru/Kconfig b/src/mainboard/google/gru/Kconfig index 41e8105595..57b1762578 100644 --- a/src/mainboard/google/gru/Kconfig +++ b/src/mainboard/google/gru/Kconfig @@ -46,6 +46,7 @@ config BOARD_SPECIFIC_OPTIONS select SPI_FLASH_WINBOND config CHROMEOS + select EC_GOOGLE_CHROMEEC_SWITCHES select EC_SOFTWARE_SYNC select SPI_TPM if GRU_HAS_TPM2 select VBOOT_VBNV_FLASH diff --git a/src/mainboard/google/gru/chromeos.c b/src/mainboard/google/gru/chromeos.c index cc2b3b6604..d9e5e28f00 100644 --- a/src/mainboard/google/gru/chromeos.c +++ b/src/mainboard/google/gru/chromeos.c @@ -14,11 +14,9 @@ * */ +#include #include -#include -#include #include -#include #include "board.h" @@ -42,20 +40,6 @@ void fill_lb_gpios(struct lb_gpios *gpios) lb_add_gpios(gpios, chromeos_gpios, ARRAY_SIZE(chromeos_gpios)); } -int get_developer_mode_switch(void) -{ - return 0; -} - -int get_recovery_mode_switch(void) -{ - uint32_t ec_events; - - ec_events = google_chromeec_get_events_b(); - return !!(ec_events & - EC_HOST_EVENT_MASK(EC_HOST_EVENT_KEYBOARD_RECOVERY)); -} - void setup_chromeos_gpios(void) { gpio_input_pullup(GPIO_WP); diff --git a/src/mainboard/google/lars/Kconfig b/src/mainboard/google/lars/Kconfig index 2a4973eb45..49dcf1be4a 100644 --- a/src/mainboard/google/lars/Kconfig +++ b/src/mainboard/google/lars/Kconfig @@ -21,6 +21,7 @@ config BOARD_SPECIFIC_OPTIONS # dummy select SOC_INTEL_SKYLAKE config CHROMEOS + select EC_GOOGLE_CHROMEEC_SWITCHES select LID_SWITCH config DRIVERS_GENERIC_MAX98357A diff --git a/src/mainboard/google/lars/chromeos.c b/src/mainboard/google/lars/chromeos.c index daa85c69e0..42763a7d34 100644 --- a/src/mainboard/google/lars/chromeos.c +++ b/src/mainboard/google/lars/chromeos.c @@ -14,19 +14,13 @@ * GNU General Public License for more details. */ -#include -#include -#include -#include #include #include #include #include -#include #include #include "gpio.h" -#include "ec.h" #if ENV_RAMSTAGE #include @@ -47,36 +41,6 @@ void fill_lb_gpios(struct lb_gpios *gpios) } #endif /* ENV_RAMSTAGE */ -int get_lid_switch(void) -{ - /* Read lid switch state from the EC. */ - return !!(google_chromeec_get_switches() & EC_SWITCH_LID_OPEN); -} - -int get_developer_mode_switch(void) -{ - /* No physical developer mode switch. */ - return 0; -} - -int get_recovery_mode_switch(void) -{ - /* Check for dedicated recovery switch first. */ - if (google_chromeec_get_switches() & EC_SWITCH_DEDICATED_RECOVERY) - return 1; - - /* Otherwise check if the EC has posted the keyboard recovery event. */ - return !!(google_chromeec_get_events_b() & - EC_HOST_EVENT_MASK(EC_HOST_EVENT_KEYBOARD_RECOVERY)); -} - -int clear_recovery_mode_switch(void) -{ - /* Clear keyboard recovery event. */ - return google_chromeec_clear_events_b( - EC_HOST_EVENT_MASK(EC_HOST_EVENT_KEYBOARD_RECOVERY)); -} - int get_write_protect_state(void) { /* Read PCH_WP GPIO. */ diff --git a/src/mainboard/google/link/Kconfig b/src/mainboard/google/link/Kconfig index d1e1140773..b521f9c238 100644 --- a/src/mainboard/google/link/Kconfig +++ b/src/mainboard/google/link/Kconfig @@ -17,6 +17,7 @@ config BOARD_SPECIFIC_OPTIONS # dummy select MAINBOARD_HAS_NATIVE_VGA_INIT config CHROMEOS + select EC_GOOGLE_CHROMEEC_SWITCHES select LID_SWITCH select VBOOT_VBNV_CMOS diff --git a/src/mainboard/google/link/chromeos.c b/src/mainboard/google/link/chromeos.c index 4be31d9fa4..0469d65c7c 100644 --- a/src/mainboard/google/link/chromeos.c +++ b/src/mainboard/google/link/chromeos.c @@ -15,13 +15,8 @@ #include #include -#include -#include -#include #include #include -#include "ec.h" -#include #include #ifndef __PRE_RAM__ @@ -78,37 +73,6 @@ int get_write_protect_state(void) return get_gpio(57); } -int get_lid_switch(void) -{ - u8 ec_switches = inb(EC_LPC_ADDR_MEMMAP + EC_MEMMAP_SWITCHES); - - return !!(ec_switches & EC_SWITCH_LID_OPEN); -} - -/* The dev-switch is virtual on Link (and so handled elsewhere). */ -int get_developer_mode_switch(void) -{ - return 0; -} - -/* There are actually two recovery switches. One is the magic keyboard chord, - * the other is driven by Servo. */ -int get_recovery_mode_switch(void) -{ - u8 ec_switches = inb(EC_LPC_ADDR_MEMMAP + EC_MEMMAP_SWITCHES); - u32 ec_events; - - /* If a switch is set, we don't need to look at events. */ - if (ec_switches & (EC_SWITCH_DEDICATED_RECOVERY)) - return 1; - - /* Else check if the EC has posted the keyboard recovery event. */ - ec_events = google_chromeec_get_events_b(); - - return !!(ec_events & - EC_HOST_EVENT_MASK(EC_HOST_EVENT_KEYBOARD_RECOVERY)); -} - static const struct cros_gpio cros_gpios[] = { CROS_GPIO_REC_AL(9, CROS_GPIO_DEVICE_NAME), CROS_GPIO_WP_AH(57, CROS_GPIO_DEVICE_NAME), diff --git a/src/mainboard/google/ninja/Kconfig b/src/mainboard/google/ninja/Kconfig index ce32d3dac8..4c28e1a23b 100644 --- a/src/mainboard/google/ninja/Kconfig +++ b/src/mainboard/google/ninja/Kconfig @@ -14,6 +14,7 @@ config BOARD_SPECIFIC_OPTIONS select MAINBOARD_HAS_LPC_TPM config CHROMEOS + select EC_GOOGLE_CHROMEEC_SWITCHES select EC_SOFTWARE_SYNC select LID_SWITCH select VBOOT_VBNV_CMOS diff --git a/src/mainboard/google/ninja/chromeos.c b/src/mainboard/google/ninja/chromeos.c index 1213266d3f..fa4c66f98f 100644 --- a/src/mainboard/google/ninja/chromeos.c +++ b/src/mainboard/google/ninja/chromeos.c @@ -15,16 +15,8 @@ #include #include -#include -#include -#include #include -#if CONFIG_EC_GOOGLE_CHROMEEC -#include "ec.h" -#include -#endif - /* The WP status pin lives on GPIO_SSUS_6 which is pad 36 in the SUS well. */ #define WP_STATUS_PAD 36 @@ -34,18 +26,6 @@ #define ACTIVE_LOW 0 #define ACTIVE_HIGH 1 -int get_lid_switch(void) -{ -#if CONFIG_EC_GOOGLE_CHROMEEC - u8 ec_switches = inb(EC_LPC_ADDR_MEMMAP + EC_MEMMAP_SWITCHES); - - return !!(ec_switches & EC_SWITCH_LID_OPEN); -#else - /* Default to force open. */ - return 1; -#endif -} - void fill_lb_gpios(struct lb_gpios *gpios) { struct lb_gpio chromeos_gpios[] = { @@ -60,31 +40,6 @@ void fill_lb_gpios(struct lb_gpios *gpios) } #endif -int get_developer_mode_switch(void) -{ - return 0; -} - -int get_recovery_mode_switch(void) -{ -#if CONFIG_EC_GOOGLE_CHROMEEC - u8 ec_switches = inb(EC_LPC_ADDR_MEMMAP + EC_MEMMAP_SWITCHES); - u32 ec_events; - - /* If a switch is set, we don't need to look at events. */ - if (ec_switches & (EC_SWITCH_DEDICATED_RECOVERY)) - return 1; - - /* Else check if the EC has posted the keyboard recovery event. */ - ec_events = google_chromeec_get_events_b(); - - return !!(ec_events & - EC_HOST_EVENT_MASK(EC_HOST_EVENT_KEYBOARD_RECOVERY)); -#else - return 0; -#endif -} - int get_write_protect_state(void) { /* diff --git a/src/mainboard/google/nyan/Kconfig b/src/mainboard/google/nyan/Kconfig index 9b25d5c9b2..515d16bd78 100644 --- a/src/mainboard/google/nyan/Kconfig +++ b/src/mainboard/google/nyan/Kconfig @@ -32,6 +32,7 @@ config BOARD_SPECIFIC_OPTIONS # dummy select SPI_FLASH_FAST_READ_DUAL_OUTPUT_3B config CHROMEOS + select EC_GOOGLE_CHROMEEC_SWITCHES select EC_SOFTWARE_SYNC select VBOOT_VBNV_EC select VIRTUAL_DEV_SWITCH diff --git a/src/mainboard/google/nyan/chromeos.c b/src/mainboard/google/nyan/chromeos.c index 9d5d6b248e..aa7c9c69f6 100644 --- a/src/mainboard/google/nyan/chromeos.c +++ b/src/mainboard/google/nyan/chromeos.c @@ -15,12 +15,8 @@ #include #include -#include -#include -#include #include #include -#include void fill_lb_gpios(struct lb_gpios *gpios) { @@ -36,20 +32,6 @@ void fill_lb_gpios(struct lb_gpios *gpios) lb_add_gpios(gpios, chromeos_gpios, ARRAY_SIZE(chromeos_gpios)); } -int get_developer_mode_switch(void) -{ - return 0; -} - -int get_recovery_mode_switch(void) -{ - uint32_t ec_events; - - ec_events = google_chromeec_get_events_b(); - return !!(ec_events & - EC_HOST_EVENT_MASK(EC_HOST_EVENT_KEYBOARD_RECOVERY)); -} - int get_write_protect_state(void) { return !gpio_get(GPIO(R1)); diff --git a/src/mainboard/google/nyan_big/Kconfig b/src/mainboard/google/nyan_big/Kconfig index bcf8f5d619..c8411bf435 100644 --- a/src/mainboard/google/nyan_big/Kconfig +++ b/src/mainboard/google/nyan_big/Kconfig @@ -33,6 +33,7 @@ config BOARD_SPECIFIC_OPTIONS # dummy select SPI_FLASH_FAST_READ_DUAL_OUTPUT_3B config CHROMEOS + select EC_GOOGLE_CHROMEEC_SWITCHES select EC_SOFTWARE_SYNC select VBOOT_VBNV_EC select VIRTUAL_DEV_SWITCH diff --git a/src/mainboard/google/nyan_big/chromeos.c b/src/mainboard/google/nyan_big/chromeos.c index e9df4e3bda..2c9ba28e5f 100644 --- a/src/mainboard/google/nyan_big/chromeos.c +++ b/src/mainboard/google/nyan_big/chromeos.c @@ -15,12 +15,8 @@ #include #include -#include -#include -#include #include #include -#include void fill_lb_gpios(struct lb_gpios *gpios) { @@ -36,20 +32,6 @@ void fill_lb_gpios(struct lb_gpios *gpios) lb_add_gpios(gpios, chromeos_gpios, ARRAY_SIZE(chromeos_gpios)); } -int get_developer_mode_switch(void) -{ - return 0; -} - -int get_recovery_mode_switch(void) -{ - uint32_t ec_events; - - ec_events = google_chromeec_get_events_b(); - return !!(ec_events & - EC_HOST_EVENT_MASK(EC_HOST_EVENT_KEYBOARD_RECOVERY)); -} - int get_write_protect_state(void) { return !gpio_get(GPIO(R1)); diff --git a/src/mainboard/google/nyan_blaze/Kconfig b/src/mainboard/google/nyan_blaze/Kconfig index 0782cc0fd6..530397c425 100644 --- a/src/mainboard/google/nyan_blaze/Kconfig +++ b/src/mainboard/google/nyan_blaze/Kconfig @@ -34,6 +34,7 @@ config BOARD_SPECIFIC_OPTIONS # dummy select SPI_FLASH_FAST_READ_DUAL_OUTPUT_3B config CHROMEOS + select EC_GOOGLE_CHROMEEC_SWITCHES select EC_SOFTWARE_SYNC select VBOOT_VBNV_EC select VIRTUAL_DEV_SWITCH diff --git a/src/mainboard/google/nyan_blaze/chromeos.c b/src/mainboard/google/nyan_blaze/chromeos.c index eddf15005b..2c9ba28e5f 100644 --- a/src/mainboard/google/nyan_blaze/chromeos.c +++ b/src/mainboard/google/nyan_blaze/chromeos.c @@ -14,17 +14,9 @@ */ #include -#include -#include -#include +#include #include #include -#include - -//enum { -// ACTIVE_LOW = 0, -// ACTIVE_HIGH = 1 -//}; void fill_lb_gpios(struct lb_gpios *gpios) { @@ -40,20 +32,6 @@ void fill_lb_gpios(struct lb_gpios *gpios) lb_add_gpios(gpios, chromeos_gpios, ARRAY_SIZE(chromeos_gpios)); } -int get_developer_mode_switch(void) -{ - return 0; -} - -int get_recovery_mode_switch(void) -{ - uint32_t ec_events; - - ec_events = google_chromeec_get_events_b(); - return !!(ec_events & - EC_HOST_EVENT_MASK(EC_HOST_EVENT_KEYBOARD_RECOVERY)); -} - int get_write_protect_state(void) { return !gpio_get(GPIO(R1)); diff --git a/src/mainboard/google/oak/Kconfig b/src/mainboard/google/oak/Kconfig index acb27de55f..01bd0bcffb 100644 --- a/src/mainboard/google/oak/Kconfig +++ b/src/mainboard/google/oak/Kconfig @@ -34,6 +34,7 @@ config BOARD_SPECIFIC_OPTIONS select SPI_FLASH config CHROMEOS + select EC_GOOGLE_CHROMEEC_SWITCHES select EC_SOFTWARE_SYNC select VBOOT_EC_SLOW_UPDATE select VBOOT_OPROM_MATTERS diff --git a/src/mainboard/google/oak/chromeos.c b/src/mainboard/google/oak/chromeos.c index 0265c7a3c4..60c24e76ae 100644 --- a/src/mainboard/google/oak/chromeos.c +++ b/src/mainboard/google/oak/chromeos.c @@ -14,13 +14,10 @@ */ #include +#include #include -#include -#include -#include #include #include -#include #include "gpio.h" @@ -50,20 +47,6 @@ void fill_lb_gpios(struct lb_gpios *gpios) lb_add_gpios(gpios, chromeos_gpios, ARRAY_SIZE(chromeos_gpios)); } -int get_developer_mode_switch(void) -{ - return 0; -} - -int get_recovery_mode_switch(void) -{ - uint32_t ec_events; - - ec_events = google_chromeec_get_events_b(); - return !!(ec_events & - EC_HOST_EVENT_MASK(EC_HOST_EVENT_KEYBOARD_RECOVERY)); -} - int get_write_protect_state(void) { return !gpio_get(WRITE_PROTECT); diff --git a/src/mainboard/google/peppy/Kconfig b/src/mainboard/google/peppy/Kconfig index 8829371bcd..b35cc58d19 100644 --- a/src/mainboard/google/peppy/Kconfig +++ b/src/mainboard/google/peppy/Kconfig @@ -22,6 +22,7 @@ config BOARD_SPECIFIC_OPTIONS # dummy select INTEL_INT15 config CHROMEOS + select EC_GOOGLE_CHROMEEC_SWITCHES select EC_SOFTWARE_SYNC select LID_SWITCH select MAINBOARD_DO_NATIVE_VGA_INIT diff --git a/src/mainboard/google/peppy/chromeos.c b/src/mainboard/google/peppy/chromeos.c index a8cef3279b..22ec0742e2 100644 --- a/src/mainboard/google/peppy/chromeos.c +++ b/src/mainboard/google/peppy/chromeos.c @@ -15,18 +15,10 @@ #include #include -#include -#include -#include #include #include #include -#if CONFIG_EC_GOOGLE_CHROMEEC -#include "ec.h" -#include -#endif - #ifndef __PRE_RAM__ #include @@ -44,45 +36,6 @@ void fill_lb_gpios(struct lb_gpios *gpios) } #endif -int get_lid_switch(void) -{ -#if CONFIG_EC_GOOGLE_CHROMEEC - u8 ec_switches = inb(EC_LPC_ADDR_MEMMAP + EC_MEMMAP_SWITCHES); - - return !!(ec_switches & EC_SWITCH_LID_OPEN); -#else - return 0; -#endif -} - -/* The dev-switch is virtual */ -int get_developer_mode_switch(void) -{ - return 0; -} - -/* There are actually two recovery switches. One is the magic keyboard chord, - * the other is driven by Servo. */ -int get_recovery_mode_switch(void) -{ -#if CONFIG_EC_GOOGLE_CHROMEEC - u8 ec_switches = inb(EC_LPC_ADDR_MEMMAP + EC_MEMMAP_SWITCHES); - u32 ec_events; - - /* If a switch is set, we don't need to look at events. */ - if (ec_switches & (EC_SWITCH_DEDICATED_RECOVERY)) - return 1; - - /* Else check if the EC has posted the keyboard recovery event. */ - ec_events = google_chromeec_get_events_b(); - - return !!(ec_events & - EC_HOST_EVENT_MASK(EC_HOST_EVENT_KEYBOARD_RECOVERY)); -#else - return 0; -#endif -} - int get_write_protect_state(void) { return get_gpio(58); diff --git a/src/mainboard/google/rambi/Kconfig b/src/mainboard/google/rambi/Kconfig index 48af3b396f..94354c9c92 100644 --- a/src/mainboard/google/rambi/Kconfig +++ b/src/mainboard/google/rambi/Kconfig @@ -13,6 +13,7 @@ config BOARD_SPECIFIC_OPTIONS select MAINBOARD_HAS_LPC_TPM config CHROMEOS + select EC_GOOGLE_CHROMEEC_SWITCHES select EC_SOFTWARE_SYNC select LID_SWITCH select VBOOT_VBNV_CMOS diff --git a/src/mainboard/google/rambi/chromeos.c b/src/mainboard/google/rambi/chromeos.c index 4304179d4b..10e076209d 100644 --- a/src/mainboard/google/rambi/chromeos.c +++ b/src/mainboard/google/rambi/chromeos.c @@ -14,19 +14,10 @@ */ #include -#include #include -#include -#include #include -#include #include -#if CONFIG_EC_GOOGLE_CHROMEEC -#include "ec.h" -#include -#endif - /* The WP status pin lives on GPIO_SSUS_6 which is pad 36 in the SUS well. */ #define WP_STATUS_PAD 36 @@ -47,55 +38,6 @@ void fill_lb_gpios(struct lb_gpios *gpios) } #endif -int get_lid_switch(void) -{ -#if CONFIG_EC_GOOGLE_CHROMEEC - u8 ec_switches = inb(EC_LPC_ADDR_MEMMAP + EC_MEMMAP_SWITCHES); - - return !!(ec_switches & EC_SWITCH_LID_OPEN); -#else - /* Default to force open. */ - return 1; -#endif -} - -int get_developer_mode_switch(void) -{ - return 0; -} - -int get_recovery_mode_switch(void) -{ -#if CONFIG_EC_GOOGLE_CHROMEEC - u8 ec_switches = inb(EC_LPC_ADDR_MEMMAP + EC_MEMMAP_SWITCHES); - u32 ec_events; - - /* If a switch is set, we don't need to look at events. */ - if (ec_switches & (EC_SWITCH_DEDICATED_RECOVERY)) - return 1; - - /* Else check if the EC has posted the keyboard recovery event. */ - ec_events = google_chromeec_get_events_b(); - - return !!(ec_events & - EC_HOST_EVENT_MASK(EC_HOST_EVENT_KEYBOARD_RECOVERY)); -#else - return 0; -#endif -} - -int clear_recovery_mode_switch(void) -{ -#if CONFIG_EC_GOOGLE_CHROMEEC - const uint32_t kb_rec_mask = - EC_HOST_EVENT_MASK(EC_HOST_EVENT_KEYBOARD_RECOVERY); - /* Unconditionally clear the EC recovery request. */ - return google_chromeec_clear_events_b(kb_rec_mask); -#else - return 0; -#endif -} - int get_write_protect_state(void) { /* diff --git a/src/mainboard/google/reef/Kconfig b/src/mainboard/google/reef/Kconfig index 4d76f3838b..2cc391eeca 100644 --- a/src/mainboard/google/reef/Kconfig +++ b/src/mainboard/google/reef/Kconfig @@ -33,8 +33,9 @@ config DRIVER_TPM_I2C_IRQ default 60 # GPE0_DW1_28 config CHROMEOS - select LID_SWITCH if BASEBOARD_REEF_LAPTOP + select EC_GOOGLE_CHROMEEC_SWITCHES select HAS_RECOVERY_MRC_CACHE + select LID_SWITCH if BASEBOARD_REEF_LAPTOP config DRIVERS_I2C_DA7219 default y diff --git a/src/mainboard/google/reef/chromeos.c b/src/mainboard/google/reef/chromeos.c index 506f9de94b..256db16548 100644 --- a/src/mainboard/google/reef/chromeos.c +++ b/src/mainboard/google/reef/chromeos.c @@ -15,7 +15,6 @@ #include #include -#include #include #include #include @@ -36,43 +35,6 @@ void fill_lb_gpios(struct lb_gpios *gpios) lb_add_gpios(gpios, chromeos_gpios, ARRAY_SIZE(chromeos_gpios)); } -int get_lid_switch(void) -{ - /* Read lid switch state from the EC. */ - return !!(google_chromeec_get_switches() & EC_SWITCH_LID_OPEN); -} - -int get_developer_mode_switch(void) -{ - /* No physical developer mode switch. It's virtual. */ - return 0; -} - -int get_recovery_mode_switch(void) -{ - /* Check if the EC has posted the keyboard recovery event. */ - return !!(google_chromeec_get_events_b() & - EC_HOST_EVENT_MASK(EC_HOST_EVENT_KEYBOARD_RECOVERY)); -} - -int get_recovery_mode_retrain_switch(void) -{ - /* - * Check if the EC has posted the keyboard recovery event with memory - * retrain. - */ - return !!(google_chromeec_get_events_b() & - EC_HOST_EVENT_MASK(EC_HOST_EVENT_KEYBOARD_RECOVERY_HW_REINIT)); -} - -int clear_recovery_mode_switch(void) -{ - /* Clear all host event bits requesting recovery mode. */ - return google_chromeec_clear_events_b( - EC_HOST_EVENT_MASK(EC_HOST_EVENT_KEYBOARD_RECOVERY) | - EC_HOST_EVENT_MASK(EC_HOST_EVENT_KEYBOARD_RECOVERY_HW_REINIT)); -} - int get_write_protect_state(void) { /* Read PCH_WP GPIO. */ diff --git a/src/mainboard/google/samus/Kconfig b/src/mainboard/google/samus/Kconfig index 0275189f51..46fc7a3f43 100644 --- a/src/mainboard/google/samus/Kconfig +++ b/src/mainboard/google/samus/Kconfig @@ -17,6 +17,7 @@ config BOARD_SPECIFIC_OPTIONS # dummy config CHROMEOS select CHROMEOS_RAMOOPS_DYNAMIC + select EC_GOOGLE_CHROMEEC_SWITCHES select EC_SOFTWARE_SYNC select LID_SWITCH select VBOOT_EC_SLOW_UPDATE diff --git a/src/mainboard/google/samus/chromeos.c b/src/mainboard/google/samus/chromeos.c index 7010ac9b6d..ea099f55b4 100644 --- a/src/mainboard/google/samus/chromeos.c +++ b/src/mainboard/google/samus/chromeos.c @@ -15,16 +15,9 @@ #include #include -#include -#include -#include -#include #include -#include -#include #include - /* SPI Write protect is GPIO 16 */ #define CROS_WP_GPIO 16 @@ -45,50 +38,6 @@ void fill_lb_gpios(struct lb_gpios *gpios) } #endif -int get_lid_switch(void) -{ - u8 ec_switches = inb(EC_LPC_ADDR_MEMMAP + EC_MEMMAP_SWITCHES); - - return !!(ec_switches & EC_SWITCH_LID_OPEN); -} - -/* The dev-switch is virtual */ -int get_developer_mode_switch(void) -{ - return 0; -} - -/* There are actually two recovery switches. One is the magic keyboard chord, - * the other is driven by Servo. */ -int get_recovery_mode_switch(void) -{ -#if CONFIG_EC_GOOGLE_CHROMEEC - u8 ec_switches = inb(EC_LPC_ADDR_MEMMAP + EC_MEMMAP_SWITCHES); - u32 ec_events; - - /* If a switch is set, we don't need to look at events. */ - if (ec_switches & (EC_SWITCH_DEDICATED_RECOVERY)) - return 1; - - /* Else check if the EC has posted the keyboard recovery event. */ - ec_events = google_chromeec_get_events_b(); - - return !!(ec_events & - EC_HOST_EVENT_MASK(EC_HOST_EVENT_KEYBOARD_RECOVERY)); -#else - return 0; -#endif -} - -int clear_recovery_mode_switch(void) -{ - const uint32_t kb_rec_mask = - EC_HOST_EVENT_MASK(EC_HOST_EVENT_KEYBOARD_RECOVERY); - - /* Unconditionally clear the EC recovery request. */ - return google_chromeec_clear_events_b(kb_rec_mask); -} - int get_write_protect_state(void) { return get_gpio(CROS_WP_GPIO); diff --git a/src/mainboard/google/smaug/Kconfig b/src/mainboard/google/smaug/Kconfig index 665545325b..ba6252b830 100644 --- a/src/mainboard/google/smaug/Kconfig +++ b/src/mainboard/google/smaug/Kconfig @@ -33,6 +33,7 @@ config BOARD_SPECIFIC_OPTIONS # dummy select RAM_CODE_SUPPORT config CHROMEOS + select EC_GOOGLE_CHROMEEC_SWITCHES select EC_SOFTWARE_SYNC select VBOOT_VBNV_FLASH select VIRTUAL_DEV_SWITCH diff --git a/src/mainboard/google/smaug/chromeos.c b/src/mainboard/google/smaug/chromeos.c index 8688937fd6..0372584ae0 100644 --- a/src/mainboard/google/smaug/chromeos.c +++ b/src/mainboard/google/smaug/chromeos.c @@ -13,13 +13,9 @@ * GNU General Public License for more details. */ -#include +#include #include -#include -#include -#include #include -#include #include "gpio.h" @@ -37,24 +33,6 @@ void fill_lb_gpios(struct lb_gpios *gpios) lb_add_gpios(gpios, chromeos_gpios, ARRAY_SIZE(chromeos_gpios)); } -int get_developer_mode_switch(void) -{ - return 0; -} - -int get_recovery_mode_switch(void) -{ - uint32_t ec_events; - - ec_events = google_chromeec_get_events_b(); - - /* Enter recovery mode either on keyboard recovery / fastboot event. */ - return !!((ec_events & - EC_HOST_EVENT_MASK(EC_HOST_EVENT_KEYBOARD_RECOVERY)) || - (ec_events & - EC_HOST_EVENT_MASK(EC_HOST_EVENT_KEYBOARD_FASTBOOT))); -} - int get_write_protect_state(void) { return !gpio_get(WRITE_PROTECT_L); -- cgit v1.2.3