summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLu Zhang <lu.zhang@bitland.corp-partner.google.com>2020-06-10 16:03:23 +0800
committerCommit Bot <commit-bot@chromium.org>2020-06-11 09:57:16 +0000
commitf8f4a60129ca984b6c1e95ba57f68c74d82ba045 (patch)
treee00e245c2c1f9895d238eda41f4900d7672079c3
parent2dd31c0c7e4f23233830ceb09724896cfe50541c (diff)
downloadchrome-ec-f8f4a60129ca984b6c1e95ba57f68c74d82ba045.tar.gz
vilboz: Remove ioex C1 and config the ioexpander gpio
BUG=b:158125500 BRANCH=none TEST=make buildall -j Signed-off-by: Lu Zhang <lu.zhang@bitland.corp-partner.google.com> Change-Id: Ica8cdd8f0b14f612f17018a3a95df5a23a6ad43f Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2239593 Reviewed-by: Edward Hill <ecgh@chromium.org> Reviewed-by: Peter Marheine <pmarheine@chromium.org>
-rw-r--r--baseboard/zork/baseboard.c15
-rw-r--r--baseboard/zork/baseboard.h8
-rw-r--r--baseboard/zork/variant_trembyle.c17
-rw-r--r--board/dalboz/board.c16
-rw-r--r--board/dalboz/board.h6
-rw-r--r--board/vilboz/board.c38
-rw-r--r--board/vilboz/board.h8
-rw-r--r--board/vilboz/ec.tasklist1
-rw-r--r--board/vilboz/gpio.inc16
9 files changed, 67 insertions, 58 deletions
diff --git a/baseboard/zork/baseboard.c b/baseboard/zork/baseboard.c
index 41fda62343..204a133f32 100644
--- a/baseboard/zork/baseboard.c
+++ b/baseboard/zork/baseboard.c
@@ -114,21 +114,6 @@ int board_aoz1380_set_vbus_source_current_limit(int port,
return rv;
}
-int board_tcpc_fast_role_swap_enable(int port, int enable)
-{
- int rv = EC_SUCCESS;
-
- /* Use the TCPC to enable fast switch when FRS included */
- if (port == USBC_PORT_C0) {
- rv = ioex_set_level(IOEX_USB_C0_TCPC_FASTSW_CTL_EN,
- !!enable);
- } else {
- rv = ioex_set_level(IOEX_USB_C1_TCPC_FASTSW_CTL_EN,
- !!enable);
- }
-
- return rv;
-}
static void baseboard_chipset_suspend(void)
{
/* Disable display and keyboard backlights. */
diff --git a/baseboard/zork/baseboard.h b/baseboard/zork/baseboard.h
index 287f6293c9..6de9bf2296 100644
--- a/baseboard/zork/baseboard.h
+++ b/baseboard/zork/baseboard.h
@@ -165,7 +165,6 @@
#define CONFIG_USBC_VCONN
#define CONFIG_USBC_VCONN_SWAP
#define CONFIG_USB_MUX_AMD_FP5
-#define CONFIG_USB_MUX_RUNTIME_CONFIG
#if defined(VARIANT_ZORK_TREMBYLE)
#define CONFIG_USB_PD_PORT_MAX_COUNT 2
@@ -173,9 +172,12 @@
#define CONFIG_USBC_RETIMER_PS8802
#define CONFIG_USBC_RETIMER_PS8818
#define CONFIG_IO_EXPANDER_PORT_COUNT USBC_PORT_COUNT
+ #define CONFIG_USB_MUX_RUNTIME_CONFIG
+ /* USB-A config */
+ #define GPIO_USB1_ILIM_SEL IOEX_USB_A0_CHARGE_EN_L
+ #define GPIO_USB2_ILIM_SEL IOEX_USB_A1_CHARGE_EN_DB_L
#elif defined(VARIANT_ZORK_DALBOZ)
#define CONFIG_IO_EXPANDER_PORT_COUNT IOEX_PORT_COUNT
- #define CONFIG_USB_PORT_ENABLE_DYNAMIC
#endif
/* USB-A config */
@@ -184,8 +186,6 @@
#define CONFIG_USB_PORT_POWER_SMART_CDP_SDP_ONLY
#define CONFIG_USB_PORT_POWER_SMART_DEFAULT_MODE USB_CHARGE_MODE_CDP
#define CONFIG_USB_PORT_POWER_SMART_INVERTED
-#define GPIO_USB1_ILIM_SEL IOEX_USB_A0_CHARGE_EN_L
-#define GPIO_USB2_ILIM_SEL IOEX_USB_A1_CHARGE_EN_DB_L
#define PD_POWER_SUPPLY_TURN_ON_DELAY 30000 /* us */
#define PD_POWER_SUPPLY_TURN_OFF_DELAY 30000 /* us */
diff --git a/baseboard/zork/variant_trembyle.c b/baseboard/zork/variant_trembyle.c
index 3e76cc2bdf..00204ca523 100644
--- a/baseboard/zork/variant_trembyle.c
+++ b/baseboard/zork/variant_trembyle.c
@@ -342,6 +342,23 @@ void tcpc_alert_event(enum gpio_signal signal)
schedule_deferred_pd_interrupt(port);
}
+
+int board_tcpc_fast_role_swap_enable(int port, int enable)
+{
+ int rv = EC_SUCCESS;
+
+ /* Use the TCPC to enable fast switch when FRS included */
+ if (port == USBC_PORT_C0) {
+ rv = ioex_set_level(IOEX_USB_C0_TCPC_FASTSW_CTL_EN,
+ !!enable);
+ } else {
+ rv = ioex_set_level(IOEX_USB_C1_TCPC_FASTSW_CTL_EN,
+ !!enable);
+ }
+
+ return rv;
+}
+
void bc12_interrupt(enum gpio_signal signal)
{
switch (signal) {
diff --git a/board/dalboz/board.c b/board/dalboz/board.c
index 7bb4c20a5f..3f82897b3b 100644
--- a/board/dalboz/board.c
+++ b/board/dalboz/board.c
@@ -479,6 +479,22 @@ void bc12_interrupt(enum gpio_signal signal)
}
}
+int board_tcpc_fast_role_swap_enable(int port, int enable)
+{
+ int rv = EC_SUCCESS;
+
+ /* Use the TCPC to enable fast switch when FRS included */
+ if (port == USBC_PORT_C0) {
+ rv = ioex_set_level(IOEX_USB_C0_TCPC_FASTSW_CTL_EN,
+ !!enable);
+ } else {
+ rv = ioex_set_level(IOEX_USB_C1_TCPC_FASTSW_CTL_EN,
+ !!enable);
+ }
+
+ return rv;
+}
+
static void setup_fw_config(void)
{
uint32_t board_version = 0;
diff --git a/board/dalboz/board.h b/board/dalboz/board.h
index 389aeb3587..99f92da64e 100644
--- a/board/dalboz/board.h
+++ b/board/dalboz/board.h
@@ -26,8 +26,14 @@
#define CONFIG_USBC_PPC_NX20P3483
#define CONFIG_USB_MUX_PS8740
#define CONFIG_USB_MUX_PS8743
+#define CONFIG_USB_MUX_RUNTIME_CONFIG
#define CONFIG_USB_PD_PORT_MAX_COUNT 2
+#define CONFIG_USB_PORT_ENABLE_DYNAMIC
+
+/* USB-A config */
+#define GPIO_USB1_ILIM_SEL IOEX_USB_A0_CHARGE_EN_L
+#define GPIO_USB2_ILIM_SEL IOEX_USB_A1_CHARGE_EN_DB_L
/* Power LEDs */
#define CONFIG_LED_POWER_LED
diff --git a/board/vilboz/board.c b/board/vilboz/board.c
index 9e3f6762bc..6a4313d5de 100644
--- a/board/vilboz/board.c
+++ b/board/vilboz/board.c
@@ -148,9 +148,6 @@ unsigned int motion_sensor_count = ARRAY_SIZE(motion_sensors);
#endif /* HAS_TASK_MOTIONSENSE */
-/* These IO expander GPIOs vary with DB option. */
-enum gpio_signal IOEX_USB_A1_CHARGE_EN_DB_L = IOEX_USB_A1_CHARGE_EN_DB_L_OPT1;
-
/*
* USB C0 port SBU mux use standalone FSUSB42UMX
* chip and it need a board specific driver.
@@ -185,7 +182,7 @@ const struct usb_mux usbc0_sbu_mux = {
.driver = &usbc0_sbu_mux_driver,
};
-struct usb_mux usb_muxes[] = {
+const struct usb_mux usb_muxes[] = {
[USBC_PORT_C0] = {
.usb_port = USBC_PORT_C0,
.i2c_port = I2C_PORT_USB_AP_MUX,
@@ -355,6 +352,19 @@ void tcpc_alert_event(enum gpio_signal signal)
schedule_deferred_pd_interrupt(port);
}
+int board_tcpc_fast_role_swap_enable(int port, int enable)
+{
+ int rv = EC_SUCCESS;
+
+ /* Use the TCPC to enable fast switch when FRS included */
+ if (port == USBC_PORT_C0) {
+ rv = ioex_set_level(IOEX_USB_C0_TCPC_FASTSW_CTL_EN,
+ !!enable);
+ }
+
+ return rv;
+}
+
void bc12_interrupt(enum gpio_signal signal)
{
switch (signal) {
@@ -369,16 +379,8 @@ void bc12_interrupt(enum gpio_signal signal)
static void setup_fw_config(void)
{
- if (ec_config_get_usb_db() == DALBOZ_DB_D_OPT2_USBA_HDMI) {
- ccprints("DB OPT2 HDMI");
- gpio_enable_interrupt(GPIO_HDMI_CONN_HPD_3V3);
- } else {
- ccprints("DB OPT1 USBC");
- ioex_config[IOEX_C1_NCT3807].flags = 0;
- ioex_init(IOEX_C1_NCT3807);
- IOEX_USB_A1_CHARGE_EN_DB_L = IOEX_USB_A1_CHARGE_EN_DB_L_OPT1;
- usb_port_enable[USBA_PORT_A1] = GPIO_EN_USB_A1_5V;
- }
+ /* Enable DB HDMI interrupts. */
+ gpio_enable_interrupt(GPIO_HDMI_CONN_HPD_3V3);
/* Enable PPC interrupts. */
gpio_enable_interrupt(GPIO_USB_C0_PPC_FAULT_ODL);
@@ -417,16 +419,10 @@ struct ioexpander_config_t ioex_config[] = {
.i2c_slave_addr = NCT38XX_I2C_ADDR1_1_FLAGS,
.drv = &nct38xx_ioexpander_drv,
},
- [IOEX_C1_NCT3807] = {
- .i2c_host_port = I2C_PORT_TCPC1,
- .i2c_slave_addr = NCT38XX_I2C_ADDR1_1_FLAGS,
- .drv = &nct38xx_ioexpander_drv,
- .flags = IOEX_FLAGS_DISABLED,
- },
};
BUILD_ASSERT(ARRAY_SIZE(ioex_config) == CONFIG_IO_EXPANDER_PORT_COUNT);
-int usb_port_enable[USBA_PORT_COUNT] = {
+const int usb_port_enable[USBA_PORT_COUNT] = {
IOEX_EN_USB_A0_5V,
GPIO_EN_USB_A1_5V,
};
diff --git a/board/vilboz/board.h b/board/vilboz/board.h
index cc159c16d4..fad708dd5c 100644
--- a/board/vilboz/board.h
+++ b/board/vilboz/board.h
@@ -24,6 +24,10 @@
#define CONFIG_USB_PD_PORT_MAX_COUNT 1
+/* USB-A config */
+#define GPIO_USB1_ILIM_SEL GPIO_USB_A0_CHARGE_EN_L
+#define GPIO_USB2_ILIM_SEL GPIO_USB_A1_CHARGE_EN_DB_L
+
/* Power LEDs */
#define CONFIG_LED_POWER_LED
@@ -86,7 +90,6 @@ enum pwm_channel {
enum ioex_port {
IOEX_C0_NCT3807 = 0,
- IOEX_C1_NCT3807,
IOEX_PORT_COUNT
};
@@ -174,9 +177,6 @@ static inline bool ec_config_has_hdmi_retimer_pi3hdx1204(void)
HAS_HDMI_RETIMER_PI3HDX1204);
}
-/* These IO expander GPIOs vary with DB option. */
-extern enum gpio_signal IOEX_USB_A1_CHARGE_EN_DB_L;
-
void board_reset_pd_mcu(void);
/* Common definition for the USB PD interrupt handlers. */
diff --git a/board/vilboz/ec.tasklist b/board/vilboz/ec.tasklist
index d56fd9da10..c45a43e848 100644
--- a/board/vilboz/ec.tasklist
+++ b/board/vilboz/ec.tasklist
@@ -10,7 +10,6 @@
#define CONFIG_TASK_LIST \
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, 1, TASK_STACK_SIZE) \
TASK_ALWAYS(CHARGER, charger_task, NULL, VENTI_TASK_STACK_SIZE) \
TASK_ALWAYS(MOTIONSENSE, motion_sense_task, NULL, VENTI_TASK_STACK_SIZE) \
TASK_NOTEST(CHIPSET, chipset_task, NULL, VENTI_TASK_STACK_SIZE) \
diff --git a/board/vilboz/gpio.inc b/board/vilboz/gpio.inc
index 4e458a6be0..a2b40b061d 100644
--- a/board/vilboz/gpio.inc
+++ b/board/vilboz/gpio.inc
@@ -54,8 +54,7 @@ GPIO(LED_CHRG_L, PIN(C, 0), GPIO_OUT_HIGH)
GPIO(LED3_PWM, PIN(C, 3), GPIO_OUT_HIGH)
/*
- * Dalboz has 2 DB options, with different IO expanders. IOEX_C1_NCT3807 is the
- * OPT1 DB (USB-C1), IOEX_HDMI_PCAL6408 is the OPT2 DB (HDMI).
+ * Vilboz has only 1 HDMI DB option
*/
IOEX(USB_C0_FAULT_ODL, EXPIN(IOEX_C0_NCT3807, 0, 3), GPIO_ODR_HIGH) /* C0 Fault to SOC */
IOEX(USB_C0_TCPC_FASTSW_CTL_EN, EXPIN(IOEX_C0_NCT3807, 0, 4), GPIO_OUT_LOW) /* C0 FastSwitch Control */
@@ -63,18 +62,9 @@ IOEX(USB_C0_PPC_ILIM_3A_EN, EXPIN(IOEX_C0_NCT3807, 1, 1), GPIO_OUT_LOW) /* C0 3A
IOEX(USB_C0_SBU_FAULT_ODL, EXPIN(IOEX_C0_NCT3807, 1, 2), GPIO_INPUT) /* C0 SBU Fault */
IOEX(KB_BL_EN, EXPIN(IOEX_C0_NCT3807, 1, 3), GPIO_OUT_LOW) /* KB Backlight Enable */
IOEX(EN_USB_A0_5V, EXPIN(IOEX_C0_NCT3807, 1, 5), GPIO_OUT_LOW) /* A0 5V Source Enable */
-IOEX(USB_A0_CHARGE_EN_L, EXPIN(IOEX_C0_NCT3807, 1, 6), GPIO_OUT_HIGH) /* A0 5V High Current Enable */
+UNIMPLEMENTED(USB_A0_CHARGE_EN_L)
IOEX(USB_C0_SBU_FLIP, EXPIN(IOEX_C0_NCT3807, 1, 7), GPIO_OUT_LOW) /* C0 SBU Flip */
-
-IOEX(USB_C1_HPD_IN_DB, EXPIN(IOEX_C1_NCT3807, 0, 2), GPIO_OUT_LOW) /* C1 HPD */
-IOEX(USB_C1_TCPC_FASTSW_CTL_EN, EXPIN(IOEX_C1_NCT3807, 0, 4), GPIO_OUT_LOW) /* C1 FastSwitch Control */
-IOEX(USB_C1_SBU_FAULT_DB_ODL, EXPIN(IOEX_C1_NCT3807, 1, 2), GPIO_INPUT) /* C1 SBU Fault */
-IOEX(USB_C1_PPC_EN_L, EXPIN(IOEX_C1_NCT3807, 1, 3), GPIO_OUT_LOW) /* C1 PPC Enable */
-IOEX(USB_C1_DATA_EN, EXPIN(IOEX_C1_NCT3807, 1, 5), GPIO_OUT_HIGH) /* C1 Retimer Enable */
-IOEX(EN_USB_A1_5V_DB_OPT1, EXPIN(IOEX_C1_NCT3807, 1, 6), GPIO_OUT_LOW) /* A1 5V Source Enable */
-IOEX(USB_A1_CHARGE_EN_DB_L_OPT1,EXPIN(IOEX_C1_NCT3807, 1, 7), GPIO_OUT_HIGH) /* A1 5V High Current Enable */
-
-
+UNIMPLEMENTED(USB_A1_CHARGE_EN_DB_L)
/*
* The NPCX LPC driver configures and controls SCI, so PCH_SCI_ODL [PIN(7, 6)]
* is not defined here as GPIO.