diff options
author | Ben Chen <ben.chen2@quanta.corp-partner.google.com> | 2021-05-27 14:04:35 +0800 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2021-06-02 04:04:46 +0000 |
commit | 1d25e5e69e83cb9420594ca1f953f07553106367 (patch) | |
tree | 8e858421aa9df2c79add0cc38817e51071f7f846 | |
parent | 5cc1eceb3c326b0cb931e77f8b9b6fb0263511ba (diff) | |
download | chrome-ec-1d25e5e69e83cb9420594ca1f953f07553106367.tar.gz |
volet: remmove bb control, change tcpc config
remove bb config, and modify tcpc c0/c1 Rt1715/ps8751 driver
BUG=b:189402479
BRANCH=cros/main
TEST=make BOARD PASS, and power on test normal.
Change-Id: If55e07a0de457e1e2bdb4c55b523bfefce7c7794
Signed-off-by: Ben Chen <ben.chen2@quanta.corp-partner.google.com>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2921695
Reviewed-by: Keith Short <keithshort@chromium.org>
-rw-r--r-- | board/volet/board.c | 135 | ||||
-rw-r--r-- | board/volet/board.h | 14 | ||||
-rw-r--r-- | board/volet/gpio.inc | 10 |
3 files changed, 66 insertions, 93 deletions
diff --git a/board/volet/board.c b/board/volet/board.c index d366e25eca..5faf6e802b 100644 --- a/board/volet/board.c +++ b/board/volet/board.c @@ -4,7 +4,6 @@ */ /* Volteer board-specific configuration */ -#include "bb_retimer.h" #include "button.h" #include "common.h" #include "accelgyro.h" @@ -14,11 +13,10 @@ #include "driver/als_tcs3400.h" #include "driver/bc12/pi3usb9201.h" #include "driver/ppc/syv682x.h" -#include "driver/tcpm/tcpci.h" -#include "driver/tcpm/tusb422.h" -#include "driver/tcpm/rt1715.h" -#include "driver/retimer/bb_retimer.h" #include "driver/sync.h" +#include "driver/tcpm/ps8xxx.h" +#include "driver/tcpm/rt1715.h" +#include "driver/tcpm/tcpci.h" #include "extpower.h" #include "fan.h" #include "fan_chip.h" @@ -220,20 +218,6 @@ const struct i2c_port_t i2c_ports[] = { .sda = GPIO_EC_I2C2_USB_C1_SDA, }, { - .name = "usb_0_mix", - .port = I2C_PORT_USB_0_MIX, - .kbps = 100, - .scl = GPIO_EC_I2C3_USB_1_MIX_SCL, - .sda = GPIO_EC_I2C3_USB_1_MIX_SDA, - }, - { - .name = "usb_1_mix", - .port = I2C_PORT_USB_1_MIX, - .kbps = 100, - .scl = GPIO_EC_I2C4_USB_1_MIX_SCL, - .sda = GPIO_EC_I2C4_USB_1_MIX_SDA, - }, - { .name = "power", .port = I2C_PORT_POWER, .kbps = 100, @@ -286,21 +270,34 @@ static void kb_backlight_disable(void) } DECLARE_HOOK(HOOK_CHIPSET_SUSPEND, kb_backlight_disable, HOOK_PRIO_DEFAULT); -/* Config TCPC dynamic by Board version */ -static void setup_board_tcpc(void) +static void ps8815_reset(void) { - uint8_t board_id = get_board_id(); - - if (board_id == 0) { - /* config typec C0 prot TUSB422 TCPC */ - tcpc_config[USBC_PORT_C0].i2c_info.addr_flags - = TUSB422_I2C_ADDR_FLAGS; - tcpc_config[USBC_PORT_C0].drv = &tusb422_tcpm_drv; - /* config typec C1 prot TUSB422 TCPC */ - tcpc_config[USBC_PORT_C1].i2c_info.addr_flags - = TUSB422_I2C_ADDR_FLAGS; - tcpc_config[USBC_PORT_C1].drv = &tusb422_tcpm_drv; - } + int val; + + gpio_set_level(GPIO_USB_C1_RT_RST_ODL, 0); + msleep(GENERIC_MAX(PS8XXX_RESET_DELAY_MS, + PS8815_PWR_H_RST_H_DELAY_MS)); + gpio_set_level(GPIO_USB_C1_RT_RST_ODL, 1); + msleep(PS8815_FW_INIT_DELAY_MS); + + /* + * b/144397088 + * ps8815 firmware 0x01 needs special configuration + */ + + CPRINTS("%s: patching ps8815 registers", __func__); + + if (i2c_read8(I2C_PORT_USB_C1, + PS8751_I2C_ADDR1_P2_FLAGS, 0x0f, &val) == EC_SUCCESS) + CPRINTS("ps8815: reg 0x0f was %02x", val); + + if (i2c_write8(I2C_PORT_USB_C1, + PS8751_I2C_ADDR1_P2_FLAGS, 0x0f, 0x31) == EC_SUCCESS) + CPRINTS("ps8815: reg 0x0f set to 0x31"); + + if (i2c_read8(I2C_PORT_USB_C1, + PS8751_I2C_ADDR1_P2_FLAGS, 0x0f, &val) == EC_SUCCESS) + CPRINTS("ps8815: reg 0x0f now %02x", val); } void board_reset_pd_mcu(void) @@ -309,6 +306,8 @@ void board_reset_pd_mcu(void) * Only the Burnside Bridge retimers provide a reset pin, but this is * already handled by the bb_retimer.c driver. */ + ps8815_reset(); + usb_mux_hpd_update(USBC_PORT_C1, 0, 0); } /******************************************************************************/ @@ -352,21 +351,9 @@ void ppc_interrupt(enum gpio_signal signal) } } -/* Disable FRS on boards with the SYV682A. FRS only works on the SYV682B. */ -void setup_board_ppc(void) -{ - uint8_t board_id = get_board_id(); - - if (board_id < 2) { - ppc_chips[USBC_PORT_C0].frs_en = 0; - ppc_chips[USBC_PORT_C1].frs_en = 0; - } -} - __override void board_cbi_init(void) { - setup_board_tcpc(); - setup_board_ppc(); + } /******************************************************************************/ @@ -385,7 +372,7 @@ BUILD_ASSERT(ARRAY_SIZE(pi3usb9201_bc12_chips) == USBC_PORT_COUNT); /******************************************************************************/ /* USBC TCPC configuration */ -struct tcpc_config_t tcpc_config[] = { +const struct tcpc_config_t tcpc_config[] = { [USBC_PORT_C0] = { .bus_type = EC_BUS_TYPE_I2C, .i2c_info = { @@ -398,57 +385,45 @@ struct tcpc_config_t tcpc_config[] = { .bus_type = EC_BUS_TYPE_I2C, .i2c_info = { .port = I2C_PORT_USB_C1, - .addr_flags = RT1715_I2C_ADDR_FLAGS, + .addr_flags = PS8751_I2C_ADDR1_FLAGS, }, - .drv = &rt1715_tcpm_drv, + .flags = TCPC_FLAGS_TCPCI_REV2_0 | + TCPC_FLAGS_TCPCI_REV2_0_NO_VSAFE0V, + .drv = &ps8xxx_tcpm_drv, }, }; BUILD_ASSERT(ARRAY_SIZE(tcpc_config) == USBC_PORT_COUNT); BUILD_ASSERT(CONFIG_USB_PD_PORT_MAX_COUNT == USBC_PORT_COUNT); -/******************************************************************************/ -/* USBC mux configuration - Tiger Lake includes internal mux */ -struct usb_mux usbc0_tcss_usb_mux = { - .usb_port = USBC_PORT_C0, - .driver = &virtual_usb_mux_driver, - .hpd_update = &virtual_hpd_update, -}; -struct usb_mux usbc1_tcss_usb_mux = { +/* + * USB3 DB mux configuration - the top level mux still needs to be set to the + * virtual_usb_mux_driver so the AP gets notified of mux changes and updates + * the TCSS configuration on state changes. + */ +static const struct usb_mux usbc1_usb3_db_retimer = { .usb_port = USBC_PORT_C1, - .driver = &virtual_usb_mux_driver, - .hpd_update = &virtual_hpd_update, + .driver = &tcpci_tcpm_usb_mux_driver, + .hpd_update = &ps8xxx_tcpc_update_hpd_status, + .next_mux = NULL, }; -struct usb_mux usb_muxes[] = { +/******************************************************************************/ +/* USBC mux configuration - Tiger Lake includes internal mux */ +const struct usb_mux usb_muxes[] = { [USBC_PORT_C0] = { .usb_port = USBC_PORT_C0, - .next_mux = &usbc0_tcss_usb_mux, - .driver = &bb_usb_retimer, - .i2c_port = I2C_PORT_USB_0_MIX, - .i2c_addr_flags = USBC_PORT_C0_BB_RETIMER_I2C_ADDR, + .driver = &virtual_usb_mux_driver, + .hpd_update = &virtual_hpd_update, }, [USBC_PORT_C1] = { .usb_port = USBC_PORT_C1, - .next_mux = &usbc1_tcss_usb_mux, - .driver = &bb_usb_retimer, - .i2c_port = I2C_PORT_USB_1_MIX, - .i2c_addr_flags = USBC_PORT_C1_BB_RETIMER_I2C_ADDR, + .driver = &virtual_usb_mux_driver, + .hpd_update = &virtual_hpd_update, + .next_mux = &usbc1_usb3_db_retimer, }, }; BUILD_ASSERT(ARRAY_SIZE(usb_muxes) == USBC_PORT_COUNT); -struct bb_usb_control bb_controls[] = { - [USBC_PORT_C0] = { - .usb_ls_en_gpio = GPIO_USB_C0_LS_EN, - .retimer_rst_gpio = GPIO_USB_C0_RT_RST_ODL, - }, - [USBC_PORT_C1] = { - .usb_ls_en_gpio = GPIO_USB_C1_LS_EN, - .retimer_rst_gpio = GPIO_USB_C1_RT_RST_ODL, - }, -}; -BUILD_ASSERT(ARRAY_SIZE(bb_controls) == USBC_PORT_COUNT); - static void board_tcpc_init(void) { /* Don't reset TCPCs after initial reset */ diff --git a/board/volet/board.h b/board/volet/board.h index 6793f4ae9f..9df22bad5f 100644 --- a/board/volet/board.h +++ b/board/volet/board.h @@ -85,11 +85,6 @@ /* Enabling Thunderbolt-compatible mode */ #define CONFIG_USB_PD_TBT_COMPAT_MODE -/* Enabling USB4 mode */ -#define CONFIG_USB_PD_USB4 -#define USBC_PORT_C0_BB_RETIMER_I2C_ADDR 0x40 -#define USBC_PORT_C1_BB_RETIMER_I2C_ADDR 0x41 - /* USB Type A Features */ #define USB_PORT_COUNT 1 #define CONFIG_USB_PORT_POWER_DUMB @@ -97,6 +92,9 @@ /* USBC PPC*/ #define CONFIG_USBC_PPC_SYV682X /* USBC port C0/C1 */ #define CONFIG_USB_PD_FRS_PPC +#undef CONFIG_USB_PD_TCPC_RUNTIME_CONFIG +#undef CONFIG_USB_PD_TCPM_TUSB422 +#undef CONFIG_USB_MUX_RUNTIME_CONFIG /* BC 1.2 */ @@ -111,6 +109,10 @@ #define CONFIG_CHARGER_SENSE_RESISTOR 10 #define CONFIG_CHARGER_SENSE_RESISTOR_AC 10 +/* Retimer */ +#undef CONFIG_USBC_RETIMER_INTEL_BB +#undef CONFIG_USBC_RETIMER_INTEL_BB_RUNTIME_CONFIG + /* * Macros for GPIO signals used in common code that don't match the * schematic names. Signal names in gpio.inc match the schematic and are @@ -147,8 +149,6 @@ #define I2C_PORT_SENSOR NPCX_I2C_PORT0_0 #define I2C_PORT_USB_C0 NPCX_I2C_PORT1_0 #define I2C_PORT_USB_C1 NPCX_I2C_PORT2_0 -#define I2C_PORT_USB_0_MIX NPCX_I2C_PORT3_0 -#define I2C_PORT_USB_1_MIX NPCX_I2C_PORT4_1 #define I2C_PORT_POWER NPCX_I2C_PORT5_0 #define I2C_PORT_EEPROM NPCX_I2C_PORT7_0 diff --git a/board/volet/gpio.inc b/board/volet/gpio.inc index 0b5d462b61..ed4b426a86 100644 --- a/board/volet/gpio.inc +++ b/board/volet/gpio.inc @@ -120,6 +120,10 @@ GPIO(EC_SLP_S0IX, PIN(7, 2), GPIO_INPUT | GPIO_PULL_UP) GPIO(UNUSED_GPIO34, PIN(3, 4), GPIO_INPUT | GPIO_PULL_UP) GPIO(UNUSED_GPIO60, PIN(6, 0), GPIO_INPUT | GPIO_PULL_UP) GPIO(UNUSED_GPIOA7, PIN(A, 7), GPIO_INPUT | GPIO_PULL_UP) +GPIO(UNUSED_GPIOD0, PIN(D, 0), GPIO_INPUT | GPIO_PULL_UP) +GPIO(UNUSED_GPIOD1, PIN(D, 1), GPIO_INPUT | GPIO_PULL_UP) +GPIO(UNUSED_GPIOF2, PIN(F, 2), GPIO_INPUT | GPIO_PULL_UP) +GPIO(UNUSED_GPIOF3, PIN(F, 3), GPIO_INPUT | GPIO_PULL_UP) /* * eDP backlight - both PCH and EC have enable pins that must be high @@ -135,10 +139,6 @@ GPIO(EC_I2C1_USB_C0_SCL, PIN(9, 0), GPIO_INPUT) GPIO(EC_I2C1_USB_C0_SDA, PIN(8, 7), GPIO_INPUT) GPIO(EC_I2C2_USB_C1_SCL, PIN(9, 2), GPIO_INPUT) GPIO(EC_I2C2_USB_C1_SDA, PIN(9, 1), GPIO_INPUT) -GPIO(EC_I2C3_USB_1_MIX_SCL, PIN(D, 1), GPIO_INPUT) -GPIO(EC_I2C3_USB_1_MIX_SDA, PIN(D, 0), GPIO_INPUT) -GPIO(EC_I2C4_USB_1_MIX_SCL, PIN(F, 3), GPIO_INPUT) -GPIO(EC_I2C4_USB_1_MIX_SDA, PIN(F, 2), GPIO_INPUT) GPIO(EC_I2C5_POWER_SCL, PIN(3, 3), GPIO_INPUT) GPIO(EC_I2C5_POWER_SDA, PIN(3, 6), GPIO_INPUT) GPIO(EC_I2C7_EEPROM_SCL, PIN(B, 3), GPIO_INPUT) @@ -151,8 +151,6 @@ GPIO(EC_BATT_PRES_ODL, PIN(E, 1), GPIO_INPUT) ALTERNATE(PIN_MASK(B, BIT(5) | BIT(4)), 0, MODULE_I2C, (GPIO_INPUT | GPIO_SEL_1P8V)) /* I2C0 */ ALTERNATE(PIN_MASK(9, BIT(0) | BIT(2) | BIT(1)), 0, MODULE_I2C, 0) /* I2C1 SCL / I2C2 */ ALTERNATE(PIN_MASK(8, BIT(7)), 0, MODULE_I2C, 0) /* I2C1 SDA */ -ALTERNATE(PIN_MASK(D, BIT(1) | BIT(0)), 0, MODULE_I2C, 0) /* I2C3 */ -ALTERNATE(PIN_MASK(F, BIT(3) | BIT(2)), 0, MODULE_I2C, 0) /* I2C4 */ ALTERNATE(PIN_MASK(3, BIT(3) | BIT(6)), 0, MODULE_I2C, 0) /* I2C5 */ ALTERNATE(PIN_MASK(B, BIT(3) | BIT(2)), 0, MODULE_I2C, 0) /* I2C7 */ |