summaryrefslogtreecommitdiff
path: root/board/poppy
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/poppy
parent08f5a1e6fc2c9467230444ac9b582dcf4d9f0068 (diff)
downloadchrome-ec-stabilize-14496.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/poppy')
-rw-r--r--board/poppy/analyzestack.yaml230
-rw-r--r--board/poppy/base_detect_lux.c237
-rw-r--r--board/poppy/base_detect_poppy.c262
-rw-r--r--board/poppy/battery.c226
-rw-r--r--board/poppy/board.c894
-rw-r--r--board/poppy/board.h264
-rw-r--r--board/poppy/build.mk18
-rw-r--r--board/poppy/ec.tasklist22
-rw-r--r--board/poppy/gpio.inc174
-rw-r--r--board/poppy/led.c165
-rw-r--r--board/poppy/usb_pd_policy.c145
-rw-r--r--board/poppy/vif_override.xml3
12 files changed, 0 insertions, 2640 deletions
diff --git a/board/poppy/analyzestack.yaml b/board/poppy/analyzestack.yaml
deleted file mode 100644
index 59e0f9de4c..0000000000
--- a/board/poppy/analyzestack.yaml
+++ /dev/null
@@ -1,230 +0,0 @@
-# Size of extra stack frame needed by exception context switch.
-# See core/cortex-m/switch.S
-exception_frame_size: 224
-# Add some missing calls.
-add:
- # TCPC stuff:
- tcpm_init.lto_priv.255[driver/tcpm/tcpm.h:77]:
- - anx74xx_tcpm_init
- - tcpci_tcpm_init
- tcpm_release[driver/tcpm/tcpm.h:90]:
- - anx74xx_tcpm_release
- - ps8xxx_tcpm_release
- tcpm_get_cc.lto_priv.246[driver/tcpm/tcpm.h:95]:
- - anx74xx_tcpm_get_cc
- - tcpci_tcpm_get_cc
- tcpm_select_rp_value[driver/tcpm/tcpm.h:105]:
- - anx74xx_tcpm_select_rp_value
- - tcpci_tcpm_select_rp_value
- tcpm_set_cc.lto_priv.239[driver/tcpm/tcpm.h:110]:
- - anx74xx_tcpm_set_cc
- - tcpci_tcpm_set_cc
- tcpm_set_polarity[driver/tcpm/tcpm.h:115]:
- - anx74xx_tcpm_set_polarity
- - tcpci_tcpm_set_polarity
- tcpm_set_vconn.lto_priv.249[driver/tcpm/tcpm.h:120]:
- - anx74xx_tcpm_set_vconn
- - tcpci_tcpm_set_vconn
- tcpm_set_msg_header[driver/tcpm/tcpm.h:125]:
- - anx74xx_tcpm_set_msg_header
- - tcpci_tcpm_set_msg_header
- tcpm_set_rx_enable.lto_priv.252[driver/tcpm/tcpm.h:131]:
- - anx74xx_tcpm_set_rx_enable
- - tcpci_tcpm_set_rx_enable
- tcpm_get_message[driver/tcpm/tcpm.h:136]:
- - anx74xx_tcpm_get_message
- - tcpci_tcpm_get_message
- tcpm_transmit[driver/tcpm/tcpm.h:142]:
- - anx74xx_tcpm_transmit
- - ps8xxx_tcpm_transmit
- tcpc_alert[driver/tcpm/tcpm.h:147]:
- - anx74xx_tcpc_alert
- - tcpci_tcpc_alert
- tcpc_discharge_vbus[driver/tcpm/tcpm.h:152]:
- - anx74xx_tcpc_discharge_vbus
- - tcpci_tcpc_discharge_vbus
- tcpm_set_drp_toggle[driver/tcpm/tcpm.h:163]:
- - anx74xx_tcpc_drp_toggle
- - tcpci_tcpc_drp_toggle
- tcpm_get_chip_info[driver/tcpm/tcpm.h:185]:
- - tcpci_get_chip_info
- board_tcpc_init[board/poppy/board.c:336]:
- - anx74xx_tcpc_update_hpd_status
- - ps8xxx_tcpc_update_hpd_status
- tcpci_tcpc_drp_toggle[driver/tcpm/tcpci.c:148]:
- - None
- # USB mux stuff
- usb_mux_init[driver/usb_mux.c:25]:
- - anx74xx_tcpm_mux_init
- - tcpci_tcpm_mux_init
- usb_mux_init[driver/usb_mux.c:31]:
- - None
- usb_mux_set[driver/usb_mux.c:52]:
- - anx74xx_tcpm_mux_set
- - tcpci_tcpm_mux_set
- usb_mux_get[driver/usb_mux.c:71]:
- - anx74xx_tcpm_mux_get
- - tcpci_tcpm_mux_get
- usb_mux_flip[driver/usb_mux.c:92]:
- - anx74xx_tcpm_mux_get
- - tcpci_tcpm_mux_get
- usb_mux_flip[driver/usb_mux.c:103]:
- - anx74xx_tcpm_mux_set
- - tcpci_tcpm_mux_set
- hc_usb_pd_mux_info[driver/usb_mux.c:169]:
- - anx74xx_tcpm_mux_get
- - tcpci_tcpm_mux_get
- svdm_dp_post_config.lto_priv.271[board/poppy/usb_pd_policy.c:364]:
- - anx74xx_tcpc_update_hpd_status
- - ps8xxx_tcpc_update_hpd_status
- svdm_dp_attention.lto_priv.272[board/poppy/usb_pd_policy.c:379]:
- - anx74xx_tcpc_update_hpd_status
- - ps8xxx_tcpc_update_hpd_status
- svdm_exit_dp_mode.lto_priv.273[board/poppy/usb_pd_policy.c:390]:
- - anx74xx_tcpc_update_hpd_status
- - ps8xxx_tcpc_update_hpd_status
- # pd_svdm
- pd_dfp_enter_mode[common/usb_pd_policy.c:459]:
- - svdm_enter_dp_mode
- dfp_consume_attention.lto_priv.259[common/usb_pd_policy.c:497]:
- - svdm_dp_attention
- pd_dfp_exit_mode[common/usb_pd_policy.c:563]:
- - svdm_exit_dp_mode
- pd_dfp_exit_mode[common/usb_pd_policy.c:580]:
- - svdm_exit_dp_mode
- pd_svdm[common/usb_pd_policy.c:767]:
- - svdm_dp_status
- pd_svdm[common/usb_pd_policy.c:778]:
- - svdm_dp_config
- pd_svdm[common/usb_pd_policy.c:784]:
- - svdm_dp_post_config
- # Motion sense
- queue_advance_head[common/queue.c:105]:
- - queue_action_null
- queue_advance_tail[common/queue.c:116]:
- - queue_action_null
- motion_sense_set_data_rate[common/motion_sense.c:270]:
- - set_data_rate[driver/accelgyro_bmi160.c]
- - opt3001_set_data_rate
- motion_sense_set_data_rate[common/motion_sense.c:289]:
- - get_data_rate[driver/accelgyro_bmi160.c]
- - opt3001_get_data_rate
- motion_sense_set_ec_rate_from_ap[common/motion_sense.c:308]:
- - get_data_rate[driver/accelgyro_bmi160.c]
- - opt3001_get_data_rate
- motion_sense_set_motion_intervals.lto_priv.303[common/motion_sense.c:414]:
- - get_data_rate[driver/accelgyro_bmi160.c]
- - opt3001_get_data_rate
- motion_sense_init[common/motion_sense.c:450]:
- - init[driver/accelgyro_bmi160.c]
- - opt3001_init
- sensor_init_done[common/motion_sense.c:471]:
- - set_range[driver/accelgyro_bmi160.c]
- - opt3001_set_range
- sensor_init_done[common/motion_sense.c:474]:
- - get_range[driver/accelgyro_bmi160.c]
- - opt3001_get_range
- motion_sense_process.isra.9[common/motion_sense.c:721]:
- - irq_handler[driver/accelgyro_bmi160.c]
- host_cmd_motion_sense[common/motion_sense.c:1251]:
- - set_range[driver/accelgyro_bmi160.c]
- - opt3001_set_range
- host_cmd_motion_sense[common/motion_sense.c:1259]:
- - get_range[driver/accelgyro_bmi160.c]
- - opt3001_get_range
- host_cmd_motion_sense[common/motion_sense.c:1274]:
- - set_offset[driver/accelgyro_bmi160.c]
- - opt3001_set_offset
- host_cmd_motion_sense[common/motion_sense.c:1297]:
- - perform_calib[driver/accelgyro_bmi160.c]
- host_cmd_motion_sense[common/motion_sense.c:1300]:
- - get_offset[driver/accelgyro_bmi160.c]
- - opt3001_get_offset
- command_accelrange[common/motion_sense.c:1515]:
- - set_range[driver/accelgyro_bmi160.c]
- - opt3001_set_range
- command_accelrange[common/motion_sense.c:1520]:
- - get_range[driver/accelgyro_bmi160.c]
- - opt3001_get_range
- host_cmd_motion_sense[common/motion_sense.c:1520]:
- - get_range[driver/accelgyro_bmi160.c]
- - opt3001_get_range
- command_accelresolution[common/motion_sense.c:1564]:
- - None
- command_accelresolution[common/motion_sense.c:1568]:
- - get_resolution[driver/accelgyro_bmi160.c]
- command_accel_data_rate[common/motion_sense.c:1623]:
- - get_data_rate[driver/accelgyro_bmi160.c]
- - opt3001_get_data_rate
- command_accel_read_xyz[common/motion_sense.c:1659]:
- - read[driver/accelgyro_bmi160.c]
- - opt3001_read_lux
- # Temp (see temp_sensors array in board file)
- temp_sensor_read[common/temp_sensor.c:26]:
- - charge_get_battery_temp
- - bd99992gw_get_val
- # Misc
- jump_to_image[common/system.c:568]:
- - None
- system_download_from_flash[chip/npcx/system-npcx5.c:257]:
- - None
- __hibernate_npcx_series[chip/npcx/system-npcx5.c:144]:
- - None
- handle_command[common/console.c:248]:
- - { name: __cmds, stride: 16, offset: 4 }
- hook_task[common/hooks.c:197]:
- - { name: __deferred_funcs, stride: 4, offset: 0 }
- - { name: __hooks_second, stride: 8, offset: 0 }
- - { name: __hooks_tick, stride: 8, offset: 0 }
- # Note: This assumes worse case, where all hook functions can be called from
- # any hook_notify call
- # Generate using `grep hooks_.*_end build/soraka/R*/ec.R*.smap |
- # sed -e 's/.*\(__hooks.*\)_end/ - { name: \1, stride: 8, offset: 0 }/' |
- # sort -u`
- hook_notify[common/hooks.c:127]:
- - { name: __hooks_ac_change, stride: 8, offset: 0 }
- - { name: __hooks_battery_soc_change, stride: 8, offset: 0 }
- - { name: __hooks_chipset_pre_init, stride: 8, offset: 0 }
- - { name: __hooks_chipset_reset, stride: 8, offset: 0 }
- - { name: __hooks_chipset_resume, stride: 8, offset: 0 }
- - { name: __hooks_chipset_shutdown, stride: 8, offset: 0 }
- - { name: __hooks_chipset_startup, stride: 8, offset: 0 }
- - { name: __hooks_chipset_suspend, stride: 8, offset: 0 }
- - { name: __hooks_freq_change, stride: 8, offset: 0 }
- - { name: __hooks_lid_change, stride: 8, offset: 0 }
- - { name: __hooks_pre_freq_change, stride: 8, offset: 0 }
- - { name: __hooks_pwrbtn_change, stride: 8, offset: 0 }
- - { name: __hooks_sysjump, stride: 8, offset: 0 }
- - { name: __hooks_tablet_mode_change, stride: 8, offset: 0 }
- mkbp_get_next_event[common/mkbp_event.c:130]:
- - { name: __mkbp_evt_srcs, stride: 8, offset: 4 }
- host_send_response[common/host_command.c:153]:
- - lpc_send_response
- host_packet_respond[common/host_command.c:240]:
- - lpc_send_response
- host_command_process[common/host_command.c:704]:
- - { name: __hcmds, stride: 12, offset: 0 }
- # gpio_interrupt.lto_priv.407[chip/npcx/gpio.c:479]
- vfnprintf:
- # This covers all the addchar in vfnprintf, but stackanalyzer does not
- # realize that...
- - __tx_char
- i2c_command_passthru[common/i2c_master.c:597]:
- - None
-remove:
-# Remove all callsites pointing to panic_assert_fail.
-- panic_assert_fail
-# Remove hook paths that don't make sense
-- [ common_intel_x86_power_handle_state, hook_notify, powerbtn_x86_lid_change ]
-- [ base_disable, hook_notify, handle_pending_reboot.lto_priv.290 ]
-- [ system_common_shutdown, hook_notify, system_run_image_copy ]
-- [ base_detect_change, hook_notify, [ powerbtn_x86_lid_change, jump_to_image, power_up_inhibited_cb, motion_sense_shutdown, motion_sense_resume, system_common_shutdown, base_disable ] ]
-- [ jump_to_image, hook_notify, [ powerbtn_x86_lid_change, system_common_shutdown, power_up_inhibited_cb, motion_sense_shutdown, motion_sense_resume, base_disable ] ]
-- [ [ extpower_deferred, charger_task ], hook_notify, [ powerbtn_x86_lid_change, system_common_shutdown ] ]
-- [ common_intel_x86_power_handle_state, hook_notify, power_up_inhibited_cb ]
-# pd_request_power_swap calls set_state with either PD_STATE_SRC_SWAP_INIT or
-# PD_STATE_SNK_SWAP_INIT as parameters, which cannot call any of the
-# charge_manager functions.
-- [ [ pd_request_power_swap, pd_execute_hard_reset, pd_request_data_swap, pd_request_vconn_swap.lto_priv.237, pd_send_request_msg.lto_priv.250 ], set_state.lto_priv.236, [ typec_set_input_current_limit, charge_manager_update_charge, pd_power_supply_reset, pd_dfp_exit_mode, usb_mux_set ] ]
-# Debug prints that do not actually need a 64 uint division, of the time
-- [ [i2c_reset, i2c_abort_data, i2c_xfer], cprintf, vfnprintf, [uint64divmod.part.3.lto_priv.141, get_time] ]
diff --git a/board/poppy/base_detect_lux.c b/board/poppy/base_detect_lux.c
deleted file mode 100644
index c348eb681d..0000000000
--- a/board/poppy/base_detect_lux.c
+++ /dev/null
@@ -1,237 +0,0 @@
-/* Copyright 2018 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.
- */
-
-/* Lux base detection code */
-
-#include "adc.h"
-#include "board.h"
-#include "chipset.h"
-#include "common.h"
-#include "console.h"
-#include "extpower.h"
-#include "gpio.h"
-#include "hooks.h"
-#include "host_command.h"
-#include "system.h"
-#include "tablet_mode.h"
-#include "task.h"
-#include "timer.h"
-#include "util.h"
-
-#define CPRINTS(format, args...) cprints(CC_USB, format, ## args)
-#define CPRINTF(format, args...) cprintf(CC_USB, format, ## args)
-
-/* Base detection and debouncing */
-#define BASE_DETECT_DEBOUNCE_US (20 * MSEC)
-
-/*
- * If the base status is unclear (i.e. not within expected ranges, read
- * the ADC value again every 500ms.
- */
-#define BASE_DETECT_RETRY_US (500 * MSEC)
-
-/*
- * When base is disconnected, and gets connected:
- * Lid has 1M pull-up, base has 200K pull-down, so the ADC
- * value should be around 200/(200+1000)*3300 = 550.
- *
- * Idle value should be ~3300: lid has 1M pull-up, and nothing else (i.e. ADC
- * maxing out at 2813).
- */
-#define BASE_DISCONNECTED_CONNECT_MIN_MV 450
-#define BASE_DISCONNECTED_CONNECT_MAX_MV 600
-
-#define BASE_DISCONNECTED_MIN_MV 2800
-#define BASE_DISCONNECTED_MAX_MV (ADC_MAX_VOLT+1)
-
-/*
- * When base is connected, then gets disconnected:
- * Lid has 1M pull-up, lid has 10.0K pull-down, so the ADC
- * value should be around 10.0/(10.0+1000)*3300 = 33.
- *
- * Idle level when connected should be:
- * Lid has 10K pull-down, base has 5.1K pull-up, so the ADC value should be
- * around 10.0/(10.0+5.1)*3300 = 2185 (actual value is 2153 as there is still
- * a 1M pull-up on lid, and 200K pull-down on base).
- */
-#define BASE_CONNECTED_DISCONNECT_MIN_MV 20
-#define BASE_CONNECTED_DISCONNECT_MAX_MV 40
-
-#define BASE_CONNECTED_MIN_MV 2050
-#define BASE_CONNECTED_MAX_MV 2300
-
-static uint64_t base_detect_debounce_time;
-
-static void base_detect_deferred(void);
-DECLARE_DEFERRED(base_detect_deferred);
-
-enum base_status {
- BASE_UNKNOWN = 0,
- BASE_DISCONNECTED = 1,
- BASE_CONNECTED = 2,
-};
-
-static enum base_status current_base_status;
-
-/**
- * Board-specific routine to indicate if the base is connected.
- */
-int board_is_base_connected(void)
-{
- return current_base_status == BASE_CONNECTED;
-}
-
-/**
- * Board-specific routine to enable power distribution between lid and base
- * (current can flow both ways).
- *
- * We only allow the base power to be enabled if the detection code knows that
- * the base is connected.
- */
-void board_enable_base_power(int enable)
-{
- gpio_set_level(GPIO_PPVAR_VAR_BASE,
- enable && current_base_status == BASE_CONNECTED);
-}
-
-/*
- * This function is called whenever there is a change in the base detect
- * status. Actions taken include:
- * 1. Enable/disable pull-down on half-duplex UART line
- * 2. Disable power transfer between lid and base when unplugged.
- * 3. Indicate mode change to host.
- * 4. Indicate tablet mode to host. Current assumption is that if base is
- * disconnected then the system is in tablet mode, else if the base is
- * connected, then the system is not in tablet mode.
- */
-static void base_detect_change(enum base_status status)
-{
- int connected = (status == BASE_CONNECTED);
-
- if (current_base_status == status)
- return;
-
- current_base_status = status;
-
- /* Enable pull-down if connected. */
- gpio_set_level(GPIO_EC_COMM_PD, !connected);
- /* Disable power to/from base as quickly as possible. */
- if (!connected)
- board_enable_base_power(0);
-
- /*
- * Wake the charger task (it is responsible for enabling power to the
- * base, and providing OTG power to the base if required).
- */
- task_wake(TASK_ID_CHARGER);
-
- tablet_set_mode(!connected, TABLET_TRIGGER_BASE);
-}
-
-static void print_base_detect_value(const char *str, int v)
-{
- CPRINTS("Base %s. ADC: %d", str, v);
-}
-
-static void base_detect_deferred(void)
-{
- uint64_t time_now = get_time().val;
- int v;
-
- if (base_detect_debounce_time > time_now) {
- hook_call_deferred(&base_detect_deferred_data,
- base_detect_debounce_time - time_now);
- return;
- }
-
- v = adc_read_channel(ADC_BASE_DET);
- if (v == ADC_READ_ERROR)
- goto retry;
-
- if (current_base_status == BASE_CONNECTED) {
- if (v >= BASE_CONNECTED_DISCONNECT_MIN_MV &&
- v <= BASE_CONNECTED_DISCONNECT_MAX_MV) {
- print_base_detect_value("disconnected", v);
- base_detect_change(BASE_DISCONNECTED);
- return;
- } else if (v >= BASE_CONNECTED_MIN_MV &&
- v <= BASE_CONNECTED_MAX_MV) {
- /* Still connected. */
- return;
- }
- } else { /* Disconnected or unknown. */
- if (v >= BASE_DISCONNECTED_CONNECT_MIN_MV &&
- v <= BASE_DISCONNECTED_CONNECT_MAX_MV) {
- print_base_detect_value("connected", v);
- base_detect_change(BASE_CONNECTED);
- return;
- } else if (v >= BASE_DISCONNECTED_MIN_MV &&
- v <= BASE_DISCONNECTED_MAX_MV) {
- if (current_base_status == BASE_UNKNOWN) {
- print_base_detect_value("disconnected", v);
- base_detect_change(BASE_DISCONNECTED);
- }
- /* Still disconnected. */
- return;
- }
- }
-
-retry:
- print_base_detect_value("status unclear", v);
- /* Unclear base status, schedule again in a while. */
- hook_call_deferred(&base_detect_deferred_data,
- BASE_DETECT_RETRY_US);
-}
-
-void base_detect_interrupt(enum gpio_signal signal)
-{
- uint64_t time_now = get_time().val;
-
- if (base_detect_debounce_time <= time_now)
- hook_call_deferred(&base_detect_deferred_data,
- BASE_DETECT_DEBOUNCE_US);
-
- base_detect_debounce_time = time_now + BASE_DETECT_DEBOUNCE_US;
-}
-
-void board_base_reset(void)
-{
- CPRINTS("Resetting base.");
- base_detect_change(BASE_UNKNOWN);
- hook_call_deferred(&base_detect_deferred_data, BASE_DETECT_RETRY_US);
-}
-
-static void base_init(void)
-{
- /*
- * Make sure base power and pull-down are off. This will reset the base
- * if it is already connected.
- */
- board_enable_base_power(0);
- gpio_set_level(GPIO_EC_COMM_PD, 1);
-
- /* Enable base detection interrupt. */
- hook_call_deferred(&base_detect_deferred_data, BASE_DETECT_DEBOUNCE_US);
- gpio_enable_interrupt(GPIO_BASE_DET_A);
-}
-DECLARE_HOOK(HOOK_INIT, base_init, HOOK_PRIO_DEFAULT+1);
-
-void base_force_state(enum ec_set_base_state_cmd state)
-{
- if (state == EC_SET_BASE_STATE_ATTACH) {
- gpio_disable_interrupt(GPIO_BASE_DET_A);
- base_detect_change(BASE_CONNECTED);
- CPRINTS("BD forced connected");
- } else if (state == EC_SET_BASE_STATE_DETACH) {
- gpio_disable_interrupt(GPIO_BASE_DET_A);
- base_detect_change(BASE_DISCONNECTED);
- CPRINTS("BD forced disconnected");
- } else {
- hook_call_deferred(&base_detect_deferred_data,
- BASE_DETECT_DEBOUNCE_US);
- gpio_enable_interrupt(GPIO_BASE_DET_A);
- CPRINTS("BD forced reset");
- }
-}
diff --git a/board/poppy/base_detect_poppy.c b/board/poppy/base_detect_poppy.c
deleted file mode 100644
index 0fde6fb8e6..0000000000
--- a/board/poppy/base_detect_poppy.c
+++ /dev/null
@@ -1,262 +0,0 @@
-/* Copyright 2018 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.
- */
-
-/* Poppy/Soraka base detection code */
-
-#include "acpi.h"
-#include "adc.h"
-#include "board.h"
-#include "chipset.h"
-#include "common.h"
-#include "console.h"
-#include "gpio.h"
-#include "hooks.h"
-#include "host_command.h"
-#include "system.h"
-#include "tablet_mode.h"
-#include "timer.h"
-#include "util.h"
-
-#define CPRINTS(format, args...) cprints(CC_USB, format, ## args)
-#define CPRINTF(format, args...) cprintf(CC_USB, format, ## args)
-
-/* Base detection and debouncing */
-#define BASE_DETECT_DEBOUNCE_US (20 * MSEC)
-
-/*
- * If the base status is unclear (i.e. not within expected ranges, read
- * the ADC value again every 500ms.
- */
-#define BASE_DETECT_RETRY_US (500 * MSEC)
-
-/*
- * rev0: Lid has 100K pull-up, base has 5.1K pull-down, so the ADC
- * value should be around 5.1/(100+5.1)*3300 = 160.
- * >=rev1: Lid has 604K pull-up, base has 30.1K pull-down, so the
- * ADC value should be around 30.1/(604+30.1)*3300 = 156
- *
- * We add a significant marging on the maximum value, due to noise on the line,
- * especially when PWM is active. See b/64193554 for details.
- */
-#define BASE_DETECT_MIN_MV 120
-#define BASE_DETECT_MAX_MV 300
-
-/*
- * When the base is connected in reverse, it presents a 100K pull-down,
- * so the ADC value should be around 100/(604+100)*3300 = 469
- *
- * TODO(b:64370797): Do something with these values.
- */
-#define BASE_DETECT_REVERSE_MIN_MV 450
-#define BASE_DETECT_REVERSE_MAX_MV 500
-
-/* Minimum ADC value to indicate base is disconnected for sure */
-#define BASE_DETECT_DISCONNECT_MIN_MV 1500
-
-/*
- * Base EC pulses detection pin for 500 us to signal out of band USB wake (that
- * can be used to wake system from deep S3).
- */
-#define BASE_DETECT_PULSE_MIN_US 400
-#define BASE_DETECT_PULSE_MAX_US 650
-
-static uint64_t base_detect_debounce_time;
-
-static void base_detect_deferred(void);
-DECLARE_DEFERRED(base_detect_deferred);
-
-enum base_status {
- BASE_UNKNOWN = 0,
- BASE_DISCONNECTED = 1,
- BASE_CONNECTED = 2,
- BASE_CONNECTED_REVERSE = 3,
-};
-
-static enum base_status current_base_status;
-
-/*
- * This function is called whenever there is a change in the base detect
- * status. Actions taken include:
- * 1. Change in power to base
- * 2. Indicate mode change to host.
- * 3. Indicate tablet mode to host. Current assumption is that if base is
- * disconnected then the system is in tablet mode, else if the base is
- * connected, then the system is not in tablet mode.
- */
-static void base_detect_change(enum base_status status)
-{
- int connected = (status == BASE_CONNECTED);
-
- if (current_base_status == status)
- return;
-
- CPRINTS("Base %sconnected", connected ? "" : "not ");
- gpio_set_level(GPIO_PP3300_DX_BASE, connected);
- tablet_set_mode(!connected, TABLET_TRIGGER_BASE);
- current_base_status = status;
-
- if (connected)
- acpi_dptf_set_profile_num(DPTF_PROFILE_BASE_ATTACHED);
- else
- acpi_dptf_set_profile_num(DPTF_PROFILE_BASE_DETACHED);
-
-}
-
-/* Measure detection pin pulse duration (used to wake AP from deep S3). */
-static uint64_t pulse_start;
-static uint32_t pulse_width;
-
-static void print_base_detect_value(int v, int tmp_pulse_width)
-{
- CPRINTS("%s = %d (pulse %d)", adc_channels[ADC_BASE_DET].name,
- v, tmp_pulse_width);
-}
-
-static void base_detect_deferred(void)
-{
- uint64_t time_now = get_time().val;
- int v;
- uint32_t tmp_pulse_width = pulse_width;
- static int reverse_debounce = 1;
-
- if (base_detect_debounce_time > time_now) {
- hook_call_deferred(&base_detect_deferred_data,
- base_detect_debounce_time - time_now);
- return;
- }
-
- v = adc_read_channel(ADC_BASE_DET);
- if (v == ADC_READ_ERROR)
- return;
-
- print_base_detect_value(v, tmp_pulse_width);
-
- if (v >= BASE_DETECT_REVERSE_MIN_MV &&
- v <= BASE_DETECT_REVERSE_MAX_MV) {
- /*
- * If we are unlucky when we sample the ADC, we may think that
- * the base is connected in reverse, while this may just be a
- * transient. Force debouncing a little longer in that case.
- */
- if (current_base_status == BASE_CONNECTED_REVERSE)
- return;
-
- if (reverse_debounce == 0) {
- base_detect_change(BASE_CONNECTED_REVERSE);
- return;
- }
-
- reverse_debounce = 0;
- hook_call_deferred(&base_detect_deferred_data,
- BASE_DETECT_DEBOUNCE_US);
- return;
- }
- /* Reset reverse debounce */
- reverse_debounce = 1;
-
- if (v >= BASE_DETECT_MIN_MV && v <= BASE_DETECT_MAX_MV) {
- if (current_base_status != BASE_CONNECTED) {
- base_detect_change(BASE_CONNECTED);
- } else if (tmp_pulse_width >= BASE_DETECT_PULSE_MIN_US &&
- tmp_pulse_width <= BASE_DETECT_PULSE_MAX_US) {
- CPRINTS("Sending event to AP");
- host_set_single_event(EC_HOST_EVENT_KEY_PRESSED);
- }
- return;
- }
-
- if (v >= BASE_DETECT_DISCONNECT_MIN_MV) {
- base_detect_change(BASE_DISCONNECTED);
- return;
- }
-
- /* Unclear base status, schedule again in a while. */
- hook_call_deferred(&base_detect_deferred_data, BASE_DETECT_RETRY_US);
-}
-
-static inline int detect_pin_connected(enum gpio_signal det_pin)
-{
- return gpio_get_level(det_pin) == 0;
-}
-
-void base_detect_interrupt(enum gpio_signal signal)
-{
- uint64_t time_now = get_time().val;
-
- if (base_detect_debounce_time <= time_now) {
- /*
- * Detect and measure detection pin pulse, when base is
- * connected. Only a single pulse is measured over a debounce
- * period. If no pulse, or multiple pulses are detected,
- * pulse_width is set to 0.
- */
- if (current_base_status == BASE_CONNECTED &&
- !detect_pin_connected(signal)) {
- pulse_start = time_now;
- } else {
- pulse_start = 0;
- }
- pulse_width = 0;
-
- hook_call_deferred(&base_detect_deferred_data,
- BASE_DETECT_DEBOUNCE_US);
- } else {
- if (current_base_status == BASE_CONNECTED &&
- detect_pin_connected(signal) && !pulse_width &&
- pulse_start) {
- /* First pulse within period. */
- pulse_width = time_now - pulse_start;
- } else {
- pulse_start = 0;
- pulse_width = 0;
- }
- }
-
- base_detect_debounce_time = time_now + BASE_DETECT_DEBOUNCE_US;
-}
-
-static void base_enable(void)
-{
- /* Enable base detection interrupt. */
- base_detect_debounce_time = get_time().val;
- hook_call_deferred(&base_detect_deferred_data, 0);
- gpio_enable_interrupt(GPIO_BASE_DET_A);
-}
-DECLARE_HOOK(HOOK_CHIPSET_STARTUP, base_enable, HOOK_PRIO_DEFAULT);
-
-static void base_disable(void)
-{
- /* Disable base detection interrupt and disable power to base. */
- gpio_disable_interrupt(GPIO_BASE_DET_A);
- base_detect_change(BASE_DISCONNECTED);
-}
-DECLARE_HOOK(HOOK_CHIPSET_SHUTDOWN, base_disable, HOOK_PRIO_DEFAULT);
-
-static void base_init(void)
-{
- /*
- * If we jumped to this image and chipset is already in S0, enable
- * base.
- */
- if (system_jumped_late() && chipset_in_state(CHIPSET_STATE_ON))
- base_enable();
-}
-DECLARE_HOOK(HOOK_INIT, base_init, HOOK_PRIO_DEFAULT+1);
-
-void base_force_state(enum ec_set_base_state_cmd state)
-{
- if (state == EC_SET_BASE_STATE_ATTACH) {
- gpio_disable_interrupt(GPIO_BASE_DET_A);
- base_detect_change(BASE_CONNECTED);
- CPRINTS("BD forced connected");
- } else if (state == EC_SET_BASE_STATE_DETACH) {
- gpio_disable_interrupt(GPIO_BASE_DET_A);
- base_detect_change(BASE_DISCONNECTED);
- CPRINTS("BD forced disconnected");
- } else {
- base_enable();
- CPRINTS("BD forced reset");
- }
-}
diff --git a/board/poppy/battery.c b/board/poppy/battery.c
deleted file mode 100644
index 3f6c4e273d..0000000000
--- a/board/poppy/battery.c
+++ /dev/null
@@ -1,226 +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.
- *
- * Placeholder values for temporary battery pack.
- */
-
-#include "battery.h"
-#include "battery_smart.h"
-#include "charge_state.h"
-#include "console.h"
-#include "ec_commands.h"
-#include "extpower.h"
-#include "gpio.h"
-#include "util.h"
-
-#define CPRINTS(format, args...) cprints(CC_CHARGER, format, ## args)
-
-static enum battery_present batt_pres_prev = BP_NOT_SURE;
-
-/* Shutdown mode parameter to write to manufacturer access register */
-#define SB_SHIP_MODE_REG SB_MANUFACTURER_ACCESS
-#define SB_SHUTDOWN_DATA 0x0010
-#define SB_REVIVE_DATA 0x23a7
-
-#if defined(BOARD_SORAKA) || defined(BOARD_LUX)
-static const struct battery_info info = {
- .voltage_max = 8800,
- .voltage_normal = 7700,
- .voltage_min = 6100,
- /* Pre-charge values. */
- .precharge_current = 256, /* mA */
-
- .start_charging_min_c = 0,
- .start_charging_max_c = 45,
- .charging_min_c = 0,
- .charging_max_c = 45,
- .discharging_min_c = -10,
- .discharging_max_c = 60,
-};
-#elif defined(BOARD_POPPY)
-
-static const struct battery_info info = {
- .voltage_max = 13200,
- .voltage_normal = 11550,
- .voltage_min = 9100,
- /* Pre-charge values. */
- .precharge_current = 256, /* mA */
-
- .start_charging_min_c = 0,
- .start_charging_max_c = 50,
- .charging_min_c = 0,
- .charging_max_c = 60,
- .discharging_min_c = 0,
- .discharging_max_c = 60,
-};
-#else
-#error "Battery information not available for board"
-#endif
-
-const struct battery_info *battery_get_info(void)
-{
- return &info;
-}
-
-int board_cut_off_battery(void)
-{
- int rv;
-
- /* Ship mode command must be sent twice to take effect */
- rv = sb_write(SB_SHIP_MODE_REG, SB_SHUTDOWN_DATA);
-
- if (rv != EC_SUCCESS)
- return rv;
-
- return sb_write(SB_SHIP_MODE_REG, SB_SHUTDOWN_DATA);
-}
-
-enum battery_present battery_hw_present(void)
-{
- /* The GPIO is low when the battery is physically present */
- return gpio_get_level(GPIO_BATTERY_PRESENT_L) ? BP_NO : BP_YES;
-}
-
-static int battery_init(void)
-{
- int batt_status;
-
- return battery_status(&batt_status) ? 0 :
- !!(batt_status & STATUS_INITIALIZED);
-}
-
-/*
- * Check for case where both XCHG and XDSG bits are set indicating that even
- * though the FG can be read from the battery, the battery is not able to be
- * charged or discharged. This situation will happen if a battery disconnect was
- * intiaited via H1 setting the DISCONN signal to the battery. This will put the
- * battery pack into a sleep state and when power is reconnected, the FG can be
- * read, but the battery is still not able to provide power to the system. The
- * calling function returns batt_pres = BP_NO, which instructs the charging
- * state machine to prevent powering up the AP on battery alone which could lead
- * to a brownout event when the battery isn't able yet to provide power to the
- * system. .
- */
-static int battery_check_disconnect(void)
-{
- int rv;
- uint8_t data[6];
-
- /* Check if battery charging + discharging is disabled. */
- rv = sb_read_mfgacc(PARAM_OPERATION_STATUS,
- SB_ALT_MANUFACTURER_ACCESS, data, sizeof(data));
- if (rv)
- return BATTERY_DISCONNECT_ERROR;
-
- if ((data[3] & (BATTERY_DISCHARGING_DISABLED |
- BATTERY_CHARGING_DISABLED)) ==
- (BATTERY_DISCHARGING_DISABLED | BATTERY_CHARGING_DISABLED))
- return BATTERY_DISCONNECTED;
-
- return BATTERY_NOT_DISCONNECTED;
-}
-
-#ifdef BOARD_SORAKA
-/*
- * In case of soraka, battery enters an "emergency shutdown" mode when hardware
- * button combo is used to cutoff battery. In order to get out of this mode, EC
- * needs to send SB_REVIVE_DATA.
- *
- * Do not send revive data if:
- * 1. It has already been sent during this boot or
- * 2. Battery was/is in a state other than "BATTERY_DISCONNECTED".
- *
- * Try upto ten times to send the revive data command and if it fails every
- * single time, give up and continue booting on AC power.
- */
-static void battery_revive(void)
-{
-#define MAX_REVIVE_TRIES 10
- static int battery_revive_done;
- int tries = MAX_REVIVE_TRIES;
-
- if (battery_revive_done)
- return;
-
- battery_revive_done = 1;
-
- while (tries--) {
- if (battery_check_disconnect() != BATTERY_DISCONNECTED)
- return;
-
- CPRINTS("Battery is disconnected! Try#%d to revive",
- MAX_REVIVE_TRIES - tries);
-
- if (sb_write(SB_MANUFACTURER_ACCESS, SB_REVIVE_DATA) ==
- EC_SUCCESS)
- return;
- }
-
- if (battery_check_disconnect() == BATTERY_DISCONNECTED)
- CPRINTS("Battery is still disconnected! Giving up!");
-}
-#endif
-
-static enum battery_present battery_check_present_status(void)
-{
- enum battery_present batt_pres;
- int batt_disconnect_status;
-
- /* 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;
-
- /*
- * Check battery disconnect status. If we are unable to read battery
- * disconnect status, then return BP_NOT_SURE. Battery could be in ship
- * mode and might require pre-charge current to wake it up. BP_NO is not
- * returned here because charger state machine will not provide
- * pre-charge current assuming that battery is not present.
- */
- batt_disconnect_status = battery_check_disconnect();
- if (batt_disconnect_status == BATTERY_DISCONNECT_ERROR)
- return BP_NOT_SURE;
-
-#ifdef BOARD_SORAKA
- /*
- * Since battery just changed status to present and we are able to read
- * disconnect status, try reviving it if necessary.
- */
- battery_revive();
-#endif
-
- /*
- * Ensure that battery is:
- * 1. Not in cutoff
- * 2. Not disconnected
- * 3. Initialized
- */
- if (battery_is_cut_off() != BATTERY_CUTOFF_STATE_NORMAL ||
- batt_disconnect_status != BATTERY_NOT_DISCONNECTED ||
- 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/board/poppy/board.c b/board/poppy/board.c
deleted file mode 100644
index 2124faa421..0000000000
--- a/board/poppy/board.c
+++ /dev/null
@@ -1,894 +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.
- */
-
-/* Poppy board-specific configuration */
-
-#include "adc.h"
-#include "als.h"
-#include "bd99992gw.h"
-#include "board_config.h"
-#include "button.h"
-#include "charge_manager.h"
-#include "charge_state.h"
-#include "charge_ramp.h"
-#include "charger.h"
-#include "chipset.h"
-#include "console.h"
-#include "driver/accelgyro_bmi_common.h"
-#include "driver/als_opt3001.h"
-#include "driver/baro_bmp280.h"
-#include "driver/charger/isl923x.h"
-#include "driver/tcpm/anx74xx.h"
-#include "driver/tcpm/ps8xxx.h"
-#include "driver/tcpm/tcpci.h"
-#include "driver/tcpm/tcpm.h"
-#include "driver/temp_sensor/bd99992gw.h"
-#include "extpower.h"
-#include "gpio.h"
-#include "hooks.h"
-#include "host_command.h"
-#include "i2c.h"
-#include "lid_switch.h"
-#include "math_util.h"
-#include "motion_lid.h"
-#include "motion_sense.h"
-#include "pi3usb9281.h"
-#include "power.h"
-#include "power_button.h"
-#include "spi.h"
-#include "switch.h"
-#include "system.h"
-#include "tablet_mode.h"
-#include "task.h"
-#include "temp_sensor.h"
-#include "timer.h"
-#include "uart.h"
-#include "usb_charge.h"
-#include "usb_mux.h"
-#include "usb_pd.h"
-#include "usb_pd_tcpm.h"
-#include "util.h"
-#include "espi.h"
-
-#define CPRINTS(format, args...) cprints(CC_USBCHARGE, format, ## args)
-#define CPRINTF(format, args...) cprintf(CC_USBCHARGE, format, ## args)
-
-#define USB_PD_PORT_ANX74XX 0
-
-/* Minimum input current limit. */
-#define ILIM_MIN_MA 472
-
-static void tcpc_alert_event(enum gpio_signal signal)
-{
- if ((signal == GPIO_USB_C0_PD_INT_ODL) &&
- !gpio_get_level(GPIO_USB_C0_PD_RST_L))
- return;
- else if ((signal == GPIO_USB_C1_PD_INT_ODL) &&
- !gpio_get_level(GPIO_USB_C1_PD_RST_L))
- return;
-
-#ifdef HAS_TASK_PDCMD
- /* Exchange status with TCPCs */
- host_command_pd_send_status(PD_CHARGE_NO_CHANGE);
-#endif
-}
-
-/* Set PD discharge whenever VBUS detection is high (i.e. below threshold). */
-static void vbus_discharge_handler(void)
-{
- if (system_get_board_version() >= 2) {
- pd_set_vbus_discharge(0,
- gpio_get_level(GPIO_USB_C0_VBUS_WAKE_L));
- pd_set_vbus_discharge(1,
- gpio_get_level(GPIO_USB_C1_VBUS_WAKE_L));
- }
-}
-DECLARE_DEFERRED(vbus_discharge_handler);
-
-void vbus0_evt(enum gpio_signal signal)
-{
- /* VBUS present GPIO is inverted */
- usb_charger_vbus_change(0, !gpio_get_level(signal));
- task_wake(TASK_ID_PD_C0);
-
- hook_call_deferred(&vbus_discharge_handler_data, 0);
-}
-
-void vbus1_evt(enum gpio_signal signal)
-{
- /* VBUS present GPIO is inverted */
- usb_charger_vbus_change(1, !gpio_get_level(signal));
- task_wake(TASK_ID_PD_C1);
-
- hook_call_deferred(&vbus_discharge_handler_data, 0);
-}
-
-void usb0_evt(enum gpio_signal signal)
-{
- task_set_event(TASK_ID_USB_CHG_P0, USB_CHG_EVENT_BC12);
-}
-
-void usb1_evt(enum gpio_signal signal)
-{
- task_set_event(TASK_ID_USB_CHG_P1, USB_CHG_EVENT_BC12);
-}
-
-#ifdef CONFIG_USB_PD_TCPC_LOW_POWER
-static void anx74xx_cable_det_handler(void)
-{
- int cable_det = gpio_get_level(GPIO_USB_C0_CABLE_DET);
- int reset_n = gpio_get_level(GPIO_USB_C0_PD_RST_L);
-
- /*
- * A cable_det low->high transition was detected. If following the
- * debounce time, cable_det is high, and reset_n is low, then ANX3429 is
- * currently in standby mode and needs to be woken up. Set the
- * TCPC_RESET event which will bring the ANX3429 out of standby
- * mode. Setting this event is gated on reset_n being low because the
- * ANX3429 will always set cable_det when transitioning to normal mode
- * and if in normal mode, then there is no need to trigger a tcpc reset.
- */
- if (cable_det && !reset_n)
- task_set_event(TASK_ID_PD_C0, PD_EVENT_TCPC_RESET);
-}
-DECLARE_DEFERRED(anx74xx_cable_det_handler);
-
-void anx74xx_cable_det_interrupt(enum gpio_signal signal)
-{
- /* debounce for 2 msec */
- hook_call_deferred(&anx74xx_cable_det_handler_data, (2 * MSEC));
-}
-#endif
-
-#include "gpio_list.h"
-
-/* Hibernate wake configuration */
-const enum gpio_signal hibernate_wake_pins[] = {
- GPIO_AC_PRESENT,
- GPIO_POWER_BUTTON_L,
-};
-const int hibernate_wake_pins_used = ARRAY_SIZE(hibernate_wake_pins);
-
-/* ADC channels */
-const struct adc_t adc_channels[] = {
- /* Base detection */
- [ADC_BASE_DET] = {"BASE_DET", NPCX_ADC_CH0,
- ADC_MAX_VOLT, ADC_READ_MAX+1, 0},
- /* Vbus sensing (10x voltage divider). */
- [ADC_VBUS] = {"VBUS", NPCX_ADC_CH2, ADC_MAX_VOLT*10, ADC_READ_MAX+1, 0},
- /*
- * Adapter current output or battery charging/discharging current (uV)
- * 18x amplification on charger side.
- */
- [ADC_AMON_BMON] = {"AMON_BMON", NPCX_ADC_CH1, ADC_MAX_VOLT*1000/18,
- ADC_READ_MAX+1, 0},
-#ifdef BOARD_LUX
- /*
- * ISL9238 PSYS output is 1.44 uA/W over 12.4K resistor, to read
- * 0.8V @ 45 W, i.e. 56250 uW/mV. Using ADC_MAX_VOLT*56250 and
- * ADC_READ_MAX+1 as multiplier/divider leads to overflows, so we
- * only divide by 2 (enough to avoid precision issues).
- */
- [ADC_PSYS] = {"PSYS", NPCX_ADC_CH3,
- ADC_MAX_VOLT*56250*2/(ADC_READ_MAX+1), 2, 0},
-#endif
-};
-BUILD_ASSERT(ARRAY_SIZE(adc_channels) == ADC_CH_COUNT);
-
-/* I2C port map */
-const struct i2c_port_t i2c_ports[] = {
- {"tcpc", NPCX_I2C_PORT0_0, 400, GPIO_I2C0_0_SCL, GPIO_I2C0_0_SDA},
- {"als", NPCX_I2C_PORT0_1, 400, GPIO_I2C0_1_SCL, GPIO_I2C0_1_SDA},
- {"charger", NPCX_I2C_PORT1, 100, GPIO_I2C1_SCL, GPIO_I2C1_SDA},
- {"pmic", NPCX_I2C_PORT2, 400, GPIO_I2C2_SCL, GPIO_I2C2_SDA},
- {"accelgyro", NPCX_I2C_PORT3, 400, GPIO_I2C3_SCL, GPIO_I2C3_SDA},
-};
-const unsigned int i2c_ports_used = ARRAY_SIZE(i2c_ports);
-
-/* TCPC mux configuration */
-const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_MAX_COUNT] = {
- {
- .bus_type = EC_BUS_TYPE_I2C,
- .i2c_info = {
- .port = NPCX_I2C_PORT0_0,
- .addr_flags = ANX74XX_I2C_ADDR1_FLAGS,
- },
- .drv = &anx74xx_tcpm_drv,
- },
- {
- .bus_type = EC_BUS_TYPE_I2C,
- .i2c_info = {
- .port = NPCX_I2C_PORT0_0,
- .addr_flags = PS8751_I2C_ADDR1_FLAGS,
- },
- .drv = &ps8xxx_tcpm_drv,
- },
-};
-
-const struct usb_mux usb_muxes[CONFIG_USB_PD_PORT_MAX_COUNT] = {
- {
- .usb_port = 0,
- .driver = &anx74xx_tcpm_usb_mux_driver,
- .hpd_update = &anx74xx_tcpc_update_hpd_status,
- },
- {
- .usb_port = 1,
- .driver = &tcpci_tcpm_usb_mux_driver,
- .hpd_update = &ps8xxx_tcpc_update_hpd_status,
- }
-};
-
-struct pi3usb9281_config pi3usb9281_chips[] = {
- {
- .i2c_port = I2C_PORT_USB_CHARGER_0,
- .mux_lock = NULL,
- },
- {
- .i2c_port = I2C_PORT_USB_CHARGER_1,
- .mux_lock = NULL,
- },
-};
-BUILD_ASSERT(ARRAY_SIZE(pi3usb9281_chips) ==
- CONFIG_BC12_DETECT_PI3USB9281_CHIP_COUNT);
-
-const struct charger_config_t chg_chips[] = {
- {
- .i2c_port = I2C_PORT_CHARGER,
- .i2c_addr_flags = ISL923X_ADDR_FLAGS,
- .drv = &isl923x_drv,
- },
-};
-
-
-/**
- * Power on (or off) a single TCPC.
- * minimum on/off delays are included.
- *
- * @param port Port number of TCPC.
- * @param mode 0: power off, 1: power on.
- */
-void board_set_tcpc_power_mode(int port, int mode)
-{
- if (port != USB_PD_PORT_ANX74XX)
- return;
-
- if (mode) {
- gpio_set_level(GPIO_USB_C0_TCPC_PWR, 1);
- msleep(ANX74XX_PWR_H_RST_H_DELAY_MS);
- gpio_set_level(GPIO_USB_C0_PD_RST_L, 1);
- } else {
- gpio_set_level(GPIO_USB_C0_PD_RST_L, 0);
- msleep(ANX74XX_RST_L_PWR_L_DELAY_MS);
- gpio_set_level(GPIO_USB_C0_TCPC_PWR, 0);
- msleep(ANX74XX_PWR_L_PWR_H_DELAY_MS);
- }
-}
-
-void board_reset_pd_mcu(void)
-{
- /* Assert reset */
- gpio_set_level(GPIO_USB_C0_PD_RST_L, 0);
- gpio_set_level(GPIO_USB_C1_PD_RST_L, 0);
-
- msleep(MAX(1, ANX74XX_RST_L_PWR_L_DELAY_MS));
- gpio_set_level(GPIO_USB_C1_PD_RST_L, 1);
- /* Disable TCPC0 (anx3429) power */
- gpio_set_level(GPIO_USB_C0_TCPC_PWR, 0);
-
- msleep(ANX74XX_PWR_L_PWR_H_DELAY_MS);
- board_set_tcpc_power_mode(USB_PD_PORT_ANX74XX, 1);
-}
-
-void board_tcpc_init(void)
-{
- int reg;
-
- /* Only reset TCPC if not sysjump */
- if (!system_jumped_late()) {
- gpio_set_level(GPIO_PP3300_USB_PD, 1);
- /* TODO(crosbug.com/p/61098): How long do we need to wait? */
- msleep(10);
- board_reset_pd_mcu();
- }
-
- /*
- * TODO: Remove when Poppy is updated with PS8751 A3.
- *
- * Force PS8751 A2 to wake from low power mode.
- * If PS8751 remains in low power mode after sysjump,
- * TCPM_INIT will fail due to not able to access PS8751.
- *
- * NOTE: PS8751 A3 will wake on any I2C access.
- */
- i2c_read8(NPCX_I2C_PORT0_1, 0x08, 0xA0, &reg);
-
- /* Enable TCPC interrupts */
- gpio_enable_interrupt(GPIO_USB_C0_PD_INT_ODL);
- gpio_enable_interrupt(GPIO_USB_C1_PD_INT_ODL);
-
-#ifdef CONFIG_USB_PD_TCPC_LOW_POWER
- /* Enable CABLE_DET interrupt for ANX3429 wake from standby */
- gpio_enable_interrupt(GPIO_USB_C0_CABLE_DET);
-#endif
-
- /*
- * Initialize HPD to low; after sysjump SOC needs to see
- * HPD pulse to enable video path
- */
- for (int port = 0; port < CONFIG_USB_PD_PORT_MAX_COUNT; ++port)
- usb_mux_hpd_update(port, USB_PD_MUX_HPD_LVL_DEASSERTED |
- USB_PD_MUX_HPD_IRQ_DEASSERTED);
-}
-DECLARE_HOOK(HOOK_INIT, board_tcpc_init, HOOK_PRIO_INIT_I2C+1);
-
-uint16_t tcpc_get_alert_status(void)
-{
- uint16_t status = 0;
-
- if (!gpio_get_level(GPIO_USB_C0_PD_INT_ODL)) {
- if (gpio_get_level(GPIO_USB_C0_PD_RST_L))
- status |= PD_STATUS_TCPC_ALERT_0;
- }
-
- if (!gpio_get_level(GPIO_USB_C1_PD_INT_ODL)) {
- if (gpio_get_level(GPIO_USB_C1_PD_RST_L))
- status |= PD_STATUS_TCPC_ALERT_1;
- }
-
- return status;
-}
-
-const struct temp_sensor_t temp_sensors[] = {
- {"Battery", TEMP_SENSOR_TYPE_BATTERY, charge_get_battery_temp, 0},
-
- /* These BD99992GW temp sensors are only readable in S0 */
- {"Ambient", TEMP_SENSOR_TYPE_BOARD, bd99992gw_get_val,
- BD99992GW_ADC_CHANNEL_SYSTHERM0},
- {"Charger", TEMP_SENSOR_TYPE_BOARD, bd99992gw_get_val,
- BD99992GW_ADC_CHANNEL_SYSTHERM1},
- {"DRAM", TEMP_SENSOR_TYPE_BOARD, bd99992gw_get_val,
- BD99992GW_ADC_CHANNEL_SYSTHERM2},
- {"eMMC", TEMP_SENSOR_TYPE_BOARD, bd99992gw_get_val,
- BD99992GW_ADC_CHANNEL_SYSTHERM3},
-};
-BUILD_ASSERT(ARRAY_SIZE(temp_sensors) == TEMP_SENSOR_COUNT);
-
-/*
- * Check if PMIC fault registers indicate VR fault. If yes, print out fault
- * register info to console. Additionally, set panic reason so that the OS can
- * check for fault register info by looking at offset 0x14(PWRSTAT1) and
- * 0x15(PWRSTAT2) in cros ec panicinfo.
- */
-static void board_report_pmic_fault(const char *str)
-{
- int vrfault, pwrstat1 = 0, pwrstat2 = 0;
- uint32_t info;
-
- /* RESETIRQ1 -- Bit 4: VRFAULT */
- if (i2c_read8(I2C_PORT_PMIC, I2C_ADDR_BD99992_FLAGS, 0x8, &vrfault)
- != EC_SUCCESS)
- return;
-
- if (!(vrfault & BIT(4)))
- return;
-
- /* VRFAULT has occurred, print VRFAULT status bits. */
-
- /* PWRSTAT1 */
- i2c_read8(I2C_PORT_PMIC, I2C_ADDR_BD99992_FLAGS, 0x16, &pwrstat1);
-
- /* PWRSTAT2 */
- i2c_read8(I2C_PORT_PMIC, I2C_ADDR_BD99992_FLAGS, 0x17, &pwrstat2);
-
- CPRINTS("PMIC VRFAULT: %s", str);
- CPRINTS("PMIC VRFAULT: PWRSTAT1=0x%02x PWRSTAT2=0x%02x", pwrstat1,
- pwrstat2);
-
- /* Clear all faults -- Write 1 to clear. */
- i2c_write8(I2C_PORT_PMIC, I2C_ADDR_BD99992_FLAGS, 0x8, BIT(4));
- i2c_write8(I2C_PORT_PMIC, I2C_ADDR_BD99992_FLAGS, 0x16, pwrstat1);
- i2c_write8(I2C_PORT_PMIC, I2C_ADDR_BD99992_FLAGS, 0x17, pwrstat2);
-
- /*
- * Status of the fault registers can be checked in the OS by looking at
- * offset 0x14(PWRSTAT1) and 0x15(PWRSTAT2) in cros ec panicinfo.
- */
- info = ((pwrstat2 & 0xFF) << 8) | (pwrstat1 & 0xFF);
- panic_set_reason(PANIC_SW_PMIC_FAULT, info, 0);
-}
-
-static void board_pmic_disable_slp_s0_vr_decay(void)
-{
- /*
- * VCCIOCNT:
- * Bit 6 (0) - Disable decay of VCCIO on SLP_S0# assertion
- * Bits 5:4 (00) - Nominal output voltage: 0.850V
- * Bits 3:2 (10) - VR set to AUTO on SLP_S0# de-assertion
- * Bits 1:0 (10) - VR set to AUTO operating mode
- */
- i2c_write8(I2C_PORT_PMIC, I2C_ADDR_BD99992_FLAGS, 0x30, 0x3a);
-
- /*
- * V18ACNT:
- * Bits 7:6 (00) - Disable low power mode on SLP_S0# assertion
- * Bits 5:4 (10) - Nominal voltage set to 1.8V
- * Bits 3:2 (10) - VR set to AUTO on SLP_S0# de-assertion
- * Bits 1:0 (10) - VR set to AUTO operating mode
- */
- i2c_write8(I2C_PORT_PMIC, I2C_ADDR_BD99992_FLAGS, 0x34, 0x2a);
-
- /*
- * V100ACNT:
- * Bits 7:6 (00) - Disable low power mode on SLP_S0# assertion
- * Bits 5:4 (01) - Nominal voltage 1.0V
- * Bits 3:2 (10) - VR set to AUTO on SLP_S0# de-assertion
- * Bits 1:0 (10) - VR set to AUTO operating mode
- */
- i2c_write8(I2C_PORT_PMIC, I2C_ADDR_BD99992_FLAGS, 0x37, 0x1a);
-
- /*
- * V085ACNT:
- * Bits 7:6 (00) - Disable low power mode on SLP_S0# assertion
- * Bits 5:4 (11) - Nominal voltage 1.0V
- * Bits 3:2 (10) - VR set to AUTO on SLP_S0# de-assertion
- * Bits 1:0 (10) - VR set to AUTO operating mode
- */
- i2c_write8(I2C_PORT_PMIC, I2C_ADDR_BD99992_FLAGS, 0x38, 0x3a);
-}
-
-static void board_pmic_enable_slp_s0_vr_decay(void)
-{
- /*
- * VCCIOCNT:
- * Bit 6 (1) - Enable decay of VCCIO on SLP_S0# assertion
- * Bits 5:4 (00) - Nominal output voltage: 0.850V
- * Bits 3:2 (10) - VR set to AUTO on SLP_S0# de-assertion
- * Bits 1:0 (10) - VR set to AUTO operating mode
- */
- i2c_write8(I2C_PORT_PMIC, I2C_ADDR_BD99992_FLAGS, 0x30, 0x7a);
-
- /*
- * V18ACNT:
- * Bits 7:6 (01) - Enable low power mode on SLP_S0# assertion
- * Bits 5:4 (10) - Nominal voltage set to 1.8V
- * Bits 3:2 (10) - VR set to AUTO on SLP_S0# de-assertion
- * Bits 1:0 (10) - VR set to AUTO operating mode
- */
- i2c_write8(I2C_PORT_PMIC, I2C_ADDR_BD99992_FLAGS, 0x34, 0x6a);
-
- /*
- * V100ACNT:
- * Bits 7:6 (01) - Enable low power mode on SLP_S0# assertion
- * Bits 5:4 (01) - Nominal voltage 1.0V
- * Bits 3:2 (10) - VR set to AUTO on SLP_S0# de-assertion
- * Bits 1:0 (10) - VR set to AUTO operating mode
- */
- i2c_write8(I2C_PORT_PMIC, I2C_ADDR_BD99992_FLAGS, 0x37, 0x5a);
-
- /*
- * V085ACNT:
- * Bits 7:6 (01) - Enable low power mode on SLP_S0# assertion
- * Bits 5:4 (11) - Nominal voltage 1.0V
- * Bits 3:2 (10) - VR set to AUTO on SLP_S0# de-assertion
- * Bits 1:0 (10) - VR set to AUTO operating mode
- */
- i2c_write8(I2C_PORT_PMIC, I2C_ADDR_BD99992_FLAGS, 0x38, 0x7a);
-}
-
-__override void power_board_handle_host_sleep_event(
- enum host_sleep_event state)
-{
- if (state == HOST_SLEEP_EVENT_S0IX_SUSPEND)
- board_pmic_enable_slp_s0_vr_decay();
- else if (state == HOST_SLEEP_EVENT_S0IX_RESUME)
- board_pmic_disable_slp_s0_vr_decay();
-}
-
-static void board_pmic_init(void)
-{
- board_report_pmic_fault("SYSJUMP");
-
- if (system_jumped_late())
- return;
-
- /* DISCHGCNT3 - enable 100 ohm discharge on V1.00A */
- i2c_write8(I2C_PORT_PMIC, I2C_ADDR_BD99992_FLAGS, 0x3e, 0x04);
-
- board_pmic_disable_slp_s0_vr_decay();
-
- /* VRMODECTRL - disable low-power mode for all rails */
- i2c_write8(I2C_PORT_PMIC, I2C_ADDR_BD99992_FLAGS, 0x3b, 0x1f);
-
- /* Disable power button shutdown timer. */
- i2c_write8(I2C_PORT_PMIC, I2C_ADDR_BD99992_FLAGS, 0x14, 0x00);
-}
-DECLARE_DEFERRED(board_pmic_init);
-
-/* Initialize board. */
-static void board_init(void)
-{
- /*
- * This enables pull-down on F_DIO1 (SPI MISO), and F_DIO0 (SPI MOSI),
- * whenever the EC is not doing SPI flash transactions. This avoids
- * floating SPI buffer input (MISO), which causes power leakage (see
- * b/64797021).
- */
- NPCX_PUPD_EN1 |= BIT(NPCX_DEVPU1_F_SPI_PUD_EN);
-
- /* Provide AC status to the PCH */
- gpio_set_level(GPIO_PCH_ACOK, extpower_is_present());
-
- /* Enable sensors power supply */
- gpio_set_level(GPIO_PP1800_DX_SENSOR, 1);
- gpio_set_level(GPIO_PP3300_DX_SENSOR, 1);
-
- /* Enable VBUS interrupt */
- if (system_get_board_version() == 0) {
- /*
- * crosbug.com/p/61929: rev0 does not have VBUS detection,
- * force detection on both ports.
- */
- gpio_set_flags(GPIO_USB_C0_VBUS_WAKE_L,
- GPIO_INPUT | GPIO_PULL_DOWN);
- gpio_set_flags(GPIO_USB_C1_VBUS_WAKE_L,
- GPIO_INPUT | GPIO_PULL_DOWN);
-
- vbus0_evt(GPIO_USB_C0_VBUS_WAKE_L);
- vbus1_evt(GPIO_USB_C1_VBUS_WAKE_L);
- } else {
- gpio_enable_interrupt(GPIO_USB_C0_VBUS_WAKE_L);
- gpio_enable_interrupt(GPIO_USB_C1_VBUS_WAKE_L);
- }
-
- /* Enable pericom BC1.2 interrupts */
- gpio_enable_interrupt(GPIO_USB_C0_BC12_INT_L);
- gpio_enable_interrupt(GPIO_USB_C1_BC12_INT_L);
-
- /*
- * Set unused GPIO_LED_YELLO_C0[_OLD] as INPUT | PULL_UP
- * for better S0ix/S3 power
- */
- if (system_get_board_version() >= 5)
- gpio_set_flags(GPIO_LED_YELLOW_C0_OLD,
- GPIO_INPUT | GPIO_PULL_UP);
- else
- gpio_set_flags(GPIO_LED_YELLOW_C0,
- GPIO_INPUT | GPIO_PULL_UP);
-
-#ifdef BOARD_SORAKA
- /*
- * TODO(b/64503543): Add proper options(#ifdef ) for Non-LTE SKU
- * Set unused LTE related pins as INPUT | PULL_UP
- * for better S0ix/S3 power
- */
- if (system_get_board_version() >= 4) {
- gpio_set_flags(GPIO_WLAN_PE_RST,
- GPIO_INPUT | GPIO_PULL_UP);
- gpio_set_flags(GPIO_PP3300_DX_LTE,
- GPIO_INPUT | GPIO_PULL_UP);
- gpio_set_flags(GPIO_LTE_GPS_OFF_L,
- GPIO_INPUT | GPIO_PULL_UP);
- gpio_set_flags(GPIO_LTE_BODY_SAR_L,
- GPIO_INPUT | GPIO_PULL_UP);
- gpio_set_flags(GPIO_LTE_WAKE_L,
- GPIO_INPUT | GPIO_PULL_UP);
- gpio_set_flags(GPIO_LTE_OFF_ODL,
- GPIO_INPUT | GPIO_PULL_UP);
- }
-#endif
-
-#ifndef BOARD_LUX
- /*
- * see (b/111215677): setting the internal PU/PD of the unused pin
- * GPIO10 affects the ball K10 when it is selected to CR_SIN.
- * Disabing the WKINEN bit of GPIO10 insteading setting its PU/PD to
- * bypass this issue.
- */
- NPCX_WKINEN(MIWU_TABLE_1, MIWU_GROUP_2) &= 0xFE;
-#endif
-
- /* Enable Gyro interrupts */
- gpio_enable_interrupt(GPIO_ACCELGYRO3_INT_L);
-
- /* Initialize PMIC */
- hook_call_deferred(&board_pmic_init_data, 0);
-}
-DECLARE_HOOK(HOOK_INIT, board_init, HOOK_PRIO_DEFAULT);
-
-/**
- * Buffer the AC present GPIO to the PCH.
- */
-static void board_extpower(void)
-{
- gpio_set_level(GPIO_PCH_ACOK, extpower_is_present());
-}
-DECLARE_HOOK(HOOK_AC_CHANGE, board_extpower, HOOK_PRIO_DEFAULT);
-
-/**
- * Set active charge port -- only one port can be active at a time.
- *
- * @param charge_port Charge port to enable.
- *
- * Returns EC_SUCCESS if charge port is accepted and made active,
- * EC_ERROR_* otherwise.
- */
-int board_set_active_charge_port(int charge_port)
-{
- /* charge port is a physical port */
- int is_real_port = (charge_port >= 0 &&
- charge_port < CONFIG_USB_PD_PORT_MAX_COUNT);
- /* check if we are source VBUS on the port */
- int source = gpio_get_level(charge_port == 0 ? GPIO_USB_C0_5V_EN :
- GPIO_USB_C1_5V_EN);
-
- if (is_real_port && source) {
- CPRINTF("Skip enable p%d", charge_port);
- return EC_ERROR_INVAL;
- }
-
- CPRINTF("New chg p%d", charge_port);
-
- if (charge_port == CHARGE_PORT_NONE) {
- /* Disable both ports */
- gpio_set_level(GPIO_USB_C0_CHARGE_L, 1);
- gpio_set_level(GPIO_USB_C1_CHARGE_L, 1);
- } else {
-#ifdef BOARD_LUX
- /* Disable cross-power with base, charger task will reenable. */
- board_enable_base_power(0);
-#endif
- /* Make sure non-charging port is disabled */
- gpio_set_level(charge_port ? GPIO_USB_C0_CHARGE_L :
- GPIO_USB_C1_CHARGE_L, 1);
- /* Enable charging port */
- gpio_set_level(charge_port ? GPIO_USB_C1_CHARGE_L :
- GPIO_USB_C0_CHARGE_L, 0);
- }
-
- return EC_SUCCESS;
-}
-
-/**
- * Set the charge limit based upon desired maximum.
- *
- * @param port Port number.
- * @param supplier Charge supplier type.
- * @param charge_ma Desired charge limit (mA).
- * @param charge_mv Negotiated charge voltage (mV).
- */
-void board_set_charge_limit(int port, int supplier, int charge_ma,
- int max_ma, int charge_mv)
-{
- /* Adjust ILIM according to measurements to eliminate overshoot. */
- charge_ma = (charge_ma - 500) * 31 / 32 + 472;
- /* 5V is significantly more accurate than other voltages. */
- if (charge_mv > 5000)
- charge_ma -= 52;
-
- charge_set_input_current_limit(MAX(charge_ma, ILIM_MIN_MA), charge_mv);
-}
-
-void board_hibernate(void)
-{
- CPRINTS("Triggering PMIC shutdown.");
- uart_flush_output();
-
- /* Trigger PMIC shutdown. */
- if (i2c_write8(I2C_PORT_PMIC, I2C_ADDR_BD99992_FLAGS,
- 0x49, 0x01)) {
- /*
- * If we can't tell the PMIC to shutdown, instead reset
- * and don't start the AP. Hopefully we'll be able to
- * communicate with the PMIC next time.
- */
- CPRINTS("PMIC i2c failed.");
- system_reset(SYSTEM_RESET_LEAVE_AP_OFF);
- }
-
- /* Await shutdown. */
- while (1)
- ;
-}
-
-int board_get_version(void)
-{
- static int ver = -1;
- uint8_t id4;
-
- if (ver != -1)
- return ver;
-
- ver = 0;
-
- /* First 3 strappings are binary. */
- if (gpio_get_level(GPIO_BOARD_VERSION1))
- ver |= 0x01;
- if (gpio_get_level(GPIO_BOARD_VERSION2))
- ver |= 0x02;
- if (gpio_get_level(GPIO_BOARD_VERSION3))
- ver |= 0x04;
-
- /*
- * 4th bit is using tristate strapping, ternary encoding:
- * Hi-Z (id4=2) => 0, (id4=0) => 1, (id4=1) => 2
- */
- id4 = gpio_get_ternary(GPIO_BOARD_VERSION4);
- ver |= ((id4 + 1) % 3) * 0x08;
-
- CPRINTS("Board ID = %d", ver);
-
- return ver;
-}
-
-/* Lid Sensor mutex */
-static struct mutex g_lid_mutex;
-
-static struct bmi_drv_data_t g_bmi160_data;
-static struct opt3001_drv_data_t g_opt3001_data = {
- .scale = 1,
- .uscale = 0,
- .offset = 0,
-};
-
-/* Matrix to rotate accelrator into standard reference frame */
-const mat33_fp_t mag_standard_ref = {
- { FLOAT_TO_FP(-1), 0, 0},
- { 0, FLOAT_TO_FP(1), 0},
- { 0, 0, FLOAT_TO_FP(-1)}
-};
-
-#ifdef BOARD_SORAKA
-const mat33_fp_t lid_standard_ref = {
- { 0, FLOAT_TO_FP(-1), 0},
- {FLOAT_TO_FP(1), 0, 0},
- { 0, 0, FLOAT_TO_FP(1)}
-};
-
-/* For rev3 and older */
-const mat33_fp_t lid_standard_ref_old = {
- {FLOAT_TO_FP(-1), 0, 0},
- { 0, FLOAT_TO_FP(-1), 0},
- { 0, 0, FLOAT_TO_FP(1)}
-};
-#else
-const mat33_fp_t lid_standard_ref = {
- {FLOAT_TO_FP(-1), 0, 0},
- { 0, FLOAT_TO_FP(-1), 0},
- { 0, 0, FLOAT_TO_FP(1)}
-};
-#endif
-
-struct motion_sensor_t motion_sensors[] = {
- [LID_ACCEL] = {
- .name = "Lid Accel",
- .active_mask = SENSOR_ACTIVE_S0,
- .chip = MOTIONSENSE_CHIP_BMI160,
- .type = MOTIONSENSE_TYPE_ACCEL,
- .location = MOTIONSENSE_LOC_LID,
- .drv = &bmi160_drv,
- .mutex = &g_lid_mutex,
- .drv_data = &g_bmi160_data,
- .port = I2C_PORT_GYRO,
- .i2c_spi_addr_flags = BMI160_ADDR0_FLAGS,
- .rot_standard_ref = &lid_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 = {
- /* EC use accel for angle detection */
- [SENSOR_CONFIG_EC_S0] = {
- .odr = 10000 | ROUND_UP_FLAG,
- .ec_rate = 100 * MSEC,
- },
- },
- },
-
- [LID_GYRO] = {
- .name = "Lid Gyro",
- .active_mask = SENSOR_ACTIVE_S0,
- .chip = MOTIONSENSE_CHIP_BMI160,
- .type = MOTIONSENSE_TYPE_GYRO,
- .location = MOTIONSENSE_LOC_LID,
- .drv = &bmi160_drv,
- .mutex = &g_lid_mutex,
- .drv_data = &g_bmi160_data,
- .port = I2C_PORT_GYRO,
- .i2c_spi_addr_flags = BMI160_ADDR0_FLAGS,
- .default_range = 1000, /* dps */
- .rot_standard_ref = &lid_standard_ref,
- .min_frequency = BMI_GYRO_MIN_FREQ,
- .max_frequency = BMI_GYRO_MAX_FREQ,
- },
-
- [LID_MAG] = {
- .name = "Lid Mag",
- .active_mask = SENSOR_ACTIVE_S0,
- .chip = MOTIONSENSE_CHIP_BMI160,
- .type = MOTIONSENSE_TYPE_MAG,
- .location = MOTIONSENSE_LOC_LID,
- .drv = &bmi160_drv,
- .mutex = &g_lid_mutex,
- .drv_data = &g_bmi160_data,
- .port = I2C_PORT_GYRO,
- .i2c_spi_addr_flags = BMI160_ADDR0_FLAGS,
- .default_range = BIT(11), /* 16LSB / uT, fixed */
- .rot_standard_ref = &mag_standard_ref,
- .min_frequency = BMM150_MAG_MIN_FREQ,
- .max_frequency = BMM150_MAG_MAX_FREQ(SPECIAL),
- },
- [LID_ALS] = {
- .name = "Light",
- .active_mask = SENSOR_ACTIVE_S0,
- .chip = MOTIONSENSE_CHIP_OPT3001,
- .type = MOTIONSENSE_TYPE_LIGHT,
- .location = MOTIONSENSE_LOC_LID,
- .drv = &opt3001_drv,
- .drv_data = &g_opt3001_data,
- .port = I2C_PORT_ALS,
- .i2c_spi_addr_flags = OPT3001_I2C_ADDR_FLAGS,
- .rot_standard_ref = NULL,
- .default_range = 0x10000, /* scale = 1; uscale = 0 */
- .min_frequency = OPT3001_LIGHT_MIN_FREQ,
- .max_frequency = OPT3001_LIGHT_MAX_FREQ,
- .config = {
- [SENSOR_CONFIG_EC_S0] = {
- .odr = 1000,
- },
- },
- },
-};
-const unsigned int motion_sensor_count = ARRAY_SIZE(motion_sensors);
-
-/* ALS instances when LPC mapping is needed. Each entry directs to a sensor. */
-const struct motion_sensor_t *motion_als_sensors[] = {
- &motion_sensors[LID_ALS],
-};
-BUILD_ASSERT(ARRAY_SIZE(motion_als_sensors) == ALS_COUNT);
-
-#ifdef BOARD_SORAKA
-static void board_sensor_init(void)
-{
- /* Old soraka use a different reference matrix */
- if (system_get_board_version() <= 3) {
- motion_sensors[LID_ACCEL].rot_standard_ref =
- &lid_standard_ref_old;
- motion_sensors[LID_GYRO].rot_standard_ref =
- &lid_standard_ref_old;
- }
-}
-DECLARE_HOOK(HOOK_INIT, board_sensor_init, HOOK_PRIO_DEFAULT);
-#endif
-
-static void board_chipset_reset(void)
-{
- board_report_pmic_fault("CHIPSET RESET");
-}
-DECLARE_HOOK(HOOK_CHIPSET_RESET, board_chipset_reset, HOOK_PRIO_DEFAULT);
-
-/* Called on AP S3 -> S0 transition */
-static void board_chipset_resume(void)
-{
- gpio_set_level(GPIO_ENABLE_BACKLIGHT, 1);
-}
-DECLARE_HOOK(HOOK_CHIPSET_RESUME, board_chipset_resume, HOOK_PRIO_DEFAULT);
-
-/* Called on AP S0 -> S3 transition */
-static void board_chipset_suspend(void)
-{
- gpio_set_level(GPIO_ENABLE_BACKLIGHT, 0);
-}
-DECLARE_HOOK(HOOK_CHIPSET_SUSPEND, board_chipset_suspend, HOOK_PRIO_DEFAULT);
-
-int board_has_working_reset_flags(void)
-{
- int version = system_get_board_version();
-
- /* Boards Rev1 and Rev2 will lose reset flags on power cycle. */
- if ((version == 1) || (version == 2))
- return 0;
-
- /* All other board versions should have working reset flags */
- return 1;
-}
diff --git a/board/poppy/board.h b/board/poppy/board.h
deleted file mode 100644
index bf4acfe8ff..0000000000
--- a/board/poppy/board.h
+++ /dev/null
@@ -1,264 +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.
- */
-
-/* Eve board configuration */
-
-#ifndef __CROS_EC_BOARD_H
-#define __CROS_EC_BOARD_H
-
-/*
- * Allow dangerous commands.
- * TODO: Remove this config before production.
- */
-#define CONFIG_SYSTEM_UNLOCKED
-
-/* EC */
-#define CONFIG_ADC
-#define CONFIG_BACKLIGHT_LID
-#define CONFIG_BOARD_FORCE_RESET_PIN
-#define CONFIG_BUTTON_TRIGGERED_RECOVERY
-#define CONFIG_DETACHABLE_BASE
-#define CONFIG_DPTF
-#ifndef BOARD_LUX
-#define CONFIG_DPTF_MULTI_PROFILE
-#endif
-#define CONFIG_EMULATED_SYSRQ
-#define CONFIG_FLASH_SIZE_BYTES 0x80000
-#define CONFIG_FPU
-#define CONFIG_I2C
-#define CONFIG_I2C_CONTROLLER
-#define CONFIG_LED_COMMON
-#define CONFIG_LID_SWITCH
-#define CONFIG_LOW_POWER_IDLE
-#define CONFIG_LTO
-#define CONFIG_CHIP_PANIC_BACKUP
-#define CONFIG_SOFTWARE_PANIC
-#define CONFIG_SPI_FLASH_REGS
-#define CONFIG_SPI_FLASH_W25X40
-#define CONFIG_VBOOT_HASH
-#define CONFIG_SHA256_UNROLLED
-#define CONFIG_VOLUME_BUTTONS
-#define CONFIG_VSTORE
-#define CONFIG_VSTORE_SLOT_COUNT 1
-#define CONFIG_WATCHDOG_HELP
-#define CONFIG_WIRELESS
-#define CONFIG_WIRELESS_SUSPEND \
- (EC_WIRELESS_SWITCH_WLAN | EC_WIRELESS_SWITCH_WLAN_POWER)
-#define WIRELESS_GPIO_WLAN GPIO_WLAN_OFF_L
-#define WIRELESS_GPIO_WLAN_POWER GPIO_PP3300_DX_WLAN
-#define WIRELESS_GPIO_WWAN GPIO_PP3300_DX_LTE
-
-/* EC console commands */
-#define CONFIG_CMD_ACCELS
-#define CONFIG_CMD_ACCEL_INFO
-#define CONFIG_CMD_BUTTON
-
-/* Port80 */
-#undef CONFIG_PORT80_HISTORY_LEN
-#define CONFIG_PORT80_HISTORY_LEN 256
-
-/* SOC */
-#define CONFIG_CHIPSET_SKYLAKE
-#define CONFIG_CHIPSET_HAS_PLATFORM_PMIC_RESET
-#define CONFIG_CHIPSET_RESET_HOOK
-#define CONFIG_HOSTCMD_ESPI
-#define CONFIG_HOSTCMD_ESPI_VW_SLP_S3
-#define CONFIG_HOSTCMD_ESPI_VW_SLP_S4
-
-/* Battery */
-#define CONFIG_BATTERY_CUT_OFF
-#define CONFIG_BATTERY_HW_PRESENT_CUSTOM
-#define CONFIG_BATTERY_DEVICE_CHEMISTRY "LION"
-#define CONFIG_BATTERY_PRESENT_CUSTOM
-#define CONFIG_BATTERY_SMART
-
-#ifdef BOARD_LUX
-#define CONFIG_UART_PAD_SWITCH
-
-#define CONFIG_EC_EC_COMM_CLIENT
-#define CONFIG_EC_EC_COMM_BATTERY
-#define CONFIG_CRC8
-#endif
-
-/* Charger */
-#define CONFIG_CHARGE_MANAGER
-#define CONFIG_CHARGE_RAMP_HW /* This, or just RAMP? */
-
-#define CONFIG_CHARGER
-#define CONFIG_CHARGER_ISL9238
-#define CONFIG_CHARGER_DISCHARGE_ON_AC
-#define CONFIG_CHARGER_INPUT_CURRENT 512
-#define CONFIG_CHARGER_PSYS
-#define CONFIG_CHARGER_SENSE_RESISTOR 10
-#define CONFIG_CHARGER_SENSE_RESISTOR_AC 20
-#ifdef BOARD_LUX
-#define CONFIG_CHARGER_OTG
-#define CONFIG_CHARGER_PSYS_READ
-#endif
-#define CONFIG_CMD_CHARGER_ADC_AMON_BMON
-#define CONFIG_HOSTCMD_PD_CONTROL
-#define CONFIG_EXTPOWER_GPIO
-#undef CONFIG_EXTPOWER_DEBOUNCE_MS
-#define CONFIG_EXTPOWER_DEBOUNCE_MS 1000
-#define CONFIG_POWER_BUTTON
-#define CONFIG_POWER_BUTTON_X86
-#define CONFIG_POWER_COMMON
-#define CONFIG_POWER_SIGNAL_INTERRUPT_STORM_DETECT_THRESHOLD 30
-#define CONFIG_POWER_S0IX
-#define CONFIG_POWER_TRACK_HOST_SLEEP_STATE
-
-/* Sensor */
-#define CONFIG_ALS
-#define CONFIG_ALS_OPT3001
-#define ALS_COUNT 1
-#define OPT3001_I2C_ADDR_FLAGS OPT3001_I2C_ADDR1_FLAGS
-#define CONFIG_TEMP_SENSOR
-#define CONFIG_TEMP_SENSOR_BD99992GW
-#define CONFIG_THERMISTOR_NCP15WB
-
-#define CONFIG_MKBP_INPUT_DEVICES
-#define CONFIG_MKBP_EVENT
-#define CONFIG_MKBP_USE_HOST_EVENT
-#define CONFIG_ACCELGYRO_BMI160
-#define CONFIG_MAG_BMI_BMM150
-#define CONFIG_ACCEL_INTERRUPTS
-#define CONFIG_ACCELGYRO_BMI160_INT_EVENT \
- TASK_EVENT_MOTION_SENSOR_INTERRUPT(LID_ACCEL)
-#define CONFIG_ACCELGYRO_SEC_ADDR_FLAGS BMM150_ADDR0_FLAGS
-#define CONFIG_MAG_CALIBRATE
-/* Lower maximal ODR to 100Hz */
-#define CONFIG_EC_MAX_SENSOR_FREQ_MILLIHZ 100000
-
-/* 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 512
-/* Depends on how fast the AP boots and typical ODRs */
-#define CONFIG_ACCEL_FIFO_THRES (CONFIG_ACCEL_FIFO_SIZE / 3)
-
-#define CONFIG_TABLET_MODE
-#define CONFIG_TABLET_MODE_SWITCH
-
-#undef CONFIG_UART_TX_BUF_SIZE
-#define CONFIG_UART_TX_BUF_SIZE 2048
-
-/* USB */
-#define CONFIG_USB_CHARGER
-#define CONFIG_USB_PD_ALT_MODE
-#define CONFIG_USB_PD_ALT_MODE_DFP
-#define CONFIG_USB_PD_DISCHARGE_TCPC
-#define CONFIG_USB_PD_DUAL_ROLE
-#define CONFIG_USB_PD_DUAL_ROLE_AUTO_TOGGLE
-#define CONFIG_USB_PD_LOGGING
-#define CONFIG_USB_PD_MAX_SINGLE_SOURCE_CURRENT TYPEC_RP_3A0
-#define CONFIG_USB_PD_PORT_MAX_COUNT 2
-#define CONFIG_USB_PD_VBUS_DETECT_GPIO
-#define CONFIG_USB_PD_TCPC_LOW_POWER
-#define CONFIG_USB_PD_TCPM_MUX
-#define CONFIG_USB_PD_TCPM_ANX3429
-#define CONFIG_USB_PD_TCPM_TCPCI
-#define CONFIG_USB_PD_TCPM_PS8751
-#define CONFIG_USB_PD_TRY_SRC
-#define CONFIG_USB_POWER_DELIVERY
-#define CONFIG_USB_PD_TCPMV1
-#define CONFIG_USBC_SS_MUX
-#define CONFIG_USBC_VCONN
-#define CONFIG_USBC_VCONN_SWAP
-
-/* BC 1.2 charger */
-#define CONFIG_BC12_DETECT_PI3USB9281
-#define CONFIG_BC12_DETECT_PI3USB9281_CHIP_COUNT 2
-
-/* Optional feature to configure npcx chip */
-#define NPCX_UART_MODULE2 1 /* 1:GPIO64/65 as UART */
-#define NPCX_JTAG_MODULE2 0 /* 0:GPIO21/17/16/20 as JTAG */
-#define NPCX_TACH_SEL2 0 /* 0:GPIO40/73 as TACH */
-
-/* I2C ports */
-#define I2C_PORT_TCPC0 NPCX_I2C_PORT0_0
-#define I2C_PORT_TCPC1 NPCX_I2C_PORT0_0
-#define I2C_PORT_ALS NPCX_I2C_PORT0_1
-#define I2C_PORT_USB_CHARGER_1 NPCX_I2C_PORT0_1
-#define I2C_PORT_USB_CHARGER_0 NPCX_I2C_PORT1
-#define I2C_PORT_CHARGER NPCX_I2C_PORT1
-#define I2C_PORT_BATTERY NPCX_I2C_PORT1
-#define I2C_PORT_PMIC NPCX_I2C_PORT2
-#define I2C_PORT_MP2949 NPCX_I2C_PORT2
-#define I2C_PORT_GYRO NPCX_I2C_PORT3
-#define I2C_PORT_BARO NPCX_I2C_PORT3
-#define I2C_PORT_ACCEL I2C_PORT_GYRO
-#define I2C_PORT_THERMAL I2C_PORT_PMIC
-
-/* I2C addresses */
-#define I2C_ADDR_BD99992_FLAGS 0x30
-#define I2C_ADDR_MP2949_FLAGS 0x20
-
-#ifndef __ASSEMBLER__
-
-#include "gpio_signal.h"
-#include "registers.h"
-
-enum temp_sensor_id {
- TEMP_SENSOR_BATTERY, /* BD99956GW TSENSE */
- TEMP_SENSOR_AMBIENT, /* BD99992GW SYSTHERM0 */
- TEMP_SENSOR_CHARGER, /* BD99992GW SYSTHERM1 */
- TEMP_SENSOR_DRAM, /* BD99992GW SYSTHERM2 */
- TEMP_SENSOR_EMMC, /* BD99992GW SYSTHERM3 */
- TEMP_SENSOR_COUNT
-};
-
-/*
- * Motion sensors:
- * When reading through IO memory is set up for sensors (LPC is used),
- * the first 2 entries must be accelerometers, then gyroscope.
- * For BMI160, accel, gyro and compass sensors must be next to each other.
- */
-enum sensor_id {
- LID_ACCEL = 0,
- LID_GYRO,
- LID_MAG,
- LID_ALS,
- SENSOR_COUNT,
-};
-
-enum adc_channel {
- ADC_BASE_DET,
- ADC_VBUS,
- ADC_AMON_BMON,
-#ifdef BOARD_LUX
- ADC_PSYS,
-#endif
- ADC_CH_COUNT
-};
-
-/* TODO(crosbug.com/p/61098): Verify the numbers below. */
-/*
- * delay to turn on the power supply max is ~16ms.
- * delay to turn off the power supply max is about ~180ms.
- */
-#define PD_POWER_SUPPLY_TURN_ON_DELAY 30000 /* us */
-#define PD_POWER_SUPPLY_TURN_OFF_DELAY 250000 /* us */
-
-/* delay to turn on/off vconn */
-
-/* Define typical operating power and max power */
-#define PD_OPERATING_POWER_MW 15000
-#define PD_MAX_POWER_MW 45000
-#define PD_MAX_CURRENT_MA 3000
-#define PD_MAX_VOLTAGE_MV 20000
-
-/* Board specific handlers */
-int board_get_version(void);
-void board_reset_pd_mcu(void);
-void board_set_tcpc_power_mode(int port, int mode);
-
-void base_detect_interrupt(enum gpio_signal signal);
-
-/* Sensors without hardware FIFO are in forced mode */
-#define CONFIG_ACCEL_FORCE_MODE_MASK BIT(LID_ALS)
-
-#endif /* !__ASSEMBLER__ */
-
-#endif /* __CROS_EC_BOARD_H */
diff --git a/board/poppy/build.mk b/board/poppy/build.mk
deleted file mode 100644
index df32a7ca8f..0000000000
--- a/board/poppy/build.mk
+++ /dev/null
@@ -1,18 +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
-#
-
-CHIP:=npcx
-CHIP_VARIANT:=npcx5m6g
-
-board-y=board.o
-board-$(CONFIG_BATTERY_SMART)+=battery.o
-board-$(CONFIG_LED_COMMON)+=led.o
-board-$(CONFIG_USB_POWER_DELIVERY)+=usb_pd_policy.o
-board-$(BOARD_LUX)+=base_detect_lux.o
-board-$(BOARD_POPPY)+=base_detect_poppy.o
-board-$(BOARD_SORAKA)+=base_detect_poppy.o
diff --git a/board/poppy/ec.tasklist b/board/poppy/ec.tasklist
deleted file mode 100644
index 7591137bc9..0000000000
--- a/board/poppy/ec.tasklist
+++ /dev/null
@@ -1,22 +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, 800) \
- TASK_ALWAYS(USB_CHG_P0, usb_charger_task, NULL, 800) \
- TASK_ALWAYS(USB_CHG_P1, usb_charger_task, NULL, 800) \
- TASK_ALWAYS(CHARGER, charger_task, NULL, 800) \
- TASK_ALWAYS(MOTIONSENSE, motion_sense_task, NULL, 768) \
- TASK_NOTEST(CHIPSET, chipset_task, NULL, 800) \
- TASK_NOTEST(PDCMD, pd_command_task, NULL, 880) \
- TASK_ALWAYS(HOSTCMD, host_command_task, NULL, 840) \
- TASK_ALWAYS(CONSOLE, console_task, NULL, 960) \
- TASK_ALWAYS(POWERBTN, power_button_task, NULL, 800) \
- TASK_ALWAYS(PD_C0, pd_task, NULL, 1000) \
- TASK_ALWAYS(PD_C1, pd_task, NULL, 1000)
diff --git a/board/poppy/gpio.inc b/board/poppy/gpio.inc
deleted file mode 100644
index 286085d39c..0000000000
--- a/board/poppy/gpio.inc
+++ /dev/null
@@ -1,174 +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(USB_C0_PD_INT_ODL, PIN(3, 7), GPIO_INT_FALLING, tcpc_alert_event)
-GPIO_INT(USB_C1_PD_INT_ODL, PIN(C, 5), GPIO_INT_FALLING, tcpc_alert_event)
-#ifdef CONFIG_POWER_S0IX
-GPIO_INT(PCH_SLP_S0_L, PIN(7, 5), GPIO_INT_BOTH, power_signal_interrupt)
-#endif
-#ifndef CONFIG_HOSTCMD_ESPI_VW_SLP_S3
-#ifdef BOARD_LUX
-GPIO_INT(PCH_SLP_S3_L, PIN(2, 2), GPIO_INT_BOTH, power_signal_interrupt)
-#else
-GPIO_INT(PCH_SLP_S3_L, PIN(7, 3), GPIO_INT_BOTH, power_signal_interrupt)
-#endif
-#endif /* CONFIG_HOSTCMD_ESPI_VW_SLP_S3 */
-#ifndef CONFIG_HOSTCMD_ESPI_VW_SLP_S4
-GPIO_INT(PCH_SLP_S4_L, PIN(8, 6), GPIO_INT_BOTH, power_signal_interrupt)
-#endif
-GPIO_INT(PCH_SLP_SUS_L, PIN(6, 2), GPIO_INT_BOTH, power_signal_interrupt)
-GPIO_INT(RSMRST_L_PGOOD, PIN(B, 0), GPIO_INT_BOTH, power_signal_interrupt)
-GPIO_INT(PMIC_DPWROK, PIN(C, 7), GPIO_INT_BOTH, power_signal_interrupt)
-GPIO_INT(POWER_BUTTON_L, PIN(0, 4), GPIO_INT_BOTH | GPIO_PULL_UP, power_button_interrupt)
-GPIO_INT(LID_OPEN, PIN(6, 7), GPIO_INT_BOTH, lid_interrupt)
-/* TODO(b/35585396): Make use of reverse dock signal. */
-GPIO_INT(REVERSE_DOCK, PIN(B, 7), GPIO_INT_BOTH, lid_interrupt)
-GPIO_INT(VOLUME_DOWN_L, PIN(8, 3), GPIO_INT_BOTH | GPIO_PULL_UP, button_interrupt)
-GPIO_INT(VOLUME_UP_L, PIN(8, 2), GPIO_INT_BOTH | GPIO_PULL_UP, button_interrupt)
-GPIO_INT(WP_L, PIN(4, 0), GPIO_INT_BOTH, switch_interrupt)
-GPIO_INT(AC_PRESENT, PIN(C, 1), GPIO_INT_BOTH, extpower_interrupt)
-GPIO_INT(USB_C0_VBUS_WAKE_L, PIN(9, 3), GPIO_INT_BOTH | GPIO_PULL_UP, vbus0_evt)
-GPIO_INT(USB_C1_VBUS_WAKE_L, PIN(9, 7), GPIO_INT_BOTH | GPIO_PULL_UP, vbus1_evt)
-GPIO_INT(USB_C0_BC12_INT_L, PIN(D, 3), GPIO_INT_FALLING, usb0_evt)
-GPIO_INT(USB_C1_BC12_INT_L, PIN(3, 3), GPIO_INT_FALLING, usb1_evt)
-#ifdef BOARD_LUX
-GPIO_INT(ACCELGYRO3_INT_L, PIN(7, 3), GPIO_INT_FALLING | GPIO_SEL_1P8V, bmi160_interrupt)
-#else
-GPIO_INT(ACCELGYRO3_INT_L, PIN(3, 6), GPIO_INT_FALLING | GPIO_SEL_1P8V, bmi160_interrupt)
-#endif
-GPIO_INT(BASE_DET_A, PIN(4, 5), GPIO_INT_BOTH, base_detect_interrupt)
-GPIO_INT(USB_C0_CABLE_DET, PIN(D, 2), GPIO_INT_RISING, anx74xx_cable_det_interrupt)
-#ifdef BOARD_LUX
-GPIO_INT(UART_MAIN_RX, PIN(6, 4), GPIO_INT_FALLING, uart_default_pad_rx_interrupt)
-#endif
-
-GPIO(PCH_RTCRST, PIN(2, 7), GPIO_OUT_LOW) /* RTCRST# to SOC (>= rev4) */
-GPIO(ENABLE_BACKLIGHT, PIN(2, 6), GPIO_OUT_LOW) /* Enable Backlight */
-GPIO(WLAN_OFF_L, PIN(7, 2), GPIO_OUT_LOW) /* Disable WLAN */
-GPIO(PP3300_DX_WLAN, PIN(A, 7), GPIO_OUT_LOW) /* Enable WLAN 3.3V Power */
-GPIO(CPU_PROCHOT, PIN(8, 1), GPIO_OUT_HIGH) /* PROCHOT# to SOC */
-GPIO(PCH_ACOK, PIN(5, 0), GPIO_ODR_LOW) /* ACOK to SOC */
-GPIO(PCH_WAKE_L, PIN(A, 3), GPIO_ODR_HIGH) /* Wake SOC */
-GPIO(PCH_RSMRST_L, PIN(7, 0), GPIO_OUT_LOW) /* RSMRST# to SOC */
-GPIO(PCH_PWRBTN_L, PIN(4, 1), GPIO_ODR_HIGH) /* Power Button to SOC */
-GPIO(EC_PLATFORM_RST, PIN(A, 6), GPIO_OUT_LOW) /* EC Reset to LDO_EN */
-GPIO(SYS_RESET_L, PIN(6, 1), GPIO_ODR_HIGH) /* Cold Reset to SOC */
-GPIO(PMIC_SLP_SUS_L, PIN(8, 5), GPIO_OUT_LOW) /* SLP_SUS# to PMIC */
-GPIO(BATTERY_PRESENT_L, PIN(3, 4), GPIO_INPUT) /* Battery Present */
-GPIO(CCD_MODE_ODL, PIN(6, 3), GPIO_INPUT) /* Case Closed Debug Mode */
-GPIO(EC_HAVEN_RESET_ODL, PIN(0, 2), GPIO_INPUT | GPIO_PULL_UP) /* H1 Reset (unused) */
-GPIO(ENTERING_RW, PIN(7, 6), GPIO_OUTPUT) /* EC Entering RW */
-GPIO(PMIC_INT_L, PIN(6, 0), GPIO_INPUT | GPIO_PULL_UP) /* PMIC interrupt */
-#ifndef CONFIG_POWER_S0IX
-GPIO(PCH_SLP_S0_L, PIN(7, 5), GPIO_INPUT)
-#endif
-
-/* Sensor interrupts, not implemented yet */
-GPIO(ALS_INT_L, PIN(2, 5), GPIO_INPUT)
-
-/* TODO(b/35585396): Make use of these GPIOs */
-GPIO(PP1800_DX_SENSOR, PIN(1, 4), GPIO_OUTPUT)
-GPIO(PP3300_DX_SENSOR, PIN(2, 1), GPIO_OUTPUT)
-GPIO(PP3300_USB_PD, PIN(2, 0), GPIO_OUTPUT)
-/* end of TODO */
-
-GPIO(PP3300_DX_LTE, PIN(0, 5), GPIO_OUT_LOW)
-
-#ifndef BOARD_LUX
-GPIO(WLAN_PE_RST, PIN(1, 2), GPIO_OUTPUT)
-GPIO(LTE_GPS_OFF_L, PIN(0, 0), GPIO_ODR_HIGH)
-GPIO(LTE_BODY_SAR_L, PIN(0, 1), GPIO_ODR_HIGH)
-GPIO(LTE_OFF_ODL, PIN(8, 0), GPIO_ODR_LOW)
-GPIO(LTE_WAKE_L, PIN(7, 1), GPIO_INPUT)
-#endif
-
-#ifdef BOARD_LUX
-GPIO(WFCAM_VSYNC, PIN(7, 1), GPIO_INPUT)
-#endif
-
-/* Set unused pins as Input+PU */
-#ifdef BOARD_LUX
-GPIO(TP_EC_GPIO_00, PIN(0, 0), GPIO_INPUT | GPIO_PULL_UP)
-GPIO(TP_EC_GPIO_01, PIN(0, 1), GPIO_INPUT | GPIO_PULL_UP)
-GPIO(TP_EC_GPIO_36, PIN(3, 6), GPIO_INPUT | GPIO_PULL_UP)
-GPIO(TP_EC_GPIO_80, PIN(8, 0), GPIO_INPUT | GPIO_PULL_UP)
-#else
-GPIO(TP_EC_GPIO_06, PIN(0, 6), GPIO_INPUT | GPIO_PULL_UP)
-GPIO(TP_EC_GPIO_22, PIN(2, 2), GPIO_INPUT | GPIO_PULL_UP)
-#endif
-GPIO(TP_EC_GPIO_16, PIN(1, 6), GPIO_INPUT | GPIO_PULL_UP)
-GPIO(TP_EC_GPIO_23, PIN(2, 3), GPIO_INPUT | GPIO_PULL_UP)
-GPIO(TP_EC_GPIO_57, PIN(5, 7), GPIO_INPUT | GPIO_PULL_UP)
-GPIO(TP_EC_GPIO_B6, PIN(B, 6), GPIO_INPUT | GPIO_PULL_UP)
-
-#ifdef BOARD_LUX
-GPIO(UART_ALT_RX, PIN(1, 0), GPIO_INPUT)
-GPIO(UART_ALT_TX, PIN(1, 1), GPIO_INPUT)
-GPIO(EC_COMM_PD, PIN(1, 5), GPIO_ODR_HIGH)
-GPIO(EC_COMM_PU, PIN(0, 7), GPIO_INPUT)
-GPIO(PPVAR_VAR_BASE, PIN(1, 2), GPIO_OUT_LOW)
-#else
-GPIO(PP3300_DX_BASE, PIN(1, 1), GPIO_OUT_LOW)
-GPIO(TP_EC_GPIO_07, PIN(0, 7), GPIO_INPUT | GPIO_PULL_UP)
-GPIO(TP_EC_GPIO_10, PIN(1, 0), GPIO_INPUT)
-GPIO(TP_EC_GPIO_15, PIN(1, 5), GPIO_INPUT | GPIO_PULL_UP)
-#endif
-
-/* I2C pins - these will be reconfigured for alternate function below */
-GPIO(I2C0_0_SCL, PIN(B, 5), GPIO_INPUT) /* EC_I2C0_0_USBC_3V3_SCL */
-GPIO(I2C0_0_SDA, PIN(B, 4), GPIO_INPUT) /* EC_I2C0_0_USBC_3V3_SDA */
-GPIO(I2C0_1_SCL, PIN(B, 3), GPIO_INPUT) /* EC_I2C0_1_3V3_SCL */
-GPIO(I2C0_1_SDA, PIN(B, 2), GPIO_INPUT) /* EC_I2C0_1_3V3_SDA */
-GPIO(I2C1_SCL, PIN(9, 0), GPIO_INPUT) /* EC_I2C1_3V3_SCL */
-GPIO(I2C1_SDA, PIN(8, 7), GPIO_INPUT) /* EC_I2C1_3V3_SDA */
-GPIO(I2C2_SCL, PIN(9, 2), GPIO_INPUT) /* EC_I2C2_PMIC_3V3_SCL */
-GPIO(I2C2_SDA, PIN(9, 1), GPIO_INPUT) /* EC_I2C2_PMIC_3V3_SDA */
-GPIO(I2C3_SCL, PIN(D, 1), GPIO_INPUT | GPIO_SEL_1P8V) /* EC_I2C3_SENSOR_1V8_SCL */
-GPIO(I2C3_SDA, PIN(D, 0), GPIO_INPUT | GPIO_SEL_1P8V) /* EC_I2C3_SENSOR_1V8_SDA */
-
-#ifdef BOARD_LUX
-GPIO(USB_C0_5V_EN, PIN(0, 6), GPIO_OUT_LOW) /* C0 5V Enable */
-#else
-GPIO(USB_C0_5V_EN, PIN(4, 2), GPIO_OUT_LOW) /* C0 5V Enable */
-#endif
-GPIO(USB_C0_3A_EN, PIN(6, 6), GPIO_OUT_LOW) /* C0 Enable 3A */
-GPIO(USB_C0_CHARGE_L, PIN(C, 0), GPIO_OUT_LOW) /* C0 Charge enable */
-GPIO(USB_C1_5V_EN, PIN(B, 1), GPIO_OUT_LOW) /* C1 5V Enable */
-GPIO(USB_C1_3A_EN, PIN(3, 5), GPIO_OUT_LOW) /* C1 3A Enable */
-GPIO(USB_C1_CHARGE_L, PIN(C, 3), GPIO_OUT_LOW) /* C1 Charge enable */
-GPIO(USB_C0_PD_RST_L, PIN(0, 3), GPIO_OUT_LOW) /* C0 PD Reset */
-GPIO(USB_C1_PD_RST_L, PIN(7, 4), GPIO_ODR_HIGH) /* C1 PD Reset */
-GPIO(USB_C0_DP_HPD, PIN(9, 4), GPIO_INPUT) /* C0 DP Hotplug Detect */
-GPIO(USB_C1_DP_HPD, PIN(A, 5), GPIO_INPUT) /* C1 DP Hotplug Detect */
-GPIO(USB_C0_TCPC_PWR, PIN(8, 4), GPIO_OUT_LOW) /* Enable C0 TCPC Power */
-GPIO(USB2_OTG_ID, PIN(A, 1), GPIO_OUT_LOW) /* OTG ID */
-GPIO(USB2_OTG_VBUSSENSE, PIN(9, 5), GPIO_OUT_LOW) /* OTG VBUS Sense */
-
-/* LEDs (2 colors on each port) */
-GPIO(LED_YELLOW_C0, PIN(2, 4), GPIO_OUT_LOW) /* This is from rev5 */
-GPIO(LED_YELLOW_C0_OLD, PIN(3, 2), GPIO_OUT_LOW) /* This is for rev1 to rev4 */
-GPIO(LED_WHITE_C0, PIN(C, 6), GPIO_OUT_LOW)
-GPIO(LED_YELLOW_C1, PIN(3, 1), GPIO_OUT_LOW)
-GPIO(LED_WHITE_C1, PIN(3, 0), GPIO_OUT_LOW)
-
-/* Board ID */
-GPIO(BOARD_VERSION1, PIN(C, 4), GPIO_INPUT) /* Board ID bit0 */
-GPIO(BOARD_VERSION2, PIN(C, 2), GPIO_INPUT) /* Board ID bit1 */
-GPIO(BOARD_VERSION3, PIN(1, 3), GPIO_INPUT) /* Board ID bit2 */
-GPIO(BOARD_VERSION4, PIN(1, 7), GPIO_INPUT) /* Board ID strap 3 (ternary) */
-
-/* Alternate functions GPIO definitions */
-ALTERNATE(PIN_MASK(6, 0x30), 1, MODULE_UART, 0) /* GPIO64-65 */ /* UART from EC to Servo */
-ALTERNATE(PIN_MASK(8, 0x80), 1, MODULE_I2C, 0) /* GPIO87 */ /* EC_I2C1_3V3_SDA */
-ALTERNATE(PIN_MASK(9, 0x01), 1, MODULE_I2C, 0) /* GPIO90 */ /* EC_I2C1_3V3_SCL */
-ALTERNATE(PIN_MASK(9, 0x06), 1, MODULE_I2C, 0) /* GPIO91-92 */ /* EC_I2C2_PMIC_3V3_SDA/SCL */
-ALTERNATE(PIN_MASK(B, 0x30), 1, MODULE_I2C, 0) /* GPIOB4-B5 */ /* EC_I2C0_0_USBC_3V3_SDA/SCL */
-ALTERNATE(PIN_MASK(B, 0x0C), 1, MODULE_I2C, 0) /* GPOPB2-B3 */ /* EC_I2C0_1_3V3_SDA/SCL */
-ALTERNATE(PIN_MASK(D, 0x03), 1, MODULE_I2C, 0) /* GPIOD0-D1 */ /* EC_I2C3_SENSOR_1V8_SDA/SCL */
diff --git a/board/poppy/led.c b/board/poppy/led.c
deleted file mode 100644
index 0c2d7f1832..0000000000
--- a/board/poppy/led.c
+++ /dev/null
@@ -1,165 +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.
- *
- * Power and battery LED control.
- */
-
-#include "battery.h"
-#include "charge_manager.h"
-#include "charge_state.h"
-#include "chipset.h"
-#include "ec_commands.h"
-#include "gpio.h"
-#include "hooks.h"
-#include "host_command.h"
-#include "led_common.h"
-#include "system.h"
-#include "util.h"
-
-#define BAT_LED_ON 1
-#define BAT_LED_OFF 0
-
-const enum ec_led_id supported_led_ids[] = {
- EC_LED_ID_LEFT_LED,
- EC_LED_ID_RIGHT_LED,
-};
-
-const int supported_led_ids_count = ARRAY_SIZE(supported_led_ids);
-
-enum led_color {
- LED_OFF = 0,
- LED_AMBER,
- LED_WHITE,
- LED_COLOR_COUNT /* Number of colors, not a color itself */
-};
-
-static void side_led_set_color(int port, enum led_color color)
-{
- int yellow_c0 = (system_get_board_version() >= 5) ?
- GPIO_LED_YELLOW_C0 : GPIO_LED_YELLOW_C0_OLD;
- gpio_set_level(port ? GPIO_LED_YELLOW_C1 : yellow_c0,
- (color == LED_AMBER) ? BAT_LED_ON : BAT_LED_OFF);
- gpio_set_level(port ? GPIO_LED_WHITE_C1 : GPIO_LED_WHITE_C0,
- (color == LED_WHITE) ? BAT_LED_ON : BAT_LED_OFF);
-}
-
-void led_get_brightness_range(enum ec_led_id led_id, uint8_t *brightness_range)
-{
- brightness_range[EC_LED_COLOR_AMBER] = 1;
- brightness_range[EC_LED_COLOR_WHITE] = 1;
-}
-
-int led_set_brightness(enum ec_led_id led_id, const uint8_t *brightness)
-{
- int port;
-
- switch (led_id) {
- case EC_LED_ID_LEFT_LED:
- port = 0;
- break;
- case EC_LED_ID_RIGHT_LED:
- port = 1;
- break;
- default:
- return EC_ERROR_PARAM1;
- }
-
- if (brightness[EC_LED_COLOR_WHITE] != 0)
- side_led_set_color(port, LED_WHITE);
- else if (brightness[EC_LED_COLOR_AMBER] != 0)
- side_led_set_color(port, LED_AMBER);
- else
- side_led_set_color(port, LED_OFF);
-
- return EC_SUCCESS;
-}
-
-/*
- * Set active charge port color to the parameter, turn off all others.
- * If no port is active (-1), turn off all LEDs.
- */
-static void set_active_port_color(enum led_color color)
-{
- int port = charge_manager_get_active_charge_port();
-
- if (led_auto_control_is_enabled(EC_LED_ID_LEFT_LED))
- side_led_set_color(0, (port == 0) ? color : LED_OFF);
- if (led_auto_control_is_enabled(EC_LED_ID_RIGHT_LED))
- side_led_set_color(1, (port == 1) ? color : LED_OFF);
-}
-
-static void board_led_set_battery(void)
-{
- static int battery_ticks;
- uint32_t chflags = charge_get_flags();
-
- battery_ticks++;
-
- switch (charge_get_state()) {
- case PWR_STATE_CHARGE:
- /* Always indicate when charging, even in suspend. */
- set_active_port_color(LED_AMBER);
- break;
- case PWR_STATE_DISCHARGE:
- if (led_auto_control_is_enabled(EC_LED_ID_LEFT_LED)) {
- if (charge_get_percent() <= 10)
- side_led_set_color(0,
- (battery_ticks & 0x4) ? LED_WHITE : LED_OFF);
- else
- side_led_set_color(0, LED_OFF);
- }
-
- if (led_auto_control_is_enabled(EC_LED_ID_RIGHT_LED))
- side_led_set_color(1, LED_OFF);
- break;
- case PWR_STATE_ERROR:
- set_active_port_color((battery_ticks & 0x2) ?
- LED_WHITE : LED_OFF);
- break;
- case PWR_STATE_CHARGE_NEAR_FULL:
- set_active_port_color(LED_WHITE);
- break;
- case PWR_STATE_IDLE: /* External power connected in IDLE */
- if (chflags & CHARGE_FLAG_FORCE_IDLE)
- set_active_port_color((battery_ticks & 0x4) ?
- LED_AMBER : LED_OFF);
- else
- set_active_port_color(LED_WHITE);
- break;
- default:
- /* Other states don't alter LED behavior */
- break;
- }
-}
-
-/* Called by hook task every TICK */
-static void led_tick(void)
-{
- board_led_set_battery();
-}
-DECLARE_HOOK(HOOK_TICK, led_tick, HOOK_PRIO_DEFAULT);
-
-void led_control(enum ec_led_id led_id, enum ec_led_state state)
-{
- enum led_color color;
-
- 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_LEFT_LED, 1);
- led_auto_control(EC_LED_ID_RIGHT_LED, 1);
- board_led_set_battery();
- return;
- }
-
- color = state ? LED_WHITE : LED_OFF;
-
- led_auto_control(EC_LED_ID_LEFT_LED, 0);
- led_auto_control(EC_LED_ID_RIGHT_LED, 0);
-
- side_led_set_color(0, color);
- side_led_set_color(1, color);
-}
diff --git a/board/poppy/usb_pd_policy.c b/board/poppy/usb_pd_policy.c
deleted file mode 100644
index a32b77bbe7..0000000000
--- a/board/poppy/usb_pd_policy.c
+++ /dev/null
@@ -1,145 +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 "extpower.h"
-#include "charge_manager.h"
-#include "common.h"
-#include "console.h"
-#include "driver/tcpm/anx74xx.h"
-#include "driver/tcpm/ps8xxx.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[CONFIG_USB_PD_PORT_MAX_COUNT];
-static uint8_t vbus_rp[CONFIG_USB_PD_PORT_MAX_COUNT] = {TYPEC_RP_1A5,
- TYPEC_RP_1A5};
-
-int board_vbus_source_enabled(int port)
-{
- return vbus_en[port];
-}
-
-static void board_vbus_update_source_current(int port)
-{
- enum gpio_signal gpio_5v_en = port ? GPIO_USB_C1_5V_EN :
- GPIO_USB_C0_5V_EN;
- enum gpio_signal gpio_3a_en = port ? GPIO_USB_C1_3A_EN :
- GPIO_USB_C0_3A_EN;
-
- if (system_get_board_version() >= 1) {
- /*
- * For rev1 and beyond, 1.5 vs 3.0 A limit is controlled by a
- * dedicated gpio where high = 3.0A and low = 1.5A. VBUS on/off
- * is controlled by GPIO_USB_C0/1_5V_EN. Both of these signals
- * can remain outputs.
- */
- gpio_set_level(gpio_3a_en, vbus_rp[port] == TYPEC_RP_3A0 ?
- 1 : 0);
- gpio_set_level(gpio_5v_en, vbus_en[port]);
- } else {
- /*
- * Driving USB_Cx_5V_EN high, actually put a 16.5k resistance
- * (2x 33k in parallel) on the NX5P3290 load switch ILIM pin,
- * setting a minimum OCP current of 3186 mA.
- * Putting an internal pull-up on USB_Cx_5V_EN, effectively put
- * a 33k resistor on ILIM, setting a minimum OCP current of
- * 1505 mA.
- */
- int flags = (vbus_rp[port] == TYPEC_RP_1A5 && vbus_en[port]) ?
- (GPIO_INPUT | GPIO_PULL_UP) :
- (GPIO_OUTPUT | GPIO_PULL_UP);
- gpio_set_level(gpio_5v_en, vbus_en[port]);
- gpio_set_flags(gpio_5v_en, flags);
- }
-}
-
-void typec_set_source_current_limit(int port, enum tcpc_rp_value rp)
-{
- vbus_rp[port] = rp;
-
- /* change the GPIO driving the load switch if needed */
- board_vbus_update_source_current(port);
-}
-
-int pd_set_power_supply_ready(int port)
-{
- /* Disable charging */
- gpio_set_level(port ? GPIO_USB_C1_CHARGE_L :
- GPIO_USB_C0_CHARGE_L, 1);
-
- /* Ensure we advertise the proper available current quota */
- charge_manager_source_port(port, 1);
-
- /* Provide VBUS */
- vbus_en[port] = 1;
- board_vbus_update_source_current(port);
-
- if (system_get_board_version() >= 2)
- pd_set_vbus_discharge(port, 0);
-
- /* 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[port];
-
- /* Disable VBUS */
- vbus_en[port] = 0;
- board_vbus_update_source_current(port);
-
- /* Enable discharge if we were previously sourcing 5V */
- if (system_get_board_version() >= 2 && prev_en)
- pd_set_vbus_discharge(port, 1);
-
- /* Give back the current quota we are no longer using */
- charge_manager_source_port(port, 0);
-
- /* notify host of power info change */
- pd_send_host_event(PD_EVENT_POWER_CHANGE);
-}
-
-int pd_snk_is_vbus_provided(int port)
-{
- return !gpio_get_level(port ? GPIO_USB_C1_VBUS_WAKE_L :
- GPIO_USB_C0_VBUS_WAKE_L);
-}
-
-int pd_check_vconn_swap(int port)
-{
- /* in G3, do not allow vconn swap since pp5000_A rail is off */
- return gpio_get_level(GPIO_PMIC_SLP_SUS_L);
-}
-
-__override void pd_execute_data_swap(int port,
- enum pd_data_role data_role)
-{
- /* Only port 0 supports device mode. */
- if (port != 0)
- return;
-
- gpio_set_level(GPIO_USB2_OTG_ID,
- (data_role == PD_ROLE_UFP) ? 1 : 0);
- gpio_set_level(GPIO_USB2_OTG_VBUSSENSE,
- (data_role == PD_ROLE_UFP) ? 1 : 0);
-}
diff --git a/board/poppy/vif_override.xml b/board/poppy/vif_override.xml
deleted file mode 100644
index 32736caf64..0000000000
--- a/board/poppy/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.
--->