diff options
author | Keith Short <keithshort@chromium.org> | 2020-06-15 10:46:47 -0600 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2020-07-02 02:40:20 +0000 |
commit | 921ccafdc9ca1187a3f8be7e3f1a695aa34cd954 (patch) | |
tree | 430d00a9364753ac466eae58948d955ce2b2efd4 /baseboard/volteer | |
parent | 07833a0fc114e28c200fcee5691c082534344bfe (diff) | |
download | chrome-ec-921ccafdc9ca1187a3f8be7e3f1a695aa34cd954.tar.gz |
volteer: Move USB DB checks from baseboard
The FW_CONFIG fields share a common layout across the entire Volteer
program, but the individual fields are defined on a project level. Move
the USB DB fields from the baseboard program to the board project.
BUG=b:155497872
BRANCH=none
TEST=make buildall
TEST=verify FW_CONFIG data on Volteer
Cq-Depend: chromium:2248238, chromium:2248239, chromium:2248240
Cq-Depend: chromium:2248241, chromium:2248242, chromium:2252484
Signed-off-by: Keith Short <keithshort@chromium.org>
Change-Id: I7d4f27159907b1cec029d2b2ae867321e70b3326
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2247617
Reviewed-by: Abe Levkoy <alevkoy@chromium.org>
Diffstat (limited to 'baseboard/volteer')
-rw-r--r-- | baseboard/volteer/baseboard.c | 113 | ||||
-rw-r--r-- | baseboard/volteer/baseboard.h | 13 | ||||
-rw-r--r-- | baseboard/volteer/cbi_ec_fw_config.c | 7 |
3 files changed, 8 insertions, 125 deletions
diff --git a/baseboard/volteer/baseboard.c b/baseboard/volteer/baseboard.c index 78d720eedc..d51e99a921 100644 --- a/baseboard/volteer/baseboard.c +++ b/baseboard/volteer/baseboard.c @@ -267,37 +267,6 @@ struct tcpc_config_t tcpc_config[] = { BUILD_ASSERT(ARRAY_SIZE(tcpc_config) == USBC_PORT_COUNT); BUILD_ASSERT(CONFIG_USB_PD_PORT_MAX_COUNT == USBC_PORT_COUNT); -/* USBC TCPC configuration for port 1 on USB3 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, - .usb23 = USBC_PORT_1_USB2_NUM | (USBC_PORT_1_USB3_NUM << 4), -}; - -/* - * USB3 DB mux configuration - the top level mux still needs to be set to the - * virutal_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 = { - .usb_port = USBC_PORT_C1, - .driver = &virtual_usb_mux_driver, - .hpd_update = &virtual_hpd_update, - .next_mux = &usbc1_usb3_db_retimer, -}; - /******************************************************************************/ /* USBC PPC configuration */ struct ppc_config_t ppc_chips[] = { @@ -388,50 +357,6 @@ void ppc_interrupt(enum gpio_signal signal) /******************************************************************************/ /* TCPC support routines */ -enum gpio_signal ps8xxx_rst_odl = GPIO_USB_C1_RT_RST_ODL; - -static void ps8815_reset(void) -{ - int val; - - gpio_set_level(ps8xxx_rst_odl, 0); - msleep(GENERIC_MAX(PS8XXX_RESET_DELAY_MS, - PS8815_PWR_H_RST_H_DELAY_MS)); - gpio_set_level(ps8xxx_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) -{ - 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); - } -} - uint16_t tcpc_get_alert_status(void) { uint16_t status = 0; @@ -573,18 +498,6 @@ static void baseboard_init(void) } DECLARE_HOOK(HOOK_INIT, baseboard_init, HOOK_PRIO_DEFAULT); -/* - * 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) - */ -static void config_db_usb3(void) -{ - tcpc_config[USBC_PORT_C1] = tcpc_config_p1_usb3; - usb_muxes[USBC_PORT_C1] = mux_config_p1_usb3; -} - static uint8_t board_id; uint8_t get_board_id(void) @@ -592,11 +505,10 @@ uint8_t get_board_id(void) return board_id; } -__overridable void config_volteer_gpios(void) +__overridable void board_cbi_init(void) { } -static const char *db_type_prefix = "USB DB type: "; /* * Read CBI from i2c eeprom and initialize variables for board variants * @@ -606,7 +518,6 @@ static const char *db_type_prefix = "USB DB type: "; static void cbi_init(void) { uint32_t cbi_val; - enum ec_cfg_usb_db_type usb_db; /* Board ID */ if (cbi_get_board_version(&cbi_val) != EC_SUCCESS || @@ -617,28 +528,10 @@ static void cbi_init(void) CPRINTS("Board ID: %d", board_id); - config_volteer_gpios(); - /* FW config */ init_fw_config(); - usb_db = ec_cfg_usb_db_type(); - switch (usb_db) { - case DB_USB_ABSENT: - CPRINTS("%sNone", db_type_prefix); - break; - case DB_USB4_GEN2: - CPRINTS("%sUSB4 Gen1/2", db_type_prefix); - break; - case DB_USB4_GEN3: - CPRINTS("%sUSB4 Gen3", db_type_prefix); - break; - case DB_USB3_ACTIVE: - config_db_usb3(); - CPRINTS("%sUSB3 Active", db_type_prefix); - break; - default: - CPRINTS("%sID %d not supported", db_type_prefix, usb_db); - } + /* Allow the board project to make runtime changes based on CBI data */ + board_cbi_init(); } DECLARE_HOOK(HOOK_INIT, cbi_init, HOOK_PRIO_FIRST); diff --git a/baseboard/volteer/baseboard.h b/baseboard/volteer/baseboard.h index a134c9ced8..7ad485fbe8 100644 --- a/baseboard/volteer/baseboard.h +++ b/baseboard/volteer/baseboard.h @@ -266,10 +266,6 @@ enum usbc_port { USBC_PORT_COUNT }; -extern enum gpio_signal ps8xxx_rst_odl; - -void board_reset_pd_mcu(void); - /* Common definition for the USB PD interrupt handlers. */ void ppc_interrupt(enum gpio_signal signal); void tcpc_alert_event(enum gpio_signal signal); @@ -278,11 +274,12 @@ void bc12_interrupt(enum gpio_signal signal); unsigned char get_board_id(void); /** - * Configure GPIOs based on the CBI board version. Boards in the Volteer - * family can optionally implement this function to change GPIO definitions for - * different board build phases. + * Configure run-time data structures and operation based on CBI data. This + * typically includes customization for changes in the BOARD_VERSION and + * FW_CONFIG fields in CBI. This routine is called from the baseboard after + * the CBI data has been initialized. */ -__override_proto void config_volteer_gpios(void); +__override_proto void board_cbi_init(void); #endif /* !__ASSEMBLER__ */ diff --git a/baseboard/volteer/cbi_ec_fw_config.c b/baseboard/volteer/cbi_ec_fw_config.c index 145115e930..788f152b92 100644 --- a/baseboard/volteer/cbi_ec_fw_config.c +++ b/baseboard/volteer/cbi_ec_fw_config.c @@ -13,13 +13,6 @@ static union volteer_cbi_fw_config fw_config; BUILD_ASSERT(sizeof(fw_config) == sizeof(uint32_t)); -/* - * TODO in separate CL. Update FW_CONFIG default for all Volteer projects - */ -union volteer_cbi_fw_config fw_config_defaults = { - .usb_db = DB_USB4_GEN2, -}; - /**************************************************************************** * Volteer FW_CONFIG access */ |