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 <furquan@chromium.org>
Reviewed-on: https://review.coreboot.org/17449
Tested-by: build bot (Jenkins)
Reviewed-by: Julius Werner <jwerner@chromium.org>
This commit is contained in:
Furquan Shaikh
2016-11-15 20:33:29 -08:00
committed by Furquan Shaikh
parent f8a274acf5
commit cd2afc0df0
50 changed files with 106 additions and 875 deletions

View File

@ -158,3 +158,10 @@ config EC_GOOGLE_CHROMEEC_PD_FIRMWARE_FILE
depends on EC_GOOGLE_CHROMEEC_PD_FIRMWARE_EXTERNAL
help
The path and filename of the PD firmware file to use.
config EC_GOOGLE_CHROMEEC_SWITCHES
depends on EC_GOOGLE_CHROMEEC && CHROMEOS
bool
help
Enable support for Chrome OS mode switches provided by the Chrome OS
EC.

View File

@ -29,6 +29,10 @@ smm-$(CONFIG_VBOOT) += vboot_storage.c
romstage-$(CONFIG_VBOOT) += vboot_storage.c
verstage-$(CONFIG_VBOOT) += vboot_storage.c
verstage-$(CONFIG_EC_GOOGLE_CHROMEEC_SWITCHES) += switches.c
romstage-$(CONFIG_EC_GOOGLE_CHROMEEC_SWITCHES) += switches.c
ramstage-$(CONFIG_EC_GOOGLE_CHROMEEC_SWITCHES) += switches.c
CHROMEEC_SOURCE ?= $(top)/3rdparty/chromeec
# These are Chrome EC firmware images that a payload (such as depthcharge) can

View File

@ -0,0 +1,59 @@
/*
* This file is part of the coreboot project.
*
* Copyright 2016 Google Inc.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 2 of the License.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*/
#include <bootmode.h>
#include <ec/google/chromeec/ec.h>
#if IS_ENABLED(CONFIG_EC_GOOGLE_CHROMEEC_LPC)
int get_lid_switch(void)
{
if (!IS_ENABLED(CONFIG_LID_SWITCH))
return -1;
return !!(google_chromeec_get_switches() & EC_SWITCH_LID_OPEN);
}
#endif
int get_recovery_mode_switch(void)
{
/* Check for dedicated recovery switch first. */
if (IS_ENABLED(CONFIG_EC_GOOGLE_CHROMEEC_LPC) &&
(google_chromeec_get_switches() & EC_SWITCH_DEDICATED_RECOVERY))
return 1;
/* Check if the EC has posted the keyboard recovery/fastboot event. */
return !!(google_chromeec_get_events_b() &
(EC_HOST_EVENT_MASK(EC_HOST_EVENT_KEYBOARD_RECOVERY) |
EC_HOST_EVENT_MASK(EC_HOST_EVENT_KEYBOARD_FASTBOOT)));
}
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) |
EC_HOST_EVENT_MASK(EC_HOST_EVENT_KEYBOARD_FASTBOOT));
}

View File

@ -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

View File

@ -14,14 +14,8 @@
*/
#include <string.h>
#include <arch/io.h>
#include <device/device.h>
#include <device/pci.h>
#include <console/console.h>
#include <vendorcode/google/chromeos/chromeos.h>
#include <ec/google/chromeec/ec.h>
#include <soc/gpio.h>
#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);

View File

@ -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

View File

@ -14,14 +14,8 @@
*/
#include <string.h>
#include <arch/io.h>
#include <device/device.h>
#include <device/pci.h>
#include <console/console.h>
#include <vendorcode/google/chromeos/chromeos.h>
#include <ec/google/chromeec/ec.h>
#include <soc/gpio.h>
#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);

View File

@ -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

View File

@ -14,19 +14,13 @@
* GNU General Public License for more details.
*/
#include <arch/io.h>
#include <console/console.h>
#include <device/device.h>
#include <device/pci.h>
#include <rules.h>
#include <gpio.h>
#include <soc/gpio.h>
#include <string.h>
#include <ec/google/chromeec/ec.h>
#include <vendorcode/google/chromeos/chromeos.h>
#include "gpio.h"
#include "ec.h"
#if ENV_RAMSTAGE
#include <boot/coreboot_tables.h>
@ -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. */

View File

@ -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

View File

