summaryrefslogtreecommitdiff
path: root/baseboard/hatch
diff options
context:
space:
mode:
Diffstat (limited to 'baseboard/hatch')
-rw-r--r--baseboard/hatch/baseboard.c397
-rw-r--r--baseboard/hatch/baseboard.h222
-rw-r--r--baseboard/hatch/battery.c80
-rw-r--r--baseboard/hatch/build.mk11
-rw-r--r--baseboard/hatch/usb_pd_policy.c90
5 files changed, 0 insertions, 800 deletions
diff --git a/baseboard/hatch/baseboard.c b/baseboard/hatch/baseboard.c
deleted file mode 100644
index dd93e581cf..0000000000
--- a/baseboard/hatch/baseboard.c
+++ /dev/null
@@ -1,397 +0,0 @@
-/* Copyright 2019 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.
- */
-
-/* Hatch family-specific configuration */
-#include "atomic.h"
-#include "battery_fuel_gauge.h"
-#include "charge_manager.h"
-#include "charge_state_v2.h"
-#include "chipset.h"
-#include "console.h"
-#include "cros_board_info.h"
-#include "driver/charger/bq25710.h"
-#include "driver/ppc/sn5s330.h"
-#include "driver/tcpm/anx7447.h"
-#include "driver/tcpm/ps8xxx.h"
-#include "driver/tcpm/tcpci.h"
-#include "driver/tcpm/tcpm.h"
-#include "ec_commands.h"
-#include "espi.h"
-#include "gpio.h"
-#include "hooks.h"
-#include "i2c.h"
-#include "keyboard_scan.h"
-#include "power.h"
-#include "stdbool.h"
-#include "system.h"
-#include "tcpm/tcpci.h"
-#include "timer.h"
-#include "usbc_ppc.h"
-#include "util.h"
-
-#define CPRINTS(format, args...) cprints(CC_SYSTEM, format, ## args)
-#define CPRINTF(format, args...) cprintf(CC_SYSTEM, format, ## args)
-
-#define CPRINTSUSB(format, args...) cprints(CC_USBCHARGE, format, ## args)
-#define CPRINTFUSB(format, args...) cprintf(CC_USBCHARGE, format, ## args)
-
-/******************************************************************************/
-/* Wake up pins */
-const enum gpio_signal hibernate_wake_pins[] = {
- GPIO_LID_OPEN,
- GPIO_ACOK_OD,
- GPIO_POWER_BUTTON_L,
- /* EC_RST_ODL needs to wake device while in PSL hibernate. */
- GPIO_SYS_RESET_L,
-};
-const int hibernate_wake_pins_used = ARRAY_SIZE(hibernate_wake_pins);
-
-/******************************************************************************/
-/* I2C port map configuration */
-const struct i2c_port_t i2c_ports[] = {
-#ifdef CONFIG_ACCEL_FIFO
- {"sensor", I2C_PORT_SENSOR, 100, GPIO_I2C0_SCL, GPIO_I2C0_SDA},
-#endif
- {"ppc0", I2C_PORT_PPC0, 100, GPIO_I2C1_SCL, GPIO_I2C1_SDA},
-#if CONFIG_USB_PD_PORT_MAX_COUNT > 1
- {"tcpc1", I2C_PORT_TCPC1, 400, GPIO_I2C2_SCL, GPIO_I2C2_SDA},
-#endif
- {"tcpc0", I2C_PORT_TCPC0, 400, GPIO_I2C3_SCL, GPIO_I2C3_SDA},
-#ifdef BOARD_AKEMI
- {"thermal", I2C_PORT_THERMAL, 400, GPIO_I2C4_SCL, GPIO_I2C4_SDA},
-#endif
-#ifdef BOARD_JINLON
- {"thermal", I2C_PORT_THERMAL, 100, GPIO_I2C4_SCL, GPIO_I2C4_SDA},
-#endif
-#ifdef BOARD_MUSHU
- {"f75303_temp", I2C_PORT_THERMAL, 100, GPIO_I2C0_SCL, GPIO_I2C0_SDA},
- {"gpu_temp", I2C_PORT_GPU, 100, GPIO_I2C4_SCL, GPIO_I2C4_SDA},
-#endif
- {"power", I2C_PORT_POWER, 100, GPIO_I2C5_SCL, GPIO_I2C5_SDA},
- {"eeprom", I2C_PORT_EEPROM, 100, GPIO_I2C7_SCL, GPIO_I2C7_SDA},
-};
-const unsigned int i2c_ports_used = ARRAY_SIZE(i2c_ports);
-
-/******************************************************************************/
-/* Charger Chip Configuration */
-const struct charger_config_t chg_chips[] = {
- {
- .i2c_port = I2C_PORT_CHARGER,
- .i2c_addr_flags = BQ25710_SMBUS_ADDR1_FLAGS,
- .drv = &bq25710_drv,
- },
-};
-
-/******************************************************************************/
-/* Chipset callbacks/hooks */
-
-__attribute__((weak)) bool board_has_kb_backlight(void)
-{
- /* Default enable keyboard backlight */
- return true;
-}
-
-/* Called on AP S0iX -> S0 transition */
-static void baseboard_chipset_resume(void)
-{
- if (board_has_kb_backlight())
- gpio_set_level(GPIO_EC_KB_BL_EN, 1);
-}
-DECLARE_HOOK(HOOK_CHIPSET_RESUME, baseboard_chipset_resume, HOOK_PRIO_DEFAULT);
-
-/* Called on AP S0 -> S0iX transition */
-static void baseboard_chipset_suspend(void)
-{
- if (board_has_kb_backlight())
- gpio_set_level(GPIO_EC_KB_BL_EN, 0);
-}
-DECLARE_HOOK(HOOK_CHIPSET_SUSPEND, baseboard_chipset_suspend,
- HOOK_PRIO_DEFAULT);
-
-void board_hibernate(void)
-{
- int port;
-
- /*
- * To support hibernate from ectool, keyboard, and console,
- * ensure that the AP is fully shutdown before hibernating.
- */
-#ifdef HAS_TASK_CHIPSET
- chipset_force_shutdown(CHIPSET_SHUTDOWN_BOARD_CUSTOM);
-#endif
-
- /*
- * If VBUS is not being provided by any of the PD ports,
- * then enable the SNK FET to allow AC to pass through
- * if it is later connected to ensure that AC_PRESENT
- * will wake up the EC from this state
- */
- for (port = 0; port < CONFIG_USB_PD_PORT_MAX_COUNT; ++port)
- ppc_vbus_sink_enable(port, 1);
-
- /*
- * This seems like a hack, but the AP chipset state machine
- * needs time to work through the transitions. Also, it
- * works.
- */
- msleep(300);
-}
-
-/******************************************************************************/
-/* USB-C PPC Configuration */
-struct ppc_config_t ppc_chips[CONFIG_USB_PD_PORT_MAX_COUNT] = {
- [USB_PD_PORT_TCPC_0] = {
- .i2c_port = I2C_PORT_PPC0,
- .i2c_addr_flags = SN5S330_ADDR0_FLAGS,
- .drv = &sn5s330_drv
- },
-#if CONFIG_USB_PD_PORT_MAX_COUNT > 1
- [USB_PD_PORT_TCPC_1] = {
- .i2c_port = I2C_PORT_TCPC1,
- .i2c_addr_flags = SN5S330_ADDR0_FLAGS,
- .drv = &sn5s330_drv
- },
-#endif
-};
-unsigned int ppc_cnt = ARRAY_SIZE(ppc_chips);
-
-/* Power Delivery and charging functions */
-void baseboard_tcpc_init(void)
-{
- /* Only reset TCPC if not sysjump */
- if (!system_jumped_late())
- board_reset_pd_mcu();
-
- /* Enable PPC interrupts. */
- gpio_enable_interrupt(GPIO_USB_C0_PPC_INT_ODL);
- /* Enable TCPC interrupts. */
- gpio_enable_interrupt(GPIO_USB_C0_TCPC_INT_ODL);
- /* Enable BC 1.2 interrupts */
- gpio_enable_interrupt(GPIO_USB_C0_BC12_INT_ODL);
-
-#if CONFIG_USB_PD_PORT_MAX_COUNT > 1
- /* Enable PPC interrupts. */
- gpio_enable_interrupt(GPIO_USB_C1_PPC_INT_ODL);
- /* Enable TCPC interrupts. */
- gpio_enable_interrupt(GPIO_USB_C1_TCPC_INT_ODL);
- /* Enable BC 1.2 interrupts */
- gpio_enable_interrupt(GPIO_USB_C1_BC12_INT_ODL);
-#endif
-}
-DECLARE_HOOK(HOOK_INIT, baseboard_tcpc_init, HOOK_PRIO_INIT_I2C + 1);
-
-uint16_t tcpc_get_alert_status(void)
-{
- uint16_t status = 0;
- int level;
-
- /*
- * Check which port has the ALERT line set and ignore if that TCPC has
- * its reset line active.
- */
- if (!gpio_get_level(GPIO_USB_C0_TCPC_INT_ODL)) {
- level = !!(tcpc_config[USB_PD_PORT_TCPC_0].flags &
- TCPC_FLAGS_RESET_ACTIVE_HIGH);
- if (gpio_get_level(GPIO_USB_C0_TCPC_RST) != level)
- status |= PD_STATUS_TCPC_ALERT_0;
- }
-
-#if CONFIG_USB_PD_PORT_MAX_COUNT > 1
- if (!gpio_get_level(GPIO_USB_C1_TCPC_INT_ODL)) {
- level = !!(tcpc_config[USB_PD_PORT_TCPC_1].flags &
- TCPC_FLAGS_RESET_ACTIVE_HIGH);
- if (gpio_get_level(GPIO_USB_C1_TCPC_RST) != level)
- status |= PD_STATUS_TCPC_ALERT_1;
- }
-#endif
-
- return status;
-}
-
-static void reset_pd_port(int port, enum gpio_signal reset_gpio,
- int hold_delay, int finish_delay)
-{
- int level = !!(tcpc_config[port].flags & TCPC_FLAGS_RESET_ACTIVE_HIGH);
-
- gpio_set_level(reset_gpio, level);
- msleep(hold_delay);
- gpio_set_level(reset_gpio, !level);
- if (finish_delay)
- msleep(finish_delay);
-}
-
-void board_reset_pd_mcu(void)
-{
- /*
- * TODO(b/130194590): This should be replaced with a common function
- * once the gpio signal and delays are added to tcpc_config struct.
- */
-
- /* Assert reset to TCPC for required delay only if we have a battery. */
- if (battery_is_present() != BP_YES)
- return;
-
- /* Reset TCPC0 */
- reset_pd_port(USB_PD_PORT_TCPC_0, GPIO_USB_C0_TCPC_RST,
- BOARD_TCPC_C0_RESET_HOLD_DELAY,
- BOARD_TCPC_C0_RESET_POST_DELAY);
-
-#if CONFIG_USB_PD_PORT_MAX_COUNT > 1
- /* Reset TCPC1 */
- reset_pd_port(USB_PD_PORT_TCPC_1, GPIO_USB_C1_TCPC_RST,
- BOARD_TCPC_C1_RESET_HOLD_DELAY,
- BOARD_TCPC_C1_RESET_POST_DELAY);
-#endif
-}
-
-int board_set_active_charge_port(int port)
-{
- int is_valid_port = (port >= 0 &&
- port < CONFIG_USB_PD_PORT_MAX_COUNT);
- int i;
-
- if (!is_valid_port && port != CHARGE_PORT_NONE)
- return EC_ERROR_INVAL;
-
- if (port == CHARGE_PORT_NONE) {
- CPRINTSUSB("Disabling all charger ports");
-
- /* Disable all ports. */
- for (i = 0; i < ppc_cnt; i++) {
- /*
- * Do not return early if one fails otherwise we can
- * get into a boot loop assertion failure.
- */
- if (ppc_vbus_sink_enable(i, 0))
- CPRINTSUSB("Disabling C%d as sink failed.", i);
- }
-
- return EC_SUCCESS;
- }
-
- /* Check if the port is sourcing VBUS. */
- if (ppc_is_sourcing_vbus(port)) {
- CPRINTFUSB("Skip enable C%d", port);
- return EC_ERROR_INVAL;
- }
-
- CPRINTSUSB("New charge port: C%d", port);
-
- /*
- * Turn off the other ports' sink path FETs, before enabling the
- * requested charge port.
- */
- for (i = 0; i < ppc_cnt; i++) {
- if (i == port)
- continue;
-
- if (ppc_vbus_sink_enable(i, 0))
- CPRINTSUSB("C%d: sink path disable failed.", i);
- }
-
- /* Enable requested charge port. */
- if (ppc_vbus_sink_enable(port, 1)) {
- CPRINTSUSB("C%d: sink path enable failed.", port);
- return EC_ERROR_UNKNOWN;
- }
-
- return EC_SUCCESS;
-}
-
-int ppc_get_alert_status(int port)
-{
- if (port == USB_PD_PORT_TCPC_0)
- return gpio_get_level(GPIO_USB_C0_PPC_INT_ODL) == 0;
- return port == USB_PD_PORT_TCPC_0 ?
- gpio_get_level(GPIO_USB_C0_PPC_INT_ODL) == 0 :
-#if CONFIG_USB_PD_PORT_MAX_COUNT > 1
- gpio_get_level(GPIO_USB_C1_PPC_INT_ODL) == 0;
-#else
- EC_SUCCESS;
-#endif
-}
-
-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);
-}
-
-#ifdef USB_PD_PORT_TCPC_MST
-void baseboard_mst_enable_control(enum mst_source src, int level)
-{
- static uint32_t mst_input_levels;
-
- if (level)
- atomic_or(&mst_input_levels, 1 << src);
- else
- atomic_clear_bits(&mst_input_levels, 1 << src);
-
- gpio_set_level(GPIO_EN_MST, mst_input_levels ? 1 : 0);
-}
-#endif
-
-/* Enable or disable input devices, based on chipset state */
-__override void lid_angle_peripheral_enable(int enable)
-{
- if (board_is_convertible()) {
- if (chipset_in_state(CHIPSET_STATE_ANY_OFF))
- enable = 0;
- keyboard_scan_enable(enable, KB_SCAN_DISABLE_LID_ANGLE);
- }
-}
-
-static uint8_t sku_id;
-static uint8_t board_id;
-
-uint8_t get_board_sku(void)
-{
- return sku_id;
-}
-
-uint8_t get_board_id(void)
-{
- return board_id;
-}
-
-/* Read CBI from i2c eeprom and initialize variables for board variants */
-static void cbi_init(void)
-{
- uint32_t val;
-
- /* SKU ID */
- if (cbi_get_sku_id(&val) != EC_SUCCESS || val > UINT8_MAX) {
- CPRINTS("Read SKU Error value :%d", val);
- return;
- }
-
- sku_id = val;
-
- CPRINTS("SKU: %d", sku_id);
-
- /* Board ID */
- if (cbi_get_board_version(&val) != EC_SUCCESS || val > UINT8_MAX) {
- CPRINTS("Read Board ID Error (%d)", val);
- }
-
- board_id = val;
-
- CPRINTS("Board ID: %d", board_id);
-}
-DECLARE_HOOK(HOOK_INIT, cbi_init, HOOK_PRIO_INIT_I2C + 1);
-
-__override enum ec_pd_port_location board_get_pd_port_location(int port)
-{
- switch (port) {
- case 0:
- return EC_PD_PORT_LOCATION_LEFT_BACK;
- case 1:
- return EC_PD_PORT_LOCATION_RIGHT_BACK;
- default:
- return EC_PD_PORT_LOCATION_UNKNOWN;
- }
-}
diff --git a/baseboard/hatch/baseboard.h b/baseboard/hatch/baseboard.h
deleted file mode 100644
index bf9140b33f..0000000000
--- a/baseboard/hatch/baseboard.h
+++ /dev/null
@@ -1,222 +0,0 @@
-/* Copyright 2019 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.
- */
-
-/* Hatch baseboard configuration */
-
-#ifndef __CROS_EC_BASEBOARD_H
-#define __CROS_EC_BASEBOARD_H
-
-#include "compiler.h"
-#include "stdbool.h"
-
-/*
- * By default, enable all console messages excepted HC, ACPI and event:
- * The sensor stack is generating a lot of activity.
- */
-#define CC_DEFAULT (CC_ALL & ~(CC_MASK(CC_EVENTS) | CC_MASK(CC_LPC)))
-#undef CONFIG_HOSTCMD_DEBUG_MODE
-#define CONFIG_HOSTCMD_DEBUG_MODE HCDEBUG_OFF
-
-/* NPCX7 config */
-#define NPCX7_PWM1_SEL 0 /* GPIO C2 is not used as PWM1. */
-#define NPCX_UART_MODULE2 1 /* GPIO64/65 are used as UART pins. */
-/* Internal SPI flash on NPCX796FC is 512 kB */
-#define CONFIG_FLASH_SIZE_BYTES (512 * 1024)
-#define CONFIG_SPI_FLASH_REGS
-#define CONFIG_SPI_FLASH_W25Q80 /* Internal SPI flash type. */
-#define CONFIG_I2C
-
-/* Optional console commands */
-#define CONFIG_CMD_CHARGER_DUMP
-
-/* EC Defines */
-#define CONFIG_ADC
-#define CONFIG_BOARD_VERSION_CBI
-#define CONFIG_CRC8
-#define CONFIG_CBI_EEPROM
-#define CONFIG_DPTF
-#define CONFIG_HIBERNATE_PSL
-#define CONFIG_LED_ONOFF_STATES
-#define CONFIG_LTO
-#define CONFIG_PWM
-#define CONFIG_VBOOT_HASH
-#define CONFIG_VSTORE
-#define CONFIG_VSTORE_SLOT_COUNT 1
-
-/* Chipset config */
-#define CONFIG_CHIPSET_COMETLAKE
-#define CONFIG_CHIPSET_HAS_PRE_INIT_CALLBACK
-#define CONFIG_CHIPSET_RESET_HOOK
-#define CONFIG_CPU_PROCHOT_ACTIVE_LOW
-#define CONFIG_EXTPOWER_GPIO
-#define CONFIG_POWER_BUTTON
-#define CONFIG_POWER_BUTTON_X86
-#define CONFIG_POWER_COMMON
-#define CONFIG_POWER_PP5000_CONTROL
-#define CONFIG_POWER_S0IX
-#define CONFIG_POWER_SLEEP_FAILURE_DETECTION
-#define CONFIG_POWER_TRACK_HOST_SLEEP_STATE
-
-/* Common Keyboard Defines */
-#define CONFIG_CMD_KEYBOARD
-#define CONFIG_KEYBOARD_COL2_INVERTED
-#define CONFIG_KEYBOARD_KEYPAD
-#define CONFIG_KEYBOARD_PROTOCOL_8042
-#define CONFIG_KEYBOARD_PWRBTN_ASSERTS_KSI2
-
-/* Sensors */
-#define CONFIG_MKBP_EVENT
-#define CONFIG_MKBP_USE_GPIO_AND_HOST_EVENT
-#define CONFIG_DYNAMIC_MOTION_SENSOR_COUNT
-
-/* Don't wake up from suspend on any MKBP event */
-#define CONFIG_MKBP_EVENT_WAKEUP_MASK 0
-
-/* I2C_PORT_ACCEL needs to be defined for i2c transactions */
-#define I2C_PORT_ACCEL I2C_PORT_SENSOR
-
-/* Enable sensor fifo, must also define the _SIZE and _THRES */
-#if !defined(BOARD_PALKIA)
-#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 (CONFIG_ACCEL_FIFO_SIZE / 3)
-
-/* Sensor console commands */
-#define CONFIG_CMD_ACCELS
-#define CONFIG_CMD_ACCEL_INFO
-#endif /* !BOARD_PALKIA */
-
-/* Common charger defines */
-#define CONFIG_CHARGE_MANAGER
-#define CONFIG_CHARGE_MANAGER_EXTERNAL_POWER_LIMIT
-#define CONFIG_CHARGER
-#define CONFIG_CHARGER_BQ25710
-#define CONFIG_CHARGER_DISCHARGE_ON_AC
-#define CONFIG_CHARGER_INPUT_CURRENT 512 /* Allow low-current USB charging */
-#undef CONFIG_CHARGER_MIN_BAT_PCT_FOR_POWER_ON
-#define CONFIG_CHARGER_MIN_BAT_PCT_FOR_POWER_ON 1
-#define CONFIG_CHARGE_RAMP_HW
-#define CONFIG_CHARGER_SENSE_RESISTOR 10
-#define CONFIG_CHARGER_SENSE_RESISTOR_AC 10
-/*
- * Don't allow the system to boot to S0 when the battery is low and unable to
- * communicate on locked systems (which haven't PD negotiated)
- */
-#define CONFIG_CHARGER_MIN_POWER_MW_FOR_POWER_ON_WITH_BATT 15000
-#define CONFIG_CHARGER_MIN_POWER_MW_FOR_POWER_ON 15001
-
-/* Common battery defines */
-#define CONFIG_BATTERY_CUT_OFF
-#define CONFIG_BATTERY_DEVICE_CHEMISTRY "LION"
-#define CONFIG_BATTERY_FUEL_GAUGE
-#define CONFIG_BATTERY_HW_PRESENT_CUSTOM
-#define CONFIG_BATTERY_PRESENT_CUSTOM
-#define CONFIG_BATTERY_REVIVE_DISCONNECT
-#define CONFIG_BATTERY_SMART
-#undef CONFIG_BATT_HOST_FULL_FACTOR
-#define CONFIG_BATT_HOST_FULL_FACTOR 100
-
-/* USB Type C and USB PD defines */
-#define CONFIG_USB_POWER_DELIVERY
-#define CONFIG_USB_PD_TCPMV1
-#if defined(BOARD_PALKIA)
-#define CONFIG_USB_PD_PORT_MAX_COUNT 1
-#else
-#define CONFIG_USB_PD_PORT_MAX_COUNT 2
-#endif
-#define CONFIG_USB_PD_MAX_SINGLE_SOURCE_CURRENT TYPEC_RP_3A0
-#define CONFIG_USB_PD_TCPC_LOW_POWER
-#define CONFIG_USB_PD_DUAL_ROLE_AUTO_TOGGLE
-#define CONFIG_USB_PD_DUAL_ROLE
-#define CONFIG_USB_PD_LOGGING
-#define CONFIG_USB_PD_ALT_MODE
-#define CONFIG_USB_PD_ALT_MODE_DFP
-#define CONFIG_USB_PD_DISCHARGE_PPC
-#define CONFIG_USB_PD_TRY_SRC
-#define CONFIG_USB_PD_VBUS_DETECT_PPC
-#define CONFIG_USB_PD_TCPM_TCPCI
-#define CONFIG_USBC_PPC_SN5S330
-#define CONFIG_USBC_PPC_VCONN
-#define CONFIG_USBC_SS_MUX
-#define CONFIG_USB_PD_TCPM_MUX
-#define CONFIG_USBC_VCONN
-#define CONFIG_USBC_VCONN_SWAP
-#define CONFIG_USBC_PPC_DEDICATED_INT
-
-#define CONFIG_HOSTCMD_PD_CONTROL
-#define CONFIG_CMD_PPC_DUMP
-
-/* Include CLI command needed to support CCD testing. */
-#define CONFIG_CMD_CHARGEN
-
-#define USB_PD_PORT_TCPC_0 0
-#if CONFIG_USB_PD_PORT_MAX_COUNT > 1
-#define USB_PD_PORT_TCPC_1 1
-#endif
-
-/* BC 1.2 */
-#define CONFIG_USB_CHARGER
-
-#if !defined(BOARD_PALKIA)
-/* Common Sensor Defines */
-#define CONFIG_TABLET_MODE
-#endif
-
-/* TODO(b/122273953): Use correct PD delay values */
-#define PD_POWER_SUPPLY_TURN_ON_DELAY 30000 /* us */
-#define PD_POWER_SUPPLY_TURN_OFF_DELAY 250000 /* us */
-
-/* TODO(b/122273953): Use correct PD power values */
-#define PD_OPERATING_POWER_MW 15000
-#define PD_MAX_POWER_MW 60000
-#define PD_MAX_CURRENT_MA 3000
-#define PD_MAX_VOLTAGE_MV 20000
-
-/* I2C Bus Configuration */
-#define CONFIG_I2C
-#define CONFIG_I2C_CONTROLLER
-#define I2C_PORT_SENSOR NPCX_I2C_PORT0_0
-#define I2C_PORT_PPC0 NPCX_I2C_PORT1_0
-#define I2C_PORT_TCPC1 NPCX_I2C_PORT2_0
-#define I2C_PORT_TCPC0 NPCX_I2C_PORT3_0
-#define I2C_PORT_THERMAL NPCX_I2C_PORT4_1
-#define I2C_PORT_POWER NPCX_I2C_PORT5_0
-#define I2C_PORT_EEPROM NPCX_I2C_PORT7_0
-#define I2C_ADDR_EEPROM_FLAGS 0x50
-#define I2C_PORT_BATTERY I2C_PORT_POWER
-#define I2C_PORT_CHARGER I2C_PORT_POWER
-
-/* Other common defines */
-#define CONFIG_BACKLIGHT_LID
-#define GPIO_ENABLE_BACKLIGHT GPIO_EDP_BKLTEN_OD
-
-#define PP5000_PGOOD_POWER_SIGNAL_MASK POWER_SIGNAL_MASK(X86_PP5000_A_PGOOD)
-
-#ifndef __ASSEMBLER__
-
-enum mst_source {
- MST_TYPE_C0,
- MST_TYPE_C1,
- MST_HDMI,
-};
-
-/* Forward declare common (within Hatch) board-specific functions */
-bool board_has_kb_backlight(void);
-unsigned char get_board_sku(void);
-unsigned char get_board_id(void);
-void board_reset_pd_mcu(void);
-void baseboard_mst_enable_control(enum mst_source, int level);
-bool board_is_convertible(void);
-
-FORWARD_DECLARE_ENUM(battery_present);
-
-/* Check with variant about battery presence. */
-enum battery_present variant_battery_present(void);
-
-#endif /* !__ASSEMBLER__ */
-
-#endif /* __CROS_EC_BASEBOARD_H */
diff --git a/baseboard/hatch/battery.c b/baseboard/hatch/battery.c
deleted file mode 100644
index 063aa3721d..0000000000
--- a/baseboard/hatch/battery.c
+++ /dev/null
@@ -1,80 +0,0 @@
-/* Copyright 2019 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_fuel_gauge.h"
-#include "battery_smart.h"
-#include "gpio.h"
-#include "system.h"
-
-static enum battery_present batt_pres_prev = BP_NOT_SURE;
-
-enum battery_present __attribute__((weak)) variant_battery_present(void)
-{
- return BP_NOT_SURE;
-}
-
-enum battery_present battery_hw_present(void)
-{
- enum battery_present bp = variant_battery_present();
-
- if (bp != BP_NOT_SURE)
- return bp;
-
- return gpio_get_level(GPIO_EC_BATT_PRES_ODL) ? BP_NO : BP_YES;
-}
-
-static int battery_init(void)
-{
- int batt_status;
-
- return battery_status(&batt_status) ? 0 :
- !!(batt_status & STATUS_INITIALIZED);
-}
-
-/*
- * Physical detection of battery.
- */
-static enum battery_present battery_check_present_status(void)
-{
- enum battery_present batt_pres;
-
- /* Get the physical hardware status */
- batt_pres = battery_hw_present();
-
- /*
- * If the battery is not physically connected, then no need to perform
- * any more checks.
- */
- if (batt_pres != BP_YES)
- return batt_pres;
-
- /*
- * If the battery is present now and was present last time we checked,
- * return early.
- */
- if (batt_pres == batt_pres_prev)
- return batt_pres;
-
- /*
- * Ensure that battery is:
- * 1. Not in cutoff
- * 2. Initialized
- */
- if (battery_is_cut_off() != BATTERY_CUTOFF_STATE_NORMAL ||
- battery_init() == 0) {
- batt_pres = BP_NO;
- }
-
- return batt_pres;
-}
-
-enum battery_present battery_is_present(void)
-{
- batt_pres_prev = battery_check_present_status();
- return batt_pres_prev;
-}
diff --git a/baseboard/hatch/build.mk b/baseboard/hatch/build.mk
deleted file mode 100644
index 864225f605..0000000000
--- a/baseboard/hatch/build.mk
+++ /dev/null
@@ -1,11 +0,0 @@
-# -*- makefile -*-
-# Copyright 2019 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.
-#
-# Hatch baseboard specific files build
-#
-
-baseboard-y=baseboard.o
-baseboard-$(CONFIG_BATTERY_SMART)+=battery.o
-baseboard-$(CONFIG_USB_POWER_DELIVERY)+=usb_pd_policy.o
diff --git a/baseboard/hatch/usb_pd_policy.c b/baseboard/hatch/usb_pd_policy.c
deleted file mode 100644
index a66bfefe87..0000000000
--- a/baseboard/hatch/usb_pd_policy.c
+++ /dev/null
@@ -1,90 +0,0 @@
-/* Copyright 2019 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.
- */
-
-/* Shared USB-C policy for Hatch boards */
-
-#include "charge_manager.h"
-#include "common.h"
-#include "compile_time_macros.h"
-#include "console.h"
-#include "ec_commands.h"
-#include "gpio.h"
-#include "system.h"
-#include "tcpm/tcpci.h"
-#include "tcpm/tcpm.h"
-#include "usb_mux.h"
-#include "usb_pd.h"
-#include "usbc_ppc.h"
-#include "util.h"
-
-#define CPRINTF(format, args...) cprintf(CC_USBPD, format, ## args)
-#define CPRINTS(format, args...) cprints(CC_USBPD, format, ## args)
-
-int pd_check_vconn_swap(int port)
-{
- /* Only allow vconn swap if pp5000_A rail is enabled */
- return gpio_get_level(GPIO_EN_PP5000_A);
-}
-
-void pd_power_supply_reset(int port)
-{
- int prev_en;
-
- prev_en = ppc_is_sourcing_vbus(port);
-
- /* Disable VBUS. */
- ppc_vbus_source_enable(port, 0);
-
- /* Enable discharge if we were previously sourcing 5V */
- if (prev_en)
- pd_set_vbus_discharge(port, 1);
-
-#ifdef CONFIG_USB_PD_MAX_SINGLE_SOURCE_CURRENT
- /* Give back the current quota we are no longer using */
- charge_manager_source_port(port, 0);
-#endif /* defined(CONFIG_USB_PD_MAX_SINGLE_SOURCE_CURRENT) */
-
- /* Notify host of power info change. */
- pd_send_host_event(PD_EVENT_POWER_CHANGE);
-}
-
-int pd_set_power_supply_ready(int port)
-{
- int rv;
-
- /* Disable charging. */
- rv = ppc_vbus_sink_enable(port, 0);
- if (rv)
- return rv;
-
- pd_set_vbus_discharge(port, 0);
-
- /* Provide Vbus. */
- rv = ppc_vbus_source_enable(port, 1);
- if (rv)
- return rv;
-
-#ifdef CONFIG_USB_PD_MAX_SINGLE_SOURCE_CURRENT
- /* Ensure we advertise the proper available current quota */
- charge_manager_source_port(port, 1);
-#endif /* defined(CONFIG_USB_PD_MAX_SINGLE_SOURCE_CURRENT) */
-
- /* Notify host of power info change. */
- pd_send_host_event(PD_EVENT_POWER_CHANGE);
-
- return EC_SUCCESS;
-}
-
-#ifdef CONFIG_USB_PD_VBUS_DETECT_PPC
-int pd_snk_is_vbus_provided(int port)
-{
- return ppc_is_vbus_present(port);
-}
-#endif
-
-int board_vbus_source_enabled(int port)
-{
- return ppc_is_sourcing_vbus(port);
-}