summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorScott Chao <scott_chao@wistron.corp-partner.google.com>2022-03-28 10:48:10 +0800
committerChromeos LUCI <chromeos-scoped@luci-project-accounts.iam.gserviceaccount.com>2022-04-01 07:14:17 +0000
commitdeea95594b472407a652ed3067c73d38b3db80b7 (patch)
tree2a73a831dc163a7bcd67492f80bcc1a96e0020ad
parent1323aa8603aa12331d6d581b5e98fbd002fa513e (diff)
downloadchrome-ec-deea95594b472407a652ed3067c73d38b3db80b7.tar.gz
moli: update gpio configuration
- Follow Moli GPIO Table_20220324.xlsx to modify the GPIO. - Add second charging port. - Add second TCPC/ PPC/ BC1.2/ BB retimer. - Modify IOexpander GPIO. - Correct USBC2 to USBC1. BUG=b:220670917 BRANCH=none TEST=make -j BOARD=moli Change-Id: I23c6546ff0e1fd3fec857b8ab8facaf462e7f0ef Signed-off-by: Scott Chao <scott_chao@wistron.corp-partner.google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3554181 Reviewed-by: Boris Mittelberg <bmbm@google.com>
-rw-r--r--board/moli/board.c1
-rw-r--r--board/moli/board.h14
-rw-r--r--board/moli/ec.tasklist5
-rw-r--r--board/moli/gpio.inc55
-rw-r--r--board/moli/i2c.c24
-rw-r--r--board/moli/usbc_config.c72
-rw-r--r--board/moli/usbc_config.h3
7 files changed, 110 insertions, 64 deletions
diff --git a/board/moli/board.c b/board/moli/board.c
index 10b4de5589..b22b9aa50b 100644
--- a/board/moli/board.c
+++ b/board/moli/board.c
@@ -83,6 +83,7 @@ int board_set_active_charge_port(int port)
switch (port) {
case CHARGE_PORT_TYPEC0:
+ case CHARGE_PORT_TYPEC1:
case CHARGE_PORT_BARRELJACK:
/* Make sure BJ adapter is sourcing power */
if (gpio_get_level(GPIO_BJ_ADP_PRESENT_ODL))
diff --git a/board/moli/board.h b/board/moli/board.h
index 4a94ff73e9..5569e7fc88 100644
--- a/board/moli/board.h
+++ b/board/moli/board.h
@@ -33,7 +33,7 @@
#define CONFIG_IO_EXPANDER
#define CONFIG_IO_EXPANDER_NCT38XX
-#define CONFIG_IO_EXPANDER_PORT_COUNT 1
+#define CONFIG_IO_EXPANDER_PORT_COUNT 2
#define CONFIG_USB_PD_PPC
#define CONFIG_USBC_RETIMER_INTEL_BB
@@ -90,14 +90,14 @@
/* I2C Bus Configuration */
-#define I2C_PORT_USB_C0_C2_TCPC NPCX_I2C_PORT1_0
+#define I2C_PORT_USB_C0_C1_TCPC NPCX_I2C_PORT1_0
-#define I2C_PORT_USB_C0_C2_PPC NPCX_I2C_PORT2_0
+#define I2C_PORT_USB_C0_C1_PPC NPCX_I2C_PORT2_0
#define I2C_PORT_USB_A0_A1_MIX NPCX_I2C_PORT6_1
-#define I2C_PORT_USB_C0_C2_BC12 NPCX_I2C_PORT2_0
+#define I2C_PORT_USB_C0_C1_BC12 NPCX_I2C_PORT2_0
-#define I2C_PORT_USB_C0_C2_MUX NPCX_I2C_PORT3_0
+#define I2C_PORT_USB_C0_C1_MUX NPCX_I2C_PORT3_0
#define I2C_PORT_QI NPCX_I2C_PORT5_0
#define I2C_PORT_EEPROM NPCX_I2C_PORT7_0
@@ -108,7 +108,7 @@
#define I2C_ADDR_MP2964_FLAGS 0x20
#define USBC_PORT_C0_BB_RETIMER_I2C_ADDR 0x58
-#define USBC_PORT_C2_BB_RETIMER_I2C_ADDR 0x59
+#define USBC_PORT_C1_BB_RETIMER_I2C_ADDR 0x59
/* Enabling Thunderbolt-compatible mode */
#define CONFIG_USB_PD_TBT_COMPAT_MODE
@@ -145,6 +145,7 @@
enum charge_port {
CHARGE_PORT_TYPEC0,
+ CHARGE_PORT_TYPEC1,
CHARGE_PORT_BARRELJACK,
CHARGE_PORT_ENUM_COUNT
};
@@ -168,6 +169,7 @@ enum temp_sensor_id {
enum ioex_port {
IOEX_C0_NCT38XX = 0,
+ IOEX_C1_NCT38XX,
IOEX_PORT_COUNT
};
diff --git a/board/moli/ec.tasklist b/board/moli/ec.tasklist
index ebabe8ef51..f51cbddd1b 100644
--- a/board/moli/ec.tasklist
+++ b/board/moli/ec.tasklist
@@ -14,7 +14,6 @@
TASK_ALWAYS(HOOKS, hook_task, NULL, LARGER_TASK_STACK_SIZE) \
TASK_ALWAYS(USB_CHG_P0, usb_charger_task, 0, TASK_STACK_SIZE) \
TASK_ALWAYS(USB_CHG_P1, usb_charger_task, 0, TASK_STACK_SIZE) \
- TASK_ALWAYS(USB_CHG_P2, usb_charger_task, 0, TASK_STACK_SIZE) \
TASK_NOTEST(CHIPSET, chipset_task, NULL, LARGER_TASK_STACK_SIZE) \
TASK_ALWAYS(USB_MUX, usb_mux_task, NULL, VENTI_TASK_STACK_SIZE) \
TASK_ALWAYS(HOSTCMD, host_command_task, NULL, LARGER_TASK_STACK_SIZE) \
@@ -22,7 +21,5 @@
TASK_ALWAYS(POWERBTN, power_button_task, NULL, LARGER_TASK_STACK_SIZE) \
TASK_ALWAYS(PD_C0, pd_task, NULL, VENTI_TASK_STACK_SIZE) \
TASK_ALWAYS(PD_C1, pd_task, NULL, VENTI_TASK_STACK_SIZE) \
- TASK_ALWAYS(PD_C2, pd_task, NULL, VENTI_TASK_STACK_SIZE) \
- TASK_ALWAYS(PD_INT_C0, pd_shared_alert_task, (BIT(2) | BIT(0)), LARGER_TASK_STACK_SIZE) \
- TASK_ALWAYS(PD_INT_C1, pd_interrupt_handler_task, 1, LARGER_TASK_STACK_SIZE) \
+ TASK_ALWAYS(PD_INT_C0, pd_shared_alert_task, (BIT(1) | BIT(0)), LARGER_TASK_STACK_SIZE) \
TASK_ALWAYS(CEC, cec_task, NULL, LARGER_TASK_STACK_SIZE)
diff --git a/board/moli/gpio.inc b/board/moli/gpio.inc
index fb3043e03c..73ff3d5e45 100644
--- a/board/moli/gpio.inc
+++ b/board/moli/gpio.inc
@@ -17,11 +17,14 @@ GPIO_INT(SLP_S3_L, PIN(A, 5), GPIO_INT_BOTH, power_signal_inte
GPIO_INT(SLP_SUS_L, PIN(F, 1), GPIO_INT_BOTH, power_signal_interrupt)
GPIO_INT(SYS_SLP_S0IX_L, PIN(D, 5), GPIO_INT_BOTH, power_signal_interrupt)
GPIO_INT(USB_C0_BC12_INT_ODL, PIN(C, 6), GPIO_INT_FALLING, bc12_interrupt)
-GPIO_INT(USB_C0_C2_TCPC_INT_ODL, PIN(E, 0), GPIO_INT_FALLING, tcpc_alert_event)
+GPIO_INT(USB_C0_C1_TCPC_INT_ODL, PIN(E, 0), GPIO_INT_FALLING, tcpc_alert_event)
GPIO_INT(USB_C0_PPC_INT_ODL, PIN(6, 2), GPIO_INT_FALLING, ppc_interrupt)
GPIO_INT(USB_C0_RT_INT_ODL, PIN(B, 1), GPIO_INT_FALLING, retimer_interrupt)
GPIO_INT(BJ_ADP_PRESENT_ODL, PIN(8, 2), GPIO_INT_BOTH | GPIO_PULL_UP, adp_connect_interrupt)
GPIO_INT(EC_RECOVERY_BTN_ODL, PIN(2, 3), GPIO_INT_BOTH, button_interrupt)
+GPIO_INT(USB_C1_RT_INT_ODL, PIN(4, 1), GPIO_INT_FALLING, retimer_interrupt)
+GPIO_INT(USB_C1_BC12_INT_ODL, PIN(8, 3), GPIO_INT_FALLING, bc12_interrupt)
+GPIO_INT(USB_C1_PPC_INT_ODL, PIN(7, 0), GPIO_INT_FALLING, ppc_interrupt)
/* CCD */
GPIO(CCD_MODE_ODL, PIN(E, 5), GPIO_INPUT)
@@ -80,24 +83,26 @@ GPIO(EC_I2C_QI_INT_ODL, PIN(9, 6), GPIO_INPUT)
GPIO(HDMI_CEC_IN, PIN(4, 0), GPIO_INPUT)
GPIO(HDMI_CEC_OUT, PIN(D, 3), GPIO_OUT_HIGH | GPIO_OPEN_DRAIN)
GPIO(HDMI_CEC_PULL_UP, PIN(C, 2), GPIO_OUT_HIGH)
+GPIO(HDMI2_CEC_PULL_UP, PIN(F, 3), GPIO_OUT_HIGH)
+GPIO(HDMI2_CEC_OUT, PIN(F, 2), GPIO_OUT_HIGH | GPIO_OPEN_DRAIN)
+GPIO(HDMI2_CEC_IN, PIN(A, 7), GPIO_INPUT)
/* I2C SCL/SDA */
GPIO(EC_I2C_QI_SCL, PIN(3, 3), GPIO_INPUT)
GPIO(EC_I2C_QI_SDA, PIN(3, 6), GPIO_INPUT)
GPIO(EC_I2C_MISC_SCL, PIN(B, 3), GPIO_INPUT)
GPIO(EC_I2C_MISC_SDA, PIN(B, 2), GPIO_INPUT)
-GPIO(EC_I2C_USB_C0_C2_PPC_BC_SCL, PIN(9, 2), GPIO_INPUT)
-GPIO(EC_I2C_USB_C0_C2_PPC_BC_SDA, PIN(9, 1), GPIO_INPUT)
-GPIO(EC_I2C_USB_C0_C2_RT_SCL, PIN(D, 1), GPIO_INPUT)
-GPIO(EC_I2C_USB_C0_C2_RT_SDA, PIN(D, 0), GPIO_INPUT)
-GPIO(EC_I2C_USB_C0_C2_TCPC_SCL, PIN(9, 0), GPIO_INPUT)
-GPIO(EC_I2C_USB_C0_C2_TCPC_SDA, PIN(8, 7), GPIO_INPUT)
+GPIO(EC_I2C_USB_C0_C1_PPC_BC_SCL, PIN(9, 2), GPIO_INPUT)
+GPIO(EC_I2C_USB_C0_C1_PPC_BC_SDA, PIN(9, 1), GPIO_INPUT)
+GPIO(EC_I2C_USB_C0_C1_RT_SCL, PIN(D, 1), GPIO_INPUT)
+GPIO(EC_I2C_USB_C0_C1_RT_SDA, PIN(D, 0), GPIO_INPUT)
+GPIO(EC_I2C_USB_C0_C1_TCPC_SCL, PIN(9, 0), GPIO_INPUT)
+GPIO(EC_I2C_USB_C0_C1_TCPC_SDA, PIN(8, 7), GPIO_INPUT)
GPIO(EC_I2C_USB_A0_A1_MIX_SCL, PIN(E, 4), GPIO_INPUT)
GPIO(EC_I2C_USB_A0_A1_MIX_SDA, PIN(E, 3), GPIO_INPUT)
/* USBA */
GPIO(EN_PP5000_USBA, PIN(D, 7), GPIO_OUT_LOW)
-GPIO(USB_A0_OC_ODL, PIN(3, 1), GPIO_INPUT | GPIO_PULL_UP)
GPIO(USB_A1_OC_ODL, PIN(3, 0), GPIO_INPUT | GPIO_PULL_UP)
GPIO(USB_A2_OC_ODL, PIN(2, 7), GPIO_INPUT | GPIO_PULL_UP)
GPIO(USB_A3_OC_ODL, PIN(2, 6), GPIO_INPUT | GPIO_PULL_UP)
@@ -105,38 +110,31 @@ GPIO(USB_A4_OC_ODL, PIN(0, 6), GPIO_INPUT | GPIO_PULL_UP)
GPIO(USB_A0_STATUS_L, PIN(2, 1), GPIO_INPUT)
GPIO(USB_A1_STATUS_L, PIN(2, 0), GPIO_INPUT)
GPIO(USB_A2_STATUS_L, PIN(1, 7), GPIO_INPUT)
-GPIO(USB_A_LOW_PWR0_OD, PIN(1, 5), GPIO_INPUT | GPIO_PULL_DOWN)
GPIO(USB_A_LOW_PWR1_OD, PIN(1, 4), GPIO_INPUT | GPIO_PULL_DOWN)
GPIO(USB_A_LOW_PWR2_OD, PIN(1, 1), GPIO_INPUT | GPIO_PULL_DOWN)
GPIO(USB_A_OC_SOC_L, PIN(8, 0), GPIO_OUT_HIGH)
-/* LED */
-/* TODO(b/197471359): LED implementation */
-GPIO(LED_1_L, PIN(C, 3), GPIO_OUT_LOW)
-GPIO(LED_2_L, PIN(C, 4), GPIO_OUT_LOW)
-
/* USBC */
-GPIO(USB_C0_C2_TCPC_RST_ODL, PIN(A, 7), GPIO_ODR_LOW)
+GPIO(USB_C0_C1_TCPC_RST_ODL, PIN(F, 5), GPIO_ODR_LOW)
/* LAN */
GPIO(LAN_PWR_GOOD, PIN(0, 2), GPIO_INPUT)
/* Option Board */
GPIO(HDMI1_MONITOR_ON, PIN(B, 4), GPIO_INPUT)
-GPIO(HDMI1_MONON_SIO, PIN(1, 6), GPIO_OUT_LOW)
+GPIO(HDMI1_MONON_SIO, PIN(1, 6), GPIO_ODR_LOW)
GPIO(OPTION_MONITOR_ON, PIN(1, 0), GPIO_INPUT)
-GPIO(DP1_MONITOR_ON, PIN(B, 5), GPIO_INPUT)
-GPIO(OPTION_MONON_SIO, PIN(4, 1), GPIO_OUT_LOW)
-GPIO(DP1_MONON_SIO, PIN(8, 3), GPIO_OUT_LOW)
-
-/* GPIO02_P1 to PU */
-/* GPIO03_P1 to PU */
-IOEX(NCT_3807_GPIO02_P1, EXPIN(IOEX_C0_NCT38XX, 0, 2), GPIO_ODR_LOW)
-IOEX(DBGACC_CONN_P1_L, EXPIN(IOEX_C0_NCT38XX, 0, 3), GPIO_ODR_HIGH)
-IOEX(USB_C0_FRS_EN, EXPIN(IOEX_C0_NCT38XX, 0, 4), GPIO_LOW)
-IOEX(USB_C0_OC_ODL, EXPIN(IOEX_C0_NCT38XX, 0, 6), GPIO_ODR_HIGH)
+GPIO(HDMI2_MONITOR_ON, PIN(B, 5), GPIO_INPUT)
+GPIO(HDMI2_MONON_SIO, PIN(1, 5), GPIO_ODR_LOW)
+
+IOEX(USB_C0_OC_ODL, EXPIN(IOEX_C0_NCT38XX, 0, 1), GPIO_ODR_HIGH)
+IOEX(USB_C0_FRS_EN, EXPIN(IOEX_C0_NCT38XX, 0, 6), GPIO_LOW)
IOEX(USB_C0_RT_RST_ODL, EXPIN(IOEX_C0_NCT38XX, 0, 7), GPIO_ODR_LOW)
+IOEX(USB_C1_OC_ODL, EXPIN(IOEX_C1_NCT38XX, 0, 1), GPIO_ODR_HIGH)
+IOEX(USB_C1_RT_RST_ODL, EXPIN(IOEX_C1_NCT38XX, 0, 2), GPIO_ODR_LOW)
+IOEX(USB_C1_FRS_EN, EXPIN(IOEX_C1_NCT38XX, 0, 6), GPIO_LOW)
+
/* UART alternate functions */
ALTERNATE(PIN_MASK(6, 0x30), 0, MODULE_UART, 0) /* GPIO64/CR_SIN1, GPO65/CR_SOUT1/FLPRG1_L */
@@ -160,6 +158,7 @@ ALTERNATE(PIN_MASK(E, 0x02), 0, MODULE_ADC, 0) /* GPIOE1/ADC7 */
/* Unused Pins */
UNUSED(PIN(D, 6)) /* GPOD6/CR_SOUT3/SHDF_ESPI_L */
+UNUSED(PIN(3, 1)) /* KSI0/GPIO31/TRACEDATA3/GP_MOSI */
UNUSED(PIN(3, 2)) /* GPO32/TRIS_L */
UNUSED(PIN(3, 5)) /* GPO35/CR_SOUT4/TEST_L */
UNUSED(PIN(6, 6)) /* GPIO66 */
@@ -172,9 +171,5 @@ UNUSED(PIN(1, 2)) /* KSO07/GPO12/JEN# */
UNUSED(PIN(0, 4)) /* KSO13/GPIO04 */
UNUSED(PIN(A, 2)) /* F_SCLK/GPIOA2 */
UNUSED(PIN(5, 0)) /* GPIO50 */
-UNUSED(PIN(7, 0)) /* GPIO70/PS2_DAT0 */
UNUSED(PIN(9, 4)) /* GPIO94 */
-UNUSED(PIN(F, 5)) /* GPIOF5/I2C5_SCL1 */
-UNUSED(PIN(F, 3)) /* GPIOF3/I2C4_SCL1 */
-UNUSED(PIN(F, 2)) /* GPIOF2/I2C4_SDA1 */
UNUSED(PIN(A, 0)) /* F_CS0_L/GPIOA0 */
diff --git a/board/moli/i2c.c b/board/moli/i2c.c
index e644c7ade7..534cc89a57 100644
--- a/board/moli/i2c.c
+++ b/board/moli/i2c.c
@@ -12,27 +12,27 @@
const struct i2c_port_t i2c_ports[] = {
{
/* I2C1 */
- .name = "tcpc0,2",
- .port = I2C_PORT_USB_C0_C2_TCPC,
+ .name = "tcpc0,1",
+ .port = I2C_PORT_USB_C0_C1_TCPC,
.kbps = 1000,
- .scl = GPIO_EC_I2C_USB_C0_C2_TCPC_SCL,
- .sda = GPIO_EC_I2C_USB_C0_C2_TCPC_SDA,
+ .scl = GPIO_EC_I2C_USB_C0_C1_TCPC_SCL,
+ .sda = GPIO_EC_I2C_USB_C0_C1_TCPC_SDA,
},
{
/* I2C2 */
- .name = "ppc0,2",
- .port = I2C_PORT_USB_C0_C2_PPC,
+ .name = "ppc0,1",
+ .port = I2C_PORT_USB_C0_C1_PPC,
.kbps = 1000,
- .scl = GPIO_EC_I2C_USB_C0_C2_PPC_BC_SCL,
- .sda = GPIO_EC_I2C_USB_C0_C2_PPC_BC_SDA,
+ .scl = GPIO_EC_I2C_USB_C0_C1_PPC_BC_SCL,
+ .sda = GPIO_EC_I2C_USB_C0_C1_PPC_BC_SDA,
},
{
/* I2C3 */
- .name = "retimer0,2",
- .port = I2C_PORT_USB_C0_C2_MUX,
+ .name = "retimer0,1",
+ .port = I2C_PORT_USB_C0_C1_MUX,
.kbps = 1000,
- .scl = GPIO_EC_I2C_USB_C0_C2_RT_SCL,
- .sda = GPIO_EC_I2C_USB_C0_C2_RT_SDA,
+ .scl = GPIO_EC_I2C_USB_C0_C1_RT_SCL,
+ .sda = GPIO_EC_I2C_USB_C0_C1_RT_SDA,
},
{
/* I2C5 */
diff --git a/board/moli/usbc_config.c b/board/moli/usbc_config.c
index e2b8335e8c..9aad900ffb 100644
--- a/board/moli/usbc_config.c
+++ b/board/moli/usbc_config.c
@@ -38,13 +38,22 @@ const struct tcpc_config_t tcpc_config[] = {
[USBC_PORT_C0] = {
.bus_type = EC_BUS_TYPE_I2C,
.i2c_info = {
- .port = I2C_PORT_USB_C0_C2_TCPC,
+ .port = I2C_PORT_USB_C0_C1_TCPC,
.addr_flags = NCT38XX_I2C_ADDR1_1_FLAGS,
},
.drv = &nct38xx_tcpm_drv,
.flags = TCPC_FLAGS_TCPCI_REV2_0 |
TCPC_FLAGS_NO_DEBUG_ACC_CONTROL,
},
+ [USBC_PORT_C1] = {
+ .bus_type = EC_BUS_TYPE_I2C,
+ .i2c_info = {
+ .port = I2C_PORT_USB_C0_C1_TCPC,
+ .addr_flags = NCT38XX_I2C_ADDR2_1_FLAGS,
+ },
+ .drv = &nct38xx_tcpm_drv,
+ .flags = TCPC_FLAGS_TCPCI_REV2_0,
+ },
};
BUILD_ASSERT(ARRAY_SIZE(tcpc_config) == USBC_PORT_COUNT);
BUILD_ASSERT(CONFIG_USB_PD_PORT_MAX_COUNT == USBC_PORT_COUNT);
@@ -52,10 +61,15 @@ BUILD_ASSERT(CONFIG_USB_PD_PORT_MAX_COUNT == USBC_PORT_COUNT);
/* USBC PPC configuration */
struct ppc_config_t ppc_chips[] = {
[USBC_PORT_C0] = {
- .i2c_port = I2C_PORT_USB_C0_C2_PPC,
+ .i2c_port = I2C_PORT_USB_C0_C1_PPC,
.i2c_addr_flags = SYV682X_ADDR0_FLAGS,
.drv = &syv682x_drv,
},
+ [USBC_PORT_C1] = {
+ .i2c_port = I2C_PORT_USB_C0_C1_PPC,
+ .i2c_addr_flags = SYV682X_ADDR2_FLAGS,
+ .drv = &syv682x_drv,
+ },
};
BUILD_ASSERT(ARRAY_SIZE(ppc_chips) == USBC_PORT_COUNT);
@@ -68,24 +82,42 @@ static const struct usb_mux usbc0_tcss_usb_mux = {
.hpd_update = &virtual_hpd_update,
};
+static const struct usb_mux usbc1_tcss_usb_mux = {
+ .usb_port = USBC_PORT_C1,
+ .driver = &virtual_usb_mux_driver,
+ .hpd_update = &virtual_hpd_update,
+};
+
const struct usb_mux usb_muxes[] = {
[USBC_PORT_C0] = {
.usb_port = USBC_PORT_C0,
.driver = &bb_usb_retimer,
.hpd_update = bb_retimer_hpd_update,
- .i2c_port = I2C_PORT_USB_C0_C2_MUX,
+ .i2c_port = I2C_PORT_USB_C0_C1_MUX,
.i2c_addr_flags = USBC_PORT_C0_BB_RETIMER_I2C_ADDR,
.next_mux = &usbc0_tcss_usb_mux,
},
+ [USBC_PORT_C1] = {
+ .usb_port = USBC_PORT_C1,
+ .driver = &bb_usb_retimer,
+ .hpd_update = bb_retimer_hpd_update,
+ .i2c_port = I2C_PORT_USB_C0_C1_MUX,
+ .i2c_addr_flags = USBC_PORT_C1_BB_RETIMER_I2C_ADDR,
+ .next_mux = &usbc1_tcss_usb_mux,
+ },
};
BUILD_ASSERT(ARRAY_SIZE(usb_muxes) == USBC_PORT_COUNT);
/* BC1.2 charger detect configuration */
const struct pi3usb9201_config_t pi3usb9201_bc12_chips[] = {
[USBC_PORT_C0] = {
- .i2c_port = I2C_PORT_USB_C0_C2_BC12,
+ .i2c_port = I2C_PORT_USB_C0_C1_BC12,
.i2c_addr_flags = PI3USB9201_I2C_ADDR_3_FLAGS,
},
+ [USBC_PORT_C1] = {
+ .i2c_port = I2C_PORT_USB_C0_C1_BC12,
+ .i2c_addr_flags = PI3USB9201_I2C_ADDR_1_FLAGS,
+ },
};
BUILD_ASSERT(ARRAY_SIZE(pi3usb9201_bc12_chips) == USBC_PORT_COUNT);
@@ -100,11 +132,17 @@ BUILD_ASSERT(ARRAY_SIZE(pi3usb9201_bc12_chips) == USBC_PORT_COUNT);
struct ioexpander_config_t ioex_config[] = {
[IOEX_C0_NCT38XX] = {
- .i2c_host_port = I2C_PORT_USB_C0_C2_TCPC,
+ .i2c_host_port = I2C_PORT_USB_C0_C1_TCPC,
.i2c_addr_flags = NCT38XX_I2C_ADDR1_1_FLAGS,
.drv = &nct38xx_ioexpander_drv,
.flags = IOEX_FLAGS_DEFAULT_INIT_DISABLED,
},
+ [IOEX_C1_NCT38XX] = {
+ .i2c_host_port = I2C_PORT_USB_C0_C1_TCPC,
+ .i2c_addr_flags = NCT38XX_I2C_ADDR2_1_FLAGS,
+ .drv = &nct38xx_ioexpander_drv,
+ .flags = IOEX_FLAGS_DEFAULT_INIT_DISABLED,
+ },
};
BUILD_ASSERT(ARRAY_SIZE(ioex_config) == CONFIG_IO_EXPANDER_PORT_COUNT);
@@ -114,6 +152,8 @@ __override int bb_retimer_power_enable(const struct usb_mux *me, bool enable)
if (me->usb_port == USBC_PORT_C0) {
rst_signal = IOEX_USB_C0_RT_RST_ODL;
+ } else if (me->usb_port == USBC_PORT_C1) {
+ rst_signal = IOEX_USB_C1_RT_RST_ODL;
} else {
return EC_ERROR_INVAL;
}
@@ -161,7 +201,7 @@ void board_reset_pd_mcu(void)
{
enum gpio_signal tcpc_rst;
- tcpc_rst = GPIO_USB_C0_C2_TCPC_RST_ODL;
+ tcpc_rst = GPIO_USB_C0_C1_TCPC_RST_ODL;
/*
* TODO(b/179648104): figure out correct timing
@@ -195,17 +235,19 @@ static void board_tcpc_init(void)
/*
* These IO expander pins are implemented using the
- * C0/C2 TCPC, so they must be set up after the TCPC has
+ * C0/C1 TCPC, so they must be set up after the TCPC has
* been taken out of reset.
*/
enable_ioex(IOEX_C0_NCT38XX);
+ enable_ioex(IOEX_C1_NCT38XX);
}
/* Enable PPC interrupts. */
gpio_enable_interrupt(GPIO_USB_C0_PPC_INT_ODL);
+ gpio_enable_interrupt(GPIO_USB_C1_PPC_INT_ODL);
/* Enable TCPC interrupts. */
- gpio_enable_interrupt(GPIO_USB_C0_C2_TCPC_INT_ODL);
+ gpio_enable_interrupt(GPIO_USB_C0_C1_TCPC_INT_ODL);
}
DECLARE_HOOK(HOOK_INIT, board_tcpc_init, HOOK_PRIO_INIT_CHIPSET);
@@ -213,8 +255,8 @@ uint16_t tcpc_get_alert_status(void)
{
uint16_t status = 0;
- if (gpio_get_level(GPIO_USB_C0_C2_TCPC_INT_ODL) == 0)
- status |= PD_STATUS_TCPC_ALERT_0 | PD_STATUS_TCPC_ALERT_2;
+ if (gpio_get_level(GPIO_USB_C0_C1_TCPC_INT_ODL) == 0)
+ status |= PD_STATUS_TCPC_ALERT_0 | PD_STATUS_TCPC_ALERT_1;
return status;
}
@@ -223,13 +265,15 @@ int ppc_get_alert_status(int port)
{
if (port == USBC_PORT_C0)
return gpio_get_level(GPIO_USB_C0_PPC_INT_ODL) == 0;
+ else if (port == USBC_PORT_C1)
+ return gpio_get_level(GPIO_USB_C1_PPC_INT_ODL) == 0;
return 0;
}
void tcpc_alert_event(enum gpio_signal signal)
{
switch (signal) {
- case GPIO_USB_C0_C2_TCPC_INT_ODL:
+ case GPIO_USB_C0_C1_TCPC_INT_ODL:
schedule_deferred_pd_interrupt(USBC_PORT_C0);
break;
default:
@@ -243,6 +287,9 @@ void bc12_interrupt(enum gpio_signal signal)
case GPIO_USB_C0_BC12_INT_ODL:
task_set_event(TASK_ID_USB_CHG_P0, USB_CHG_EVENT_BC12);
break;
+ case GPIO_USB_C1_BC12_INT_ODL:
+ task_set_event(TASK_ID_USB_CHG_P1, USB_CHG_EVENT_BC12);
+ break;
default:
break;
}
@@ -254,6 +301,9 @@ void ppc_interrupt(enum gpio_signal signal)
case GPIO_USB_C0_PPC_INT_ODL:
syv682x_interrupt(USBC_PORT_C0);
break;
+ case GPIO_USB_C1_PPC_INT_ODL:
+ syv682x_interrupt(USBC_PORT_C1);
+ break;
default:
break;
}
diff --git a/board/moli/usbc_config.h b/board/moli/usbc_config.h
index b294eb69c8..002f4803b7 100644
--- a/board/moli/usbc_config.h
+++ b/board/moli/usbc_config.h
@@ -8,10 +8,11 @@
#ifndef __CROS_EC_USBC_CONFIG_H
#define __CROS_EC_USBC_CONFIG_H
-#define CONFIG_USB_PD_PORT_MAX_COUNT 1
+#define CONFIG_USB_PD_PORT_MAX_COUNT 2
enum usbc_port {
USBC_PORT_C0 = 0,
+ USBC_PORT_C1,
USBC_PORT_COUNT
};