@ -15,12 +15,6 @@
*/
#include <arch/io.h>
#include <device/device.h>
#include <device/pci.h>
#if IS_ENABLED(CONFIG_EC_GOOGLE_CHROMEEC)
#include "ec.h"
#include <ec/google/chromeec/ec.h>
#endif
#include <rules.h>
#include <soc/gpio.h>
#include <string.h>
@ -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)
{
/*

View File

@ -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

View File

@ -15,17 +15,9 @@
#include <string.h>
#include <bootmode.h>
#include <arch/io.h>
#include <device/device.h>
#include <device/pci.h>
#include <soc/gpio.h>
#include <vendorcode/google/chromeos/chromeos.h>
#if CONFIG_EC_GOOGLE_CHROMEEC
#include "ec.h"
#include <ec/google/chromeec/ec.h>
#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)
{
/*

View File

@ -18,6 +18,7 @@ config BOARD_SPECIFIC_OPTIONS
select TPM2
config CHROMEOS
select EC_GOOGLE_CHROMEEC_SWITCHES
select LID_SWITCH
config DRIVERS_I2C_GENERIC

View File

@ -14,15 +14,12 @@
* GNU General Public License for more details.
*/
#include <arch/io.h>
#include <rules.h>
#include <gpio.h>
#include <soc/gpio.h>
#include <ec/google/chromeec/ec.h>
#include <vendorcode/google/chromeos/chromeos.h>
#include "gpio.h"
#include "ec.h"
#if ENV_RAMSTAGE
#include <boot/coreboot_tables.h>
@ -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. */

View File

@ -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

View File

@ -15,18 +15,10 @@
#include <string.h>
#include <bootmode.h>
#include <arch/io.h>
#include <device/device.h>
#include <device/pci.h>
#include <southbridge/intel/lynxpoint/pch.h>
#include <southbridge/intel/common/gpio.h>
#include <vendorcode/google/chromeos/chromeos.h>
#if CONFIG_EC_GOOGLE_CHROMEEC
#include "ec.h"
#include <ec/google/chromeec/ec.h>
#endif
#ifndef __PRE_RAM__
#include <boot/coreboot_tables.h>
@ -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);

View File

@ -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

View File

@ -14,19 +14,14 @@
* GNU General Public License for more details.
*/
#include <arch/io.h>
#include <console/console.h>
#include <device/device.h>
#include <device/pci.h>
#include <bootmode.h>
#include <rules.h>
#include <gpio.h>
#include <soc/gpio.h>
#include <string.h>
#include <ec/google/chromeec/ec.h>
#include <vendorcode/google/chromeos/chromeos.h>
#include "gpio.h"
#include "ec.h"
#if ENV_RAMSTAGE
#include <boot/coreboot_tables.h>
@ -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. */

View File

@ -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

View File

@ -14,11 +14,9 @@
*
*/
#include <bootmode.h>
#include <boot/coreboot_tables.h>
#include <ec/google/chromeec/ec.h>
#include <ec/google/chromeec/ec_commands.h>
#include <gpio.h>
#include <vendorcode/google/chromeos/chromeos.h>
#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);

View File

@ -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

View File

@ -14,19 +14,13 @@
* GNU General Public License for more details.
*/
#include <arch/io.h>
#include <console/console.h>
#include <device/device.h>
#include <device/pci.h>
#include <rules.h>
#include <gpio.h>
#include <soc/gpio.h>
#include <string.h>
#include <ec/google/chromeec/ec.h>
#include <vendorcode/google/chromeos/chromeos.h>
#include "gpio.h"
#include "ec.h"
#if ENV_RAMSTAGE
#include <boot/coreboot_tables.h>
@ -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. */

View File

@ -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

View File

@ -15,13 +15,8 @@
#include <string.h>
#include <bootmode.h>
#include <arch/io.h>
#include <device/device.h>
#include <device/pci.h>
#include <southbridge/intel/bd82x6x/pch.h>
#include <southbridge/intel/common/gpio.h>
#include "ec.h"
#include <ec/google/chromeec/ec.h>
#include <vendorcode/google/chromeos/chromeos.h>
#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),

View File

@ -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

View File

