diff options
author | David Huang <david.huang@quanta.corp-partner.google.com> | 2020-11-20 14:32:12 +0800 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2020-11-30 09:51:55 +0000 |
commit | 0c2af622c929ace9b0d0814d475007ab60c791eb (patch) | |
tree | 840ff0983d732d39e7ea7a877d0c7f2a275403ae /board/voema | |
parent | 73b5043df48f5071131cd0424f9e6d992e89f4f5 (diff) | |
download | chrome-ec-0c2af622c929ace9b0d0814d475007ab60c791eb.tar.gz |
voema: Typec port remove unused config and reconfig tcpc/ppc config.
Remove unused configuration and gpio pin and reconfig tcpc/ppc config for voema typec port.
BUG=b:169356808
BRANCH=master
TEST=Check C0/C1 port workable.
Signed-off-by: David Huang <david.huang@quanta.corp-partner.google.com>
Change-Id: I0ff2322b1cf19e24f66745c1509b811eeff69161
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2550118
Reviewed-by: Keith Short <keithshort@chromium.org>
Diffstat (limited to 'board/voema')
-rw-r--r-- | board/voema/board.c | 232 | ||||
-rw-r--r-- | board/voema/board.h | 13 | ||||
-rw-r--r-- | board/voema/gpio.inc | 6 |
3 files changed, 38 insertions, 213 deletions
diff --git a/board/voema/board.c b/board/voema/board.c index b67b9abc4f..898732838d 100644 --- a/board/voema/board.c +++ b/board/voema/board.c @@ -4,7 +4,6 @@ */ /* Volteer board-specific configuration */ -#include "bb_retimer.h" #include "button.h" #include "common.h" #include "accelgyro.h" @@ -13,14 +12,11 @@ #include "driver/accelgyro_bmi260.h" #include "driver/als_tcs3400.h" #include "driver/bc12/pi3usb9201.h" -#include "driver/ppc/sn5s330.h" #include "driver/ppc/syv682x.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 "driver/tcpm/tusb422.h" #include "extpower.h" #include "gpio.h" #include "hooks.h" @@ -69,7 +65,7 @@ struct keyboard_scan_config keyscan_config = { * FW_CONFIG defaults for Volteer if the CBI data is not initialized. */ union volteer_cbi_fw_config fw_config_defaults = { - .usb_db = DB_USB4_GEN2, + .usb_db = DB_USB3_ACTIVE, }; static void board_init(void) @@ -77,47 +73,6 @@ static void board_init(void) } DECLARE_HOOK(HOOK_INIT, board_init, HOOK_PRIO_DEFAULT); -__override enum tbt_compat_cable_speed board_get_max_tbt_speed(int port) -{ - enum ec_cfg_usb_db_type usb_db = ec_cfg_usb_db_type(); - - if (port == USBC_PORT_C1) { - if (usb_db == DB_USB4_GEN2) { - /* - * Older boards violate 205mm trace length prior - * to connection to the re-timer and only support up - * to GEN2 speeds. - */ - return TBT_SS_U32_GEN1_GEN2; - } else if (usb_db == DB_USB4_GEN3) { - return TBT_SS_TBT_GEN3; - } - } - - /* - * Thunderbolt-compatible mode not supported - * - * TODO (b/147726366): All the USB-C ports need to support same speed. - * Need to fix once USB-C feature set is known for Volteer. - */ - return TBT_SS_RES_0; -} - -__override bool board_is_tbt_usb4_port(int port) -{ - enum ec_cfg_usb_db_type usb_db = ec_cfg_usb_db_type(); - - /* - * Volteer reference design only supports TBT & USB4 on port 1 - * if the USB4 DB is present. - * - * TODO (b/147732807): All the USB-C ports need to support same - * features. Need to fix once USB-C feature set is known for Volteer. - */ - return ((port == USBC_PORT_C1) - && ((usb_db == DB_USB4_GEN2) || (usb_db == DB_USB4_GEN3))); -} - /******************************************************************************/ /* EC thermal management configuration */ @@ -191,13 +146,6 @@ const struct i2c_port_t i2c_ports[] = { .sda = GPIO_EC_I2C2_USB_C1_SDA, }, { - .name = "usb_1_mix", - .port = I2C_PORT_USB_1_MIX, - .kbps = 100, - .scl = GPIO_EC_I2C3_USB_1_MIX_SCL, - .sda = GPIO_EC_I2C3_USB_1_MIX_SDA, - }, - { .name = "power", .port = I2C_PORT_POWER, .kbps = 100, @@ -232,45 +180,6 @@ const struct pwm_t pwm_channels[] = { BUILD_ASSERT(ARRAY_SIZE(pwm_channels) == PWM_CH_COUNT); /******************************************************************************/ -/* Volteer specific USB daughter-board configuration */ - -/* USBC TCPC configuration for USB3 daughter board */ -static const struct tcpc_config_t tcpc_config_p1_usb3 = { - .bus_type = EC_BUS_TYPE_I2C, - .i2c_info = { - .port = I2C_PORT_USB_C1, - .addr_flags = PS8751_I2C_ADDR1_FLAGS, - }, - .flags = TCPC_FLAGS_TCPCI_REV2_0 | TCPC_FLAGS_TCPCI_REV2_0_NO_VSAFE0V, - .drv = &ps8xxx_tcpm_drv, -}; - -/* - * 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 = &tcpci_tcpm_usb_mux_driver, - .hpd_update = &ps8xxx_tcpc_update_hpd_status, - .next_mux = NULL, -}; - -static const struct usb_mux mux_config_p1_usb3_active = { - .usb_port = USBC_PORT_C1, - .driver = &virtual_usb_mux_driver, - .hpd_update = &virtual_hpd_update, - .next_mux = &usbc1_usb3_db_retimer, -}; - -static const struct usb_mux mux_config_p1_usb3_passive = { - .usb_port = USBC_PORT_C1, - .driver = &virtual_usb_mux_driver, - .hpd_update = &virtual_hpd_update, -}; - -/******************************************************************************/ /* USB-A charging control */ const int usb_port_enable[USB_PORT_COUNT] = { @@ -309,98 +218,14 @@ static void ps8815_reset(void) void board_reset_pd_mcu(void) { - enum ec_cfg_usb_db_type usb_db = ec_cfg_usb_db_type(); - /* No reset available for TCPC on port 0 */ /* Daughterboard specific reset for port 1 */ - if (usb_db == DB_USB3_ACTIVE) { - ps8815_reset(); - usb_mux_hpd_update(USBC_PORT_C1, 0, 0); - } + ps8815_reset(); + usb_mux_hpd_update(USBC_PORT_C1, 0, 0); } -/* - * Set up support for the USB3 daughterboard: - * Parade PS8815 TCPC (integrated retimer) - * Diodes PI3USB9201 BC 1.2 chip (same as USB4 board) - * Silergy SYV682A PPC (same as USB4 board) - * Virtual mux with stacked retimer - */ -static void config_db_usb3_active(void) -{ - tcpc_config[USBC_PORT_C1] = tcpc_config_p1_usb3; - usb_muxes[USBC_PORT_C1] = mux_config_p1_usb3_active; -} - -/* - * Set up support for the passive USB3 daughterboard: - * TUSB422 TCPC (already the default) - * PI3USB9201 BC 1.2 chip (already the default) - * Silergy SYV682A PPC (already the default) - * Virtual mux without stacked retimer - */ - -static void config_db_usb3_passive(void) -{ - usb_muxes[USBC_PORT_C1] = mux_config_p1_usb3_passive; -} - -static void config_port_discrete_tcpc(int port) -{ - /* - * Support 2 Pin-to-Pin compatible parts: TUSB422 and RT1715, for - * simplicity allow either and decide at runtime which we are using. - * Default to TUSB422, and switch to RT1715 if it is on the I2C bus and - * the VID matches. - */ - - int regval; - - if (i2c_read16(port ? I2C_PORT_USB_C1 : I2C_PORT_USB_C0, - RT1715_I2C_ADDR_FLAGS, TCPC_REG_VENDOR_ID, - ®val) == EC_SUCCESS) { - if (regval == RT1715_VENDOR_ID) { - CPRINTS("C%d: RT1715 detected", port); - tcpc_config[port].i2c_info.addr_flags = - RT1715_I2C_ADDR_FLAGS; - tcpc_config[port].drv = &rt1715_tcpm_drv; - return; - } - } - CPRINTS("C%d: Default to TUSB422", port); -} - -static const char *db_type_prefix = "USB DB type: "; __override void board_cbi_init(void) { - enum ec_cfg_usb_db_type usb_db = ec_cfg_usb_db_type(); - - config_port_discrete_tcpc(0); - switch (usb_db) { - case DB_USB_ABSENT: - CPRINTS("%sNone", db_type_prefix); - break; - case DB_USB4_GEN2: - config_port_discrete_tcpc(1); - CPRINTS("%sUSB4 Gen1/2", db_type_prefix); - break; - case DB_USB4_GEN3: - config_port_discrete_tcpc(1); - CPRINTS("%sUSB4 Gen3", db_type_prefix); - break; - case DB_USB3_ACTIVE: - config_db_usb3_active(); - CPRINTS("%sUSB3 Active", db_type_prefix); - break; - case DB_USB3_PASSIVE: - config_db_usb3_passive(); - config_port_discrete_tcpc(1); - CPRINTS("%sUSB3 Passive", db_type_prefix); - break; - default: - CPRINTS("%sID %d not supported", db_type_prefix, usb_db); - } - if ((!IS_ENABLED(TEST_BUILD) && !ec_cfg_has_numeric_pad()) || get_board_id() <= 2) keyboard_raw_set_cols(KEYBOARD_COLS_NO_KEYPAD); @@ -411,8 +236,8 @@ __override void board_cbi_init(void) struct ppc_config_t ppc_chips[] = { [USBC_PORT_C0] = { .i2c_port = I2C_PORT_USB_C0, - .i2c_addr_flags = SN5S330_ADDR0_FLAGS, - .drv = &sn5s330_drv, + .i2c_addr_flags = SYV682X_ADDR0_FLAGS, + .drv = &syv682x_drv, }, [USBC_PORT_C1] = { .i2c_port = I2C_PORT_USB_C1, @@ -429,7 +254,7 @@ void ppc_interrupt(enum gpio_signal signal) { switch (signal) { case GPIO_USB_C0_PPC_INT_ODL: - sn5s330_interrupt(USBC_PORT_C0); + syv682x_interrupt(USBC_PORT_C0); break; case GPIO_USB_C1_PPC_INT_ODL: syv682x_interrupt(USBC_PORT_C1); @@ -454,36 +279,44 @@ 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 = { .port = I2C_PORT_USB_C0, - .addr_flags = TUSB422_I2C_ADDR_FLAGS, + .addr_flags = RT1715_I2C_ADDR_FLAGS, }, - .drv = &tusb422_tcpm_drv, + .drv = &rt1715_tcpm_drv, }, [USBC_PORT_C1] = { .bus_type = EC_BUS_TYPE_I2C, .i2c_info = { .port = I2C_PORT_USB_C1, - .addr_flags = TUSB422_I2C_ADDR_FLAGS, + .addr_flags = PS8751_I2C_ADDR1_FLAGS, }, - .drv = &tusb422_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 usbc1_usb4_db_retimer = { +/* + * 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 = &bb_usb_retimer, - .i2c_port = I2C_PORT_USB_1_MIX, - .i2c_addr_flags = USBC_PORT_C1_BB_RETIMER_I2C_ADDR, + .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, .driver = &virtual_usb_mux_driver, @@ -493,22 +326,11 @@ struct usb_mux usb_muxes[] = { .usb_port = USBC_PORT_C1, .driver = &virtual_usb_mux_driver, .hpd_update = &virtual_hpd_update, - .next_mux = &usbc1_usb4_db_retimer, + .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-C port 0 doesn't have a retimer */ - }, - [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/voema/board.h b/board/voema/board.h index a6051d930b..fe8276c3ce 100644 --- a/board/voema/board.h +++ b/board/voema/board.h @@ -74,9 +74,6 @@ /* Enabling Thunderbolt-compatible mode */ #define CONFIG_USB_PD_TBT_COMPAT_MODE -/* Enabling USB4 mode */ -#define CONFIG_USB_PD_USB4 -#define USBC_PORT_C1_BB_RETIMER_I2C_ADDR 0x40 /* * For USB4, set the total budget for source current to 4.5A so that the first * connected port is allowed to source 3A while sourcing 1.5A on other type-C @@ -89,8 +86,10 @@ #define CONFIG_USB_PORT_POWER_DUMB /* USBC PPC*/ -#define CONFIG_USBC_PPC_SN5S330 /* USBC port C0 */ -#define CONFIG_USBC_PPC_SYV682X /* USBC port C1 */ +#define CONFIG_USBC_PPC_SYV682X /* USBC port C0/C1 */ +#undef CONFIG_USB_PD_TCPC_RUNTIME_CONFIG +#undef CONFIG_USB_PD_TCPM_TUSB422 +#undef CONFIG_USB_MUX_RUNTIME_CONFIG /* BC 1.2 */ @@ -103,6 +102,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 diff --git a/board/voema/gpio.inc b/board/voema/gpio.inc index bd3d874383..7577e81f28 100644 --- a/board/voema/gpio.inc +++ b/board/voema/gpio.inc @@ -109,6 +109,7 @@ GPIO(EC_KB_BL_EN, PIN(8, 6), GPIO_OUT_LOW) GPIO(UNUSED_GPIO72, PIN(7, 2), GPIO_INPUT | GPIO_PULL_UP) GPIO(UNUSED_GPIO41, PIN(4, 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) GPIO(UNUSED_GPIO96, PIN(9, 6), GPIO_INPUT | GPIO_PULL_UP) GPIO(UNUSED_GPIO34, PIN(3, 4), GPIO_INPUT | GPIO_PULL_UP) GPIO(UNUSED_GPIO57, PIN(5, 7), GPIO_INPUT | GPIO_PULL_UP) @@ -116,6 +117,8 @@ GPIO(UNUSED_GPIOC2, PIN(C, 2), GPIO_INPUT | GPIO_PULL_UP) GPIO(UNUSED_GPIO61, PIN(6, 1), GPIO_INPUT | GPIO_PULL_UP) GPIO(UNUSED_GPIOB7, PIN(B, 7), GPIO_INPUT | GPIO_PULL_UP) GPIO(UNUSED_GPIO40, PIN(4, 0), GPIO_INPUT | GPIO_PULL_UP) +GPIO(UNUSED_GPIOD1, PIN(D, 1), GPIO_INPUT | GPIO_PULL_UP) +GPIO(UNUSED_GPIOD0, PIN(D, 0), GPIO_INPUT | GPIO_PULL_UP) /* * eDP backlight - both PCH and EC have enable pins that must be high @@ -131,8 +134,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_I2C5_BATTERY_SCL, PIN(3, 3), GPIO_INPUT) GPIO(EC_I2C5_BATTERY_SDA, PIN(3, 6), GPIO_INPUT) GPIO(EC_I2C7_EEPROM_PWR_SCL_R, PIN(B, 3), GPIO_INPUT) @@ -149,7 +150,6 @@ GPIO(LED_2_L, PIN(C, 3), GPIO_OUT_HIGH) /* Amber */ 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(3, BIT(3) | BIT(6)), 0, MODULE_I2C, 0) /* I2C5 */ ALTERNATE(PIN_MASK(B, BIT(3) | BIT(2)), 0, MODULE_I2C, 0) /* I2C7 */ |