summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEdward Hill <ecgh@chromium.org>2020-03-17 20:59:46 -0600
committerCommit Bot <commit-bot@chromium.org>2020-03-20 18:14:19 +0000
commitd9f78047be7d7cc1d2e9279a6f2c3bac16c54af9 (patch)
tree5b4c04e53e071d699378f87daa322390b1655a29
parent1deb79863d965a2410515f633ff66646badd9a65 (diff)
downloadchrome-ec-d9f78047be7d7cc1d2e9279a6f2c3bac16c54af9.tar.gz
zork: split ioex_config[] to trembyle and dalboz
BUG=b:150349225 BRANCH=none TEST=none Signed-off-by: Edward Hill <ecgh@chromium.org> Change-Id: Ifc615bf8c4c5c8a684954ef932c5e9f5e60122de Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2108335 Reviewed-by: Denis Brockus <dbrockus@chromium.org> Reviewed-by: Paul Ma <magf@bitland.corp-partner.google.com> Tested-by: Paul Ma <magf@bitland.corp-partner.google.com>
-rw-r--r--baseboard/zork/baseboard.c16
-rw-r--r--baseboard/zork/baseboard.h11
-rw-r--r--baseboard/zork/variant_dalboz.c23
-rw-r--r--baseboard/zork/variant_trembyle.c20
-rw-r--r--board/dalboz/gpio.inc42
5 files changed, 74 insertions, 38 deletions
diff --git a/baseboard/zork/baseboard.c b/baseboard/zork/baseboard.c
index e5761f4e5b..2a10392077 100644
--- a/baseboard/zork/baseboard.c
+++ b/baseboard/zork/baseboard.c
@@ -29,7 +29,6 @@
#include "gpio.h"
#include "hooks.h"
#include "ioexpander.h"
-#include "ioexpander_nct38xx.h"
#include "i2c.h"
#include "keyboard_scan.h"
#include "lid_switch.h"
@@ -429,21 +428,6 @@ void bc12_interrupt(enum gpio_signal signal)
}
}
-struct ioexpander_config_t ioex_config[] = {
- [USBC_PORT_C0] = {
- .i2c_host_port = I2C_PORT_TCPC0,
- .i2c_slave_addr = NCT38XX_I2C_ADDR1_1_FLAGS,
- .drv = &nct38xx_ioexpander_drv,
- },
- [USBC_PORT_C1] = {
- .i2c_host_port = I2C_PORT_TCPC1,
- .i2c_slave_addr = NCT38XX_I2C_ADDR1_1_FLAGS,
- .drv = &nct38xx_ioexpander_drv,
- },
-};
-BUILD_ASSERT(ARRAY_SIZE(ioex_config) == USBC_PORT_COUNT);
-BUILD_ASSERT(CONFIG_IO_EXPANDER_PORT_COUNT == USBC_PORT_COUNT);
-
const int usb_port_enable[USB_PORT_COUNT] = {
IOEX_EN_USB_A0_5V,
IOEX_EN_USB_A1_5V_DB,
diff --git a/baseboard/zork/baseboard.h b/baseboard/zork/baseboard.h
index 16976e553c..693b4b77ff 100644
--- a/baseboard/zork/baseboard.h
+++ b/baseboard/zork/baseboard.h
@@ -106,7 +106,6 @@
#define CONFIG_IO_EXPANDER
#define CONFIG_IO_EXPANDER_NCT38XX
-#define CONFIG_IO_EXPANDER_PORT_COUNT USBC_PORT_COUNT
#define CONFIG_KEYBOARD_BOARD_CONFIG
#define CONFIG_KEYBOARD_COL2_INVERTED
@@ -167,8 +166,11 @@
#define CONFIG_USBC_RETIMER_PI3DPX1207
#define CONFIG_USBC_RETIMER_PS8802
#define CONFIG_USBC_RETIMER_PS8818
+ #define CONFIG_IO_EXPANDER_PORT_COUNT USBC_PORT_COUNT
#elif defined(VARIANT_ZORK_DALBOZ)
#define CONFIG_USB_MUX_PS8740
+ #define CONFIG_IO_EXPANDER_PCAL6408
+ #define CONFIG_IO_EXPANDER_PORT_COUNT IOEX_PORT_COUNT
#endif
/* USB-A config */
@@ -296,6 +298,13 @@ enum sensor_id {
};
#if defined(VARIANT_ZORK_DALBOZ)
+ enum ioex_port {
+ IOEX_C0_NCT3807 = 0,
+ IOEX_C1_NCT3807,
+ IOEX_HDMI_PCAL6408,
+ IOEX_PORT_COUNT
+ };
+
#define PORT_TO_HPD(port) ((port == 0) \
? GPIO_USB3_C0_DP2_HPD \
: GPIO_DP1_HPD)
diff --git a/baseboard/zork/variant_dalboz.c b/baseboard/zork/variant_dalboz.c
index 6fd0955fe8..92617e62bf 100644
--- a/baseboard/zork/variant_dalboz.c
+++ b/baseboard/zork/variant_dalboz.c
@@ -5,13 +5,36 @@
#include "common.h"
#include "console.h"
+#include "driver/ioexpander/pcal6408.h"
#include "driver/usb_mux/amd_fp5.h"
#include "gpio.h"
#include "hooks.h"
#include "i2c.h"
#include "ioexpander.h"
+#include "ioexpander_nct38xx.h"
#include "usb_mux.h"
+struct ioexpander_config_t ioex_config[] = {
+ [IOEX_C0_NCT3807] = {
+ .i2c_host_port = I2C_PORT_TCPC0,
+ .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,
+ },
+ [IOEX_HDMI_PCAL6408] = {
+ .i2c_host_port = I2C_PORT_TCPC1,
+ .i2c_slave_addr = PCAL6408_I2C_ADDR0,
+ .drv = &pcal6408_ioexpander_drv,
+ .flags = IOEX_FLAGS_DISABLED,
+ },
+};
+BUILD_ASSERT(ARRAY_SIZE(ioex_config) == CONFIG_IO_EXPANDER_PORT_COUNT);
+
static void usba_retimer_on(void)
{
ioex_set_level(IOEX_USB_A1_RETIMER_EN, 1);
diff --git a/baseboard/zork/variant_trembyle.c b/baseboard/zork/variant_trembyle.c
index d50eecc3b5..c602d792e9 100644
--- a/baseboard/zork/variant_trembyle.c
+++ b/baseboard/zork/variant_trembyle.c
@@ -16,6 +16,7 @@
#include "hooks.h"
#include "i2c.h"
#include "ioexpander.h"
+#include "ioexpander_nct38xx.h"
#include "timer.h"
#include "usb_mux.h"
@@ -23,6 +24,25 @@
#define CPRINTFUSB(format, args...) cprintf(CC_USBCHARGE, format, ## args)
/*****************************************************************************
+ * IO expander
+ */
+
+struct ioexpander_config_t ioex_config[] = {
+ [USBC_PORT_C0] = {
+ .i2c_host_port = I2C_PORT_TCPC0,
+ .i2c_slave_addr = NCT38XX_I2C_ADDR1_1_FLAGS,
+ .drv = &nct38xx_ioexpander_drv,
+ },
+ [USBC_PORT_C1] = {
+ .i2c_host_port = I2C_PORT_TCPC1,
+ .i2c_slave_addr = NCT38XX_I2C_ADDR1_1_FLAGS,
+ .drv = &nct38xx_ioexpander_drv,
+ },
+};
+BUILD_ASSERT(ARRAY_SIZE(ioex_config) == USBC_PORT_COUNT);
+BUILD_ASSERT(CONFIG_IO_EXPANDER_PORT_COUNT == USBC_PORT_COUNT);
+
+/*****************************************************************************
* Fan
*/
diff --git a/board/dalboz/gpio.inc b/board/dalboz/gpio.inc
index b2472d09a0..05950f45c6 100644
--- a/board/dalboz/gpio.inc
+++ b/board/dalboz/gpio.inc
@@ -50,27 +50,27 @@ GPIO(DP1_HPD, PIN(F, 4), GPIO_OUT_LOW) /* C1 DP Hotplug Detect */
GPIO(LED_FULL_L, PIN(6, 0), GPIO_OUT_HIGH)
GPIO(LED_CHRG_L, PIN(C, 0), GPIO_OUT_HIGH)
-IOEX_INT(HDMI_CONN_HPD_3V3_DB, EXPIN(USBC_PORT_C1, 1, 0), GPIO_INT_BOTH, hdmi_hpd_interrupt)
-
-IOEX(USB_C0_FAULT_ODL, EXPIN(USBC_PORT_C0, 0, 3), GPIO_ODR_HIGH) /* C0 Fault to SOC */
-IOEX(USB_C0_TCPC_FASTSW_CTL_EN, EXPIN(USBC_PORT_C0, 0, 4), GPIO_OUT_LOW) /* C0 FastSwitch Control */
-IOEX(USB_C1_FAULT_ODL, EXPIN(USBC_PORT_C0, 1, 0), GPIO_ODR_HIGH) /* C1 Fault to SOC */
-IOEX(USB_C0_PPC_ILIM_3A_EN, EXPIN(USBC_PORT_C0, 1, 1), GPIO_OUT_LOW) /* C0 3A Current Limit Enable */
-IOEX(USB_C0_SBU_FAULT_ODL, EXPIN(USBC_PORT_C0, 1, 2), GPIO_INPUT) /* C0 SBU Fault */
-IOEX(KB_BL_EN, EXPIN(USBC_PORT_C0, 1, 3), GPIO_OUT_LOW) /* KB Backlight Enable */
-IOEX(EN_USB_A0_5V, EXPIN(USBC_PORT_C0, 1, 5), GPIO_OUT_LOW) /* A0 5V Source Enable */
-IOEX(USB_A0_CHARGE_EN_L, EXPIN(USBC_PORT_C0, 1, 6), GPIO_OUT_HIGH) /* A0 5V High Current Enable */
-IOEX(USB_C0_SBU_FLIP, EXPIN(USBC_PORT_C0, 1, 7), GPIO_OUT_LOW) /* C0 SBU Flip */
-
-IOEX(USB_A1_RETIMER_EN, EXPIN(USBC_PORT_C1, 0, 0), GPIO_OUT_LOW) /* A1 Retimer Enable */
-IOEX(USB_C1_HPD_IN_DB, EXPIN(USBC_PORT_C1, 0, 2), GPIO_OUT_LOW) /* C1 HPD */
-IOEX(USB_C1_TCPC_FASTSW_CTL_EN, EXPIN(USBC_PORT_C1, 0, 4), GPIO_OUT_LOW) /* C1 FastSwitch Control */
-IOEX(USB_C1_SBU_FAULT_DB_ODL, EXPIN(USBC_PORT_C1, 1, 2), GPIO_INPUT) /* C1 SBU Fault */
-IOEX(USB_C1_PPC_EN_L, EXPIN(USBC_PORT_C1, 1, 3), GPIO_OUT_LOW) /* C1 PPC Enable */
-IOEX(HDMI_DATA_EN_DB, EXPIN(USBC_PORT_C1, 1, 4), GPIO_OUT_HIGH) /* HDMI Retimer Enable */
-IOEX(USB_C1_DATA_EN, EXPIN(USBC_PORT_C1, 1, 5), GPIO_OUT_HIGH) /* C1 Retimer Enable */
-IOEX(EN_USB_A1_5V_DB, EXPIN(USBC_PORT_C1, 1, 6), GPIO_OUT_LOW) /* A1 5V Source Enable */
-IOEX(USB_A1_CHARGE_EN_DB_L, EXPIN(USBC_PORT_C1, 1, 7), GPIO_OUT_HIGH) /* A1 5V High Current Enable */
+IOEX_INT(HDMI_CONN_HPD_3V3_DB, EXPIN(IOEX_C1_NCT3807, 1, 0), GPIO_INT_BOTH, hdmi_hpd_interrupt)
+
+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 */
+IOEX(USB_C1_FAULT_ODL, EXPIN(IOEX_C0_NCT3807, 1, 0), GPIO_ODR_HIGH) /* C1 Fault to SOC */
+IOEX(USB_C0_PPC_ILIM_3A_EN, EXPIN(IOEX_C0_NCT3807, 1, 1), GPIO_OUT_LOW) /* C0 3A Current Limit Enable */
+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 */
+IOEX(USB_C0_SBU_FLIP, EXPIN(IOEX_C0_NCT3807, 1, 7), GPIO_OUT_LOW) /* C0 SBU Flip */
+
+IOEX(USB_A1_RETIMER_EN, EXPIN(IOEX_C1_NCT3807, 0, 0), GPIO_OUT_LOW) /* A1 Retimer Enable */
+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(HDMI_DATA_EN_DB, EXPIN(IOEX_C1_NCT3807, 1, 4), GPIO_OUT_HIGH) /* HDMI Retimer Enable */
+IOEX(USB_C1_DATA_EN, EXPIN(IOEX_C1_NCT3807, 1, 5), GPIO_OUT_HIGH) /* C1 Retimer Enable */
+IOEX(EN_USB_A1_5V_DB, EXPIN(IOEX_C1_NCT3807, 1, 6), GPIO_OUT_LOW) /* A1 5V Source Enable */
+IOEX(USB_A1_CHARGE_EN_DB_L, EXPIN(IOEX_C1_NCT3807, 1, 7), GPIO_OUT_HIGH) /* A1 5V High Current Enable */
/*
* The NPCX LPC driver configures and controls SCI, so PCH_SCI_ODL [PIN(7, 6)]