@ -15,16 +15,8 @@
#include <string.h>
#include <vendorcode/google/chromeos/chromeos.h>
#include <arch/io.h>
#include <device/device.h>
#include <device/pci.h>
#include <soc/gpio.h>
#if CONFIG_EC_GOOGLE_CHROMEEC
#include "ec.h"
#include <ec/google/chromeec/ec.h>
#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)
{
/*

View File

@ -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

View File

@ -15,12 +15,8 @@
#include <boot/coreboot_tables.h>
#include <bootmode.h>
#include <console/console.h>
#include <ec/google/chromeec/ec.h>
#include <ec/google/chromeec/ec_commands.h>
#include <gpio.h>
#include <string.h>
#include <vendorcode/google/chromeos/chromeos.h>
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));

View File

@ -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

View File

@ -15,12 +15,8 @@
#include <boot/coreboot_tables.h>
#include <bootmode.h>
#include <console/console.h>
#include <ec/google/chromeec/ec.h>
#include <ec/google/chromeec/ec_commands.h>
#include <gpio.h>
#include <string.h>
#include <vendorcode/google/chromeos/chromeos.h>
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));

View File

@ -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

View File

@ -14,17 +14,9 @@
*/
#include <boot/coreboot_tables.h>
#include <console/console.h>
#include <ec/google/chromeec/ec.h>
#include <ec/google/chromeec/ec_commands.h>
#include <bootmode.h>
#include <gpio.h>
#include <string.h>
#include <vendorcode/google/chromeos/chromeos.h>
//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));

View File

@ -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

View File

@ -14,13 +14,10 @@
*/
#include <boardid.h>
#include <bootmode.h>
#include <boot/coreboot_tables.h>
#include <console/console.h>
#include <ec/google/chromeec/ec.h>
#include <ec/google/chromeec/ec_commands.h>
#include <gpio.h>
#include <string.h>
#include <vendorcode/google/chromeos/chromeos.h>
#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);

View File

@ -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

View File

@ -15,18 +15,10 @@
#include <string.h>
#include <bootmode.h>
#include <arch/io.h>
#include <device/device.h>
#include <device/pci.h>
#include <southbridge/intel/lynxpoint/pch.h>
#include <southbridge/intel/common/gpio.h>
#include <vendorcode/google/chromeos/chromeos.h>
#if CONFIG_EC_GOOGLE_CHROMEEC
#include "ec.h"
#include <ec/google/chromeec/ec.h>
#endif
#ifndef __PRE_RAM__
#include <boot/coreboot_tables.h>
@ -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);

View File

@ -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

View File

@ -14,19 +14,10 @@
*/
#include <string.h>
#include <arch/io.h>
#include <bootmode.h>
#include <device/device.h>
#include <device/pci.h>
#include <soc/gpio.h>
#include <vboot/vboot_common.h>
#include <vendorcode/google/chromeos/chromeos.h>
#if CONFIG_EC_GOOGLE_CHROMEEC
#include "ec.h"
#include <ec/google/chromeec/ec.h>
#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)
{
/*

View File

@ -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

View File

@ -15,7 +15,6 @@
#include <baseboard/variants.h>
#include <boot/coreboot_tables.h>
#include <ec/google/chromeec/ec.h>
#include <gpio.h>
#include <vendorcode/google/chromeos/chromeos.h>
#include <soc/gpio.h>
@ -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. */

View File

@ -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

View File

@ -15,16 +15,9 @@
#include <string.h>
#include <bootmode.h>
#include <arch/io.h>
#include <device/device.h>
#include <device/pci.h>
#include <console/console.h>
#include <vendorcode/google/chromeos/chromeos.h>
#include <ec/google/chromeec/ec.h>
#include <ec/google/chromeec/ec_commands.h>
#include <soc/gpio.h>
/* 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);

View File

@ -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

View File

@ -13,13 +13,9 @@
* GNU General Public License for more details.
*/
#include <boardid.h>
#include <bootmode.h>
#include <boot/coreboot_tables.h>
#include <console/console.h>
#include <ec/google/chromeec/ec.h>
#include <ec/google/chromeec/ec_commands.h>
#include <string.h>
#include <vendorcode/google/chromeos/chromeos.h>
#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);

View File

@ -33,6 +33,7 @@ config KUNIMITSU_USES_FSP2_0
endchoice
config CHROMEOS
select EC_GOOGLE_CHROMEEC_SWITCHES
select LID_SWITCH
config DRIVERS_GENERIC_MAX98357A

View File

@ -14,19 +14,13 @@
* GNU General Public License for more details.
*/
#include <arch/io.h>
#include <console/console.h>
#include <device/device.h>
#include <device/pci.h>
#include <rules.h>
#include <gpio.h>
#include <soc/gpio.h>
#include <string.h>
#include <ec/google/chromeec/ec.h>
#include <vendorcode/google/chromeos/chromeos.h>
#include "gpio.h"
#include "ec.h"
#if ENV_RAMSTAGE
#include <boot/coreboot_tables.h>
@ -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. */

View File

@ -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

View File

@ -14,14 +14,6 @@
* GNU General Public License for more details.
*/
#include <arch/io.h>
#include <device/device.h>
#include <device/pci.h>
#if IS_ENABLED(CONFIG_EC_GOOGLE_CHROMEEC)
#include "ec.h"
#include <ec/google/chromeec/ec.h>
#endif
#include <rules.h>
#include <gpio.h>
#include <string.h>
@ -49,60 +41,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)
{
/*

View File

@ -17,9 +17,15 @@
#include <string.h>
#include "chromeos.h"
int __attribute__((weak)) get_developer_mode_switch(void)
{
// Weak implementation. No physical developer switch.
return 0;
}
int __attribute__((weak)) clear_recovery_mode_switch(void)
{
// Can be implemented by a mainboard
// Weak implementation. Nothing to do.
return 0;
}