summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhilip Chen <philipchen@google.com>2017-11-07 23:01:00 -0800
committerchrome-bot <chrome-bot@chromium.org>2017-11-15 20:21:12 -0800
commit790e0199da8380a5cf0b68171bb2363fe470436e (patch)
treec82d886f8a1d6371ae9428cf20244d8d23ec8e2d
parentdcf047fc1609b2afd06b7a2544f40742ae1e8493 (diff)
downloadchrome-ec-790e0199da8380a5cf0b68171bb2363fe470436e.tar.gz
nautilus: Replace anx74xx with another ps8xxx
On Nautilus, we use two ps8751b TCPC chips. According to the latest schematic (link is in the bug), we'll place two TCPC chips separately on different I2C ports. BUG=b:69017605 BRANCH=none TEST=build/flash nautilus rev0, and confirm PD charging from one USB-C port works. Change-Id: Iab7402023f148d478cba249aaf83a23675a7137b Signed-off-by: Philip Chen <philipchen@google.com> Reviewed-on: https://chromium-review.googlesource.com/758336 Commit-Ready: Philip Chen <philipchen@chromium.org> Tested-by: Philip Chen <philipchen@chromium.org> Reviewed-by: Shawn N <shawnn@chromium.org>
-rw-r--r--board/nautilus/board.c80
-rw-r--r--board/nautilus/board.h3
-rw-r--r--board/nautilus/gpio.inc8
-rw-r--r--board/nautilus/usb_pd_policy.c1
4 files changed, 14 insertions, 78 deletions
diff --git a/board/nautilus/board.c b/board/nautilus/board.c
index c95f1ceab2..2f40113d6f 100644
--- a/board/nautilus/board.c
+++ b/board/nautilus/board.c
@@ -20,7 +20,6 @@
#include "driver/accelgyro_bmi160.h"
#include "driver/als_opt3001.h"
#include "driver/baro_bmp280.h"
-#include "driver/tcpm/anx74xx.h"
#include "driver/tcpm/ps8xxx.h"
#include "driver/tcpm/tcpci.h"
#include "driver/tcpm/tcpm.h"
@@ -55,8 +54,6 @@
#define CPRINTS(format, args...) cprints(CC_USBCHARGE, format, ## args)
#define CPRINTF(format, args...) cprintf(CC_USBCHARGE, format, ## args)
-#define USB_PD_PORT_ANX74XX 0
-
static void tcpc_alert_event(enum gpio_signal signal)
{
if ((signal == GPIO_USB_C0_PD_INT_ODL) &&
@@ -112,33 +109,6 @@ void usb1_evt(enum gpio_signal signal)
task_set_event(TASK_ID_USB_CHG_P1, USB_CHG_EVENT_BC12, 0);
}
-#ifdef CONFIG_USB_PD_TCPC_LOW_POWER
-static void anx74xx_cable_det_handler(void)
-{
- int cable_det = gpio_get_level(GPIO_USB_C0_CABLE_DET);
- int reset_n = gpio_get_level(GPIO_USB_C0_PD_RST_L);
-
- /*
- * A cable_det low->high transition was detected. If following the
- * debounce time, cable_det is high, and reset_n is low, then ANX3429 is
- * currently in standby mode and needs to be woken up. Set the
- * TCPC_RESET event which will bring the ANX3429 out of standby
- * mode. Setting this event is gated on reset_n being low because the
- * ANX3429 will always set cable_det when transitioning to normal mode
- * and if in normal mode, then there is no need to trigger a tcpc reset.
- */
- if (cable_det && !reset_n)
- task_set_event(TASK_ID_PD_C0, PD_EVENT_TCPC_RESET, 0);
-}
-DECLARE_DEFERRED(anx74xx_cable_det_handler);
-
-void anx74xx_cable_det_interrupt(enum gpio_signal signal)
-{
- /* debounce for 2 msec */
- hook_call_deferred(&anx74xx_cable_det_handler_data, (2 * MSEC));
-}
-#endif
-
/*
* Base detection and debouncing
*
@@ -372,8 +342,8 @@ BUILD_ASSERT(ARRAY_SIZE(adc_channels) == ADC_CH_COUNT);
/* I2C port map */
const struct i2c_port_t i2c_ports[] = {
- {"tcpc", NPCX_I2C_PORT0_0, 400, GPIO_I2C0_0_SCL, GPIO_I2C0_0_SDA},
- {"als", NPCX_I2C_PORT0_1, 400, GPIO_I2C0_1_SCL, GPIO_I2C0_1_SDA},
+ {"tcpc0", NPCX_I2C_PORT0_0, 400, GPIO_I2C0_0_SCL, GPIO_I2C0_0_SDA},
+ {"tcpc1", NPCX_I2C_PORT0_1, 400, GPIO_I2C0_1_SCL, GPIO_I2C0_1_SDA},
{"charger", NPCX_I2C_PORT1, 100, GPIO_I2C1_SCL, GPIO_I2C1_SDA},
{"pmic", NPCX_I2C_PORT2, 400, GPIO_I2C2_SCL, GPIO_I2C2_SDA},
{"accelgyro", NPCX_I2C_PORT3, 400, GPIO_I2C3_SCL, GPIO_I2C3_SDA},
@@ -382,15 +352,15 @@ const unsigned int i2c_ports_used = ARRAY_SIZE(i2c_ports);
/* TCPC mux configuration */
const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_COUNT] = {
- {NPCX_I2C_PORT0_0, 0x50, &anx74xx_tcpm_drv, TCPC_ALERT_ACTIVE_LOW},
{NPCX_I2C_PORT0_0, 0x16, &ps8xxx_tcpm_drv, TCPC_ALERT_ACTIVE_LOW},
+ {NPCX_I2C_PORT0_1, 0x16, &ps8xxx_tcpm_drv, TCPC_ALERT_ACTIVE_LOW},
};
struct usb_mux usb_muxes[CONFIG_USB_PD_PORT_COUNT] = {
{
- .port_addr = 0, /* don't care / unused */
- .driver = &anx74xx_tcpm_usb_mux_driver,
- .hpd_update = &anx74xx_tcpc_update_hpd_status,
+ .port_addr = 0,
+ .driver = &tcpci_tcpm_usb_mux_driver,
+ .hpd_update = &ps8xxx_tcpc_update_hpd_status,
},
{
.port_addr = 1,
@@ -412,43 +382,14 @@ struct pi3usb9281_config pi3usb9281_chips[] = {
BUILD_ASSERT(ARRAY_SIZE(pi3usb9281_chips) ==
CONFIG_BC12_DETECT_PI3USB9281_CHIP_COUNT);
-/**
- * Power on (or off) a single TCPC.
- * minimum on/off delays are included.
- *
- * @param port Port number of TCPC.
- * @param mode 0: power off, 1: power on.
- */
-void board_set_tcpc_power_mode(int port, int mode)
-{
- if (port != USB_PD_PORT_ANX74XX)
- return;
-
- if (mode) {
- gpio_set_level(GPIO_USB_C0_TCPC_PWR, 1);
- msleep(ANX74XX_PWR_H_RST_H_DELAY_MS);
- gpio_set_level(GPIO_USB_C0_PD_RST_L, 1);
- } else {
- gpio_set_level(GPIO_USB_C0_PD_RST_L, 0);
- msleep(ANX74XX_RST_L_PWR_L_DELAY_MS);
- gpio_set_level(GPIO_USB_C0_TCPC_PWR, 0);
- msleep(ANX74XX_PWR_L_PWR_H_DELAY_MS);
- }
-}
-
void board_reset_pd_mcu(void)
{
/* Assert reset */
gpio_set_level(GPIO_USB_C0_PD_RST_L, 0);
gpio_set_level(GPIO_USB_C1_PD_RST_L, 0);
-
- msleep(MAX(1, ANX74XX_RST_L_PWR_L_DELAY_MS));
+ msleep(1);
+ gpio_set_level(GPIO_USB_C0_PD_RST_L, 1);
gpio_set_level(GPIO_USB_C1_PD_RST_L, 1);
- /* Disable TCPC0 (anx3429) power */
- gpio_set_level(GPIO_USB_C0_TCPC_PWR, 0);
-
- msleep(ANX74XX_PWR_L_PWR_H_DELAY_MS);
- board_set_tcpc_power_mode(USB_PD_PORT_ANX74XX, 1);
}
void board_tcpc_init(void)
@@ -478,11 +419,6 @@ void board_tcpc_init(void)
gpio_enable_interrupt(GPIO_USB_C0_PD_INT_ODL);
gpio_enable_interrupt(GPIO_USB_C1_PD_INT_ODL);
-#ifdef CONFIG_USB_PD_TCPC_LOW_POWER
- /* Enable CABLE_DET interrupt for ANX3429 wake from standby */
- gpio_enable_interrupt(GPIO_USB_C0_CABLE_DET);
-#endif
-
/*
* Initialize HPD to low; after sysjump SOC needs to see
* HPD pulse to enable video path
diff --git a/board/nautilus/board.h b/board/nautilus/board.h
index 93506c3aa2..afd0f45b11 100644
--- a/board/nautilus/board.h
+++ b/board/nautilus/board.h
@@ -141,7 +141,6 @@
#define CONFIG_USB_PD_VBUS_DETECT_GPIO
#define CONFIG_USB_PD_TCPC_LOW_POWER
#define CONFIG_USB_PD_TCPM_MUX
-#define CONFIG_USB_PD_TCPM_ANX74XX
#define CONFIG_USB_PD_TCPM_TCPCI
#define CONFIG_USB_PD_TCPM_PS8751
#define CONFIG_USB_PD_TRY_SRC
@@ -162,7 +161,7 @@
/* I2C ports */
#define I2C_PORT_TCPC0 NPCX_I2C_PORT0_0
-#define I2C_PORT_TCPC1 NPCX_I2C_PORT0_0
+#define I2C_PORT_TCPC1 NPCX_I2C_PORT0_1
#define I2C_PORT_ALS NPCX_I2C_PORT0_1
#define I2C_PORT_USB_CHARGER_1 NPCX_I2C_PORT0_1
#define I2C_PORT_USB_CHARGER_0 NPCX_I2C_PORT1
diff --git a/board/nautilus/gpio.inc b/board/nautilus/gpio.inc
index afbf580e13..2485b9702a 100644
--- a/board/nautilus/gpio.inc
+++ b/board/nautilus/gpio.inc
@@ -35,7 +35,6 @@ GPIO_INT(USB_C0_BC12_INT_L, PIN(D, 3), GPIO_INT_FALLING, usb0_evt)
GPIO_INT(USB_C1_BC12_INT_L, PIN(3, 3), GPIO_INT_FALLING, usb1_evt)
GPIO_INT(ACCELGYRO3_INT_L, PIN(3, 6), GPIO_INT_FALLING, bmi160_interrupt)
GPIO_INT(BASE_DET_A, PIN(4, 5), GPIO_INT_BOTH, base_detect_interrupt)
-GPIO_INT(USB_C0_CABLE_DET, PIN(D, 2), GPIO_INT_RISING, anx74xx_cable_det_interrupt)
GPIO(PCH_RTCRST, PIN(2, 7), GPIO_OUT_LOW) /* RTCRST# to SOC (>= rev4) */
GPIO(ENABLE_BACKLIGHT, PIN(2, 6), GPIO_OUT_LOW) /* Enable Backlight */
@@ -58,6 +57,9 @@ GPIO(PMIC_INT_L, PIN(6, 0), GPIO_INPUT) /* PMIC interrupt */
GPIO(PCH_SLP_S0_L, PIN(7, 5), GPIO_INPUT)
#endif
+/* NC pins */
+GPIO(GPIOD2_NC, PIN(D, 2), GPIO_INPUT | GPIO_PULL_UP)
+
/* Sensor interrupts, not implemented yet */
GPIO(ALS_INT_L, PIN(2, 5), GPIO_INPUT)
@@ -79,8 +81,8 @@ GPIO(PP3300_DX_BASE, PIN(1, 1), GPIO_OUT_LOW)
/* I2C pins - these will be reconfigured for alternate function below */
GPIO(I2C0_0_SCL, PIN(B, 5), GPIO_INPUT) /* EC_I2C0_0_USBC_3V3_SCL */
GPIO(I2C0_0_SDA, PIN(B, 4), GPIO_INPUT) /* EC_I2C0_0_USBC_3V3_SDA */
-GPIO(I2C0_1_SCL, PIN(B, 3), GPIO_INPUT) /* EC_I2C0_1_3V3_SCL */
-GPIO(I2C0_1_SDA, PIN(B, 2), GPIO_INPUT) /* EC_I2C0_1_3V3_SDA */
+GPIO(I2C0_1_SCL, PIN(B, 3), GPIO_INPUT) /* EC_I2C0_1_USBC_3V3_SCL */
+GPIO(I2C0_1_SDA, PIN(B, 2), GPIO_INPUT) /* EC_I2C0_1_USBC_3V3_SDA */
GPIO(I2C1_SCL, PIN(9, 0), GPIO_INPUT) /* EC_I2C1_3V3_SCL */
GPIO(I2C1_SDA, PIN(8, 7), GPIO_INPUT) /* EC_I2C1_3V3_SDA */
GPIO(I2C2_SCL, PIN(9, 2), GPIO_INPUT) /* EC_I2C2_PMIC_3V3_SCL */
diff --git a/board/nautilus/usb_pd_policy.c b/board/nautilus/usb_pd_policy.c
index d45db30c42..749eaff051 100644
--- a/board/nautilus/usb_pd_policy.c
+++ b/board/nautilus/usb_pd_policy.c
@@ -8,7 +8,6 @@
#include "charge_manager.h"
#include "common.h"
#include "console.h"
-#include "driver/tcpm/anx74xx.h"
#include "driver/tcpm/ps8xxx.h"
#include "gpio.h"
#include "hooks.h"