summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--baseboard/dedede/baseboard.h1
-rw-r--r--baseboard/dragonegg/baseboard.h1
-rw-r--r--baseboard/intelrvp/ite_ec.h1
-rw-r--r--baseboard/octopus/baseboard.h1
-rw-r--r--board/it8xxx2_pdevb/board.h1
-rw-r--r--board/reef_it8320/board.h1
-rw-r--r--chip/it83xx/clock.c4
-rw-r--r--chip/it83xx/gpio.c22
-rw-r--r--driver/tcpm/it83xx_pd.h4
-rw-r--r--include/config.h6
10 files changed, 30 insertions, 12 deletions
diff --git a/baseboard/dedede/baseboard.h b/baseboard/dedede/baseboard.h
index accd1376c1..2c0fbe7da3 100644
--- a/baseboard/dedede/baseboard.h
+++ b/baseboard/dedede/baseboard.h
@@ -67,6 +67,7 @@
#define CONFIG_USB_PD_TCPM_ITE_ON_CHIP /* C0: ITE EC TCPC */
#define CONFIG_USB_PD_TCPM_ANX7447 /* C1: ANX TCPC + Mux */
#define CONFIG_BC12_DETECT_PI3USB9201 /* BC 1.2 */
+ #define CONFIG_USB_PD_ITE_ACTIVE_PORT_COUNT 1
#else
#error "Must define a VARIANT_DEDEDE_EC!"
#endif
diff --git a/baseboard/dragonegg/baseboard.h b/baseboard/dragonegg/baseboard.h
index 7365891000..3eff17ba1a 100644
--- a/baseboard/dragonegg/baseboard.h
+++ b/baseboard/dragonegg/baseboard.h
@@ -82,6 +82,7 @@
#define CONFIG_USB_PD_TCPM_TUSB422 /* C1 TCPC: TUSB422 */
#define CONFIG_USB_POWER_DELIVERY
#define CONFIG_USB_PD_TCPMV1
+#define CONFIG_USB_PD_ITE_ACTIVE_PORT_COUNT 2
/*
* TODO (b/111281797): DragonEgg has 3 ports. Only adding support for the port
diff --git a/baseboard/intelrvp/ite_ec.h b/baseboard/intelrvp/ite_ec.h
index 14d9b27370..9fc5def311 100644
--- a/baseboard/intelrvp/ite_ec.h
+++ b/baseboard/intelrvp/ite_ec.h
@@ -11,6 +11,7 @@
/* USB PD config */
#define CONFIG_USB_PD_TCPM_ITE_ON_CHIP
#define CONFIG_USB_PD_VBUS_DETECT_GPIO
+#define CONFIG_USB_PD_ITE_ACTIVE_PORT_COUNT 2
/* Optional feature - used by ITE */
#define CONFIG_IT83XX_FLASH_CLOCK_48MHZ
diff --git a/baseboard/octopus/baseboard.h b/baseboard/octopus/baseboard.h
index 2bbcff6d32..7a22a81f4b 100644
--- a/baseboard/octopus/baseboard.h
+++ b/baseboard/octopus/baseboard.h
@@ -70,6 +70,7 @@
#define I2C_PORT_USB_MUX I2C_PORT_USBC0 /* For MUX driver */
#define I2C_PORT_EEPROM IT83XX_I2C_CH_F
#define I2C_ADDR_EEPROM_FLAGS 0x50
+ #define CONFIG_USB_PD_ITE_ACTIVE_PORT_COUNT 2
/* EC variant determines USB-C variant */
#define VARIANT_OCTOPUS_USBC_ITE_EC_TCPCS
diff --git a/board/it8xxx2_pdevb/board.h b/board/it8xxx2_pdevb/board.h
index 3131151980..075d830254 100644
--- a/board/it8xxx2_pdevb/board.h
+++ b/board/it8xxx2_pdevb/board.h
@@ -36,6 +36,7 @@
#define CONFIG_USB_PD_CUSTOM_PDO
#define CONFIG_USB_PD_DUAL_ROLE
#define CONFIG_USB_PD_PORT_MAX_COUNT 3
+#define CONFIG_USB_PD_ITE_ACTIVE_PORT_COUNT 3
#define CONFIG_USB_PD_TCPMV1
#define CONFIG_USB_PD_TCPM_ITE_ON_CHIP
#define CONFIG_USB_PD_TRY_SRC
diff --git a/board/reef_it8320/board.h b/board/reef_it8320/board.h
index 3df468bd60..b8f8210848 100644
--- a/board/reef_it8320/board.h
+++ b/board/reef_it8320/board.h
@@ -73,6 +73,7 @@
#define CONFIG_USB_PD_LOGGING
#define CONFIG_USB_PD_MAX_SINGLE_SOURCE_CURRENT TYPEC_RP_3A0
#define CONFIG_USB_PD_PORT_MAX_COUNT 2
+#define CONFIG_USB_PD_ITE_ACTIVE_PORT_COUNT 2
#define CONFIG_USB_PD_VBUS_DETECT_CHARGER
#define CONFIG_USB_PD_TCPM_ITE_ON_CHIP
#define CONFIG_USB_PD_TCPM_TCPCI
diff --git a/chip/it83xx/clock.c b/chip/it83xx/clock.c
index b0f3b09d01..c3fc6ffbf4 100644
--- a/chip/it83xx/clock.c
+++ b/chip/it83xx/clock.c
@@ -509,10 +509,10 @@ void __enter_hibernate(uint32_t seconds, uint32_t microseconds)
if (IS_ENABLED(CONFIG_USB_PD_TCPM_ITE_ON_CHIP)) {
/*
- * Disable integrated pd modules in hibernate for
+ * Disable active pd modules in hibernate for
* better power consumption.
*/
- for (i = 0; i < IT83XX_USBPD_PHY_PORT_COUNT; i++)
+ for (i = 0; i < CONFIG_USB_PD_ITE_ACTIVE_PORT_COUNT; i++)
it83xx_disable_pd_module(i);
}
diff --git a/chip/it83xx/gpio.c b/chip/it83xx/gpio.c
index cdef32384a..94e8fe211d 100644
--- a/chip/it83xx/gpio.c
+++ b/chip/it83xx/gpio.c
@@ -666,18 +666,20 @@ void gpio_pre_init(void)
IT83XX_GPIO_GCR = 0x06;
+#if IT83XX_USBPD_PHY_PORT_COUNT < CONFIG_USB_PD_ITE_ACTIVE_PORT_COUNT
+#error "ITE pd active port count should be less than physical port count !"
+#endif
/*
- * To prevent cc pins leakage ...
- * If we don't use ITE TCPC: disable all ITE port cc modules.
+ * To prevent cc pins leakage and cc pins can be used as gpio,
+ * disable board not active ITE TCPC port cc modules.
*/
- if (!IS_ENABLED(CONFIG_USB_PD_TCPM_ITE_ON_CHIP)) {
- for (i = 0; i < IT83XX_USBPD_PHY_PORT_COUNT; i++) {
- it83xx_disable_cc_module(i);
- /* Dis-connect 5.1K dead battery resistor to CC */
- IT83XX_USBPD_CCPSR(i) |=
- (USBPD_REG_MASK_DISCONNECT_5_1K_CC2_DB |
- USBPD_REG_MASK_DISCONNECT_5_1K_CC1_DB);
- }
+ for (i = CONFIG_USB_PD_ITE_ACTIVE_PORT_COUNT;
+ i < IT83XX_USBPD_PHY_PORT_COUNT; i++) {
+ it83xx_disable_cc_module(i);
+ /* Dis-connect 5.1K dead battery resistor to CC */
+ IT83XX_USBPD_CCPSR(i) |=
+ (USBPD_REG_MASK_DISCONNECT_5_1K_CC2_DB |
+ USBPD_REG_MASK_DISCONNECT_5_1K_CC1_DB);
}
#ifndef CONFIG_USB
diff --git a/driver/tcpm/it83xx_pd.h b/driver/tcpm/it83xx_pd.h
index 0056f85cb1..54c5ed3c84 100644
--- a/driver/tcpm/it83xx_pd.h
+++ b/driver/tcpm/it83xx_pd.h
@@ -191,6 +191,10 @@
#define IT83XX_USBPD_CC_PIN_CONFIG 0x86
#define IT83XX_USBPD_CC_PIN_CONFIG2 0x06
+#ifndef CONFIG_USB_PD_TCPM_ITE_ON_CHIP
+#define CONFIG_USB_PD_ITE_ACTIVE_PORT_COUNT 0
+#endif
+
#define TASK_EVENT_PHY_TX_DONE TASK_EVENT_CUSTOM_BIT(PD_EVENT_FIRST_FREE_BIT)
#define SET_MASK(reg, bit_mask) ((reg) |= (bit_mask))
diff --git a/include/config.h b/include/config.h
index 139809a918..03a77d088d 100644
--- a/include/config.h
+++ b/include/config.h
@@ -3815,6 +3815,12 @@
/* Number of USB PD ports */
#undef CONFIG_USB_PD_PORT_MAX_COUNT
+/*
+ * Number of ITE USB PD active ports
+ * NOTE: The active port usage should follow the order of ITE TCPC port index.
+ */
+#undef CONFIG_USB_PD_ITE_ACTIVE_PORT_COUNT
+
/* Simple DFP, such as power adapter, will not send discovery VDM on connect */
#undef CONFIG_USB_PD_SIMPLE_DFP