diff options
-rw-r--r-- | baseboard/intelrvp/baseboard.c | 1 | ||||
-rw-r--r-- | baseboard/intelrvp/baseboard.h | 6 | ||||
-rw-r--r-- | baseboard/intelrvp/build.mk | 9 | ||||
-rw-r--r-- | baseboard/intelrvp/ite_ec.c | 23 | ||||
-rw-r--r-- | baseboard/intelrvp/ite_ec.h | 4 | ||||
-rw-r--r-- | baseboard/intelrvp/led.c | 3 | ||||
-rw-r--r-- | baseboard/intelrvp/retimer.c | 28 | ||||
-rw-r--r-- | baseboard/intelrvp/usb_mux.c | 80 | ||||
-rw-r--r-- | board/jslrvp_ite/board.c | 35 | ||||
-rw-r--r-- | board/jslrvp_ite/board.h | 11 | ||||
-rw-r--r-- | board/tglrvpu_ite/board.c | 69 | ||||
-rw-r--r-- | board/tglrvpu_ite/board.h | 11 |
12 files changed, 129 insertions, 151 deletions
diff --git a/baseboard/intelrvp/baseboard.c b/baseboard/intelrvp/baseboard.c index bf1127bb76..6bf955b100 100644 --- a/baseboard/intelrvp/baseboard.c +++ b/baseboard/intelrvp/baseboard.c @@ -190,4 +190,3 @@ __override void intel_x86_sys_reset_delay(void) */ udelay(60 * MSEC); } - diff --git a/baseboard/intelrvp/baseboard.h b/baseboard/intelrvp/baseboard.h index e3db7ffa75..7f60793f77 100644 --- a/baseboard/intelrvp/baseboard.h +++ b/baseboard/intelrvp/baseboard.h @@ -8,9 +8,9 @@ #ifndef __CROS_EC_BASEBOARD_H #define __CROS_EC_BASEBOARD_H -#ifdef CHIP_FAMILY_IT83XX +#ifdef VARIANT_INTELRVP_EC_IT8320 #include "ite_ec.h" -#endif /* CHIP_FAMILY_IT83XX */ +#endif /* VARIANT_INTELRVP_EC_IT8320 */ /* * Allow dangerous commands. @@ -44,7 +44,6 @@ /* Battery */ #define CONFIG_BATTERY_CUT_OFF #define CONFIG_BATTERY_FUEL_GAUGE -#define CONFIG_BATTERY_PRESENT_GPIO GPIO_EC_BATT_PRES_L #define CONFIG_BATTERY_REVIVE_DISCONNECT #define CONFIG_BATTERY_SMART @@ -128,7 +127,6 @@ /* Tablet mode */ #define CONFIG_TABLET_MODE #define CONFIG_GMR_TABLET_MODE -#define GMR_TABLET_MODE_GPIO_L GPIO_TABLET_MODE_L /* Verified boot */ #define CONFIG_CRC8 diff --git a/baseboard/intelrvp/build.mk b/baseboard/intelrvp/build.mk index d48d862fd5..896673c4a4 100644 --- a/baseboard/intelrvp/build.mk +++ b/baseboard/intelrvp/build.mk @@ -13,14 +13,7 @@ baseboard-$(CONFIG_BATTERY_SMART)+=battery.o baseboard-$(CONFIG_USB_POWER_DELIVERY)+=chg_usb_pd.o usb_pd_policy.o #EC specific files -baseboard-$(CONFIG_USB_PD_TCPM_ITE_ON_CHIP)+=ite_ec.o +baseboard-$(VARIANT_INTELRVP_EC_IT8320)+=ite_ec.o #BC1.2 specific files baseboard-$(CONFIG_BC12_DETECT_MAX14637)+=bc12.o - -#USB MUX specific files -baseboard-$(CONFIG_USB_MUX_VIRTUAL)+=usb_mux.o -baseboard-$(CONFIG_USB_MUX_ANX7440)+=usb_mux.o - -#USB Retimer specific files -baseboard-$(CONFIG_USBC_RETIMER_INTEL_BB)+=retimer.o diff --git a/baseboard/intelrvp/ite_ec.c b/baseboard/intelrvp/ite_ec.c index 2a847e5132..a575aab417 100644 --- a/baseboard/intelrvp/ite_ec.c +++ b/baseboard/intelrvp/ite_ec.c @@ -13,29 +13,6 @@ #include "timer.h" #include "usb_pd_tcpm.h" -/* USB-C TPCP Configuration */ -const struct tcpc_config_t tcpc_config[] = { - [TYPE_C_PORT_0] = { - .bus_type = EC_BUS_TYPE_EMBEDDED, - /* TCPC is embedded within EC so no i2c config needed */ - .drv = &it83xx_tcpm_drv, -#ifdef CONFIG_INTEL_VIRTUAL_MUX - .usb23 = TYPE_C_PORT_0_USB2_NUM | (TYPE_C_PORT_0_USB3_NUM << 4), -#endif - }, -#ifdef HAS_TASK_PD_C1 - [TYPE_C_PORT_1] = { - .bus_type = EC_BUS_TYPE_EMBEDDED, - /* TCPC is embedded within EC so no i2c config needed */ - .drv = &it83xx_tcpm_drv, -#ifdef CONFIG_INTEL_VIRTUAL_MUX - .usb23 = TYPE_C_PORT_1_USB2_NUM | (TYPE_C_PORT_1_USB3_NUM << 4), -#endif - }, -#endif /* HAS_TASK_PD_C1 */ -}; -BUILD_ASSERT(ARRAY_SIZE(tcpc_config) == CONFIG_USB_PD_PORT_MAX_COUNT); - /* Reset PD MCU */ void board_reset_pd_mcu(void) { diff --git a/baseboard/intelrvp/ite_ec.h b/baseboard/intelrvp/ite_ec.h index a09923dbb0..2857f8efdf 100644 --- a/baseboard/intelrvp/ite_ec.h +++ b/baseboard/intelrvp/ite_ec.h @@ -8,10 +8,6 @@ #ifndef __CROS_EC_ITE_EC_H #define __CROS_EC_ITE_EC_H -/* USB PD config */ -#define CONFIG_USB_PD_TCPM_ITE_ON_CHIP -#define CONFIG_USB_PD_ITE_ACTIVE_PORT_COUNT 2 - /* Optional feature - used by ITE */ #define CONFIG_IT83XX_FLASH_CLOCK_48MHZ diff --git a/baseboard/intelrvp/led.c b/baseboard/intelrvp/led.c index 8e98f8e10f..47dad8994f 100644 --- a/baseboard/intelrvp/led.c +++ b/baseboard/intelrvp/led.c @@ -14,9 +14,6 @@ #define LED_ON_LVL 0 #define LED_OFF_LVL 1 -#define GPIO_BAT_LED_RED_L GPIO_BAT_LED_GREEN_L -#define GPIO_PWR_LED_WHITE_L GPIO_AC_LED_GREEN_L - const int led_charge_lvl_1 = 5; const int led_charge_lvl_2 = 97; diff --git a/baseboard/intelrvp/retimer.c b/baseboard/intelrvp/retimer.c deleted file mode 100644 index c64ad64bcb..0000000000 --- a/baseboard/intelrvp/retimer.c +++ /dev/null @@ -1,28 +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. - */ - -/* Intel BASEBOARD-RVP Retimer specific configuration */ - -#include "bb_retimer.h" -#include "compile_time_macros.h" -#include "common.h" - -/* USB Retimers configuration */ -#ifdef CONFIG_USBC_RETIMER_INTEL_BB -const struct bb_usb_control bb_controls[] = { - [TYPE_C_PORT_0] = { - .usb_ls_en_gpio = GPIO_USB_C0_LS_EN, - .retimer_rst_gpio = GPIO_USB_C0_RETIMER_RST, - }, -#ifdef HAS_TASK_PD_C1 - [TYPE_C_PORT_1] = { - .usb_ls_en_gpio = GPIO_USB_C1_LS_EN, - .retimer_rst_gpio = GPIO_USB_C1_RETIMER_RST, - }, -#endif /* HAS_TASK_PD_C1 */ -}; -BUILD_ASSERT(ARRAY_SIZE(bb_controls) == CONFIG_USB_PD_PORT_MAX_COUNT); - -#endif /* CONFIG_USBC_RETIMER_INTEL_BB */ diff --git a/baseboard/intelrvp/usb_mux.c b/baseboard/intelrvp/usb_mux.c deleted file mode 100644 index 644ae1735c..0000000000 --- a/baseboard/intelrvp/usb_mux.c +++ /dev/null @@ -1,80 +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. - */ - -/* Intel BASEBOARD-RVP USB MUX specific configuration */ - -#include "common.h" -#include "anx7440.h" -#include "bb_retimer.h" -#include "timer.h" -#include "usb_mux.h" - -#ifdef CONFIG_USBC_RETIMER_INTEL_BB -struct usb_mux usbc0_retimer = { - .usb_port = TYPE_C_PORT_0, - .driver = &bb_usb_retimer, - .i2c_port = I2C_PORT0_BB_RETIMER, - .i2c_addr_flags = I2C_PORT0_BB_RETIMER_ADDR, -}; -#ifdef HAS_TASK_PD_C1 -struct usb_mux usbc1_retimer = { - .usb_port = TYPE_C_PORT_1, - .driver = &bb_usb_retimer, - .i2c_port = I2C_PORT1_BB_RETIMER, - .i2c_addr_flags = I2C_PORT1_BB_RETIMER_ADDR, -}; -#endif /* HAS_TASK_PD_C1 */ -#endif - -/* USB muxes Configuration */ -#ifdef CONFIG_USB_MUX_VIRTUAL -const struct usb_mux usb_muxes[] = { - [TYPE_C_PORT_0] = { - .usb_port = TYPE_C_PORT_0, - .driver = &virtual_usb_mux_driver, - .hpd_update = &virtual_hpd_update, -#ifdef CONFIG_USBC_RETIMER_INTEL_BB - .next_mux = &usbc0_retimer, -#endif - }, -#ifdef HAS_TASK_PD_C1 - [TYPE_C_PORT_1] = { - .usb_port = TYPE_C_PORT_1, - .driver = &virtual_usb_mux_driver, - .hpd_update = &virtual_hpd_update, -#ifdef CONFIG_USBC_RETIMER_INTEL_BB - .next_mux = &usbc1_retimer, -#endif - }, -#endif /* HAS_TASK_PD_C1 */ -}; -BUILD_ASSERT(ARRAY_SIZE(usb_muxes) == CONFIG_USB_PD_PORT_MAX_COUNT); -#endif /* CONFIG_USB_MUX_VIRTUAL */ - -#ifdef CONFIG_USB_MUX_ANX7440 -const struct usb_mux usb_muxes[] = { - [TYPE_C_PORT_0] = { - .usb_port = TYPE_C_PORT_0, - .i2c_port = I2C_PORT_USB_MUX, - .i2c_addr_flags = I2C_ADDR_USB_MUX0_FLAGS, - .driver = &anx7440_usb_mux_driver, -#ifdef CONFIG_USBC_RETIMER_INTEL_BB - .next_mux = &usbc0_retimer, -#endif - }, -#ifdef HAS_TASK_PD_C1 - [TYPE_C_PORT_1] = { - .usb_port = TYPE_C_PORT_1, - .i2c_port = I2C_PORT_USB_MUX, - .i2c_addr_flags = I2C_ADDR_USB_MUX1_FLAGS, - .driver = &anx7440_usb_mux_driver, -#ifdef CONFIG_USBC_RETIMER_INTEL_BB - .next_mux = &usbc1_retimer, -#endif - }, -#endif /* HAS_TASK_PD_C1 */ -}; -BUILD_ASSERT(ARRAY_SIZE(usb_muxes) == CONFIG_USB_PD_PORT_MAX_COUNT); -#endif /* CONFIG_USB_MUX_ANX7440 */ diff --git a/board/jslrvp_ite/board.c b/board/jslrvp_ite/board.c index 6a8cc3972b..c84b2cf38c 100644 --- a/board/jslrvp_ite/board.c +++ b/board/jslrvp_ite/board.c @@ -5,6 +5,7 @@ /* Intel Jasperlake RVP with ITE EC board specific configuration */ +#include "anx7440.h" #include "button.h" #include "charger.h" #include "driver/charger/isl923x.h" @@ -12,6 +13,7 @@ #include "i2c.h" #include "icelake.h" #include "intc.h" +#include "it83xx_pd.h" #include "lid_switch.h" #include "power.h" #include "power_button.h" @@ -19,6 +21,8 @@ #include "system.h" #include "tablet_mode.h" #include "uart.h" +#include "usb_mux.h" +#include "usb_pd_tcpm.h" #include "gpio_list.h" @@ -58,6 +62,37 @@ const struct tcpc_gpio_config_t tcpc_gpios[] = { }; BUILD_ASSERT(ARRAY_SIZE(tcpc_gpios) == CONFIG_USB_PD_PORT_MAX_COUNT); +/* USB-C TPCP Configuration */ +const struct tcpc_config_t tcpc_config[] = { + [TYPE_C_PORT_0] = { + .bus_type = EC_BUS_TYPE_EMBEDDED, + /* TCPC is embedded within EC so no i2c config needed */ + .drv = &it83xx_tcpm_drv, + }, + [TYPE_C_PORT_1] = { + .bus_type = EC_BUS_TYPE_EMBEDDED, + /* TCPC is embedded within EC so no i2c config needed */ + .drv = &it83xx_tcpm_drv, + }, +}; +BUILD_ASSERT(ARRAY_SIZE(tcpc_config) == CONFIG_USB_PD_PORT_MAX_COUNT); + +const struct usb_mux usb_muxes[] = { + [TYPE_C_PORT_0] = { + .usb_port = TYPE_C_PORT_0, + .i2c_port = I2C_PORT_USB_MUX, + .i2c_addr_flags = I2C_ADDR_USB_MUX0_FLAGS, + .driver = &anx7440_usb_mux_driver, + }, + [TYPE_C_PORT_1] = { + .usb_port = TYPE_C_PORT_1, + .i2c_port = I2C_PORT_USB_MUX, + .i2c_addr_flags = I2C_ADDR_USB_MUX1_FLAGS, + .driver = &anx7440_usb_mux_driver, + }, +}; +BUILD_ASSERT(ARRAY_SIZE(usb_muxes) == CONFIG_USB_PD_PORT_MAX_COUNT); + /* I2C ports */ const struct i2c_port_t i2c_ports[] = { /* Flash EC */ diff --git a/board/jslrvp_ite/board.h b/board/jslrvp_ite/board.h index 2ac8afa8d9..4f88cd5a52 100644 --- a/board/jslrvp_ite/board.h +++ b/board/jslrvp_ite/board.h @@ -8,10 +8,17 @@ #ifndef __CROS_EC_BOARD_H #define __CROS_EC_BOARD_H +/* ITE EC variant */ +#define VARIANT_INTELRVP_EC_IT8320 + #define CONFIG_CHIPSET_JASPERLAKE #define GPIO_PG_EC_RSMRST_ODL GPIO_RSMRST_L_PGOOD #define GPIO_PCH_DSW_PWROK GPIO_EC_PCH_DSW_PWROK #define GPIO_PG_EC_ALL_SYS_PWRGD GPIO_ALL_SYS_PWRGD +#define CONFIG_BATTERY_PRESENT_GPIO GPIO_EC_BATT_PRES_L +#define GMR_TABLET_MODE_GPIO_L GPIO_TABLET_MODE_L +#define GPIO_BAT_LED_RED_L GPIO_BAT_LED_GREEN_L +#define GPIO_PWR_LED_WHITE_L GPIO_AC_LED_GREEN_L /* Fan features */ #define CONFIG_FANS 1 @@ -34,6 +41,10 @@ #define CONFIG_USB_PD_PORT_MAX_COUNT 2 #define DEDICATED_CHARGE_PORT 2 +/* USB PD config */ +#define CONFIG_USB_PD_TCPM_ITE_ON_CHIP +#define CONFIG_USB_PD_ITE_ACTIVE_PORT_COUNT 2 + /* USB MUX */ #define CONFIG_USB_MUX_ANX7440 diff --git a/board/tglrvpu_ite/board.c b/board/tglrvpu_ite/board.c index 5698761c6a..a629059612 100644 --- a/board/tglrvpu_ite/board.c +++ b/board/tglrvpu_ite/board.c @@ -13,6 +13,7 @@ #include "i2c.h" #include "icelake.h" #include "intc.h" +#include "it83xx_pd.h" #include "lid_switch.h" #include "power.h" #include "power_button.h" @@ -20,6 +21,8 @@ #include "system.h" #include "tablet_mode.h" #include "uart.h" +#include "usb_mux.h" +#include "usb_pd_tcpm.h" #include "gpio_list.h" @@ -80,6 +83,72 @@ const struct tcpc_gpio_config_t tcpc_gpios[] = { }; BUILD_ASSERT(ARRAY_SIZE(tcpc_gpios) == CONFIG_USB_PD_PORT_MAX_COUNT); +/* USB-C TPCP Configuration */ +const struct tcpc_config_t tcpc_config[] = { + [TYPE_C_PORT_0] = { + .bus_type = EC_BUS_TYPE_EMBEDDED, + /* TCPC is embedded within EC so no i2c config needed */ + .drv = &it83xx_tcpm_drv, +#ifdef CONFIG_INTEL_VIRTUAL_MUX + .usb23 = TYPE_C_PORT_0_USB2_NUM | (TYPE_C_PORT_0_USB3_NUM << 4), +#endif + }, + [TYPE_C_PORT_1] = { + .bus_type = EC_BUS_TYPE_EMBEDDED, + /* TCPC is embedded within EC so no i2c config needed */ + .drv = &it83xx_tcpm_drv, +#ifdef CONFIG_INTEL_VIRTUAL_MUX + .usb23 = TYPE_C_PORT_1_USB2_NUM | (TYPE_C_PORT_1_USB3_NUM << 4), +#endif + }, +}; +BUILD_ASSERT(ARRAY_SIZE(tcpc_config) == CONFIG_USB_PD_PORT_MAX_COUNT); + +/* BB Retimers configuration */ +const struct bb_usb_control bb_controls[] = { + [TYPE_C_PORT_0] = { + .usb_ls_en_gpio = GPIO_USB_C0_LS_EN, + .retimer_rst_gpio = GPIO_USB_C0_RETIMER_RST, + }, + [TYPE_C_PORT_1] = { + .usb_ls_en_gpio = GPIO_USB_C1_LS_EN, + .retimer_rst_gpio = GPIO_USB_C1_RETIMER_RST, + }, +}; +BUILD_ASSERT(ARRAY_SIZE(bb_controls) == CONFIG_USB_PD_PORT_MAX_COUNT); + +/* USB retimer Configuration */ +struct usb_mux usbc0_retimer = { + .usb_port = TYPE_C_PORT_0, + .driver = &bb_usb_retimer, + .i2c_port = I2C_PORT0_BB_RETIMER, + .i2c_addr_flags = I2C_PORT0_BB_RETIMER_ADDR, +}; + +struct usb_mux usbc1_retimer = { + .usb_port = TYPE_C_PORT_1, + .driver = &bb_usb_retimer, + .i2c_port = I2C_PORT1_BB_RETIMER, + .i2c_addr_flags = I2C_PORT1_BB_RETIMER_ADDR, +}; + +/* USB muxes Configuration */ +const struct usb_mux usb_muxes[] = { + [TYPE_C_PORT_0] = { + .usb_port = TYPE_C_PORT_0, + .driver = &virtual_usb_mux_driver, + .hpd_update = &virtual_hpd_update, + .next_mux = &usbc0_retimer, + }, + [TYPE_C_PORT_1] = { + .usb_port = TYPE_C_PORT_1, + .driver = &virtual_usb_mux_driver, + .hpd_update = &virtual_hpd_update, + .next_mux = &usbc1_retimer, + }, +}; +BUILD_ASSERT(ARRAY_SIZE(usb_muxes) == CONFIG_USB_PD_PORT_MAX_COUNT); + /* I2C ports */ const struct i2c_port_t i2c_ports[] = { /* Flash EC */ diff --git a/board/tglrvpu_ite/board.h b/board/tglrvpu_ite/board.h index 222295c7cd..0a0bd6e14f 100644 --- a/board/tglrvpu_ite/board.h +++ b/board/tglrvpu_ite/board.h @@ -8,6 +8,9 @@ #ifndef __CROS_EC_BOARD_H #define __CROS_EC_BOARD_H +/* ITE EC variant */ +#define VARIANT_INTELRVP_EC_IT8320 + /* USB MUX */ #define CONFIG_USB_MUX_VIRTUAL @@ -31,6 +34,10 @@ #define GPIO_PG_EC_RSMRST_ODL GPIO_RSMRST_L_PGOOD #define GPIO_PCH_DSW_PWROK GPIO_EC_PCH_DSW_PWROK #define GPIO_PG_EC_ALL_SYS_PWRGD GPIO_ALL_SYS_PWRGD +#define CONFIG_BATTERY_PRESENT_GPIO GPIO_EC_BATT_PRES_L +#define GMR_TABLET_MODE_GPIO_L GPIO_TABLET_MODE_L +#define GPIO_BAT_LED_RED_L GPIO_BAT_LED_GREEN_L +#define GPIO_PWR_LED_WHITE_L GPIO_AC_LED_GREEN_L /* Charger */ #define CONFIG_CHARGER_ISL9241 @@ -43,6 +50,10 @@ #define CONFIG_USB_PD_PORT_MAX_COUNT 2 #define DEDICATED_CHARGE_PORT 2 +/* USB PD config */ +#define CONFIG_USB_PD_TCPM_ITE_ON_CHIP +#define CONFIG_USB_PD_ITE_ACTIVE_PORT_COUNT 2 + /* USB-C port's USB2 & USB3 port numbers */ #if defined(BOARD_TGLRVPU_ITE) || defined(BOARD_TGLRVPU_ITE_TCPMV1) #define TYPE_C_PORT_0_USB2_NUM 6 |