summaryrefslogtreecommitdiff
path: root/baseboard/zork
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 /baseboard/zork
parent08f5a1e6fc2c9467230444ac9b582dcf4d9f0068 (diff)
downloadchrome-ec-stabilize-14469.9.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 'baseboard/zork')
-rw-r--r--baseboard/zork/analyzestack.yaml2
-rw-r--r--baseboard/zork/baseboard.c360
-rw-r--r--baseboard/zork/baseboard.h368
-rw-r--r--baseboard/zork/build.mk14
-rw-r--r--baseboard/zork/cbi_ec_fw_config.c98
-rw-r--r--baseboard/zork/cbi_ec_fw_config.h144
-rw-r--r--baseboard/zork/cbi_ssfc.c48
-rw-r--r--baseboard/zork/cbi_ssfc.h79
-rw-r--r--baseboard/zork/usb_pd_policy.c72
-rw-r--r--baseboard/zork/variant_dalboz.c220
-rw-r--r--baseboard/zork/variant_trembyle.c550
11 files changed, 0 insertions, 1955 deletions
diff --git a/baseboard/zork/analyzestack.yaml b/baseboard/zork/analyzestack.yaml
deleted file mode 100644
index 7ff5f39644..0000000000
--- a/baseboard/zork/analyzestack.yaml
+++ /dev/null
@@ -1,2 +0,0 @@
-remove:
-- panic_assert_fail
diff --git a/baseboard/zork/baseboard.c b/baseboard/zork/baseboard.c
deleted file mode 100644
index 0b48d1075b..0000000000
--- a/baseboard/zork/baseboard.c
+++ /dev/null
@@ -1,360 +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.
- */
-
-/* Zork family-specific configuration */
-
-#include "adc.h"
-#include "button.h"
-#include "cbi_ec_fw_config.h"
-#include "charge_manager.h"
-#include "charge_ramp.h"
-#include "charge_state.h"
-#include "charge_state_v2.h"
-#include "common.h"
-#include "compile_time_macros.h"
-#include "console.h"
-#include "cros_board_info.h"
-#include "driver/accelgyro_bmi_common.h"
-#include "driver/charger/isl9241.h"
-#include "driver/retimer/pi3hdx1204.h"
-#include "driver/usb_mux/amd_fp5.h"
-#include "ec_commands.h"
-#include "extpower.h"
-#include "gpio.h"
-#include "hooks.h"
-#include "ioexpander.h"
-#include "i2c.h"
-#include "keyboard_scan.h"
-#include "lid_switch.h"
-#include "motion_sense.h"
-#include "power.h"
-#include "power_button.h"
-#include "pwm.h"
-#include "pwm_chip.h"
-#include "registers.h"
-#include "switch.h"
-#include "system.h"
-#include "task.h"
-#include "tcpm/tcpci.h"
-#include "temp_sensor.h"
-#include "temp_sensor/thermistor.h"
-#include "usb_mux.h"
-#include "usb_pd.h"
-#include "util.h"
-
-#define SAFE_RESET_VBUS_MV 5000
-
-/*
- * For legacy BC1.2 charging with CONFIG_CHARGE_RAMP_SW, ramp up input current
- * until voltage drops to 4.5V. Don't go lower than this to be kind to the
- * charger (see b/67964166).
- */
-#define BC12_MIN_VOLTAGE 4500
-
-const enum gpio_signal hibernate_wake_pins[] = {
- GPIO_LID_OPEN,
- GPIO_AC_PRESENT,
- GPIO_POWER_BUTTON_L,
- GPIO_EC_RST_ODL,
-};
-const int hibernate_wake_pins_used = ARRAY_SIZE(hibernate_wake_pins);
-
-/*
- * In the AOZ1380 PPC, there are no programmable features. We use
- * the attached NCT3807 to control a GPIO to indicate 1A5 or 3A0
- * current limits.
- */
-__overridable int board_aoz1380_set_vbus_source_current_limit(int port,
- enum tcpc_rp_value rp)
-{
- int rv;
-
- /* Use the TCPC to set the current limit */
- rv = ioex_set_level(IOEX_USB_C0_PPC_ILIM_3A_EN,
- (rp == TYPEC_RP_3A0) ? 1 : 0);
-
- return rv;
-}
-
-static void baseboard_chipset_suspend(void)
-{
- /* Disable display and keyboard backlights. */
- gpio_set_level(GPIO_ENABLE_BACKLIGHT_L, 1);
- ioex_set_level(IOEX_KB_BL_EN, 0);
-}
-DECLARE_HOOK(HOOK_CHIPSET_SUSPEND, baseboard_chipset_suspend,
- HOOK_PRIO_DEFAULT);
-
-static void baseboard_chipset_resume(void)
-{
- /* Enable display and keyboard backlights. */
- gpio_set_level(GPIO_ENABLE_BACKLIGHT_L, 0);
- ioex_set_level(IOEX_KB_BL_EN, 1);
-}
-DECLARE_HOOK(HOOK_CHIPSET_RESUME, baseboard_chipset_resume, HOOK_PRIO_DEFAULT);
-
-__overridable 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);
-}
-
-/* Keyboard scan setting */
-__override struct keyboard_scan_config keyscan_config = {
- /*
- * F3 key scan cycle completed but scan input is not
- * charging to logic high when EC start scan next
- * column for "T" key, so we set .output_settle_us
- * to 80us
- */
- .output_settle_us = 80,
- .debounce_down_us = 6 * MSEC,
- .debounce_up_us = 30 * MSEC,
- .scan_period_us = 1500,
- .min_post_scan_delay_us = 1000,
- .poll_timeout_us = SECOND,
- .actual_key_mask = {
- 0x3c, 0xff, 0xff, 0xff, 0xff, 0xf5, 0xff,
- 0xa4, 0xff, 0xfe, 0x55, 0xfa, 0xca /* full set */
- },
-};
-
-/*
- * We use 11 as the scaling factor so that the maximum mV value below (2761)
- * can be compressed to fit in a uint8_t.
- */
-#define THERMISTOR_SCALING_FACTOR 11
-
-/*
- * Values are calculated from the "Resistance VS. Temperature" table on the
- * Murata page for part NCP15WB473F03RC. Vdd=3.3V, R=30.9Kohm.
- */
-const struct thermistor_data_pair thermistor_data[] = {
- { 2761 / THERMISTOR_SCALING_FACTOR, 0},
- { 2492 / THERMISTOR_SCALING_FACTOR, 10},
- { 2167 / THERMISTOR_SCALING_FACTOR, 20},
- { 1812 / THERMISTOR_SCALING_FACTOR, 30},
- { 1462 / THERMISTOR_SCALING_FACTOR, 40},
- { 1146 / THERMISTOR_SCALING_FACTOR, 50},
- { 878 / THERMISTOR_SCALING_FACTOR, 60},
- { 665 / THERMISTOR_SCALING_FACTOR, 70},
- { 500 / THERMISTOR_SCALING_FACTOR, 80},
- { 434 / THERMISTOR_SCALING_FACTOR, 85},
- { 376 / THERMISTOR_SCALING_FACTOR, 90},
- { 326 / THERMISTOR_SCALING_FACTOR, 95},
- { 283 / THERMISTOR_SCALING_FACTOR, 100}
-};
-
-const struct thermistor_info thermistor_info = {
- .scaling_factor = THERMISTOR_SCALING_FACTOR,
- .num_pairs = ARRAY_SIZE(thermistor_data),
- .data = thermistor_data,
-};
-
-__override void lid_angle_peripheral_enable(int enable)
-{
- if (ec_config_has_lid_angle_tablet_mode()) {
- int chipset_in_s0 = chipset_in_state(CHIPSET_STATE_ON);
-
- if (enable) {
- keyboard_scan_enable(1, KB_SCAN_DISABLE_LID_ANGLE);
- } else {
- /*
- * Ensure that the chipset is off before disabling the
- * keyboard. When the chipset is on, the EC keeps the
- * keyboard enabled and the AP decides whether to
- * ignore input devices or not.
- */
- if (!chipset_in_s0)
- keyboard_scan_enable(0,
- KB_SCAN_DISABLE_LID_ANGLE);
- }
- }
-}
-
-static void cbi_init(void)
-{
- uint32_t val;
-
- if (cbi_get_board_version(&val) == EC_SUCCESS)
- ccprints("Board Version: %d (0x%x)", val, val);
- else
- ccprints("Board Version: not set in cbi");
-
- if (cbi_get_sku_id(&val) == EC_SUCCESS)
- ccprints("SKU ID: %d (0x%x)", val, val);
- else
- ccprints("SKU ID: not set in cbi");
-
- val = get_cbi_fw_config();
- if (val != UNINITIALIZED_FW_CONFIG)
- ccprints("FW Config: %d (0x%x)", val, val);
- else
- ccprints("FW Config: not set in cbi");
-}
-DECLARE_HOOK(HOOK_INIT, cbi_init, HOOK_PRIO_INIT_I2C + 1);
-
-/*
- * Returns 1 for boards that are convertible into tablet mode, and zero for
- * clamshells.
- */
-int board_is_lid_angle_tablet_mode(void)
-{
- return ec_config_has_lid_angle_tablet_mode();
-}
-
-__override uint32_t board_override_feature_flags0(uint32_t flags0)
-{
- /*
- * Remove keyboard backlight feature for devices that don't support it.
- */
- if (ec_config_has_pwm_keyboard_backlight() == PWM_KEYBOARD_BACKLIGHT_NO)
- return (flags0 & ~EC_FEATURE_MASK_0(EC_FEATURE_PWM_KEYB));
- else
- return flags0;
-}
-
-void board_hibernate(void)
-{
- int port;
-
- /*
- * If we are charging, then drop the Vbus level down to 5V to ensure
- * that we don't get locked out of the 6.8V OVLO for our PPCs in
- * dead-battery mode. This is needed when the TCPC/PPC rails go away.
- * (b/79218851, b/143778351, b/147007265)
- */
- port = charge_manager_get_active_charge_port();
- if (port != CHARGE_PORT_NONE) {
- pd_request_source_voltage(port, SAFE_RESET_VBUS_MV);
-
- /* Give PD task and PPC chip time to get to 5V */
- msleep(900);
- }
-}
-
-__overridable int check_hdmi_hpd_status(void)
-{
- /* Default hdmi insert. */
- return 1;
-}
-
-void sbu_fault_interrupt(enum ioex_signal signal)
-{
- int port = (signal == IOEX_USB_C0_SBU_FAULT_ODL) ? 0 : 1;
-
- pd_handle_overcurrent(port);
-}
-
-static void set_ac_prochot(void)
-{
- isl9241_set_ac_prochot(CHARGER_SOLO, ZORK_AC_PROCHOT_CURRENT_MA);
-}
-DECLARE_HOOK(HOOK_INIT, set_ac_prochot, HOOK_PRIO_DEFAULT);
-
-DECLARE_DEFERRED(board_print_temps);
-int temps_interval;
-
-void board_print_temps(void)
-{
- int t, i;
- int rv;
-
- cprintf(CC_THERMAL, "[%pT ", PRINTF_TIMESTAMP_NOW);
- for (i = 0; i < TEMP_SENSOR_COUNT; ++i) {
- rv = temp_sensor_read(i, &t);
- if (rv == EC_SUCCESS)
- cprintf(CC_THERMAL, "%s=%dK (%dC) ",
- temp_sensors[i].name, t, K_TO_C(t));
- }
- cprintf(CC_THERMAL, "]\n");
-
- if (temps_interval > 0)
- hook_call_deferred(&board_print_temps_data,
- temps_interval * SECOND);
-}
-
-static int command_temps_log(int argc, char **argv)
-{
- char *e = NULL;
-
- if (argc != 2)
- return EC_ERROR_PARAM_COUNT;
-
- temps_interval = strtoi(argv[1], &e, 0);
- if (*e)
- return EC_ERROR_PARAM1;
-
- board_print_temps();
-
- return EC_SUCCESS;
-}
-DECLARE_CONSOLE_COMMAND(tempslog, command_temps_log,
- "seconds",
- "Print temp sensors periodically");
-
-/*
- * b/164921478: On G3->S5, wait for RSMRST_L to be deasserted before asserting
- * PWRBTN_L.
- */
-void board_pwrbtn_to_pch(int level)
-{
- /* Add delay for G3 exit if asserting PWRBTN_L and S5_PGOOD is low. */
- if (!level && !gpio_get_level(GPIO_S5_PGOOD)) {
- /*
- * From measurement, wait 80 ms for RSMRST_L to rise after
- * S5_PGOOD.
- */
- msleep(80);
-
- if (!gpio_get_level(GPIO_S5_PGOOD))
- ccprints("Error: pwrbtn S5_PGOOD low");
- }
- gpio_set_level(GPIO_PCH_PWRBTN_L, level);
-}
-
-/**
- * Return if VBUS is sagging too low
- */
-int board_is_vbus_too_low(int port, enum chg_ramp_vbus_state ramp_state)
-{
- int voltage = 0;
- int rv;
-
- rv = charger_get_vbus_voltage(port, &voltage);
-
- if (rv) {
- ccprints("%s rv=%d", __func__, rv);
- return 0;
- }
-
- /*
- * b/168569046: The ISL9241 sometimes incorrectly reports 0 for unknown
- * reason, causing ramp to stop at 0.5A. Workaround this by ignoring 0.
- * This partly defeats the point of ramping, but will still catch
- * VBUS below 4.5V and above 0V.
- */
- if (voltage == 0) {
- ccprints("%s vbus=0", __func__);
- return 0;
- }
-
- if (voltage < BC12_MIN_VOLTAGE)
- ccprints("%s vbus=%d", __func__, voltage);
-
- return voltage < BC12_MIN_VOLTAGE;
-}
-
-/**
- * Always ramp up input current since AP needs higher power, even if battery is
- * very low or full. We can always re-ramp if input current increases beyond
- * what supplier can provide.
- */
-__override int charge_is_consuming_full_input_current(void)
-{
- return 1;
-}
diff --git a/baseboard/zork/baseboard.h b/baseboard/zork/baseboard.h
deleted file mode 100644
index d84ebbcef8..0000000000
--- a/baseboard/zork/baseboard.h
+++ /dev/null
@@ -1,368 +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.
- */
-
-/* Zork baseboard configuration */
-
-#ifndef __CROS_EC_BASEBOARD_H
-#define __CROS_EC_BASEBOARD_H
-
-#if (defined(VARIANT_ZORK_TREMBYLE) \
- + defined(VARIANT_ZORK_DALBOZ)) != 1
-#error Must choose VARIANT_ZORK_TREMBYLE or VARIANT_ZORK_DALBOZ
-#endif
-
-/* NPCX7 config */
-#define NPCX_UART_MODULE2 1 /* GPIO64/65 are used as UART pins. */
-#define NPCX_TACH_SEL2 0 /* No tach. */
-#define NPCX7_PWM1_SEL 0 /* GPIO C2 is not used as PWM1. */
-
-/* Internal SPI flash on NPCX7 */
-#define CONFIG_FLASH_SIZE_BYTES (512 * 1024)
-#define CONFIG_SPI_FLASH_REGS
-#define CONFIG_SPI_FLASH_W25Q40 /* Internal SPI flash type. */
-
-#define CC_DEFAULT (CC_ALL & ~(CC_MASK(CC_HOSTCMD) | CC_MASK(CC_LPC)))
-
-/*
- * Enable 1 slot of secure temporary storage to support
- * suspend/resume with read/write memory training.
- */
-#define CONFIG_VSTORE
-#define CONFIG_VSTORE_SLOT_COUNT 1
-
-#define CONFIG_ADC
-#define CONFIG_BACKLIGHT_LID
-#define CONFIG_BACKLIGHT_LID_ACTIVE_LOW
-#define CONFIG_CMD_AP_RESET_LOG
-#define CONFIG_CPU_PROCHOT_ACTIVE_LOW
-#define CONFIG_HIBERNATE_PSL
-#define CONFIG_HOSTCMD_ESPI
-#define CONFIG_I2C
-#define CONFIG_I2C_CONTROLLER
-#define CONFIG_I2C_UPDATE_IF_CHANGED
-#define CONFIG_LOW_POWER_IDLE
-#define CONFIG_LTO
-#define CONFIG_PWM
-#define CONFIG_PWM_KBLIGHT
-#define CONFIG_TEMP_SENSOR
-#define CONFIG_THERMISTOR_NCP15WB
-#define CONFIG_VBOOT_EFS2
-#define CONFIG_VBOOT_HASH
-#define CONFIG_VOLUME_BUTTONS
-
-/* CBI EEPROM for board version and SKU ID */
-#define CONFIG_CBI_EEPROM
-#define CONFIG_BOARD_VERSION_CBI
-#define CONFIG_CRC8
-
-#define CONFIG_BATTERY_CUT_OFF
-#define CONFIG_BATTERY_FUEL_GAUGE
-#define CONFIG_BATTERY_REVIVE_DISCONNECT
-#define CONFIG_BATTERY_SMART
-/*
- * Enable support for battery hostcmd, supporting longer strings.
- *
- * Vilboz battery options' model names vary in the 8th character, which is
- * truncated in the memory mapped battery info; differentiating them requires
- * support for EC_CMD_BATTERY_GET_STATIC version 1.
- */
-#define CONFIG_BATTERY_V2
-#define CONFIG_BATTERY_COUNT 1
-#define CONFIG_HOSTCMD_BATTERY_V2
-
-#define CONFIG_BC12_DETECT_PI3USB9201
-
-#define CONFIG_CHARGER
-#define CONFIG_CHARGE_MANAGER
-#define CONFIG_CHARGER_DISCHARGE_ON_AC
-#define CONFIG_CHARGER_INPUT_CURRENT 512
-#define CONFIG_CHARGER_ISL9241
-#define CONFIG_CHARGER_SENSE_RESISTOR 10
-#define CONFIG_CHARGER_SENSE_RESISTOR_AC 20
-/*
- * We would prefer to use CONFIG_CHARGE_RAMP_HW to enable legacy BC1.2 charging
- * but that feature of ISL9241 is broken (b/160287056) so we have to use
- * CONFIG_CHARGE_RAMP_SW instead.
- */
-#define CONFIG_CHARGE_RAMP_SW
-
-#define CONFIG_CHIPSET_STONEY
-#define CONFIG_CHIPSET_CAN_THROTTLE
-#define CONFIG_CHIPSET_RESET_HOOK
-
-#undef CONFIG_EXTPOWER_DEBOUNCE_MS
-#define CONFIG_EXTPOWER_DEBOUNCE_MS 200
-#define CONFIG_EXTPOWER_GPIO
-#define CONFIG_POWER_COMMON
-#define CONFIG_POWER_BUTTON
-#define CONFIG_POWER_BUTTON_X86
-#define CONFIG_POWER_BUTTON_TO_PCH_CUSTOM
-#define CONFIG_THROTTLE_AP
-
-#ifdef VARIANT_ZORK_TREMBYLE
- #define CONFIG_FANS FAN_CH_COUNT
- #undef CONFIG_FAN_INIT_SPEED
- #define CONFIG_FAN_INIT_SPEED 50
-#endif
-
-#define CONFIG_LED_COMMON
-#define CONFIG_CMD_LEDTEST
-#define CONFIG_LED_ONOFF_STATES
-
-/*
- * On power-on, H1 releases the EC from reset but then quickly asserts and
- * releases the reset a second time. This means the EC sees 2 resets:
- * (1) power-on reset, (2) reset-pin reset. This config will
- * allow the second reset to be treated as a power-on.
- */
-#define CONFIG_BOARD_RESET_AFTER_POWER_ON
-
-#define CONFIG_IO_EXPANDER
-#define CONFIG_IO_EXPANDER_NCT38XX
-
-
-#define CONFIG_KEYBOARD_COL2_INVERTED
-#define CONFIG_KEYBOARD_PROTOCOL_8042
-#undef CONFIG_KEYBOARD_VIVALDI
-
-/*
- * USB ID
- *
- * This is allocated specifically for Zork
- * http://google3/hardware/standards/usb/
- */
-#define CONFIG_USB_PID 0x5040
-
-#define CONFIG_USB_PD_REV30
-
-/* Enable the TCPMv2 PD stack */
-#define CONFIG_USB_PD_TCPMV2
-
-#ifndef CONFIG_USB_PD_TCPMV2
- #define CONFIG_USB_PD_TCPMV1
-#else
- #define CONFIG_USB_PD_DECODE_SOP
- #define CONFIG_USB_DRP_ACC_TRYSRC
-
- /* Enable TCPMv2 Fast Role Swap */
- /* Turn off until FRSwap is working */
- #undef CONFIG_USB_PD_FRS_TCPC
-#endif
-
-#define CONFIG_HOSTCMD_PD_CONTROL
-#define CONFIG_CMD_TCPC_DUMP
-#define CONFIG_USB_CHARGER
-#define CONFIG_USB_POWER_DELIVERY
-#define CONFIG_USB_PD_ALT_MODE
-#define CONFIG_USB_PD_ALT_MODE_DFP
-#define CONFIG_USB_PD_COMM_LOCKED
-#define CONFIG_USB_PD_DISCHARGE_TCPC
-#define CONFIG_USB_PD_DP_HPD_GPIO
-#ifdef VARIANT_ZORK_TREMBYLE
-/*
- * Use a custom HPD function that supports HPD on IO expander.
- * TODO(b/165622386) remove this when HPD is on EC GPIO.
- */
-# define CONFIG_USB_PD_DP_HPD_GPIO_CUSTOM
-#endif
-#define CONFIG_USB_PD_DUAL_ROLE
-#define CONFIG_USB_PD_DUAL_ROLE_AUTO_TOGGLE
-#define CONFIG_USB_PD_LOGGING
-#define CONFIG_USB_PD_TCPC_LOW_POWER
-#define CONFIG_USB_PD_TCPM_MUX
-#define CONFIG_USB_PD_TCPM_NCT38XX
-#define CONFIG_USB_PD_TCPM_TCPCI
-#define CONFIG_USB_PD_TRY_SRC
-#define CONFIG_USB_PD_VBUS_DETECT_TCPC
-#define CONFIG_USBC_PPC
-#define CONFIG_USBC_PPC_SBU
-#define CONFIG_USBC_PPC_AOZ1380
-#define CONFIG_USBC_RETIMER_PI3HDX1204
-#define CONFIG_USBC_SS_MUX
-#define CONFIG_USBC_SS_MUX_DFP_ONLY
-#define CONFIG_USBC_VCONN
-#define CONFIG_USBC_VCONN_SWAP
-#define CONFIG_USB_MUX_AMD_FP5
-
-#if defined(VARIANT_ZORK_TREMBYLE)
- #define CONFIG_USB_PD_PORT_MAX_COUNT 2
- #define CONFIG_USBC_PPC_NX20P3483
- #define CONFIG_USBC_RETIMER_PS8802
- #define CONFIG_USBC_RETIMER_PS8818
- #define CONFIG_IO_EXPANDER_PORT_COUNT USBC_PORT_COUNT
- #define CONFIG_USB_MUX_RUNTIME_CONFIG
- /* USB-A config */
- #define GPIO_USB1_ILIM_SEL IOEX_USB_A0_CHARGE_EN_L
- #define GPIO_USB2_ILIM_SEL IOEX_USB_A1_CHARGE_EN_DB_L
- /* PS8818 RX Input Termination - default value */
- #define ZORK_PS8818_RX_INPUT_TERM PS8818_RX_INPUT_TERM_112_OHM
-#elif defined(VARIANT_ZORK_DALBOZ)
- #define CONFIG_IO_EXPANDER_PORT_COUNT IOEX_PORT_COUNT
-#endif
-
-/* USB-A config */
-#define USB_PORT_COUNT USBA_PORT_COUNT
-#define CONFIG_USB_PORT_POWER_SMART
-#define CONFIG_USB_PORT_POWER_SMART_CDP_SDP_ONLY
-#define CONFIG_USB_PORT_POWER_SMART_DEFAULT_MODE USB_CHARGE_MODE_CDP
-#define CONFIG_USB_PORT_POWER_SMART_INVERTED
-
-#define PD_POWER_SUPPLY_TURN_ON_DELAY 30000 /* us */
-#define PD_POWER_SUPPLY_TURN_OFF_DELAY 30000 /* us */
-
-#define PD_OPERATING_POWER_MW 15000
-#define PD_MAX_POWER_MW 65000
-#define PD_MAX_CURRENT_MA 3250
-#define PD_MAX_VOLTAGE_MV 20000
-
-/* Round up 3250 max current to multiple of 128mA for ISL9241 AC prochot. */
-#define ZORK_AC_PROCHOT_CURRENT_MA 3328
-
-/*
- * EC will boot AP to depthcharge if: (BAT >= 4%) || (AC >= 50W)
- * CONFIG_CHARGER_LIMIT_* is not set, so there is no additional restriction on
- * Depthcharge to boot OS.
- */
-#define CONFIG_CHARGER_MIN_POWER_MW_FOR_POWER_ON 50000
-
-/* Increase length of history buffer for port80 messages. */
-#undef CONFIG_PORT80_HISTORY_LEN
-#define CONFIG_PORT80_HISTORY_LEN 256
-
-/* Increase console output buffer since we have the RAM available. */
-#undef CONFIG_UART_TX_BUF_SIZE
-#define CONFIG_UART_TX_BUF_SIZE 4096
-
-#define I2C_PORT_TCPC0 NPCX_I2C_PORT0_0
-#define I2C_PORT_USBA0 NPCX_I2C_PORT0_0
-#define I2C_PORT_TCPC1 NPCX_I2C_PORT1_0
-#define I2C_PORT_USBA1 NPCX_I2C_PORT1_0
-#define I2C_PORT_USB_AP_MUX NPCX_I2C_PORT3_0
-#define I2C_PORT_THERMAL_AP NPCX_I2C_PORT4_1
-#define I2C_PORT_SENSOR NPCX_I2C_PORT5_0
-#define I2C_PORT_ACCEL I2C_PORT_SENSOR
-#define I2C_PORT_EEPROM I2C_PORT_SENSOR
-#define I2C_PORT_AP_AUDIO NPCX_I2C_PORT6_1
-
-#if defined(VARIANT_ZORK_TREMBYLE)
- #define CONFIG_CHARGER_RUNTIME_CONFIG
- #define I2C_PORT_BATTERY NPCX_I2C_PORT2_0
- #define I2C_PORT_CHARGER_V0 NPCX_I2C_PORT2_0
- #define I2C_PORT_CHARGER_V1 NPCX_I2C_PORT4_1
- #define I2C_PORT_AP_HDMI NPCX_I2C_PORT7_0
-#elif defined(VARIANT_ZORK_DALBOZ)
- #define I2C_PORT_BATTERY_V0 NPCX_I2C_PORT2_0
- #define I2C_PORT_BATTERY_V1 NPCX_I2C_PORT7_0
- #define I2C_PORT_CHARGER NPCX_I2C_PORT2_0
-#endif
-
-#define I2C_ADDR_EEPROM_FLAGS 0x50
-
-#define CONFIG_MKBP_EVENT
-/* Host event is required to wake from sleep */
-#define CONFIG_MKBP_USE_GPIO_AND_HOST_EVENT
-/* Required to enable runtime configuration */
-#define CONFIG_MKBP_EVENT_WAKEUP_MASK (BIT(EC_MKBP_EVENT_DP_ALT_MODE_ENTERED))
-
-/* Sensors */
-#define CONFIG_DYNAMIC_MOTION_SENSOR_COUNT
-
-/* Thermal */
-#define CONFIG_TEMP_SENSOR_SB_TSI
-
-#ifdef HAS_TASK_MOTIONSENSE
-/* Enable sensor fifo, must also define the _SIZE and _THRES */
-#define CONFIG_ACCEL_FIFO
-/* FIFO size is a 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)
-#endif
-
-/* Audio */
-#define CONFIG_AUDIO_CODEC
-#define CONFIG_AUDIO_CODEC_DMIC
-#define CONFIG_AUDIO_CODEC_I2S_RX
-
-/* CLI COMMAND */
-#define CONFIG_CMD_CHARGEN
-
-#ifndef __ASSEMBLER__
-
-#include "gpio_signal.h"
-#include "math_util.h"
-#include "registers.h"
-
-enum power_signal {
- X86_SLP_S3_N,
- X86_SLP_S5_N,
- X86_S0_PGOOD,
- X86_S5_PGOOD,
- POWER_SIGNAL_COUNT
-};
-
-enum fan_channel {
- FAN_CH_0 = 0,
- /* Number of FAN channels */
- FAN_CH_COUNT,
-};
-
-#ifdef VARIANT_ZORK_TREMBYLE
-enum usbc_port {
- USBC_PORT_C0 = 0,
- USBC_PORT_C1,
- USBC_PORT_COUNT
-};
-#endif
-
-enum sensor_id {
- LID_ACCEL,
- BASE_ACCEL,
- BASE_GYRO,
- SENSOR_COUNT,
-};
-
-/*
- * Matrix to rotate accelerators into the standard reference frame. The default
- * is the identity which is correct for the reference design. Variations of
- * Zork may need to change it for manufacturability.
- * For the lid:
- * +x to the right
- * +y up
- * +z out of the page
- *
- * The principle axes of the body are aligned with the lid when the lid is in
- * the 180 degree position (open, flat).
- *
- * Boards within the Zork family may need to modify this definition at
- * board_init() time.
- */
-extern mat33_fp_t zork_base_standard_ref;
-
-extern const struct thermistor_info thermistor_info;
-
-/* Sensors without hardware FIFO are in forced mode */
-#define CONFIG_ACCEL_FORCE_MODE_MASK (1 << LID_ACCEL)
-
-void mst_hpd_interrupt(enum ioex_signal signal);
-void sbu_fault_interrupt(enum ioex_signal signal);
-
-#ifdef VARIANT_ZORK_TREMBYLE
-void board_reset_pd_mcu(void);
-
-/* Common definition for the USB PD interrupt handlers. */
-void tcpc_alert_event(enum gpio_signal signal);
-void bc12_interrupt(enum gpio_signal signal);
-__override_proto void ppc_interrupt(enum gpio_signal signal);
-#endif
-
-void board_print_temps(void);
-
-/* GPIO or IOEX signal used to set IN_HPD on DB retimer. */
-extern int board_usbc1_retimer_inhpd;
-
-#endif /* !__ASSEMBLER__ */
-
-#endif /* __CROS_EC_BASEBOARD_H */
diff --git a/baseboard/zork/build.mk b/baseboard/zork/build.mk
deleted file mode 100644
index e79d60cc91..0000000000
--- a/baseboard/zork/build.mk
+++ /dev/null
@@ -1,14 +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.
-#
-# Baseboard specific files build
-#
-
-baseboard-y=baseboard.o
-baseboard-y+=cbi_ec_fw_config.o
-baseboard-y+=cbi_ssfc.o
-baseboard-$(CONFIG_USB_POWER_DELIVERY)+=usb_pd_policy.o
-baseboard-$(VARIANT_ZORK_TREMBYLE)+=variant_trembyle.o
-baseboard-$(VARIANT_ZORK_DALBOZ)+=variant_dalboz.o
diff --git a/baseboard/zork/cbi_ec_fw_config.c b/baseboard/zork/cbi_ec_fw_config.c
deleted file mode 100644
index cbb0821c42..0000000000
--- a/baseboard/zork/cbi_ec_fw_config.c
+++ /dev/null
@@ -1,98 +0,0 @@
-/* Copyright 2020 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 "common.h"
-#include "cbi_ec_fw_config.h"
-#include "cros_board_info.h"
-
-/****************************************************************************
- * CBI Zork EC FW Configuration
- */
-uint32_t get_cbi_fw_config(void)
-{
- static uint32_t cached_fw_config = UNINITIALIZED_FW_CONFIG;
-
- if (cached_fw_config == UNINITIALIZED_FW_CONFIG) {
- uint32_t val;
-
- if (cbi_get_fw_config(&val) == EC_SUCCESS)
- cached_fw_config = val;
- }
- return cached_fw_config;
-}
-
-/*
- * get_cbi_ec_cfg_usb_db() will return the DB option number.
- */
-enum ec_cfg_usb_db_type ec_config_get_usb_db(void)
-{
- return ((get_cbi_fw_config() & EC_CFG_USB_DB_MASK)
- >> EC_CFG_USB_DB_L);
-}
-
-/*
- * get_cbi_ec_cfg_usb_mb() will return the MB option number.
- */
-enum ec_cfg_usb_mb_type ec_config_get_usb_mb(void)
-{
- return ((get_cbi_fw_config() & EC_CFG_USB_MB_MASK)
- >> EC_CFG_USB_MB_L);
-}
-
-/*
- * ec_config_has_lid_accel_sensor() will return ec_cfg_lid_accel_sensor_type
- */
-enum ec_cfg_lid_accel_sensor_type ec_config_has_lid_accel_sensor(void)
-{
- return ((get_cbi_fw_config() & EC_CFG_LID_ACCEL_SENSOR_MASK)
- >> EC_CFG_LID_ACCEL_SENSOR_L);
-}
-
-/*
- * ec_config_has_base_gyro_sensor() will return ec_cfg_base_gyro_sensor_type
- */
-enum ec_cfg_base_gyro_sensor_type ec_config_has_base_gyro_sensor(void)
-{
- return ((get_cbi_fw_config() & EC_CFG_BASE_GYRO_SENSOR_MASK)
- >> EC_CFG_BASE_GYRO_SENSOR_L);
-}
-
-/*
- * ec_config_has_pwm_keyboard_backlight() will return 1 is present or 0
- */
-enum ec_cfg_pwm_keyboard_backlight_type ec_config_has_pwm_keyboard_backlight(
- void)
-{
- return ((get_cbi_fw_config() & EC_CFG_PWM_KEYBOARD_BACKLIGHT_MASK)
- >> EC_CFG_PWM_KEYBOARD_BACKLIGHT_L);
-}
-
-/*
- * ec_config_has_lid_angle_tablet_mode() will return 1 is present or 0
- */
-enum ec_cfg_lid_angle_tablet_mode_type ec_config_has_lid_angle_tablet_mode(
- void)
-{
- return ((get_cbi_fw_config() & EC_CFG_LID_ANGLE_TABLET_MODE_MASK)
- >> EC_CFG_LID_ANGLE_TABLET_MODE_L);
-}
-
-/*
- * ec_config_lte_present() will return 1 if present else 0.
- */
-enum ec_cfg_lte_present_type ec_config_lte_present(void)
-{
- return ((get_cbi_fw_config() & EC_CFG_LTE_PRESENT_MASK)
- >> EC_CFG_LTE_PRESENT_L);
-}
-
-/*
- * ec_config_keyboard_layout() will return keyboard layout type.
- */
-enum ec_cfg_keyboard_layout_type ec_config_keyboard_layout(void)
-{
- return ((get_cbi_fw_config() & EC_CFG_KEYBOARD_LAYOUT_MASK)
- >> EC_CFG_KEYBOARD_LAYOUT_L);
-}
diff --git a/baseboard/zork/cbi_ec_fw_config.h b/baseboard/zork/cbi_ec_fw_config.h
deleted file mode 100644
index 4888298e3a..0000000000
--- a/baseboard/zork/cbi_ec_fw_config.h
+++ /dev/null
@@ -1,144 +0,0 @@
-/* Copyright 2020 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.
- */
-
-#ifndef _ZORK_CBI_EC_FW_CONFIG__H_
-#define _ZORK_CBI_EC_FW_CONFIG__H_
-
-/****************************************************************************
- * CBI Zork EC FW Configuration
- */
-#define UNINITIALIZED_FW_CONFIG 0xFFFFFFFF
-
-/*
- * USB Daughter Board (4 bits)
- *
- * get_cbi_ec_cfg_usb_db() will return the DB option number.
- * The option number will be defined in a variant or board level enumeration
- */
-#define EC_CFG_USB_DB_L 0
-#define EC_CFG_USB_DB_H 3
-#define EC_CFG_USB_DB_MASK \
- GENMASK(EC_CFG_USB_DB_H,\
- EC_CFG_USB_DB_L)
-
-/*
- * USB Main Board (4 bits)
- *
- * get_cbi_ec_cfg_usb_mb() will return the MB option number.
- * The option number will be defined in a variant or board level enumeration
- */
-#define EC_CFG_USB_MB_L 4
-#define EC_CFG_USB_MB_H 7
-#define EC_CFG_USB_MB_MASK \
- GENMASK(EC_CFG_USB_MB_H,\
- EC_CFG_USB_MB_L)
-
-/*
- * Lid Accelerometer Sensor (3 bits)
- *
- * ec_config_has_lid_accel_sensor() will return ec_cfg_lid_accel_sensor_type
- */
-enum ec_cfg_lid_accel_sensor_type {
- LID_ACCEL_NONE = 0,
- LID_ACCEL_KX022 = 1,
- LID_ACCEL_LIS2DWL = 2,
-};
-#define EC_CFG_LID_ACCEL_SENSOR_L 8
-#define EC_CFG_LID_ACCEL_SENSOR_H 10
-#define EC_CFG_LID_ACCEL_SENSOR_MASK \
- GENMASK(EC_CFG_LID_ACCEL_SENSOR_H,\
- EC_CFG_LID_ACCEL_SENSOR_L)
-
-/*
- * Base Gyro Sensor (3 bits)
- *
- * ec_config_has_base_gyro_sensor() will return ec_cfg_base_gyro_sensor_type
- */
-enum ec_cfg_base_gyro_sensor_type {
- BASE_GYRO_NONE = 0,
- BASE_GYRO_BMI160 = 1,
- BASE_GYRO_LSM6DSM = 2,
- BASE_GYRO_ICM426XX = 3,
-};
-#define EC_CFG_BASE_GYRO_SENSOR_L 11
-#define EC_CFG_BASE_GYRO_SENSOR_H 13
-#define EC_CFG_BASE_GYRO_SENSOR_MASK \
- GENMASK(EC_CFG_BASE_GYRO_SENSOR_H,\
- EC_CFG_BASE_GYRO_SENSOR_L)
-
-/*
- * PWM Keyboard Backlight (1 bit)
- *
- * ec_config_has_pwm_keyboard_backlight() will return 1 is present or 0
- */
-enum ec_cfg_pwm_keyboard_backlight_type {
- PWM_KEYBOARD_BACKLIGHT_NO = 0,
- PWM_KEYBOARD_BACKLIGHT_YES = 1,
-};
-#define EC_CFG_PWM_KEYBOARD_BACKLIGHT_L 14
-#define EC_CFG_PWM_KEYBOARD_BACKLIGHT_H 14
-#define EC_CFG_PWM_KEYBOARD_BACKLIGHT_MASK \
- GENMASK(EC_CFG_PWM_KEYBOARD_BACKLIGHT_H,\
- EC_CFG_PWM_KEYBOARD_BACKLIGHT_L)
-
-/*
- * Lid Angle Tablet Mode (1 bit)
- *
- * ec_config_has_lid_angle_tablet_mode() will return 1 is present or 0
- */
-enum ec_cfg_lid_angle_tablet_mode_type {
- LID_ANGLE_TABLET_MODE_NO = 0,
- LID_ANGLE_TABLET_MODE_YES = 1,
-};
-#define EC_CFG_LID_ANGLE_TABLET_MODE_L 15
-#define EC_CFG_LID_ANGLE_TABLET_MODE_H 15
-#define EC_CFG_LID_ANGLE_TABLET_MODE_MASK \
- GENMASK(EC_CFG_LID_ANGLE_TABLET_MODE_H,\
- EC_CFG_LID_ANGLE_TABLET_MODE_L)
-
-/*
- * LTE Modem Present (1 bit)
- *
- * ec_config_lte_present() will return 1 if present else 0.
- */
-enum ec_cfg_lte_present_type {
- LTE_NONE = 0,
- LTE_PRESENT = 1,
-};
-#define EC_CFG_LTE_PRESENT_L 29
-#define EC_CFG_LTE_PRESENT_H 29
-#define EC_CFG_LTE_PRESENT_MASK \
- GENMASK(EC_CFG_LTE_PRESENT_H,\
- EC_CFG_LTE_PRESENT_L)
-
-/*
- * Keyboard Layout (2 bit)
- *
- * ec_config_keyboard_layout() will return keyboard layout type.
- */
-enum ec_cfg_keyboard_layout_type {
- KB_LAYOUT_DEFAULT = 0,
- KB_LAYOUT_1 = 1,
-};
-#define EC_CFG_KEYBOARD_LAYOUT_L 30
-#define EC_CFG_KEYBOARD_LAYOUT_H 31
-#define EC_CFG_KEYBOARD_LAYOUT_MASK \
- GENMASK(EC_CFG_KEYBOARD_LAYOUT_H,\
- EC_CFG_KEYBOARD_LAYOUT_L)
-
-
-uint32_t get_cbi_fw_config(void);
-enum ec_cfg_usb_db_type ec_config_get_usb_db(void);
-enum ec_cfg_usb_mb_type ec_config_get_usb_mb(void);
-enum ec_cfg_lid_accel_sensor_type ec_config_has_lid_accel_sensor(void);
-enum ec_cfg_base_gyro_sensor_type ec_config_has_base_gyro_sensor(void);
-enum ec_cfg_pwm_keyboard_backlight_type ec_config_has_pwm_keyboard_backlight(
- void);
-enum ec_cfg_lid_angle_tablet_mode_type ec_config_has_lid_angle_tablet_mode(
- void);
-enum ec_cfg_lte_present_type ec_config_lte_present(void);
-enum ec_cfg_keyboard_layout_type ec_config_keyboard_layout(void);
-
-#endif /* _ZORK_CBI_EC_FW_CONFIG__H_ */
diff --git a/baseboard/zork/cbi_ssfc.c b/baseboard/zork/cbi_ssfc.c
deleted file mode 100644
index 1078ec6486..0000000000
--- a/baseboard/zork/cbi_ssfc.c
+++ /dev/null
@@ -1,48 +0,0 @@
-/* Copyright 2021 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 "cbi_ssfc.h"
-#include "common.h"
-#include "console.h"
-#include "cros_board_info.h"
-#include "hooks.h"
-
-#define CPRINTS(format, args...) cprints(CC_SYSTEM, format, ##args)
-
-/* Cache SSFC on init since we don't expect it to change in runtime */
-static uint32_t cached_ssfc;
-
-static void cbi_ssfc_init(void)
-{
- if (cbi_get_ssfc(&cached_ssfc) != EC_SUCCESS)
- /* Default to 0 when CBI isn't populated */
- cached_ssfc = 0;
-
- CPRINTS("Read CBI SSFC : 0x%04X", cached_ssfc);
-}
-DECLARE_HOOK(HOOK_INIT, cbi_ssfc_init, HOOK_PRIO_FIRST);
-
-enum ec_ssfc_base_gyro_sensor get_cbi_ssfc_base_sensor(void)
-{
- return (cached_ssfc & SSFC_BASE_GYRO_MASK) >> SSFC_BASE_GYRO_OFFSET;
-}
-
-enum ec_ssfc_spkr_auto_mode get_cbi_ssfc_spkr_auto_mode(void)
-{
- return (cached_ssfc & SSFC_SPKR_AUTO_MODE_MASK) >>
- SSFC_SPKR_AUTO_MODE_OFFSET;
-}
-
-enum ec_ssfc_edp_phy_alt_tuning get_cbi_ssfc_edp_phy_alt_tuning(void)
-{
- return (cached_ssfc & SSFC_EDP_PHY_ALT_TUNING_MASK) >>
- SSFC_EDP_PHY_ALT_TUNING_OFFSET;
-}
-
-enum ec_ssfc_c1_mux get_cbi_ssfc_c1_mux(void)
-{
- return (cached_ssfc & SSFC_C1_MUX_MASK) >>
- SSFC_C1_MUX_OFFSET;
-}
diff --git a/baseboard/zork/cbi_ssfc.h b/baseboard/zork/cbi_ssfc.h
deleted file mode 100644
index c51d612a06..0000000000
--- a/baseboard/zork/cbi_ssfc.h
+++ /dev/null
@@ -1,79 +0,0 @@
-/* Copyright 2021 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.
- */
-
-#ifndef _ZORK_CBI_SSFC__H_
-#define _ZORK_CBI_SSFC__H_
-
-#include "stdint.h"
-
-/****************************************************************************
- * Zork CBI Second Source Factory Cache
- */
-
-/*
- * Base Sensor (Bits 0-2)
- */
-enum ec_ssfc_base_gyro_sensor {
- SSFC_BASE_GYRO_NONE = 0,
- SSFC_BASE_GYRO_BMI160 = 1,
- SSFC_BASE_GYRO_LSM6DSM = 2,
- SSFC_BASE_GYRO_ICM426XX = 3,
-};
-#define SSFC_BASE_GYRO_OFFSET 0
-#define SSFC_BASE_GYRO_MASK GENMASK(2, 0)
-
-enum ec_ssfc_spkr_auto_mode {
- SSFC_SPKR_AUTO_MODE_OFF = 0,
- SSFC_SPKR_AUTO_MODE_ON = 1,
-};
-#define SSFC_SPKR_AUTO_MODE_OFFSET 3
-#define SSFC_SPKR_AUTO_MODE_MASK GENMASK(3, 3)
-
-/*
- * eDP PHY Alternate Tuning (Bits 4-5)
- */
-enum ec_ssfc_edp_phy_alt_tuning {
- SSFC_EDP_PHY_ALT_TUNING_0 = 0,
- SSFC_EDP_PHY_ALT_TUNING_1 = 1,
- SSFC_EDP_PHY_ALT_TUNING_2 = 2,
- SSFC_EDP_PHY_ALT_TUNING_3 = 3,
-};
-#define SSFC_EDP_PHY_ALT_TUNING_OFFSET 4
-#define SSFC_EDP_PHY_ALT_TUNING_MASK GENMASK(5, 4)
-
-/*
- * TypeC port 1 secondary MUX (Bits 6-7)
- */
-enum ec_ssfc_c1_mux {
- SSFC_C1_MUX_NONE = 0,
- SSFC_C1_MUX_TUSB544 = 1,
- SSFC_C1_MUX_PS8818 = 2,
-};
-#define SSFC_C1_MUX_OFFSET 6
-#define SSFC_C1_MUX_MASK GENMASK(7, 6)
-
-/**
- * Get the Base sensor type from SSFC_CONFIG.
- *
- * @return the Base sensor board type.
- */
-enum ec_ssfc_base_gyro_sensor get_cbi_ssfc_base_sensor(void);
-
-/**
- * Get whether speaker amp auto mode is enabled from SSFC.
- */
-enum ec_ssfc_spkr_auto_mode get_cbi_ssfc_spkr_auto_mode(void);
-
-/**
- * Get the eDP PHY alternate tuning from SSFC.
- */
-enum ec_ssfc_edp_phy_alt_tuning get_cbi_ssfc_edp_phy_alt_tuning(void);
-
-/**
- * Get the C1 usb mux from SSFC.
- */
-enum ec_ssfc_c1_mux get_cbi_ssfc_c1_mux(void);
-
-#endif /* _ZORK_CBI_SSFC__H_ */
diff --git a/baseboard/zork/usb_pd_policy.c b/baseboard/zork/usb_pd_policy.c
deleted file mode 100644
index 8dcdfa7635..0000000000
--- a/baseboard/zork/usb_pd_policy.c
+++ /dev/null
@@ -1,72 +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 Zork boards */
-
-#include "charge_manager.h"
-#include "chipset.h"
-#include "common.h"
-#include "compile_time_macros.h"
-#include "console.h"
-#include "ec_commands.h"
-#include "gpio.h"
-#include "system.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)
-{
- /* in G3, do not allow vconn swap since 5V rail is off */
- return gpio_get_level(GPIO_S5_PGOOD);
-}
-
-void pd_power_supply_reset(int port)
-{
- /* Don't need to shutoff VBus if we are not sourcing it */
- if (ppc_is_sourcing_vbus(port)) {
- /* Disable VBUS. */
- ppc_vbus_source_enable(port, 0);
-
- /* Enable discharge if we were previously sourcing 5V */
- if (IS_ENABLED(CONFIG_USB_PD_DISCHARGE))
- pd_set_vbus_discharge(port, 1);
- }
-
- /* 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;
-
- if (IS_ENABLED(CONFIG_USB_PD_DISCHARGE))
- pd_set_vbus_discharge(port, 0);
-
- /* Provide Vbus. */
- rv = ppc_vbus_source_enable(port, 1);
- if (rv)
- return rv;
-
- /* Notify host of power info change. */
- pd_send_host_event(PD_EVENT_POWER_CHANGE);
-
- return EC_SUCCESS;
-}
-
-int board_vbus_source_enabled(int port)
-{
- return ppc_is_sourcing_vbus(port);
-}
diff --git a/baseboard/zork/variant_dalboz.c b/baseboard/zork/variant_dalboz.c
deleted file mode 100644
index 10058bb8bc..0000000000
--- a/baseboard/zork/variant_dalboz.c
+++ /dev/null
@@ -1,220 +0,0 @@
-/* Copyright 2020 The Chromium OS Authors. All rights reserved.
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-#include "adc.h"
-#include "charger.h"
-#include "chipset.h"
-#include "common.h"
-#include "driver/charger/isl9241.h"
-#include "driver/temp_sensor/sb_tsi.h"
-#include "gpio.h"
-#include "hooks.h"
-#include "i2c.h"
-#include "power.h"
-#include "temp_sensor.h"
-#include "temp_sensor/thermistor.h"
-
-const struct power_signal_info power_signal_list[] = {
- [X86_SLP_S3_N] = {
- .gpio = GPIO_PCH_SLP_S3_L,
- .flags = POWER_SIGNAL_ACTIVE_HIGH,
- .name = "SLP_S3_DEASSERTED",
- },
- [X86_SLP_S5_N] = {
- .gpio = GPIO_PCH_SLP_S5_L,
- .flags = POWER_SIGNAL_ACTIVE_HIGH,
- .name = "SLP_S5_DEASSERTED",
- },
- [X86_S0_PGOOD] = {
- .gpio = GPIO_S0_PGOOD,
- .flags = POWER_SIGNAL_ACTIVE_HIGH,
- .name = "S0_PGOOD",
- },
- [X86_S5_PGOOD] = {
- .gpio = GPIO_S5_PGOOD,
- .flags = POWER_SIGNAL_ACTIVE_HIGH,
- .name = "S5_PGOOD",
- },
-};
-BUILD_ASSERT(ARRAY_SIZE(power_signal_list) == POWER_SIGNAL_COUNT);
-
-int board_get_temp(int idx, int *temp_k)
-{
- int mv;
- int temp_c;
- enum adc_channel channel;
-
- /* idx is the sensor index set in board temp_sensors[] */
- switch (idx) {
- case TEMP_SENSOR_CHARGER:
- channel = ADC_TEMP_SENSOR_CHARGER;
- break;
- case TEMP_SENSOR_SOC:
- /* thermistor is not powered in G3 */
- if (chipset_in_state(CHIPSET_STATE_HARD_OFF))
- return EC_ERROR_NOT_POWERED;
-
- /* adc power not ready when transition to S5 */
- if (chipset_in_or_transitioning_to_state(
- CHIPSET_STATE_SOFT_OFF))
- return EC_ERROR_NOT_POWERED;
-
- channel = ADC_TEMP_SENSOR_SOC;
- break;
- default:
- return EC_ERROR_INVAL;
- }
-
- mv = adc_read_channel(channel);
- if (mv < 0)
- return EC_ERROR_INVAL;
-
- temp_c = thermistor_linear_interpolate(mv, &thermistor_info);
- *temp_k = C_TO_K(temp_c);
- return EC_SUCCESS;
-}
-
-const struct adc_t adc_channels[] = {
- [ADC_TEMP_SENSOR_CHARGER] = {
- .name = "CHARGER",
- .input_ch = NPCX_ADC_CH2,
- .factor_mul = ADC_MAX_VOLT,
- .factor_div = ADC_READ_MAX + 1,
- .shift = 0,
- },
- [ADC_TEMP_SENSOR_SOC] = {
- .name = "SOC",
- .input_ch = NPCX_ADC_CH3,
- .factor_mul = ADC_MAX_VOLT,
- .factor_div = ADC_READ_MAX + 1,
- .shift = 0,
- },
-};
-BUILD_ASSERT(ARRAY_SIZE(adc_channels) == ADC_CH_COUNT);
-
-const struct temp_sensor_t temp_sensors[] = {
- [TEMP_SENSOR_CHARGER] = {
- .name = "Charger",
- .type = TEMP_SENSOR_TYPE_BOARD,
- .read = board_get_temp,
- .idx = TEMP_SENSOR_CHARGER,
- },
- [TEMP_SENSOR_SOC] = {
- .name = "SOC",
- .type = TEMP_SENSOR_TYPE_BOARD,
- .read = board_get_temp,
- .idx = TEMP_SENSOR_SOC,
- },
- [TEMP_SENSOR_CPU] = {
- .name = "CPU",
- .type = TEMP_SENSOR_TYPE_CPU,
- .read = sb_tsi_get_val,
- .idx = 0,
- },
-};
-BUILD_ASSERT(ARRAY_SIZE(temp_sensors) == TEMP_SENSOR_COUNT);
-
-__overridable struct ec_thermal_config thermal_params[TEMP_SENSOR_COUNT] = {
- [TEMP_SENSOR_CHARGER] = {
- .temp_host = {
- [EC_TEMP_THRESH_HIGH] = C_TO_K(90),
- [EC_TEMP_THRESH_HALT] = C_TO_K(92),
- },
- .temp_host_release = {
- [EC_TEMP_THRESH_HIGH] = C_TO_K(80),
- }
- },
- [TEMP_SENSOR_SOC] = {
- .temp_host = {
- [EC_TEMP_THRESH_HIGH] = C_TO_K(90),
- [EC_TEMP_THRESH_HALT] = C_TO_K(92),
- },
- .temp_host_release = {
- [EC_TEMP_THRESH_HIGH] = C_TO_K(80),
- }
- },
- [TEMP_SENSOR_CPU] = {
- .temp_host = {
- [EC_TEMP_THRESH_HIGH] = C_TO_K(90),
- [EC_TEMP_THRESH_HALT] = C_TO_K(92),
- },
- .temp_host_release = {
- [EC_TEMP_THRESH_HIGH] = C_TO_K(80),
- }
- },
-};
-BUILD_ASSERT(ARRAY_SIZE(thermal_params) == TEMP_SENSOR_COUNT);
-
-const struct i2c_port_t i2c_ports[] = {
- {
- .name = "tcpc0",
- .port = I2C_PORT_TCPC0,
- .kbps = 400,
- .scl = GPIO_EC_I2C_USB_A0_C0_SCL,
- .sda = GPIO_EC_I2C_USB_A0_C0_SDA,
- },
- {
- .name = "tcpc1",
- .port = I2C_PORT_TCPC1,
- .kbps = 400,
- .scl = GPIO_EC_I2C_USB_A1_C1_SCL,
- .sda = GPIO_EC_I2C_USB_A1_C1_SDA,
- },
- {
- .name = "charger",
- .port = I2C_PORT_CHARGER,
- .kbps = 100,
- .scl = GPIO_EC_I2C_POWER_SCL,
- .sda = GPIO_EC_I2C_POWER_SDA,
- },
- {
- .name = "ap_mux",
- .port = I2C_PORT_USB_AP_MUX,
- .kbps = 400,
- .scl = GPIO_EC_I2C_USBC_AP_MUX_SCL,
- .sda = GPIO_EC_I2C_USBC_AP_MUX_SDA,
- },
- {
- .name = "thermal",
- .port = I2C_PORT_THERMAL_AP,
- .kbps = 400,
- .scl = GPIO_FCH_SIC,
- .sda = GPIO_FCH_SID,
- },
- {
- .name = "sensor",
- .port = I2C_PORT_SENSOR,
- .kbps = 400,
- .scl = GPIO_EC_I2C_SENSOR_CBI_SCL,
- .sda = GPIO_EC_I2C_SENSOR_CBI_SDA,
- },
- {
- .name = "ap_audio",
- .port = I2C_PORT_AP_AUDIO,
- .kbps = 400,
- .scl = GPIO_I2C_AUDIO_USB_HUB_SCL,
- .sda = GPIO_I2C_AUDIO_USB_HUB_SDA,
- },
- {
- .name = "battery",
- .port = I2C_PORT_BATTERY_V1,
- .kbps = 100,
- .scl = GPIO_EC_I2C_BATT_SCL,
- .sda = GPIO_EC_I2C_BATT_SDA,
- },
-};
-const unsigned int i2c_ports_used = ARRAY_SIZE(i2c_ports);
-
-/*****************************************************************************
- * Charger
- */
-
-const struct charger_config_t chg_chips[] = {
- {
- .i2c_port = I2C_PORT_CHARGER,
- .i2c_addr_flags = ISL9241_ADDR_FLAGS,
- .drv = &isl9241_drv,
- },
-};
diff --git a/baseboard/zork/variant_trembyle.c b/baseboard/zork/variant_trembyle.c
deleted file mode 100644
index b39380db59..0000000000
--- a/baseboard/zork/variant_trembyle.c
+++ /dev/null
@@ -1,550 +0,0 @@
-/* Copyright 2020 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 "charger.h"
-#include "chipset.h"
-#include "common.h"
-#include "console.h"
-#include "driver/bc12/pi3usb9201.h"
-#include "driver/charger/isl9241.h"
-#include "driver/ppc/aoz1380.h"
-#include "driver/ppc/nx20p348x.h"
-#include "driver/retimer/ps8802.h"
-#include "driver/retimer/ps8818.h"
-#include "driver/retimer/tusb544.h"
-#include "driver/tcpm/nct38xx.h"
-#include "driver/usb_mux/amd_fp5.h"
-#include "fan.h"
-#include "fan_chip.h"
-#include "gpio.h"
-#include "hooks.h"
-#include "i2c.h"
-#include "ioexpander.h"
-#include "task.h"
-#include "timer.h"
-#include "usb_mux.h"
-#include "usb_pd_tcpm.h"
-#include "usbc_ppc.h"
-
-#define CPRINTSUSB(format, args...) cprints(CC_USBCHARGE, format, ## args)
-#define CPRINTFUSB(format, args...) cprintf(CC_USBCHARGE, format, ## args)
-
-const struct i2c_port_t i2c_ports[] = {
- {
- .name = "tcpc0",
- .port = I2C_PORT_TCPC0,
- .kbps = 400,
- .scl = GPIO_EC_I2C_USB_A0_C0_SCL,
- .sda = GPIO_EC_I2C_USB_A0_C0_SDA,
- },
- {
- .name = "tcpc1",
- .port = I2C_PORT_TCPC1,
- .kbps = 400,
- .scl = GPIO_EC_I2C_USB_A1_C1_SCL,
- .sda = GPIO_EC_I2C_USB_A1_C1_SDA,
- },
- {
- .name = "battery",
- .port = I2C_PORT_BATTERY,
- .kbps = 100,
- .scl = GPIO_EC_I2C_BATT_SCL,
- .sda = GPIO_EC_I2C_BATT_SDA,
- },
- {
- .name = "ap_mux",
- .port = I2C_PORT_USB_AP_MUX,
- .kbps = 400,
- .scl = GPIO_EC_I2C_USBC_AP_MUX_SCL,
- .sda = GPIO_EC_I2C_USBC_AP_MUX_SDA,
- },
- {
- .name = "therm_chg",
- .port = I2C_PORT_THERMAL_AP,
- .kbps = 400,
- .scl = GPIO_FCH_SIC_POWER_SCL,
- .sda = GPIO_FCH_SID_POWER_SDA,
- },
- {
- .name = "sensor",
- .port = I2C_PORT_SENSOR,
- .kbps = 400,
- .scl = GPIO_EC_I2C_SENSOR_CBI_SCL,
- .sda = GPIO_EC_I2C_SENSOR_CBI_SDA,
- },
- {
- .name = "ap_audio",
- .port = I2C_PORT_AP_AUDIO,
- .kbps = 400,
- .scl = GPIO_FCH_I2C_AUDIO_SCL,
- .sda = GPIO_FCH_I2C_AUDIO_SDA,
- },
- {
- .name = "ap_hdmi",
- .port = I2C_PORT_AP_HDMI,
- .kbps = 400,
- .scl = GPIO_FCH_I2C_HDMI_HUB_3V3_SCL,
- .sda = GPIO_FCH_I2C_HDMI_HUB_3V3_SDA,
- },
-};
-const unsigned int i2c_ports_used = ARRAY_SIZE(i2c_ports);
-
-/*****************************************************************************
- * Charger
- */
-
-struct charger_config_t chg_chips[] = {
- {
- .i2c_port = I2C_PORT_CHARGER_V1,
- .i2c_addr_flags = ISL9241_ADDR_FLAGS,
- .drv = &isl9241_drv,
- },
-};
-
-/*****************************************************************************
- * TCPC
- */
-
-void baseboard_tcpc_init(void)
-{
- /* Enable PPC interrupts. */
- gpio_enable_interrupt(GPIO_USB_C0_PPC_FAULT_ODL);
- gpio_enable_interrupt(GPIO_USB_C1_PPC_INT_ODL);
-
- /* Enable TCPC interrupts. */
- gpio_enable_interrupt(GPIO_USB_C0_TCPC_INT_ODL);
- gpio_enable_interrupt(GPIO_USB_C1_TCPC_INT_ODL);
-
- /* Enable BC 1.2 interrupts */
- gpio_enable_interrupt(GPIO_USB_C0_BC12_INT_ODL);
- gpio_enable_interrupt(GPIO_USB_C1_BC12_INT_ODL);
-
- /* Enable SBU fault interrupts */
- ioex_enable_interrupt(IOEX_USB_C0_SBU_FAULT_ODL);
- ioex_enable_interrupt(IOEX_USB_C1_SBU_FAULT_DB_ODL);
-}
-DECLARE_HOOK(HOOK_INIT, baseboard_tcpc_init, HOOK_PRIO_INIT_I2C + 1);
-
-struct ppc_config_t ppc_chips[] = {
- [USBC_PORT_C0] = {
- /* Device does not talk I2C */
- .drv = &aoz1380_drv
- },
-
- [USBC_PORT_C1] = {
- .i2c_port = I2C_PORT_TCPC1,
- .i2c_addr_flags = NX20P3483_ADDR1_FLAGS,
- .drv = &nx20p348x_drv
- },
-};
-BUILD_ASSERT(ARRAY_SIZE(ppc_chips) == USBC_PORT_COUNT);
-unsigned int ppc_cnt = ARRAY_SIZE(ppc_chips);
-
-__overridable void ppc_interrupt(enum gpio_signal signal)
-{
- switch (signal) {
- case GPIO_USB_C0_PPC_FAULT_ODL:
- aoz1380_interrupt(USBC_PORT_C0);
- break;
-
- case GPIO_USB_C1_PPC_INT_ODL:
- nx20p348x_interrupt(USBC_PORT_C1);
- break;
-
- default:
- break;
- }
-}
-
-int board_set_active_charge_port(int port)
-{
- int is_valid_port = (port >= 0 &&
- port < CONFIG_USB_PD_PORT_MAX_COUNT);
- int i;
-
- 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;
- } else if (!is_valid_port) {
- return EC_ERROR_INVAL;
- }
-
-
- /* 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;
-}
-
-void board_overcurrent_event(int port, int is_overcurrented)
-{
- switch (port) {
- case USBC_PORT_C0:
- ioex_set_level(IOEX_USB_C0_FAULT_ODL, !is_overcurrented);
- break;
-
- case USBC_PORT_C1:
- ioex_set_level(IOEX_USB_C1_FAULT_ODL, !is_overcurrented);
- break;
-
- default:
- break;
- }
-}
-
-const struct tcpc_config_t tcpc_config[] = {
- [USBC_PORT_C0] = {
- .bus_type = EC_BUS_TYPE_I2C,
- .i2c_info = {
- .port = I2C_PORT_TCPC0,
- .addr_flags = NCT38XX_I2C_ADDR1_1_FLAGS,
- },
- .drv = &nct38xx_tcpm_drv,
- .flags = TCPC_FLAGS_TCPCI_REV2_0,
- },
- [USBC_PORT_C1] = {
- .bus_type = EC_BUS_TYPE_I2C,
- .i2c_info = {
- .port = I2C_PORT_TCPC1,
- .addr_flags = NCT38XX_I2C_ADDR1_1_FLAGS,
- },
- .drv = &nct38xx_tcpm_drv,
- .flags = TCPC_FLAGS_TCPCI_REV2_0,
- },
-};
-BUILD_ASSERT(ARRAY_SIZE(tcpc_config) == USBC_PORT_COUNT);
-BUILD_ASSERT(CONFIG_USB_PD_PORT_MAX_COUNT == USBC_PORT_COUNT);
-
-const struct pi3usb9201_config_t pi3usb9201_bc12_chips[] = {
- [USBC_PORT_C0] = {
- .i2c_port = I2C_PORT_TCPC0,
- .i2c_addr_flags = PI3USB9201_I2C_ADDR_3_FLAGS,
- },
-
- [USBC_PORT_C1] = {
- .i2c_port = I2C_PORT_TCPC1,
- .i2c_addr_flags = PI3USB9201_I2C_ADDR_3_FLAGS,
- },
-};
-BUILD_ASSERT(ARRAY_SIZE(pi3usb9201_bc12_chips) == USBC_PORT_COUNT);
-
-static void reset_nct38xx_port(int port)
-{
- enum gpio_signal reset_gpio_l;
-
- if (port == USBC_PORT_C0)
- reset_gpio_l = GPIO_USB_C0_TCPC_RST_L;
- else if (port == USBC_PORT_C1)
- reset_gpio_l = GPIO_USB_C1_TCPC_RST_L;
- else
- /* Invalid port: do nothing */
- return;
-
- gpio_set_level(reset_gpio_l, 0);
- msleep(NCT38XX_RESET_HOLD_DELAY_MS);
- gpio_set_level(reset_gpio_l, 1);
- nct38xx_reset_notify(port);
- if (NCT3807_RESET_POST_DELAY_MS != 0)
- msleep(NCT3807_RESET_POST_DELAY_MS);
-}
-
-
-void board_reset_pd_mcu(void)
-{
- /* Reset TCPC0 */
- reset_nct38xx_port(USBC_PORT_C0);
-
- /* Reset TCPC1 */
- reset_nct38xx_port(USBC_PORT_C1);
-}
-
-uint16_t tcpc_get_alert_status(void)
-{
- uint16_t status = 0;
-
- /*
- * 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)) {
- if (gpio_get_level(GPIO_USB_C0_TCPC_RST_L) != 0)
- status |= PD_STATUS_TCPC_ALERT_0;
- }
-
- if (!gpio_get_level(GPIO_USB_C1_TCPC_INT_ODL)) {
- if (gpio_get_level(GPIO_USB_C1_TCPC_RST_L) != 0)
- status |= PD_STATUS_TCPC_ALERT_1;
- }
-
- return status;
-}
-
-void tcpc_alert_event(enum gpio_signal signal)
-{
- int port = -1;
-
- switch (signal) {
- case GPIO_USB_C0_TCPC_INT_ODL:
- port = 0;
- break;
- case GPIO_USB_C1_TCPC_INT_ODL:
- port = 1;
- break;
- default:
- return;
- }
-
- schedule_deferred_pd_interrupt(port);
-}
-
-
-int board_pd_set_frs_enable(int port, int enable)
-{
- int rv = EC_SUCCESS;
-
- /* Use the TCPC to enable fast switch when FRS included */
- if (port == USBC_PORT_C0) {
- rv = ioex_set_level(IOEX_USB_C0_TCPC_FASTSW_CTL_EN,
- !!enable);
- } else {
- rv = ioex_set_level(IOEX_USB_C1_TCPC_FASTSW_CTL_EN,
- !!enable);
- }
-
- return rv;
-}
-
-void bc12_interrupt(enum gpio_signal signal)
-{
- switch (signal) {
- case GPIO_USB_C0_BC12_INT_ODL:
- task_set_event(TASK_ID_USB_CHG_P0, USB_CHG_EVENT_BC12);
- break;
-
- case GPIO_USB_C1_BC12_INT_ODL:
- task_set_event(TASK_ID_USB_CHG_P1, USB_CHG_EVENT_BC12);
- break;
-
- default:
- break;
- }
-}
-
-/*****************************************************************************
- * IO expander
- */
-
-struct ioexpander_config_t ioex_config[] = {
- [USBC_PORT_C0] = {
- .i2c_host_port = I2C_PORT_TCPC0,
- .i2c_addr_flags = NCT38XX_I2C_ADDR1_1_FLAGS,
- .drv = &nct38xx_ioexpander_drv,
- },
- [USBC_PORT_C1] = {
- .i2c_host_port = I2C_PORT_TCPC1,
- .i2c_addr_flags = NCT38XX_I2C_ADDR1_1_FLAGS,
- .drv = &nct38xx_ioexpander_drv,
- },
-};
-BUILD_ASSERT(ARRAY_SIZE(ioex_config) == USBC_PORT_COUNT);
-BUILD_ASSERT(CONFIG_IO_EXPANDER_PORT_COUNT == USBC_PORT_COUNT);
-
-/*****************************************************************************
- * Custom Zork USB-C1 Retimer/MUX driver
- */
-
-/*
- * PS8802 set mux board tuning.
- * Adds in board specific gain and DP lane count configuration
- */
-static int board_ps8802_mux_set(const struct usb_mux *me,
- mux_state_t mux_state)
-{
- int rv = EC_SUCCESS;
-
- /* Make sure the PS8802 is awake */
- rv = ps8802_i2c_wake(me);
- if (rv)
- return rv;
-
- /* USB specific config */
- if (mux_state & USB_PD_MUX_USB_ENABLED) {
- /* Boost the USB gain */
- rv = ps8802_i2c_field_update16(me,
- PS8802_REG_PAGE2,
- PS8802_REG2_USB_SSEQ_LEVEL,
- PS8802_USBEQ_LEVEL_UP_MASK,
- PS8802_USBEQ_LEVEL_UP_19DB);
- if (rv)
- return rv;
- }
-
- /* DP specific config */
- if (mux_state & USB_PD_MUX_DP_ENABLED) {
- /* Boost the DP gain */
- rv = ps8802_i2c_field_update8(me,
- PS8802_REG_PAGE2,
- PS8802_REG2_DPEQ_LEVEL,
- PS8802_DPEQ_LEVEL_UP_MASK,
- PS8802_DPEQ_LEVEL_UP_19DB);
- if (rv)
- return rv;
- }
-
- return rv;
-}
-
-/*
- * PS8818 set mux board tuning.
- * Adds in board specific gain and DP lane count configuration
- */
-static int board_ps8818_mux_set(const struct usb_mux *me,
- mux_state_t mux_state)
-{
- int rv = EC_SUCCESS;
-
- /* USB specific config */
- if (mux_state & USB_PD_MUX_USB_ENABLED) {
- /* Boost the USB gain */
- rv = ps8818_i2c_field_update8(me,
- PS8818_REG_PAGE1,
- PS8818_REG1_APTX1EQ_10G_LEVEL,
- PS8818_EQ_LEVEL_UP_MASK,
- PS8818_EQ_LEVEL_UP_19DB);
- if (rv)
- return rv;
-
- rv = ps8818_i2c_field_update8(me,
- PS8818_REG_PAGE1,
- PS8818_REG1_APTX2EQ_10G_LEVEL,
- PS8818_EQ_LEVEL_UP_MASK,
- PS8818_EQ_LEVEL_UP_19DB);
- if (rv)
- return rv;
-
- rv = ps8818_i2c_field_update8(me,
- PS8818_REG_PAGE1,
- PS8818_REG1_APTX1EQ_5G_LEVEL,
- PS8818_EQ_LEVEL_UP_MASK,
- PS8818_EQ_LEVEL_UP_19DB);
- if (rv)
- return rv;
-
- rv = ps8818_i2c_field_update8(me,
- PS8818_REG_PAGE1,
- PS8818_REG1_APTX2EQ_5G_LEVEL,
- PS8818_EQ_LEVEL_UP_MASK,
- PS8818_EQ_LEVEL_UP_19DB);
- if (rv)
- return rv;
-
- /* Set the RX input termination */
- rv = ps8818_i2c_field_update8(me,
- PS8818_REG_PAGE1,
- PS8818_REG1_RX_PHY,
- PS8818_RX_INPUT_TERM_MASK,
- ZORK_PS8818_RX_INPUT_TERM);
- if (rv)
- return rv;
- }
-
- /* DP specific config */
- if (mux_state & USB_PD_MUX_DP_ENABLED) {
- /* Boost the DP gain */
- rv = ps8818_i2c_field_update8(me,
- PS8818_REG_PAGE1,
- PS8818_REG1_DPEQ_LEVEL,
- PS8818_DPEQ_LEVEL_UP_MASK,
- PS8818_DPEQ_LEVEL_UP_19DB);
- if (rv)
- return rv;
-
- /* Enable IN_HPD on the DB */
- gpio_or_ioex_set_level(board_usbc1_retimer_inhpd, 1);
- } else {
- /* Disable IN_HPD on the DB */
- gpio_or_ioex_set_level(board_usbc1_retimer_inhpd, 0);
- }
-
- return rv;
-}
-
-const struct usb_mux usbc1_ps8802 = {
- .usb_port = USBC_PORT_C1,
- .i2c_port = I2C_PORT_TCPC1,
- .i2c_addr_flags = PS8802_I2C_ADDR_FLAGS,
- .driver = &ps8802_usb_mux_driver,
- .board_set = &board_ps8802_mux_set,
-};
-const struct usb_mux usbc1_ps8818 = {
- .usb_port = USBC_PORT_C1,
- .i2c_port = I2C_PORT_TCPC1,
- .i2c_addr_flags = PS8818_I2C_ADDR_FLAGS,
- .driver = &ps8818_usb_retimer_driver,
- .board_set = &board_ps8818_mux_set,
-};
-struct usb_mux usbc1_amd_fp5_usb_mux = {
- .usb_port = USBC_PORT_C1,
- .i2c_port = I2C_PORT_USB_AP_MUX,
- .i2c_addr_flags = AMD_FP5_MUX_I2C_ADDR_FLAGS,
- .driver = &amd_fp5_usb_mux_driver,
-};
-
-/*
- * USB-C1 HPD may go through an IO expander, so we must use a custom HPD GPIO
- * control function with CONFIG_USB_PD_DP_HPD_GPIO_CUSTOM.
- *
- * TODO(b/165622386) revert to non-custom GPIO control when HPD is no longer on
- * the IO expander in any variants.
- */
-void svdm_set_hpd_gpio(int port, int en)
-{
- gpio_or_ioex_set_level(PORT_TO_HPD(port), en);
-}
-
-int svdm_get_hpd_gpio(int port)
-{
- int out;
-
- if (gpio_or_ioex_get_level(PORT_TO_HPD(port), &out) != EC_SUCCESS) {
- ccprints("Failed to read current HPD for port C%d", port);
- return 0;
- }
- return out;
-}