summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeff Chase <jnchase@google.com>2019-11-06 15:09:15 -0500
committerCommit Bot <commit-bot@chromium.org>2019-11-13 21:12:49 +0000
commitf5633029509350cf7254ab14c440d14e8e73f729 (patch)
treed62e9092d896b0b607364a3ca2cbab324e465ee9
parent65b5a9994d7759263d540d5781038e019f964d27 (diff)
downloadchrome-ec-f5633029509350cf7254ab14c440d14e8e73f729.tar.gz
Endeavour: update GPIO and port maps, remove PD
- Update the GPIO and USB/I2C port lists following the Endeavour schematic - Endeavour does not use a software-controlled TCPC so remove USB PD - Remove LED panel - Remove CEC - Add OEM_ID BUG=b:143780700 TEST=emerge-endeavour chromeos/ec Change-Id: Idb554a4f87369ea1c42de0a1532ce11d28e4da56 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1902407 Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org> Commit-Queue: Jeff Chase <jnchase@google.com> Tested-by: Jeff Chase <jnchase@google.com>
-rw-r--r--board/endeavour/board.c161
-rw-r--r--board/endeavour/board.h47
-rw-r--r--board/endeavour/build.mk1
-rw-r--r--board/endeavour/ec.tasklist6
-rw-r--r--board/endeavour/gpio.inc75
-rw-r--r--board/endeavour/usb_pd_policy.c320
6 files changed, 38 insertions, 572 deletions
diff --git a/board/endeavour/board.c b/board/endeavour/board.c
index 5a28a926e8..2a58c4bc89 100644
--- a/board/endeavour/board.c
+++ b/board/endeavour/board.c
@@ -16,12 +16,8 @@
#include "cros_board_info.h"
#include "driver/pmic_tps650x30.h"
#include "driver/temp_sensor/tmp432.h"
-#include "driver/tcpm/ps8xxx.h"
-#include "driver/tcpm/tcpci.h"
-#include "driver/tcpm/tcpm.h"
#include "espi.h"
#include "extpower.h"
-#include "espi.h"
#include "fan.h"
#include "fan_chip.h"
#include "gpio.h"
@@ -29,7 +25,6 @@
#include "host_command.h"
#include "i2c.h"
#include "math_util.h"
-#include "oz554.h"
#include "pi3usb9281.h"
#include "power.h"
#include "power_button.h"
@@ -42,10 +37,6 @@
#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"
#define CPRINTS(format, args...) cprints(CC_USBCHARGE, format, ## args)
@@ -55,39 +46,6 @@ static uint8_t board_version;
static uint32_t oem;
static uint32_t sku;
-enum bj_adapter {
- BJ_90W_19V,
- BJ_135W_19V,
-};
-
-/*
- * Bit masks to map SKU ID to BJ adapter wattage. 1:135W 0:90W
- * KBL-R i7 8550U 4 135
- * KBL-R i5 8250U 5 135
- * KBL-R i3 8130U 6 135
- * KBL-U i7 7600 3 135
- * KBL-U i5 7500 2 135
- * KBL-U i3 7100 1 90
- * KBL-U Celeron 3965 7 90
- * KBL-U Celeron 3865 0 90
- */
-#define BJ_ADAPTER_135W_MASK (1 << 4 | 1 << 5 | 1 << 6 | 1 << 3 | 1 << 2)
-
-static void tcpc_alert_event(enum gpio_signal signal)
-{
- if (!gpio_get_level(GPIO_USB_C0_PD_RST_ODL))
- return;
-#ifdef HAS_TASK_PDCMD
- /* Exchange status with TCPCs */
- host_command_pd_send_status(PD_CHARGE_NO_CHANGE);
-#endif
-}
-
-void vbus0_evt(enum gpio_signal signal)
-{
- task_wake(TASK_ID_PD_C0);
-}
-
#include "gpio_list.h"
/* Hibernate wake configuration */
@@ -128,94 +86,20 @@ const struct mft_t mft_channels[] = {
BUILD_ASSERT(ARRAY_SIZE(mft_channels) == MFT_CH_COUNT);
const struct i2c_port_t i2c_ports[] = {
- {"tcpc", I2C_PORT_TCPC0, 400, GPIO_I2C0_0_SCL, GPIO_I2C0_0_SDA},
+ {"poe", I2C_PORT_POE, 400, GPIO_I2C0_0_SCL, GPIO_I2C0_0_SDA},
{"eeprom", I2C_PORT_EEPROM, 400, GPIO_I2C0_1_SCL, GPIO_I2C0_1_SDA},
- {"backlight", I2C_PORT_BACKLIGHT, 100, GPIO_I2C1_SCL, GPIO_I2C1_SDA},
{"pmic", I2C_PORT_PMIC, 400, GPIO_I2C2_SCL, GPIO_I2C2_SDA},
{"thermal", I2C_PORT_THERMAL, 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] = {
- /* Alert is active-low, push-pull */
- {
- .bus_type = EC_BUS_TYPE_I2C,
- .i2c_info = {
- .port = I2C_PORT_TCPC0,
- .addr_flags = I2C_ADDR_TCPC0_FLAGS,
- },
- .drv = &ps8xxx_tcpm_drv,
- },
-};
-
-static int ps8751_tune_mux(int port)
-{
- /* 0x98 sets lower EQ of DP port (4.5db) */
- mux_write(port, PS8XXX_REG_MUX_DP_EQ_CONFIGURATION, 0x98);
- return EC_SUCCESS;
-}
-
-struct usb_mux usb_muxes[CONFIG_USB_PD_PORT_MAX_COUNT] = {
- {
- .driver = &tcpci_tcpm_usb_mux_driver,
- .hpd_update = &ps8xxx_tcpc_update_hpd_status,
- .board_init = &ps8751_tune_mux,
- }
-};
-
const int usb_port_enable[USB_PORT_COUNT] = {
- GPIO_USB1_ENABLE,
- GPIO_USB2_ENABLE,
- GPIO_USB3_ENABLE,
- GPIO_USB4_ENABLE,
+ GPIO_USB_C0_5V_EN,
+ GPIO_USB_FP0_5V_EN,
+ GPIO_USB_FP1_5V_EN,
+ GPIO_USB_FP3_5V_EN,
};
-void board_reset_pd_mcu(void)
-{
- gpio_set_level(GPIO_USB_C0_PD_RST_ODL, 0);
- msleep(1);
- gpio_set_level(GPIO_USB_C0_PD_RST_ODL, 1);
-}
-
-void board_tcpc_init(void)
-{
- int port, reg;
-
- /* This needs to be executed only once per boot. It could be run by RO
- * if we boot in recovery mode. It could be run by RW if we boot in
- * normal or dev mode. Note EFS makes RO jump to RW before HOOK_INIT. */
- board_reset_pd_mcu();
-
- /*
- * Wake up PS8751. 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(I2C_PORT_TCPC0, I2C_ADDR_TCPC0_FLAGS, 0xA0, &reg);
-
- /* Enable TCPC interrupts */
- gpio_enable_interrupt(GPIO_USB_C0_PD_INT_ODL);
-
- /*
- * Initialize HPD to low; after sysjump SOC needs to see
- * HPD pulse to enable video path
- */
- for (port = 0; port < CONFIG_USB_PD_PORT_MAX_COUNT; port++) {
- const struct usb_mux *mux = &usb_muxes[port];
- mux->hpd_update(port, 0, 0);
- }
-}
-DECLARE_HOOK(HOOK_INIT, board_tcpc_init, HOOK_PRIO_INIT_I2C+1);
-
-uint16_t tcpc_get_alert_status(void)
-{
- if (!gpio_get_level(GPIO_USB_C0_PD_INT_ODL) &&
- gpio_get_level(GPIO_USB_C0_PD_RST_ODL))
- return PD_STATUS_TCPC_ALERT_0;
- return 0;
-}
-
/*
* TMP431 has one local and one remote sensor.
*
@@ -462,20 +346,9 @@ static void cbi_init(void)
}
DECLARE_HOOK(HOOK_INIT, cbi_init, HOOK_PRIO_INIT_I2C + 1);
-static void setup_bj(void)
-{
- enum bj_adapter bj = (BJ_ADAPTER_135W_MASK & (1 << sku)) ?
- BJ_135W_19V : BJ_90W_19V;
- gpio_set_level(GPIO_U22_90W, bj == BJ_90W_19V);
-}
-
static void board_init(void)
{
- setup_bj();
-
board_extpower();
-
- gpio_enable_interrupt(GPIO_USB_C0_VBUS_WAKE_L);
}
DECLARE_HOOK(HOOK_INIT, board_init, HOOK_PRIO_DEFAULT);
@@ -519,27 +392,3 @@ int fan_percent_to_rpm(int fan, int pct)
return fan_table[current_level].rpm;
}
-
-__override void oz554_board_init(void)
-{
- int pin_status = 0;
-
- pin_status |= gpio_get_level(GPIO_PANEL_ID_0) << 0;
- pin_status |= gpio_get_level(GPIO_PANEL_ID_1) << 1;
- pin_status |= gpio_get_level(GPIO_PANEL_ID_2) << 2;
-
- switch (pin_status) {
- case 0x04:
- CPRINTS("PANEL_LM_SSE2");
- break;
- case 0x05:
- CPRINTS("PANEL_LM_SSK1");
- /* Reigster 0x02: Setting LED current: 55(mA) */
- if (oz554_set_config(2, 0x55))
- CPRINTS("oz554 config failed");
- break;
- default:
- CPRINTS("PANEL_UNKNOWN");
- break;
- }
-}
diff --git a/board/endeavour/board.h b/board/endeavour/board.h
index c9c54d3838..bbfbf05c4d 100644
--- a/board/endeavour/board.h
+++ b/board/endeavour/board.h
@@ -20,7 +20,6 @@
#define CONFIG_BOARD_VERSION_CBI
#define CONFIG_BOARD_HAS_RTC_RESET
#define CONFIG_CRC8
-#define CONFIG_CEC
#define CONFIG_CROS_BOARD_INFO
#define CONFIG_DEDICATED_RECOVERY_BUTTON
#define CONFIG_EMULATED_SYSRQ
@@ -45,10 +44,6 @@
(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
-#define CEC_GPIO_OUT GPIO_CEC_OUT
-#define CEC_GPIO_IN GPIO_CEC_IN
-#define CEC_GPIO_PULL_UP GPIO_CEC_PULL_UP
#define CONFIG_FANS 1
#define CONFIG_FAN_RPM_CUSTOM
#define CONFIG_THROTTLE_AP
@@ -69,7 +64,6 @@
#define CONFIG_HOSTCMD_ESPI_VW_SLP_S3
#define CONFIG_HOSTCMD_ESPI_VW_SLP_S4
-#define CONFIG_CMD_PD_CONTROL
#define CONFIG_EXTPOWER_GPIO
#undef CONFIG_EXTPOWER_DEBOUNCE_MS
#define CONFIG_EXTPOWER_DEBOUNCE_MS 1000
@@ -84,21 +78,6 @@
#define CONFIG_TEMP_SENSOR
#define CONFIG_TEMP_SENSOR_TMP432
-/* USB */
-#define CONFIG_USB_PD_ALT_MODE
-#define CONFIG_USB_PD_ALT_MODE_DFP
-#define CONFIG_USB_PD_DISCHARGE_TCPC
-#define CONFIG_USB_PD_LOGGING
-#define CONFIG_USB_PD_PORT_MAX_COUNT 1
-#define CONFIG_USB_PD_VBUS_DETECT_GPIO
-#define CONFIG_USB_PD_TCPM_MUX
-#define CONFIG_USB_PD_TCPM_TCPCI
-#define CONFIG_USB_PD_TCPM_PS8751
-#define CONFIG_USB_POWER_DELIVERY
-#define CONFIG_USBC_SS_MUX
-#define CONFIG_USBC_SS_MUX_DFP_ONLY
-#define CONFIG_USBC_VCONN
-
/* USB-A config */
#define CONFIG_USB_PORT_POWER_DUMB
#define USB_PORT_COUNT 4
@@ -109,28 +88,20 @@
#define NPCX_TACH_SEL2 1 /* 0:GPIO40/73 1:GPIO93/A6 as TACH */
/* I2C ports */
-#define I2C_PORT_TCPC0 NPCX_I2C_PORT0_0
+#define I2C_PORT_POE NPCX_I2C_PORT0_0
#define I2C_PORT_EEPROM NPCX_I2C_PORT0_1
-#define I2C_PORT_BACKLIGHT NPCX_I2C_PORT1
#define I2C_PORT_PMIC NPCX_I2C_PORT2
#define I2C_PORT_THERMAL NPCX_I2C_PORT3
/* I2C addresses */
-#define I2C_ADDR_TCPC0_FLAGS 0x0b
#define I2C_ADDR_EEPROM_FLAGS 0x50
/* Verify and jump to RW image on boot */
-#define CONFIG_VBOOT_EFS
#define CONFIG_VBOOT_HASH
#define CONFIG_VSTORE
#define CONFIG_VSTORE_SLOT_COUNT 1
/*
- * LED backlight controller
- */
-#define CONFIG_LED_DRIVER_OZ554
-
-/*
* Flash layout. Since config_flash_layout.h is included before board.h,
* we can only overwrite (=undef/define) these parameters here.
*
@@ -171,7 +142,6 @@
#include "registers.h"
enum charge_port {
- CHARGE_PORT_TYPEC0,
CHARGE_PORT_BARRELJACK,
};
@@ -207,25 +177,12 @@ enum mft_channel {
};
enum OEM_ID {
- OEM_KARMA = 7,
+ OEM_ENDEAVOUR = 9,
/* Number of OEM IDs */
OEM_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 PD_VCONN_SWAP_DELAY 5000 /* us */
-
/* Board specific handlers */
-void board_reset_pd_mcu(void);
-void board_set_tcpc_power_mode(int port, int mode);
void led_alert(int enable);
void led_critical(void);
diff --git a/board/endeavour/build.mk b/board/endeavour/build.mk
index 69256da8a0..b5915c43a8 100644
--- a/board/endeavour/build.mk
+++ b/board/endeavour/build.mk
@@ -10,5 +10,4 @@ CHIP:=npcx
CHIP_VARIANT:=npcx5m6g
board-y=board.o
-board-$(CONFIG_USB_POWER_DELIVERY)+=usb_pd_policy.o
board-y+=led.o
diff --git a/board/endeavour/ec.tasklist b/board/endeavour/ec.tasklist
index 6a1fae952c..ef58c6267a 100644
--- a/board/endeavour/ec.tasklist
+++ b/board/endeavour/ec.tasklist
@@ -11,10 +11,6 @@
TASK_ALWAYS(HOOKS, hook_task, NULL, 2048) \
/* Larger stack for RW verification (i.e. sha256, rsa) */ \
TASK_NOTEST(CHIPSET, chipset_task, NULL, TASK_STACK_SIZE) \
- TASK_NOTEST(PDCMD, pd_command_task, NULL, TASK_STACK_SIZE) \
TASK_ALWAYS(HOSTCMD, host_command_task, NULL, 2048) \
TASK_ALWAYS(CONSOLE, console_task, NULL, LARGER_TASK_STACK_SIZE) \
- TASK_ALWAYS(POWERBTN, power_button_task, NULL, LARGER_TASK_STACK_SIZE) \
- TASK_ALWAYS(PD_C0, pd_task, NULL, LARGER_TASK_STACK_SIZE) \
- TASK_ALWAYS(PD_INT_C0, pd_interrupt_handler_task, 0, TASK_STACK_SIZE) \
- TASK_ALWAYS(CEC, cec_task, NULL, TASK_STACK_SIZE)
+ TASK_ALWAYS(POWERBTN, power_button_task, NULL, LARGER_TASK_STACK_SIZE)
diff --git a/board/endeavour/gpio.inc b/board/endeavour/gpio.inc
index 6d959705b1..fb09aa03ed 100644
--- a/board/endeavour/gpio.inc
+++ b/board/endeavour/gpio.inc
@@ -8,18 +8,24 @@
/* 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 | GPIO_PULL_UP, tcpc_alert_event)
GPIO_INT(AC_PRESENT, PIN(C, 1), GPIO_INT_BOTH, extpower_interrupt)
GPIO_INT(POWER_BUTTON_L, PIN(0, 4), GPIO_INT_BOTH | GPIO_PULL_UP, power_button_interrupt) /* MECH_PWR_BTN_ODL */
-GPIO_INT(PANEL_BACKLIGHT_EN, PIN(4, 4), GPIO_INT_RISING, backlight_enable_interrupt)
GPIO_INT(PCH_SLP_S0_L, PIN(7, 5), GPIO_INT_BOTH, power_signal_interrupt)
+GPIO_INT(PCH_SLP_S3_L, PIN(7, 3), GPIO_INT_BOTH, power_signal_interrupt)
+GPIO_INT(PCH_SLP_S4_L, PIN(8, 6), GPIO_INT_BOTH, power_signal_interrupt)
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(WP_L, PIN(9, 3), GPIO_INT_BOTH, switch_interrupt)
-GPIO_INT(USB_C0_VBUS_WAKE_L, PIN(9, 7), GPIO_INT_BOTH | GPIO_PULL_UP, vbus0_evt)
GPIO_INT(RECOVERY_L, PIN(8, 2), GPIO_INT_BOTH, button_interrupt) /* Recovery button */
+
+/* TODO(jnchase): configure as interrupt when code is ready / if needed*/
+GPIO(POE_LTC_PGOOD, PIN(C, 5), GPIO_INPUT) /* PoE power good */
+GPIO(PSE_PWM_INT, PIN(3, 7), GPIO_INPUT) /* PoE LTC interrupt */
+GPIO(V3P3A_I350_PG, PIN(4, 4), GPIO_INPUT) /* Disconnected */
+GPIO(USB_C0_VBUS_DET_L, PIN(9, 7), GPIO_INPUT) /* USB-C VBUS */
+
GPIO(PCH_RTCRST, PIN(E, 7), GPIO_OUT_LOW) /* RTCRST# to SOC */
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 */
@@ -35,28 +41,19 @@ GPIO(CCD_MODE_ODL, PIN(6, 3), GPIO_INPUT) /* Case Closed Debug Mode */
GPIO(EC_HAVEN_RESET_ODL, PIN(0, 2), GPIO_ODR_HIGH) /* H1 Reset */
GPIO(ENTERING_RW, PIN(7, 6), GPIO_OUTPUT) /* EC Entering RW */
GPIO(PMIC_INT_L, PIN(6, 0), GPIO_INPUT) /* PMIC interrupt */
-GPIO(U22_90W, PIN(3, 4), GPIO_OUTPUT | GPIO_PULL_DOWN)
+
GPIO(POWER_RATE, PIN(7, 1), GPIO_INPUT) /* High: i3/5/7. Low: Celeron */
GPIO(PP3300_USB_PD_EN, PIN(6, 7), GPIO_OUT_HIGH) /* Initialize PP3300_USB_PD_EN as output high */
GPIO(LAN_PWR_EN, PIN(8, 3), GPIO_OUT_HIGH) /* Ethernet power enabled */
-GPIO(PP5000_DX_NFC, PIN(1, 5), GPIO_OUTPUT)
-
-GPIO(PP3300_DX_CAM, PIN(1, 0), GPIO_OUT_HIGH)
-GPIO(CAM_PMIC_RST_L, PIN(0, 7), GPIO_INPUT)
-
-GPIO(WLAN_PE_RST, PIN(1, 2), GPIO_OUTPUT)
-GPIO(PP3300_DX_LTE, PIN(0, 5), GPIO_OUT_LOW)
-GPIO(PP3300_DX_BASE, PIN(1, 1), GPIO_OUT_LOW)
-
/* I2C pins - these will be reconfigured for alternate function below */
-GPIO(I2C0_0_SCL, PIN(B, 5), GPIO_INPUT) /* EC_I2C_USB_C0_PD_SCL */
-GPIO(I2C0_0_SDA, PIN(B, 4), GPIO_INPUT) /* EC_I2C_USB_C0_PD_SDA */
+GPIO(I2C0_0_SCL, PIN(B, 5), GPIO_INPUT) /* EC_I2C_LTC_SCL */
+GPIO(I2C0_0_SDA, PIN(B, 4), GPIO_INPUT) /* EC_I2C_LTC_SDA */
GPIO(I2C0_1_SCL, PIN(B, 3), GPIO_INPUT) /* EC_I2C_EEPROM_SCL */
GPIO(I2C0_1_SDA, PIN(B, 2), GPIO_INPUT) /* EC_I2C_EEPROM_SDA */
-GPIO(I2C1_SCL, PIN(9, 0), GPIO_INPUT) /* EC_I2C_BAT_SCL */
-GPIO(I2C1_SDA, PIN(8, 7), GPIO_INPUT) /* EC_I2C_BAT_SDA */
+GPIO(I2C1_SCL, PIN(9, 0), GPIO_INPUT) /* TP184 */
+GPIO(I2C1_SDA, PIN(8, 7), GPIO_INPUT) /* TP185 */
GPIO(I2C2_SCL, PIN(9, 2), GPIO_INPUT) /* EC_ROP_I2C_CLK */
GPIO(I2C2_SDA, PIN(9, 1), GPIO_INPUT) /* EC_ROP_I2C_SDA */
GPIO(I2C3_SCL, PIN(D, 1), GPIO_INPUT) /* EC_THEM_CLK */
@@ -65,43 +62,31 @@ GPIO(I2C3_SDA, PIN(D, 0), GPIO_INPUT) /* EC_THEM_SDA */
/* 5V enables: INPUT=1.5A, OUT_LOW=OFF, OUT_HIGH=3A */
GPIO(USB_C0_5V_EN, PIN(4, 2), GPIO_OUT_LOW | GPIO_PULL_UP) /* C0 5V Enable */
GPIO(USB_C0_VBUS_ILIM, PIN(3, 5), GPIO_OUT_HIGH)
+GPIO(FAN_PWR_EN, PIN(9, 5), GPIO_OUT_HIGH) /* Fan power */
+GPIO(PI3_BC12_DET_L, PIN(D, 3), GPIO_INPUT) /* USB-C */
+GPIO(USB_FP3_CHARGE_EN_L, PIN(C, 6), GPIO_OUT_LOW) /* USB-C */
+GPIO(USB_FP0_5V_EN, PIN(0, 0), GPIO_OUT_LOW) /* Front port 1 */
+GPIO(USB_FP1_5V_EN, PIN(B, 1), GPIO_OUT_LOW) /* Front port 2 */
+GPIO(USB_FP3_5V_EN, PIN(A, 1), GPIO_OUT_LOW) /* Front port 3 */
+GPIO(USB_FP_CHARGE_EN_L, PIN(A, 5), GPIO_OUT_LOW) /* USB-A */
+GPIO(PP3300_TPU_EN, PIN(0, 1), GPIO_OUT_HIGH) /* TPU 3.3V enable */
+
+/* Not connected */
+GPIO(USB_C0_CHARGE_L, PIN(C, 0), GPIO_OUT_LOW) /* C0 Charge enable */
+GPIO(AC_JACK_CHARGE_L, PIN(C, 3), GPIO_OUT_LOW) /* AC jack charge enable */
GPIO(USB_C0_PD_RST_ODL, PIN(0, 3), GPIO_OUT_LOW) /* C0 PD Reset */
GPIO(USB_C0_DP_HPD, PIN(9, 4), GPIO_INPUT) /* C0 DP Hotplug Detect */
GPIO(USB_C0_TCPC_PWR, PIN(8, 4), GPIO_OUT_LOW) /* Enable C0 TCPC Power */
-GPIO(FAN_PWR_EN, PIN(9, 5), GPIO_OUT_HIGH) /* Fan power */
-GPIO(USB1_ENABLE, PIN(3, 2), GPIO_OUT_LOW) /* Rear port, bottom */
-GPIO(USB2_ENABLE, PIN(C, 6), GPIO_OUT_LOW) /* Rear port, top */
-GPIO(USB3_ENABLE, PIN(A, 1), GPIO_OUT_LOW) /* Rear port, single */
-GPIO(USB4_ENABLE, PIN(0, 0), GPIO_OUT_LOW) /* Front port 1 */
-GPIO(USB_A_CHARGE_EN_L, PIN(A, 5), GPIO_OUT_LOW)
-
-GPIO(CEC_OUT, PIN(3, 6), GPIO_OUT_HIGH | GPIO_OPEN_DRAIN)
-GPIO(CEC_IN, PIN(4, 0), GPIO_INPUT)
-GPIO(CEC_PULL_UP, PIN(D, 3), GPIO_OUT_HIGH)
-GPIO(EC_EDID_WRITE_EN_L, PIN(C, 3), GPIO_OUT_HIGH) /* LOW to write EDID */
-
-/* Speaker */
-GPIO(SPKR5, PIN(C, 2), GPIO_INPUT) /* No function */
-
-GPIO(PANEL_ID_0, PIN(C, 5), GPIO_INPUT)
-GPIO(PANEL_ID_1, PIN(0, 1), GPIO_INPUT)
-GPIO(PANEL_ID_2, PIN(B, 1), GPIO_INPUT)
-
-/* Test points */
-GPIO(TP121, PIN(3, 3), GPIO_INPUT)
-GPIO(TP127, PIN(6, 6), GPIO_INPUT)
-GPIO(TP128, PIN(C, 4), GPIO_INPUT)
-GPIO(TP248, PIN(5, 7), GPIO_INPUT)
+GPIO(TYPE_C_60W, PIN(3, 3), GPIO_OUTPUT | GPIO_PULL_DOWN)
+GPIO(TYPE_C_65W, PIN(3, 4), GPIO_OUTPUT | GPIO_PULL_DOWN)
/* 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(A, 0x40), 1, MODULE_PWM, 0) /* GPIOA6 */ /* TACH2 */
-ALTERNATE(PIN_MASK(B, 0x30), 1, MODULE_I2C, 0) /* GPIOB4-B5 */ /* EC_I2C0_0_USBC_3V3_SDA/SCL */
+ALTERNATE(PIN_MASK(B, 0x30), 1, MODULE_I2C, 0) /* GPIOB4-B5 */ /* EC_I2C0_0_LTC_SDA/SCL */
ALTERNATE(PIN_MASK(B, 0x40), 1, MODULE_PWM, 0) /* GPIOB6 */ /* EC_FAN_PWM */
-ALTERNATE(PIN_MASK(B, 0x0C), 1, MODULE_I2C, 0) /* GPOPB2-B3 */ /* EC_I2C0_1_3V3_SDA/SCL */
+ALTERNATE(PIN_MASK(B, 0x0C), 1, MODULE_I2C, 0) /* GPOPB2-B3 */ /* EC_I2C0_1_EEPROM_SDA/SCL */
ALTERNATE(PIN_MASK(D, 0x03), 1, MODULE_I2C, 0) /* GPIOD0-D1 */ /* EC_I2C3_SENSOR_1V8_SDA/SCL */
/* Alternate functions for LED PWM */
ALTERNATE(PIN_MASK(8, 0x01), 1, MODULE_PWM, 0) /* GPIO80 PWM3 Red*/
diff --git a/board/endeavour/usb_pd_policy.c b/board/endeavour/usb_pd_policy.c
deleted file mode 100644
index 2090184604..0000000000
--- a/board/endeavour/usb_pd_policy.c
+++ /dev/null
@@ -1,320 +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.
- */
-
-#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)
-
-#define PDO_FIXED_FLAGS (PDO_FIXED_EXTERNAL | \
- PDO_FIXED_DATA_SWAP | \
- PDO_FIXED_COMM_CAP)
-
-const uint32_t pd_src_pdo[] = {
- PDO_FIXED(5000, 3000, PDO_FIXED_FLAGS),
-};
-const int pd_src_pdo_cnt = ARRAY_SIZE(pd_src_pdo);
-
-void pd_transition_voltage(int idx)
-{
- /* No-operation: we are always 5V */
-}
-
-int board_vbus_source_enabled(int port)
-{
- if (port != 0)
- return 0;
- return gpio_get_level(GPIO_USB_C0_5V_EN);
-}
-
-int pd_set_power_supply_ready(int port)
-{
- /* Enable VBUS source */
- gpio_set_level(GPIO_USB_C0_5V_EN, 1);
-
- /* notify host of power info change */
- pd_send_host_event(PD_EVENT_POWER_CHANGE);
-
- return EC_SUCCESS; /* we are ready */
-}
-
-void pd_power_supply_reset(int port)
-{
- /* Disable VBUS source */
- gpio_set_level(GPIO_USB_C0_5V_EN, 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(GPIO_USB_C0_VBUS_WAKE_L);
-}
-
-int pd_board_checks(void)
-{
- return EC_SUCCESS;
-}
-
-int pd_check_data_swap(int port, int data_role)
-{
- /* Allow data swap if we are a UFP, otherwise don't allow */
- return (data_role == PD_ROLE_UFP) ? 1 : 0;
-}
-
-void pd_execute_data_swap(int port, int data_role)
-{
-}
-
-void pd_check_pr_role(int port, int pr_role, int flags)
-{
-}
-
-void pd_check_dr_role(int port, int dr_role, int flags)
-{
- /* If UFP, try to switch to DFP */
- if ((flags & PD_FLAGS_PARTNER_DR_DATA) && dr_role == PD_ROLE_UFP)
- pd_request_data_swap(port);
-}
-
-/* ----------------- Vendor Defined Messages ------------------ */
-const struct svdm_response svdm_rsp = {
- .identity = NULL,
- .svids = NULL,
- .modes = NULL,
-};
-
-int pd_custom_vdm(int port, int cnt, uint32_t *payload,
- uint32_t **rpayload)
-{
- int cmd = PD_VDO_CMD(payload[0]);
- uint16_t dev_id = 0;
- int is_rw, is_latest;
-
- /* make sure we have some payload */
- if (cnt == 0)
- return 0;
-
- switch (cmd) {
- case VDO_CMD_VERSION:
- /* guarantee last byte of payload is null character */
- *(payload + cnt - 1) = 0;
- CPRINTF("version: %s\n", (char *)(payload+1));
- break;
- case VDO_CMD_READ_INFO:
- case VDO_CMD_SEND_INFO:
- /* copy hash */
- if (cnt == 7) {
- dev_id = VDO_INFO_HW_DEV_ID(payload[6]);
- is_rw = VDO_INFO_IS_RW(payload[6]);
-
- is_latest = pd_dev_store_rw_hash(port,
- dev_id,
- payload + 1,
- is_rw ?
- SYSTEM_IMAGE_RW :
- SYSTEM_IMAGE_RO);
- /*
- * Send update host event unless our RW hash is
- * already known to be the latest update RW.
- */
- if (!is_rw || !is_latest)
- pd_send_host_event(PD_EVENT_UPDATE_DEVICE);
-
- CPRINTF("DevId:%d.%d SW:%d RW:%d\n",
- HW_DEV_ID_MAJ(dev_id),
- HW_DEV_ID_MIN(dev_id),
- VDO_INFO_SW_DBG_VER(payload[6]),
- is_rw);
- } else if (cnt == 6) {
- /* really old devices don't have last byte */
- pd_dev_store_rw_hash(port, dev_id, payload + 1,
- SYSTEM_IMAGE_UNKNOWN);
- }
- break;
- case VDO_CMD_CURRENT:
- CPRINTF("Current: %dmA\n", payload[1]);
- break;
- case VDO_CMD_FLIP:
- usb_mux_flip(port);
- break;
-#ifdef CONFIG_USB_PD_LOGGING
- case VDO_CMD_GET_LOG:
- pd_log_recv_vdm(port, cnt, payload);
- break;
-#endif /* CONFIG_USB_PD_LOGGING */
- }
-
- return 0;
-}
-
-static int dp_flags[CONFIG_USB_PD_PORT_MAX_COUNT];
-static uint32_t dp_status[CONFIG_USB_PD_PORT_MAX_COUNT];
-
-static void svdm_safe_dp_mode(int port)
-{
- /* make DP interface safe until configure */
- dp_flags[port] = 0;
- dp_status[port] = 0;
- usb_mux_set(port, TYPEC_MUX_NONE,
- USB_SWITCH_CONNECT, pd_get_polarity(port));
-}
-
-static int svdm_enter_dp_mode(int port, uint32_t mode_caps)
-{
- /* Only enter mode if device is DFP_D capable */
- if (mode_caps & MODE_DP_SNK) {
- pd_log_event(PD_EVENT_VIDEO_DP_MODE,
- PD_LOG_PORT_SIZE(port, 0), 1, NULL);
- svdm_safe_dp_mode(port);
- return 0;
- }
-
- return -1;
-}
-
-static int svdm_dp_status(int port, uint32_t *payload)
-{
- int opos = pd_alt_mode(port, USB_SID_DISPLAYPORT);
-
- payload[0] = VDO(USB_SID_DISPLAYPORT, 1,
- CMD_DP_STATUS | VDO_OPOS(opos));
- payload[1] = VDO_DP_STATUS(0, /* HPD IRQ ... not applicable */
- 0, /* HPD level ... not applicable */
- 0, /* exit DP? ... no */
- 0, /* usb mode? ... no */
- 0, /* multi-function ... no */
- (!!(dp_flags[port] & DP_FLAGS_DP_ON)),
- 0, /* power low? ... no */
- (!!(dp_flags[port] & DP_FLAGS_DP_ON)));
- return 2;
-};
-
-static int svdm_dp_config(int port, uint32_t *payload)
-{
- int opos = pd_alt_mode(port, USB_SID_DISPLAYPORT);
- int mf_pref = PD_VDO_DPSTS_MF_PREF(dp_status[port]);
- int pin_mode = pd_dfp_dp_get_pin_mode(port, dp_status[port]);
-
- if (!pin_mode)
- return 0;
-
- usb_mux_set(port, mf_pref ? TYPEC_MUX_DOCK : TYPEC_MUX_DP,
- USB_SWITCH_CONNECT, pd_get_polarity(port));
-
- payload[0] = VDO(USB_SID_DISPLAYPORT, 1,
- CMD_DP_CONFIG | VDO_OPOS(opos));
- payload[1] = VDO_DP_CFG(pin_mode, /* pin mode */
- 1, /* DPv1.3 signaling */
- 2); /* UFP connected */
- return 2;
-};
-
-static void svdm_dp_post_config(int port)
-{
- const struct usb_mux *mux = &usb_muxes[port];
-
- dp_flags[port] |= DP_FLAGS_DP_ON;
- if (!(dp_flags[port] & DP_FLAGS_HPD_HI_PENDING))
- return;
- mux->hpd_update(port, 1, 0);
-}
-
-static int svdm_dp_attention(int port, uint32_t *payload)
-{
- int lvl = PD_VDO_DPSTS_HPD_LVL(payload[1]);
- int irq = PD_VDO_DPSTS_HPD_IRQ(payload[1]);
- const struct usb_mux *mux = &usb_muxes[port];
-
- dp_status[port] = payload[1];
- if (!(dp_flags[port] & DP_FLAGS_DP_ON)) {
- if (lvl)
- dp_flags[port] |= DP_FLAGS_HPD_HI_PENDING;
- return 1;
- }
- mux->hpd_update(port, lvl, irq);
-
- /* ack */
- return 1;
-}
-
-static void svdm_exit_dp_mode(int port)
-{
- const struct usb_mux *mux = &usb_muxes[port];
-
- pd_log_event(PD_EVENT_VIDEO_DP_MODE,
- PD_LOG_PORT_SIZE(port, 0), 0, NULL);
- svdm_safe_dp_mode(port);
- mux->hpd_update(port, 0, 0);
-}
-
-static int svdm_enter_gfu_mode(int port, uint32_t mode_caps)
-{
- /* Always enter GFU mode */
- return 0;
-}
-
-static void svdm_exit_gfu_mode(int port)
-{
-}
-
-static int svdm_gfu_status(int port, uint32_t *payload)
-{
- /*
- * This is called after enter mode is successful, send unstructured
- * VDM to read info.
- */
- pd_send_vdm(port, USB_VID_GOOGLE, VDO_CMD_READ_INFO, NULL, 0);
- return 0;
-}
-
-static int svdm_gfu_config(int port, uint32_t *payload)
-{
- return 0;
-}
-
-static int svdm_gfu_attention(int port, uint32_t *payload)
-{
- return 0;
-}
-
-const struct svdm_amode_fx supported_modes[] = {
- {
- .svid = USB_SID_DISPLAYPORT,
- .enter = &svdm_enter_dp_mode,
- .status = &svdm_dp_status,
- .config = &svdm_dp_config,
- .post_config = &svdm_dp_post_config,
- .attention = &svdm_dp_attention,
- .exit = &svdm_exit_dp_mode,
- },
- {
- .svid = USB_VID_GOOGLE,
- .enter = &svdm_enter_gfu_mode,
- .status = &svdm_gfu_status,
- .config = &svdm_gfu_config,
- .attention = &svdm_gfu_attention,
- .exit = &svdm_exit_gfu_mode,
- }
-};
-const int supported_modes_cnt = ARRAY_SIZE(supported_modes);