summaryrefslogtreecommitdiff
path: root/board/scarlet
diff options
context:
space:
mode:
authorJack Rosenthal <jrosenth@chromium.org>2021-11-04 12:11:58 -0600
committerCommit Bot <commit-bot@chromium.org>2021-11-05 04:22:34 +0000
commit252457d4b21f46889eebad61d4c0a65331919cec (patch)
tree01856c4d31d710b20e85a74c8d7b5836e35c3b98 /board/scarlet
parent08f5a1e6fc2c9467230444ac9b582dcf4d9f0068 (diff)
downloadchrome-ec-release-R98-14388.B-ish.tar.gz
In the interest of making long-term branch maintenance incur as little technical debt on us as possible, we should not maintain any files on the branch we are not actually using. This has the added effect of making it extremely clear when merging CLs from the main branch when changes have the possibility to affect us. The follow-on CL adds a convenience script to actually pull updates from the main branch and generate a CL for the update. BUG=b:204206272 BRANCH=ish TEST=make BOARD=arcada_ish && make BOARD=drallion_ish Signed-off-by: Jack Rosenthal <jrosenth@chromium.org> Change-Id: I17e4694c38219b5a0823e0a3e55a28d1348f4b18 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3262038 Reviewed-by: Jett Rink <jettrink@chromium.org> Reviewed-by: Tom Hughes <tomhughes@chromium.org>
Diffstat (limited to 'board/scarlet')
-rw-r--r--board/scarlet/battery.c301
-rw-r--r--board/scarlet/board.c459
-rw-r--r--board/scarlet/board.h229
-rw-r--r--board/scarlet/build.mk14
-rw-r--r--board/scarlet/ec.tasklist19
-rw-r--r--board/scarlet/gpio.inc102
-rw-r--r--board/scarlet/led.c144
-rw-r--r--board/scarlet/usb_pd_policy.c71
-rw-r--r--board/scarlet/vif_override.xml3
9 files changed, 0 insertions, 1342 deletions
diff --git a/board/scarlet/battery.c b/board/scarlet/battery.c
deleted file mode 100644
index 0be4cc93e2..0000000000
--- a/board/scarlet/battery.c
+++ /dev/null
@@ -1,301 +0,0 @@
-/* Copyright 2016 The Chromium OS Authors. All rights reserved.
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- *
- * Battery pack vendor provided charging profile
- */
-
-#include "battery.h"
-#include "battery_smart.h"
-#include "charge_state.h"
-#include "chipset.h"
-#include "console.h"
-#include "driver/battery/max17055.h"
-#include "driver/charger/rt946x.h"
-#include "ec_commands.h"
-#include "extpower.h"
-#include "gpio.h"
-#include "hooks.h"
-#include "system.h"
-#include "util.h"
-
-/*
- * AE-Tech battery pack has two charging phases when operating
- * between 10 and 20C
- */
-#define CHARGE_PHASE_CHANGE_TRIP_VOLTAGE_MV 4200
-#define CHARGE_PHASE_CHANGE_HYSTERESIS_MV 50
-#define CHARGE_PHASE_CHANGED_CURRENT_MA 1800
-
-#define TEMP_OUT_OF_RANGE TEMP_ZONE_COUNT
-
-static uint8_t batt_id = 0xff;
-
-/* Do not change the enum values. We directly use strap gpio level to index. */
-enum battery_type {
- BATTERY_SIMPLO = 0,
- BATTERY_AETECH,
- BATTERY_COUNT
-};
-
-static const struct battery_info info[] = {
- [BATTERY_SIMPLO] = {
- .voltage_max = 4400,
- .voltage_normal = 3840,
- .voltage_min = 3000,
- .precharge_current = 256,
- .start_charging_min_c = 0,
- .start_charging_max_c = 45,
- .charging_min_c = 0,
- .charging_max_c = 60,
- .discharging_min_c = -20,
- .discharging_max_c = 60,
- },
- [BATTERY_AETECH] = {
- .voltage_max = 4350,
- .voltage_normal = 3800,
- .voltage_min = 3000,
- .precharge_current = 700,
- .start_charging_min_c = 0,
- .start_charging_max_c = 45,
- .charging_min_c = 0,
- .charging_max_c = 45,
- .discharging_min_c = -20,
- .discharging_max_c = 55,
- }
-};
-
-static const struct max17055_batt_profile batt_profile[] = {
- [BATTERY_SIMPLO] = {
- .is_ez_config = 0,
- .design_cap = 0x221e, /* 8734mAh */
- .ichg_term = 0x589, /* 443 mA */
- /* Empty voltage = 3000mV, Recovery voltage = 3600mV */
- .v_empty_detect = 0x965a,
- .learn_cfg = 0x4406,
- .dpacc = 0x0c7a,
- .rcomp0 = 0x0062,
- .tempco = 0x1327,
- .qr_table00 = 0x1680,
- .qr_table10 = 0x0900,
- .qr_table20 = 0x0280,
- .qr_table30 = 0x0280,
- },
- [BATTERY_AETECH] = {
- .is_ez_config = 0,
- .design_cap = 0x232f, /* 9007mAh */
- .ichg_term = 0x0240, /* 180mA */
- /* Empty voltage = 2700mV, Recovery voltage = 3280mV */
- .v_empty_detect = 0x8752,
- .learn_cfg = 0x4476,
- .dpacc = 0x0c7b,
- .rcomp0 = 0x0077,
- .tempco = 0x1d3f,
- .qr_table00 = 0x1200,
- .qr_table10 = 0x0900,
- .qr_table20 = 0x0480,
- .qr_table30 = 0x0480,
- },
-};
-
-const struct battery_info *battery_get_info(void)
-{
- if (batt_id >= BATTERY_COUNT)
- batt_id = gpio_get_level(GPIO_BATT_ID);
-
- return &info[batt_id];
-}
-
-const struct max17055_batt_profile *max17055_get_batt_profile(void)
-{
- if (batt_id >= BATTERY_COUNT)
- batt_id = gpio_get_level(GPIO_BATT_ID);
-
- return &batt_profile[batt_id];
-}
-
-int board_cut_off_battery(void)
-{
- return rt946x_cutoff_battery();
-}
-
-enum battery_disconnect_state battery_get_disconnect_state(void)
-{
- if (battery_is_present() == BP_YES)
- return BATTERY_NOT_DISCONNECTED;
- return BATTERY_DISCONNECTED;
-}
-
-int charger_profile_override(struct charge_state_data *curr)
-{
- /* battery temp in 0.1 deg C */
- int bat_temp_c = curr->batt.temperature - 2731;
-
- /*
- * Keep track of battery temperature range:
- *
- * ZONE_0 ZONE_1 ZONE_2
- * -----+--------+--------+------------+----- Temperature (C)
- * t0 t1 t2 t3
- */
- enum {
- TEMP_ZONE_0, /* t0 < bat_temp_c <= t1 */
- TEMP_ZONE_1, /* t1 < bat_temp_c <= t2 */
- TEMP_ZONE_2, /* t2 < bat_temp_c <= t3 */
- TEMP_ZONE_COUNT
- } temp_zone;
-
- static struct {
- int temp_min; /* 0.1 deg C */
- int temp_max; /* 0.1 deg C */
- int desired_current; /* mA */
- int desired_voltage; /* mV */
- } temp_zones[BATTERY_COUNT][TEMP_ZONE_COUNT] = {
- [BATTERY_SIMPLO] = {
- {0, 150, 1772, 4376}, /* TEMP_ZONE_0 */
- {150, 450, 4000, 4376}, /* TEMP_ZONE_1 */
- {450, 600, 4000, 4100}, /* TEMP_ZONE_2 */
- },
- [BATTERY_AETECH] = {
- {0, 100, 900, 4200}, /* TEMP_ZONE_0 */
- {100, 200, 2700, 4350}, /* TEMP_ZONE_1 */
- /*
- * TODO(b:70287349): Limit the charging current to
- * 2A unless AE-Tech fix their battery pack.
- */
- {200, 450, 2000, 4350}, /* TEMP_ZONE_2 */
- }
- };
- BUILD_ASSERT(ARRAY_SIZE(temp_zones[0]) == TEMP_ZONE_COUNT);
- BUILD_ASSERT(ARRAY_SIZE(temp_zones) == BATTERY_COUNT);
-
- static int charge_phase = 1;
- static uint8_t quirk_batt_update;
-
- /*
- * This is a quirk for old Simplo battery to clamp
- * charging current to 3A.
- */
- if ((board_get_version() <= 4) && !quirk_batt_update) {
- temp_zones[BATTERY_SIMPLO][TEMP_ZONE_1].desired_current = 3000;
- temp_zones[BATTERY_SIMPLO][TEMP_ZONE_2].desired_current = 3000;
- quirk_batt_update = 1;
- }
-
- if (batt_id >= BATTERY_COUNT)
- batt_id = gpio_get_level(GPIO_BATT_ID);
-
- if ((curr->batt.flags & BATT_FLAG_BAD_TEMPERATURE) ||
- (bat_temp_c < temp_zones[batt_id][0].temp_min) ||
- (bat_temp_c >= temp_zones[batt_id][TEMP_ZONE_COUNT - 1].temp_max))
- temp_zone = TEMP_OUT_OF_RANGE;
- else {
- for (temp_zone = 0; temp_zone < TEMP_ZONE_COUNT; temp_zone++) {
- if (bat_temp_c <
- temp_zones[batt_id][temp_zone].temp_max)
- break;
- }
- }
-
- if (curr->state != ST_CHARGE) {
- charge_phase = 1;
- return 0;
- }
-
- switch (temp_zone) {
- case TEMP_ZONE_0:
- case TEMP_ZONE_2:
- curr->requested_current =
- temp_zones[batt_id][temp_zone].desired_current;
- curr->requested_voltage =
- temp_zones[batt_id][temp_zone].desired_voltage;
- break;
- case TEMP_ZONE_1:
- /* No phase change for Simplo battery pack */
- if (batt_id == BATTERY_SIMPLO)
- charge_phase = 0;
- /*
- * If AE-Tech battery pack is used and the voltage reading
- * is bad, let's be conservative and assume change_phase == 1.
- */
- else if (curr->batt.flags & BATT_FLAG_BAD_VOLTAGE)
- charge_phase = 1;
- else {
- if (curr->batt.voltage <
- (CHARGE_PHASE_CHANGE_TRIP_VOLTAGE_MV -
- CHARGE_PHASE_CHANGE_HYSTERESIS_MV))
- charge_phase = 0;
- else if (curr->batt.voltage >
- CHARGE_PHASE_CHANGE_TRIP_VOLTAGE_MV)
- charge_phase = 1;
- }
-
- curr->requested_voltage =
- temp_zones[batt_id][temp_zone].desired_voltage;
-
- curr->requested_current = (charge_phase) ?
- CHARGE_PHASE_CHANGED_CURRENT_MA :
- temp_zones[batt_id][temp_zone].desired_current;
- break;
- case TEMP_OUT_OF_RANGE:
- curr->requested_current = curr->requested_voltage = 0;
- curr->batt.flags &= ~BATT_FLAG_WANT_CHARGE;
- curr->state = ST_IDLE;
- break;
- }
-
- /*
- * When the charger says it's done charging, even if fuel gauge says
- * SOC < BATTERY_LEVEL_NEAR_FULL, we'll overwrite SOC with
- * BATTERY_LEVEL_NEAR_FULL. So we can ensure both Chrome OS UI
- * and battery LED indicate full charge.
- */
- if (rt946x_is_charge_done()) {
- curr->batt.state_of_charge = MAX(BATTERY_LEVEL_NEAR_FULL,
- curr->batt.state_of_charge);
- /*
- * This is a workaround for b:78792296. When AP is off and
- * charge termination is detected, we disable idle mode.
- */
- if (chipset_in_state(CHIPSET_STATE_ANY_OFF))
- disable_idle();
- else
- enable_idle();
- }
-
- return 0;
-}
-
-static void board_enable_idle(void)
-{
- enable_idle();
-}
-DECLARE_HOOK(HOOK_AC_CHANGE, board_enable_idle, HOOK_PRIO_DEFAULT);
-
-static void board_charge_termination(void)
-{
- static uint8_t te;
- /* Enable charge termination when we are sure battery is present. */
- if (!te && battery_is_present() == BP_YES) {
- if (!rt946x_enable_charge_termination(1))
- te = 1;
- }
-}
-DECLARE_HOOK(HOOK_BATTERY_SOC_CHANGE,
- board_charge_termination,
- HOOK_PRIO_DEFAULT);
-
-/* Customs options controllable by host command. */
-#define PARAM_FASTCHARGE (CS_PARAM_CUSTOM_PROFILE_MIN + 0)
-
-enum ec_status charger_profile_override_get_param(uint32_t param,
- uint32_t *value)
-{
- return EC_RES_INVALID_PARAM;
-}
-
-enum ec_status charger_profile_override_set_param(uint32_t param,
- uint32_t value)
-{
- return EC_RES_INVALID_PARAM;
-}
diff --git a/board/scarlet/board.c b/board/scarlet/board.c
deleted file mode 100644
index f109d0ada3..0000000000
--- a/board/scarlet/board.c
+++ /dev/null
@@ -1,459 +0,0 @@
-/* Copyright 2016 The Chromium OS Authors. All rights reserved.
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-#include "adc.h"
-#include "backlight.h"
-#include "button.h"
-#include "charge_manager.h"
-#include "charge_state.h"
-#include "charge_state_v2.h"
-#include "charger.h"
-#include "chipset.h"
-#include "common.h"
-#include "console.h"
-#include "ec_commands.h"
-#include "driver/accelgyro_bmi_common.h"
-#include "driver/charger/rt946x.h"
-#include "driver/sync.h"
-#include "driver/tcpm/fusb302.h"
-#include "driver/temp_sensor/tmp432.h"
-#include "extpower.h"
-#include "gpio.h"
-#include "hooks.h"
-#include "host_command.h"
-#include "i2c.h"
-#include "power.h"
-#include "power_button.h"
-#include "pwm.h"
-#include "pwm_chip.h"
-#include "registers.h"
-#include "spi.h"
-#include "switch.h"
-#include "system.h"
-#include "task.h"
-#include "tcpm/tcpm.h"
-#include "temp_sensor.h"
-#include "temp_sensor_chip.h"
-#include "timer.h"
-#include "thermal.h"
-#include "usb_charge.h"
-#include "usb_mux.h"
-#include "usb_pd_tcpm.h"
-#include "util.h"
-
-#define CPRINTS(format, args...) cprints(CC_USBCHARGE, format, ## args)
-#define CPRINTF(format, args...) cprintf(CC_USBCHARGE, format, ## args)
-
-static void tcpc_alert_event(enum gpio_signal signal)
-{
- schedule_deferred_pd_interrupt(0 /* port */);
-}
-
-static void overtemp_interrupt(enum gpio_signal signal)
-{
- CPRINTS("AP wants shutdown");
- chipset_force_shutdown(CHIPSET_SHUTDOWN_THERMAL);
-}
-
-static void warm_reset_request_interrupt(enum gpio_signal signal)
-{
- CPRINTS("AP wants warm reset");
- chipset_reset(CHIPSET_RESET_AP_REQ);
-}
-
-#include "gpio_list.h"
-
-/******************************************************************************/
-/* ADC channels. Must be in the exactly same order as in enum adc_channel. */
-const struct adc_t adc_channels[] = {
- [ADC_BOARD_ID] = {"BOARD_ID", 3300, 4096, 0, STM32_AIN(10)},
-};
-BUILD_ASSERT(ARRAY_SIZE(adc_channels) == ADC_CH_COUNT);
-
-/******************************************************************************/
-/* I2C ports */
-const struct i2c_port_t i2c_ports[] = {
- {"charger", I2C_PORT_CHARGER, 400, GPIO_I2C0_SCL, GPIO_I2C0_SDA},
- {"tcpc0", I2C_PORT_TCPC0, 1000, GPIO_I2C1_SCL, GPIO_I2C1_SDA},
-};
-const unsigned int i2c_ports_used = ARRAY_SIZE(i2c_ports);
-
-/******************************************************************************/
-/* Charger Chips */
-const struct charger_config_t chg_chips[] = {
- {
- .i2c_port = I2C_PORT_CHARGER,
- .i2c_addr_flags = RT946X_ADDR_FLAGS,
- .drv = &rt946x_drv,
- },
-};
-
-/* power signal list. Must match order of enum power_signal. */
-const struct power_signal_info power_signal_list[] = {
- {GPIO_PP1250_S3_PG, POWER_SIGNAL_ACTIVE_HIGH, "PP1250_S3_PWR_GOOD"},
- {GPIO_PP900_S0_PG, POWER_SIGNAL_ACTIVE_HIGH, "PP900_S0_PWR_GOOD"},
- {GPIO_AP_CORE_PG, POWER_SIGNAL_ACTIVE_HIGH, "AP_PWR_GOOD"},
- {GPIO_AP_EC_S3_S0_L, POWER_SIGNAL_ACTIVE_LOW, "SUSPEND_DEASSERTED"},
-};
-BUILD_ASSERT(ARRAY_SIZE(power_signal_list) == POWER_SIGNAL_COUNT);
-
-#ifdef CONFIG_TEMP_SENSOR_TMP432
-/* Temperature sensors data; must be in same order as enum temp_sensor_id. */
-const struct temp_sensor_t temp_sensors[] = {
- {"TMP432_Internal", TEMP_SENSOR_TYPE_BOARD, tmp432_get_val,
- TMP432_IDX_LOCAL, 4},
- {"TMP432_Sensor_1", TEMP_SENSOR_TYPE_BOARD, tmp432_get_val,
- TMP432_IDX_REMOTE1, 4},
- {"TMP432_Sensor_2", TEMP_SENSOR_TYPE_BOARD, tmp432_get_val,
- TMP432_IDX_REMOTE2, 4},
-};
-BUILD_ASSERT(ARRAY_SIZE(temp_sensors) == TEMP_SENSOR_COUNT);
-
-/*
- * Thermal limits for each temp sensor. All temps are in degrees K. Must be in
- * same order as enum temp_sensor_id. To always ignore any temp, use 0.
- */
-struct ec_thermal_config thermal_params[] = {
- {{0, 0, 0}, 0, 0}, /* TMP432_Internal */
- {{0, 0, 0}, 0, 0}, /* TMP432_Sensor_1 */
- {{0, 0, 0}, 0, 0}, /* TMP432_Sensor_2 */
-};
-BUILD_ASSERT(ARRAY_SIZE(thermal_params) == TEMP_SENSOR_COUNT);
-#endif
-
-/******************************************************************************/
-/* SPI devices */
-const struct spi_device_t spi_devices[] = {
- { CONFIG_SPI_ACCEL_PORT, 1, GPIO_SPI_ACCEL_CS_L },
-};
-const unsigned int spi_devices_used = ARRAY_SIZE(spi_devices);
-
-/******************************************************************************/
-const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_MAX_COUNT] = {
- {
- .bus_type = EC_BUS_TYPE_I2C,
- .i2c_info = {
- .port = I2C_PORT_TCPC0,
- .addr_flags = FUSB302_I2C_ADDR_FLAGS,
- },
- .drv = &fusb302_tcpm_drv,
- },
-};
-
-const struct usb_mux usb_muxes[CONFIG_USB_PD_PORT_MAX_COUNT] = {
- {
- .usb_port = 0,
- .driver = &virtual_usb_mux_driver,
- .hpd_update = &virtual_hpd_update,
- },
-};
-
-void board_reset_pd_mcu(void)
-{
-}
-
-enum critical_shutdown board_critical_shutdown_check(
- struct charge_state_data *curr)
-{
- if ((curr->batt.flags & BATT_FLAG_BAD_VOLTAGE) ||
- (curr->batt.voltage <= BAT_LOW_VOLTAGE_THRESH))
- return CRITICAL_SHUTDOWN_CUTOFF;
- else
- return CRITICAL_SHUTDOWN_IGNORE;
-}
-
-uint16_t tcpc_get_alert_status(void)
-{
- uint16_t status = 0;
-
- if (!gpio_get_level(GPIO_USB_C0_PD_INT_L))
- status |= PD_STATUS_TCPC_ALERT_0;
-
- return status;
-}
-
-int board_set_active_charge_port(int charge_port)
-{
- CPRINTS("New chg p%d", charge_port);
-
- switch (charge_port) {
- case 0:
- /* Don't charge from a source port */
- if (board_vbus_source_enabled(charge_port))
- return -1;
- break;
- case CHARGE_PORT_NONE:
- /*
- * To ensure the fuel gauge (max17055) is always powered
- * even when battery is disconnected, keep VBAT rail on but
- * set the charging current to minimum.
- */
- charger_set_current(CHARGER_SOLO, 0);
- break;
- default:
- panic("Invalid charge port\n");
- break;
- }
-
- return EC_SUCCESS;
-}
-
-void board_set_charge_limit(int port, int supplier, int charge_ma,
- int max_ma, int charge_mv)
-{
- charge_set_input_current_limit(MAX(charge_ma,
- CONFIG_CHARGER_INPUT_CURRENT), charge_mv);
-}
-
-int extpower_is_present(void)
-{
- /*
- * The charger will indicate VBUS presence if we're sourcing 5V,
- * so exclude such ports.
- */
- if (board_vbus_source_enabled(0))
- return 0;
- else
- return tcpm_check_vbus_level(0, VBUS_PRESENT);
-}
-
-int pd_snk_is_vbus_provided(int port)
-{
- if (port)
- panic("Invalid charge port\n");
-
- return rt946x_is_vbus_ready();
-}
-
-static void board_spi_enable(void)
-{
- gpio_config_module(MODULE_SPI_CONTROLLER, 1);
-
- /* Enable clocks to SPI2 module */
- STM32_RCC_APB1ENR |= STM32_RCC_PB1_SPI2;
-
- /* Reset SPI2 */
- STM32_RCC_APB1RSTR |= STM32_RCC_PB1_SPI2;
- STM32_RCC_APB1RSTR &= ~STM32_RCC_PB1_SPI2;
-
- spi_enable(&spi_devices[0], 1);
-}
-DECLARE_HOOK(HOOK_CHIPSET_STARTUP,
- board_spi_enable,
- MOTION_SENSE_HOOK_PRIO - 1);
-
-static void board_spi_disable(void)
-{
- spi_enable(&spi_devices[0], 0);
-
- /* Disable clocks to SPI2 module */
- STM32_RCC_APB1ENR &= ~STM32_RCC_PB1_SPI2;
-
- gpio_config_module(MODULE_SPI_CONTROLLER, 0);
-}
-DECLARE_HOOK(HOOK_CHIPSET_SHUTDOWN,
- board_spi_disable,
- MOTION_SENSE_HOOK_PRIO + 1);
-
-static void board_init(void)
-{
- /* Enable TCPC alert interrupts */
- gpio_enable_interrupt(GPIO_USB_C0_PD_INT_L);
-
- /* Enable charger interrupts */
- gpio_enable_interrupt(GPIO_CHARGER_INT_L);
-
- /* Enable reboot / shutdown control inputs from AP */
- gpio_enable_interrupt(GPIO_WARM_RESET_REQ);
- gpio_enable_interrupt(GPIO_AP_OVERTEMP);
-
- /* Enable interrupts from BMI160 sensor. */
- gpio_enable_interrupt(GPIO_ACCEL_INT_L);
-
- /* Enable interrupt for the camera vsync. */
- gpio_enable_interrupt(GPIO_SYNC_INT);
-
- /* Set SPI2 pins to high speed */
- /* pins D0/D1/D3/D4 */
- STM32_GPIO_OSPEEDR(GPIO_D) |= 0x000003cf;
-
- /* Sensor Init */
- if (system_jumped_late() && chipset_in_state(CHIPSET_STATE_ON))
- board_spi_enable();
-}
-DECLARE_HOOK(HOOK_INIT, board_init, HOOK_PRIO_DEFAULT);
-
-void board_config_pre_init(void)
-{
- STM32_RCC_AHBENR |= STM32_RCC_HB_DMA1;
- /*
- * Remap USART1 and SPI2 DMA:
- *
- * Ch4: USART1_TX / Ch5: USART1_RX (1000)
- * Ch6: SPI2_RX / Ch7: SPI2_TX (0011)
- */
- STM32_DMA_CSELR(STM32_DMAC_CH4) = (8 << 12) | (8 << 16) |
- (3 << 20) | (3 << 24);
-}
-
-enum scarlet_board_version {
- BOARD_VERSION_UNKNOWN = -1,
- BOARD_VERSION_REV0 = 0,
- BOARD_VERSION_REV1 = 1,
- BOARD_VERSION_REV2 = 2,
- BOARD_VERSION_REV3 = 3,
- BOARD_VERSION_REV4 = 4,
- BOARD_VERSION_REV5 = 5,
- BOARD_VERSION_REV6 = 6,
- BOARD_VERSION_REV7 = 7,
- BOARD_VERSION_REV8 = 8,
- BOARD_VERSION_REV9 = 9,
- BOARD_VERSION_REV10 = 10,
- BOARD_VERSION_REV11 = 11,
- BOARD_VERSION_REV12 = 12,
- BOARD_VERSION_REV13 = 13,
- BOARD_VERSION_REV14 = 14,
- BOARD_VERSION_REV15 = 15,
- BOARD_VERSION_COUNT,
-};
-
-struct {
- enum scarlet_board_version version;
- int expect_mv;
-} const scarlet_boards[] = {
- { BOARD_VERSION_REV0, 109 }, /* 51.1K , 2.2K(gru 3.3K) ohm */
- { BOARD_VERSION_REV1, 211 }, /* 51.1k , 6.8K ohm */
- { BOARD_VERSION_REV2, 319 }, /* 51.1K , 11K ohm */
- { BOARD_VERSION_REV3, 427 }, /* 56K , 17.4K ohm */
- { BOARD_VERSION_REV4, 542 }, /* 51.1K , 22K ohm */
- { BOARD_VERSION_REV5, 666 }, /* 51.1K , 30K ohm */
- { BOARD_VERSION_REV6, 781 }, /* 51.1K , 39.2K ohm */
- { BOARD_VERSION_REV7, 900 }, /* 56K , 56K ohm */
- { BOARD_VERSION_REV8, 1023 }, /* 47K , 61.9K ohm */
- { BOARD_VERSION_REV9, 1137 }, /* 47K , 80.6K ohm */
- { BOARD_VERSION_REV10, 1240 }, /* 56K , 124K ohm */
- { BOARD_VERSION_REV11, 1343 }, /* 51.1K , 150K ohm */
- { BOARD_VERSION_REV12, 1457 }, /* 47K , 200K ohm */
- { BOARD_VERSION_REV13, 1576 }, /* 47K , 330K ohm */
- { BOARD_VERSION_REV14, 1684 }, /* 47K , 680K ohm */
- { BOARD_VERSION_REV15, 1800 }, /* 56K , NC */
-};
-BUILD_ASSERT(ARRAY_SIZE(scarlet_boards) == BOARD_VERSION_COUNT);
-
-#define THRESHOLD_MV 56 /* Simply assume 1800/16/2 */
-
-int board_get_version(void)
-{
- static int version = BOARD_VERSION_UNKNOWN;
- int mv;
- int i;
-
- if (version != BOARD_VERSION_UNKNOWN)
- return version;
-
- gpio_set_level(GPIO_EC_BOARD_ID_EN_L, 0);
- /* Wait to allow cap charge */
- msleep(10);
- mv = adc_read_channel(ADC_BOARD_ID);
-
- if (mv == ADC_READ_ERROR)
- mv = adc_read_channel(ADC_BOARD_ID);
-
- gpio_set_level(GPIO_EC_BOARD_ID_EN_L, 1);
-
- for (i = 0; i < BOARD_VERSION_COUNT; ++i) {
- if (mv < scarlet_boards[i].expect_mv + THRESHOLD_MV) {
- version = scarlet_boards[i].version;
- break;
- }
- }
-
- /*
- * Disable ADC module after we detect the board version,
- * since this is the only thing ADC module needs to do
- * for this board.
- */
- if (version != BOARD_VERSION_UNKNOWN)
- adc_disable();
-
- return version;
-}
-
-/* Motion sensors */
-/* Mutexes */
-static struct mutex g_base_mutex;
-
-static struct bmi_drv_data_t g_bmi160_data;
-
-/* Matrix to rotate accelerometer into standard reference frame */
-const mat33_fp_t base_standard_ref = {
- { FLOAT_TO_FP(-1), 0, 0},
- { 0, FLOAT_TO_FP(-1), 0},
- { 0, 0, FLOAT_TO_FP(1)}
-};
-
-struct motion_sensor_t motion_sensors[] = {
- /*
- * Note: bmi160: supports accelerometer and gyro sensor
- * Requirement: accelerometer sensor must init before gyro sensor
- * DO NOT change the order of the following table.
- */
- [LID_ACCEL] = {
- .name = "Accel",
- .active_mask = SENSOR_ACTIVE_S0_S3,
- .chip = MOTIONSENSE_CHIP_BMI160,
- .type = MOTIONSENSE_TYPE_ACCEL,
- .location = MOTIONSENSE_LOC_LID,
- .drv = &bmi160_drv,
- .mutex = &g_base_mutex,
- .drv_data = &g_bmi160_data,
- .port = CONFIG_SPI_ACCEL_PORT,
- .i2c_spi_addr_flags = ACCEL_MK_SPI_ADDR_FLAGS(CONFIG_SPI_ACCEL_PORT),
- .rot_standard_ref = &base_standard_ref,
- .default_range = 4, /* g, to meet CDD 7.3.1/C-1-4 reqs */
- .min_frequency = BMI_ACCEL_MIN_FREQ,
- .max_frequency = BMI_ACCEL_MAX_FREQ,
- .config = {
- /* Enable accel in S0 */
- [SENSOR_CONFIG_EC_S0] = {
- .odr = 10000 | ROUND_UP_FLAG,
- .ec_rate = 100 * MSEC,
- },
- },
- },
- [LID_GYRO] = {
- .name = "Gyro",
- .active_mask = SENSOR_ACTIVE_S0_S3,
- .chip = MOTIONSENSE_CHIP_BMI160,
- .type = MOTIONSENSE_TYPE_GYRO,
- .location = MOTIONSENSE_LOC_LID,
- .drv = &bmi160_drv,
- .mutex = &g_base_mutex,
- .drv_data = &g_bmi160_data,
- .port = CONFIG_SPI_ACCEL_PORT,
- .i2c_spi_addr_flags = ACCEL_MK_SPI_ADDR_FLAGS(CONFIG_SPI_ACCEL_PORT),
- .default_range = 1000, /* dps */
- .rot_standard_ref = &base_standard_ref,
- .min_frequency = BMI_GYRO_MIN_FREQ,
- .max_frequency = BMI_GYRO_MAX_FREQ,
- },
- [VSYNC] = {
- .name = "Camera vsync",
- .active_mask = SENSOR_ACTIVE_S0,
- .chip = MOTIONSENSE_CHIP_GPIO,
- .type = MOTIONSENSE_TYPE_SYNC,
- .location = MOTIONSENSE_LOC_CAMERA,
- .drv = &sync_drv,
- .default_range = 0,
- .min_frequency = 0,
- .max_frequency = 1,
- },
-};
-const unsigned int motion_sensor_count = ARRAY_SIZE(motion_sensors);
-
-int board_allow_i2c_passthru(int port)
-{
- return (port == I2C_PORT_VIRTUAL_BATTERY);
-}
diff --git a/board/scarlet/board.h b/board/scarlet/board.h
deleted file mode 100644
index 2880968ddc..0000000000
--- a/board/scarlet/board.h
+++ /dev/null
@@ -1,229 +0,0 @@
-/* Copyright 2016 The Chromium OS Authors. All rights reserved.
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-/* Configuration for Scarlet */
-
-#ifndef __CROS_EC_BOARD_H
-#define __CROS_EC_BOARD_H
-
-/* Free up flash space */
-#define CONFIG_DEBUG_ASSERT_BRIEF
-#define CONFIG_USB_PD_DEBUG_LEVEL 0
-
-/* Optional modules */
-#define CONFIG_ADC
-#undef CONFIG_ADC_WATCHDOG
-#define CONFIG_CHIPSET_RK3399
-#define CONFIG_CMD_ACCELS
-#define CONFIG_CMD_RTC
-#define CONFIG_EMULATED_SYSRQ
-#undef CONFIG_HIBERNATE
-#define CONFIG_HOSTCMD_RTC
-#define CONFIG_I2C
-#define CONFIG_I2C_CONTROLLER
-#define CONFIG_I2C_VIRTUAL_BATTERY
-#define CONFIG_I2C_PASSTHRU_RESTRICTED
-#define CONFIG_LED_COMMON
-#define CONFIG_LOW_POWER_IDLE
-#define CONFIG_LOW_POWER_IDLE_LIMITED
-#define CONFIG_POWER_COMMON
-#define CONFIG_SPI
-#define CONFIG_SPI_CONTROLLER
-#define CONFIG_STM_HWTIMER32
-/* Source RTCCLK from external 32.768kHz source on PC15/OSC32_IN. */
-#define CONFIG_STM32_CLOCK_LSE
-#define CONFIG_SWITCH
-#define CONFIG_WATCHDOG_HELP
-
-#define CONFIG_SYSTEM_UNLOCKED /* Allow dangerous commands for testing */
-
-#undef CONFIG_UART_CONSOLE
-#define CONFIG_UART_CONSOLE 1
-#define CONFIG_UART_RX_DMA
-
-/* Enable a different power-on sequence than the one on gru */
-#undef CONFIG_CHIPSET_POWER_SEQ_VERSION
-#define CONFIG_CHIPSET_POWER_SEQ_VERSION 1
-
-/* Optional features */
-#define CONFIG_BOARD_PRE_INIT
-#define CONFIG_BUTTON_TRIGGERED_RECOVERY
-#define CONFIG_CHARGER_ILIM_PIN_DISABLED
-#define CONFIG_FORCE_CONSOLE_RESUME
-#define CONFIG_HOST_COMMAND_STATUS
-
-/* Required for FAFT */
-#define CONFIG_CMD_BUTTON
-
-/* By default, set hcdebug to off */
-#undef CONFIG_HOSTCMD_DEBUG_MODE
-#define CONFIG_HOSTCMD_DEBUG_MODE HCDEBUG_OFF
-#undef CONFIG_LID_SWITCH
-#undef CONFIG_LTO
-#define CONFIG_POWER_BUTTON
-#define CONFIG_POWER_BUTTON_IGNORE_LID
-#define CONFIG_POWER_TRACK_HOST_SLEEP_STATE
-#define CONFIG_SOFTWARE_PANIC
-#define CONFIG_VBOOT_HASH
-#define CONFIG_VOLUME_BUTTONS
-
-#define CONFIG_CHARGER
-#define CONFIG_CHARGER_RT9467
-#define CONFIG_CHARGER_INPUT_CURRENT 512
-#define CONFIG_CHARGER_LIMIT_POWER_THRESH_BAT_PCT 2
-#define CONFIG_CHARGER_LIMIT_POWER_THRESH_CHG_MW 15000
-#define CONFIG_CHARGER_PROFILE_OVERRIDE
-#define CONFIG_CHARGER_DISCHARGE_ON_AC
-#define CONFIG_CHARGER_OTG
-#define CONFIG_USB_CHARGER
-#define CONFIG_USB_MUX_VIRTUAL
-
-/* Increase tx buffer size, as we'd like to stream EC log to AP. */
-#undef CONFIG_UART_TX_BUF_SIZE
-#define CONFIG_UART_TX_BUF_SIZE 4096
-
-/* Motion Sensors */
-#define CONFIG_ACCELGYRO_BMI160
-#define CONFIG_ACCEL_INTERRUPTS
-#define CONFIG_ACCELGYRO_BMI160_INT_EVENT \
- TASK_EVENT_MOTION_SENSOR_INTERRUPT(LID_ACCEL)
-
-/* Camera VSYNC */
-#define CONFIG_SYNC
-#define CONFIG_SYNC_COMMAND
-#define CONFIG_SYNC_INT_EVENT \
- TASK_EVENT_MOTION_SENSOR_INTERRUPT(VSYNC)
-
-/* To be able to indicate the device is in tablet mode. */
-#define CONFIG_TABLET_MODE
-#define CONFIG_TABLET_MODE_SWITCH
-
-/* Enable sensor fifo, must also define the _SIZE and _THRES */
-#define CONFIG_ACCEL_FIFO
-/* FIFO size is in power of 2. */
-#define CONFIG_ACCEL_FIFO_SIZE 256
-/* Depends on how fast the AP boots and typical ODRs. */
-#define CONFIG_ACCEL_FIFO_THRES 10
-
-/* USB PD config */
-#define CONFIG_CHARGE_MANAGER
-#define CONFIG_USB_POWER_DELIVERY
-#define CONFIG_USB_PD_TCPMV1
-#define CONFIG_USB_PD_ALT_MODE
-#define CONFIG_USB_PD_ALT_MODE_DFP
-#define CONFIG_USB_PD_DISCHARGE_GPIO
-#define CONFIG_USB_PD_DUAL_ROLE
-#define CONFIG_USB_PD_LOGGING
-#define CONFIG_USB_PD_PORT_MAX_COUNT 1
-#define CONFIG_USB_PD_TCPM_FUSB302
-#define CONFIG_USB_PD_TCPM_TCPCI
-#define CONFIG_USB_PD_VBUS_DETECT_TCPC
-#define CONFIG_USB_PD_5V_CHARGER_CTRL
-#define CONFIG_USBC_SS_MUX
-#define CONFIG_USBC_VCONN
-#define CONFIG_USBC_VCONN_SWAP
-#define CONFIG_USB_PD_COMM_LOCKED
-
-#define CONFIG_BATTERY_CUT_OFF
-#define CONFIG_BATTERY_PRESENT_CUSTOM
-#define CONFIG_BATTERY_RETRY_NACK
-#define CONFIG_BATTERY_REVIVE_DISCONNECT
-#define CONFIG_BATTERY_MAX17055
-
-/* Battery parameters for max17055 ModelGauge m5 algorithm. */
-#define BATTERY_MAX17055_RSENSE 5 /* m-ohm */
-#define BATTERY_DESIRED_CHARGING_CURRENT 4000 /* mA */
-
-#define CONFIG_THROTTLE_AP_ON_BAT_DISCHG_CURRENT
-#define BAT_MAX_DISCHG_CURRENT 5000 /* mA */
-
-#define CONFIG_THROTTLE_AP_ON_BAT_VOLTAGE
-#define BAT_LOW_VOLTAGE_THRESH 3200 /* mV */
-
-#define PD_OPERATING_POWER_MW 15000
-#define PD_MAX_POWER_MW ((PD_MAX_VOLTAGE_MV * PD_MAX_CURRENT_MA) / 1000)
-#define PD_MAX_CURRENT_MA 3000
-#define PD_MAX_VOLTAGE_MV 12850
-
-#define PD_POWER_SUPPLY_TURN_ON_DELAY 30000 /* us */
-#define PD_POWER_SUPPLY_TURN_OFF_DELAY 50000 /* us */
-
-/* Timer selection */
-#define TIM_CLOCK32 2
-#define TIM_WATCHDOG 7
-
-/* 48 MHz SYSCLK clock frequency */
-#define CPU_CLOCK 48000000
-
-/* Optional for testing */
-#undef CONFIG_PECI
-#undef CONFIG_PSTORE
-
-/* Modules we want to exclude */
-#undef CONFIG_CMD_BATTFAKE
-#undef CONFIG_CMD_FLASH
-#undef CONFIG_CMD_HASH
-#undef CONFIG_CMD_I2C_SCAN
-#undef CONFIG_CMD_MD
-#undef CONFIG_CMD_POWERINDEBUG
-#undef CONFIG_CMD_TIMERINFO
-
-#define CONFIG_TASK_PROFILING
-
-#define I2C_PORT_CHARGER 0
-#define I2C_PORT_BATTERY 0
-#define I2C_PORT_VIRTUAL_BATTERY I2C_PORT_BATTERY
-#define I2C_PORT_TCPC0 1
-
-/* Route sbs host requests to virtual battery driver */
-#define VIRTUAL_BATTERY_ADDR_FLAGS 0x0B
-
-/* Enable Accel over SPI */
-#define CONFIG_SPI_ACCEL_PORT 0 /* The first SPI master port (SPI2) */
-
-#define CONFIG_MKBP_INPUT_DEVICES
-#define CONFIG_MKBP_EVENT
-#define CONFIG_MKBP_USE_GPIO
-/* Define the host events which are allowed to wakeup AP in S3. */
-#define CONFIG_MKBP_HOST_EVENT_WAKEUP_MASK \
- (EC_HOST_EVENT_MASK(EC_HOST_EVENT_POWER_BUTTON) |\
- EC_HOST_EVENT_MASK(EC_HOST_EVENT_RTC))
-
-#ifndef __ASSEMBLER__
-
-enum adc_channel {
- /* Real ADC channels begin here */
- ADC_BOARD_ID = 0,
- ADC_CH_COUNT
-};
-
-/* power signal definitions */
-enum power_signal {
- PP1250_S3_PWR_GOOD = 0,
- PP900_S0_PWR_GOOD,
- AP_PWR_GOOD,
- SUSPEND_DEASSERTED,
-
- /* Number of signals */
- POWER_SIGNAL_COUNT,
-};
-
-/* Motion sensors */
-enum sensor_id {
- LID_ACCEL = 0,
- LID_GYRO,
- VSYNC,
- SENSOR_COUNT,
-};
-
-#include "gpio_signal.h"
-#include "registers.h"
-
-void board_reset_pd_mcu(void);
-int board_get_version(void);
-
-#endif /* !__ASSEMBLER__ */
-
-#endif /* __CROS_EC_BOARD_H */
diff --git a/board/scarlet/build.mk b/board/scarlet/build.mk
deleted file mode 100644
index f2966fea6a..0000000000
--- a/board/scarlet/build.mk
+++ /dev/null
@@ -1,14 +0,0 @@
-# -*- makefile -*-
-# Copyright 2016 The Chromium OS Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-#
-# Board specific files build
-#
-#
-# STmicro STM32F098VC
-CHIP:=stm32
-CHIP_FAMILY:=stm32f0
-CHIP_VARIANT:=stm32f09x
-
-board-y=battery.o board.o usb_pd_policy.o led.o
diff --git a/board/scarlet/ec.tasklist b/board/scarlet/ec.tasklist
deleted file mode 100644
index 1548272184..0000000000
--- a/board/scarlet/ec.tasklist
+++ /dev/null
@@ -1,19 +0,0 @@
-/* Copyright 2016 The Chromium OS Authors. All rights reserved.
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-/**
- * See CONFIG_TASK_LIST in config.h for details.
- */
-#define CONFIG_TASK_LIST \
- TASK_ALWAYS(HOOKS, hook_task, NULL, LARGER_TASK_STACK_SIZE) \
- TASK_ALWAYS(CHARGER, charger_task, NULL, LARGER_TASK_STACK_SIZE) \
- TASK_ALWAYS(USB_CHG, usb_charger_task, NULL, TASK_STACK_SIZE) \
- TASK_NOTEST(CHIPSET, chipset_task, NULL, LARGER_TASK_STACK_SIZE) \
- TASK_ALWAYS(MOTIONSENSE, motion_sense_task, NULL, VENTI_TASK_STACK_SIZE) \
- TASK_ALWAYS(HOSTCMD, host_command_task, NULL, LARGER_TASK_STACK_SIZE) \
- TASK_ALWAYS(CONSOLE, console_task, NULL, LARGER_TASK_STACK_SIZE) \
- TASK_ALWAYS(PD_C0, pd_task, NULL, LARGER_TASK_STACK_SIZE) \
- TASK_ALWAYS(PD_INT_C0, pd_interrupt_handler_task, 0, LARGER_TASK_STACK_SIZE)
-
diff --git a/board/scarlet/gpio.inc b/board/scarlet/gpio.inc
deleted file mode 100644
index 9c45295a7f..0000000000
--- a/board/scarlet/gpio.inc
+++ /dev/null
@@ -1,102 +0,0 @@
-/* -*- mode:c -*-
- *
- * Copyright 2016 The Chromium OS Authors. All rights reserved.
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-/*
- * Declare symbolic names for all the GPIOs that we care about.
- * Note: Those with interrupt handlers must be declared first.
- */
-
-GPIO_INT(SPI1_NSS, PIN(A, 15), GPIO_INT_BOTH,
- spi_event)
-GPIO_INT(USB_C0_PD_INT_L, PIN(C, 13), GPIO_INT_FALLING | GPIO_PULL_UP,
- tcpc_alert_event)
-GPIO_INT(VOLUME_UP_L, PIN(D, 10), GPIO_INT_BOTH | GPIO_PULL_UP,
- button_interrupt)
-GPIO_INT(VOLUME_DOWN_L, PIN(E, 11), GPIO_INT_BOTH | GPIO_PULL_UP,
- button_interrupt)
-GPIO_INT(POWER_BUTTON_L, PIN(A, 0), GPIO_INT_BOTH | GPIO_PULL_UP,
- power_button_interrupt)
-GPIO_INT(PP1250_S3_PG, PIN(D, 8), GPIO_INT_BOTH | GPIO_PULL_UP,
- power_signal_interrupt)
-GPIO_INT(PP900_S0_PG, PIN(D, 9), GPIO_INT_BOTH | GPIO_PULL_UP,
- power_signal_interrupt)
-GPIO_INT(AP_EC_S3_S0_L, PIN(C, 7), GPIO_INT_BOTH | GPIO_PULL_DOWN,
- power_signal_interrupt)
-GPIO_INT(WARM_RESET_REQ, PIN(E, 1), GPIO_INT_RISING | GPIO_PULL_DOWN,
- warm_reset_request_interrupt)
-GPIO_INT(AP_OVERTEMP, PIN(E, 4), GPIO_INT_RISING | GPIO_PULL_DOWN,
- overtemp_interrupt)
-GPIO_INT(ACCEL_INT_L, PIN(D, 14), GPIO_INT_FALLING | GPIO_SEL_1P8V,
- bmi160_interrupt)
-GPIO_INT(SYNC_INT, PIN(A, 12), GPIO_INT_RISING | GPIO_PULL_DOWN,
- sync_interrupt)
-GPIO_INT(CHARGER_INT_L, PIN(E, 6), GPIO_INT_FALLING | GPIO_PULL_UP,
- rt946x_interrupt)
-
-/* Voltage rails control pins */
-GPIO(PP1800_S0_EN, PIN(D, 11), GPIO_OUT_LOW)
-GPIO(AP_CORE_EN, PIN(C, 1), GPIO_OUT_LOW)
-GPIO(PP3300_S0_EN, PIN(E, 12), GPIO_OUT_LOW)
-GPIO(PP1800_USB_EN, PIN(C, 4), GPIO_OUT_LOW)
-GPIO(PP900_S0_EN, PIN(E, 8), GPIO_OUT_LOW)
-GPIO(PP1250_S3_EN, PIN(D, 13), GPIO_OUT_LOW)
-GPIO(PP1800_S3_EN, PIN(C, 3), GPIO_OUT_LOW)
-GPIO(PP3300_S3_EN, PIN(E, 2), GPIO_OUT_LOW)
-GPIO(PP900_S3_EN, PIN(E, 10), GPIO_OUT_LOW)
-
-GPIO(PP3300_REDUCE_EFF_L, PIN(D, 12), GPIO_ODR_HIGH)
-
-/*
- * I2C pins should be configured as inputs until I2C module is
- * initialized. This will avoid driving the lines unintentionally.
- */
-GPIO(I2C0_SCL, PIN(B, 8), GPIO_INPUT)
-GPIO(I2C0_SDA, PIN(B, 9), GPIO_INPUT)
-GPIO(I2C1_SCL, PIN(B, 10), GPIO_INPUT)
-GPIO(I2C1_SDA, PIN(B, 11), GPIO_INPUT)
-
-/* Analog pins */
-GPIO(BOARD_ID, PIN(C, 0), GPIO_ANALOG)
-
-/* SPI sensors */
-GPIO(SPI_ACCEL_CS_L, PIN(D, 0), GPIO_OUT_HIGH)
-
-/* Scarlet LEDs */
-GPIO(BAT_LED_GREEN, PIN(E, 9), GPIO_ODR_HIGH)
-GPIO(BAT_LED_RED, PIN(E, 13), GPIO_ODR_HIGH)
-
-/* Other input pins */
-GPIO(WP_L, PIN(E, 5), GPIO_INPUT)
-/* TODO(philipchen): Add an interrupt handler once CCD is fully developed. */
-GPIO(CCD_MODE_ODL, PIN(C, 5), GPIO_INPUT | GPIO_PULL_UP)
-/* Non-INT power signal pin */
-GPIO(AP_CORE_PG, PIN(D, 7), GPIO_INPUT | GPIO_PULL_UP)
-/* Battery ID strap pin */
-GPIO(BATT_ID, PIN(C, 2), GPIO_INPUT | GPIO_PULL_UP)
-
-
-
-/* Other output pins */
-GPIO(ENTERING_RW, PIN(C, 6), GPIO_ODR_HIGH)
-GPIO(SYS_RST_L, PIN(C, 8), GPIO_ODR_LOW)
-GPIO(EC_INT_L, PIN(E, 3), GPIO_ODR_HIGH)
-GPIO(EC_BOARD_ID_EN_L, PIN(F, 1), GPIO_ODR_HIGH)
-GPIO(USB_C0_DISCHARGE, PIN(A, 11), GPIO_OUT_LOW)
-GPIO(PCA9468_EN, PIN(E, 15), GPIO_OUT_LOW)
-
-/* USART1: PA9/PA10 */
-ALTERNATE(PIN_MASK(A, 0x0600), 1, MODULE_UART, 0)
-/* I2C MASTER: PB8/9 */
-ALTERNATE(PIN_MASK(B, 0x0300), 1, MODULE_I2C, 0)
-/* I2C MASTER: PB10/11 */
-ALTERNATE(PIN_MASK(B, 0x0c00), 1, MODULE_I2C, 0)
-/* SPI SLAVE: PB3/4/5 */
-ALTERNATE(PIN_MASK(B, 0x0038), 0, MODULE_SPI, 0)
-/* SPI SLAVE CS: PA15 */
-ALTERNATE(PIN_MASK(A, 0x8000), 0, MODULE_SPI, 0)
-/* SPI MASTER: PD1/3/4 */
-ALTERNATE(PIN_MASK(D, 0x001a), 1, MODULE_SPI_CONTROLLER, 0)
diff --git a/board/scarlet/led.c b/board/scarlet/led.c
deleted file mode 100644
index d4c758cdcc..0000000000
--- a/board/scarlet/led.c
+++ /dev/null
@@ -1,144 +0,0 @@
-/* Copyright 2017 The Chromium OS Authors. All rights reserved.
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- *
- * Battery LED control for Scarlet board.
- */
-
-#include "battery.h"
-#include "charge_state.h"
-#include "chipset.h"
-#include "hooks.h"
-#include "led_common.h"
-#include "lid_switch.h"
-#include "pwm.h"
-#include "util.h"
-
-/* LEDs on Scarlet are active low. */
-#define BAT_LED_ON 0
-#define BAT_LED_OFF 1
-
-const enum ec_led_id supported_led_ids[] = { EC_LED_ID_BATTERY_LED };
-
-const int supported_led_ids_count = ARRAY_SIZE(supported_led_ids);
-
-enum led_color {
- LED_OFF = 0,
- LED_RED,
- LED_AMBER,
- LED_GREEN,
- LED_COLOR_COUNT /* Number of colors, not a color itself */
-};
-
-static int bat_led_set_color(enum led_color color)
-{
- switch (color) {
- case LED_OFF:
- gpio_set_level(GPIO_BAT_LED_GREEN, BAT_LED_OFF);
- gpio_set_level(GPIO_BAT_LED_RED, BAT_LED_OFF);
- break;
- case LED_RED:
- gpio_set_level(GPIO_BAT_LED_GREEN, BAT_LED_OFF);
- gpio_set_level(GPIO_BAT_LED_RED, BAT_LED_ON);
- break;
- case LED_AMBER:
- gpio_set_level(GPIO_BAT_LED_GREEN, BAT_LED_ON);
- gpio_set_level(GPIO_BAT_LED_RED, BAT_LED_ON);
- break;
- case LED_GREEN:
- gpio_set_level(GPIO_BAT_LED_GREEN, BAT_LED_ON);
- gpio_set_level(GPIO_BAT_LED_RED, BAT_LED_OFF);
- break;
- default:
- return EC_ERROR_UNKNOWN;
- }
- return EC_SUCCESS;
-}
-
-static void scarlet_led_set_battery(void)
-{
- static int battery_second;
- uint32_t chflags = charge_get_flags();
-
- battery_second++;
-
- switch (charge_get_state()) {
- case PWR_STATE_CHARGE:
- bat_led_set_color(LED_AMBER);
- break;
- case PWR_STATE_DISCHARGE:
- if (charge_get_percent() < 3)
- bat_led_set_color((battery_second & 1)
- ? LED_OFF : LED_AMBER);
- else if (charge_get_percent() < 10)
- bat_led_set_color((battery_second & 3)
- ? LED_OFF : LED_AMBER);
- else if (charge_get_percent() >= BATTERY_LEVEL_NEAR_FULL &&
- (chflags & CHARGE_FLAG_EXTERNAL_POWER))
- bat_led_set_color(LED_GREEN);
- else
- bat_led_set_color(LED_OFF);
- break;
- case PWR_STATE_ERROR:
- bat_led_set_color(LED_RED);
- break;
- case PWR_STATE_CHARGE_NEAR_FULL:
- bat_led_set_color(LED_GREEN);
- break;
- case PWR_STATE_IDLE: /* External power connected in IDLE. */
- if (chflags & CHARGE_FLAG_FORCE_IDLE)
- bat_led_set_color(
- (battery_second & 0x2) ? LED_GREEN : LED_AMBER);
- else
- bat_led_set_color(LED_GREEN);
- break;
- default:
- /* Other states don't alter LED behavior */
- break;
- }
-}
-
-void led_get_brightness_range(enum ec_led_id led_id, uint8_t *brightness_range)
-{
- if (led_id == EC_LED_ID_BATTERY_LED) {
- brightness_range[EC_LED_COLOR_RED] = 1;
- brightness_range[EC_LED_COLOR_GREEN] = 1;
- }
-}
-
-int led_set_brightness(enum ec_led_id led_id, const uint8_t *brightness)
-{
- if (led_id == EC_LED_ID_BATTERY_LED) {
- gpio_set_level(GPIO_BAT_LED_RED,
- (brightness[EC_LED_COLOR_RED] != 0) ?
- BAT_LED_ON : BAT_LED_OFF);
- gpio_set_level(GPIO_BAT_LED_GREEN,
- (brightness[EC_LED_COLOR_GREEN] != 0) ?
- BAT_LED_ON : BAT_LED_OFF);
- return EC_SUCCESS;
- }
- return EC_ERROR_UNKNOWN;
-}
-
-/* Called by hook task every 1 sec */
-static void led_second(void)
-{
- if (led_auto_control_is_enabled(EC_LED_ID_BATTERY_LED))
- scarlet_led_set_battery();
-}
-DECLARE_HOOK(HOOK_SECOND, led_second, HOOK_PRIO_DEFAULT);
-
-void led_control(enum ec_led_id led_id, enum ec_led_state state)
-{
- if ((led_id != EC_LED_ID_RECOVERY_HW_REINIT_LED) &&
- (led_id != EC_LED_ID_SYSRQ_DEBUG_LED))
- return;
-
- if (state == LED_STATE_RESET) {
- led_auto_control(EC_LED_ID_BATTERY_LED, 1);
- return;
- }
-
- led_auto_control(EC_LED_ID_BATTERY_LED, 0);
- bat_led_set_color(state ? LED_AMBER : LED_OFF);
-}
diff --git a/board/scarlet/usb_pd_policy.c b/board/scarlet/usb_pd_policy.c
deleted file mode 100644
index cba4540ecd..0000000000
--- a/board/scarlet/usb_pd_policy.c
+++ /dev/null
@@ -1,71 +0,0 @@
-/* Copyright 2016 The Chromium OS Authors. All rights reserved.
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-#include "atomic.h"
-#include "charger.h"
-#include "charge_manager.h"
-#include "common.h"
-#include "console.h"
-#include "driver/charger/rt946x.h"
-#include "gpio.h"
-#include "hooks.h"
-#include "host_command.h"
-#include "registers.h"
-#include "system.h"
-#include "task.h"
-#include "timer.h"
-#include "util.h"
-#include "usb_mux.h"
-#include "usb_pd.h"
-#include "usb_pd_tcpm.h"
-
-#define CPRINTF(format, args...) cprintf(CC_USBPD, format, ## args)
-#define CPRINTS(format, args...) cprints(CC_USBPD, format, ## args)
-
-static uint8_t vbus_en;
-
-int board_vbus_source_enabled(int port)
-{
- return vbus_en;
-}
-
-int pd_set_power_supply_ready(int port)
-{
-
- pd_set_vbus_discharge(port, 0);
- /* Provide VBUS */
- vbus_en = 1;
- charger_enable_otg_power(CHARGER_SOLO, 1);
-
- /* notify host of power info change */
- pd_send_host_event(PD_EVENT_POWER_CHANGE);
-
- return EC_SUCCESS; /* we are ready */
-}
-
-void pd_power_supply_reset(int port)
-{
- int prev_en;
-
- prev_en = vbus_en;
- /* Disable VBUS */
- vbus_en = 0;
- charger_enable_otg_power(CHARGER_SOLO, 0);
- /* Enable discharge if we were previously sourcing 5V */
- if (prev_en)
- pd_set_vbus_discharge(port, 1);
-
- /* notify host of power info change */
- pd_send_host_event(PD_EVENT_POWER_CHANGE);
-}
-
-int pd_check_vconn_swap(int port)
-{
- /*
- * VCONN is provided directly by the battery (PPVAR_SYS)
- * but use the same rules as power swap.
- */
- return pd_get_dual_role(port) == PD_DRP_TOGGLE_ON ? 1 : 0;
-}
diff --git a/board/scarlet/vif_override.xml b/board/scarlet/vif_override.xml
deleted file mode 100644
index 32736caf64..0000000000
--- a/board/scarlet/vif_override.xml
+++ /dev/null
@@ -1,3 +0,0 @@
-<!-- Add VIF field overrides here. See genvif.c and the Vendor Info File
- Definition from the USB-IF.
--->