summaryrefslogtreecommitdiff
path: root/board/ezkinil
diff options
context:
space:
mode:
authorSue Chen <sue.chen@quanta.corp-partner.google.com>2020-06-19 14:32:08 +0800
committerCommit Bot <commit-bot@chromium.org>2020-08-07 23:58:30 +0000
commit454b5f685849003b3dea31d36f9e821e6c54ce26 (patch)
treeaf4c74a3eb07db6bc4c0a7470a785deb1d99e4eb /board/ezkinil
parent79ffbee1ce5de606a05adb79764ea90448405798 (diff)
downloadchrome-ec-454b5f685849003b3dea31d36f9e821e6c54ce26.tar.gz
Ezkinil: Add AOZ1380 for DB TYPEC C1
IOEX01 USB_C1_POWER_SWITCH_ID check which ppc chip is supported. 0 for NX20P3483UK 1 for AOZ1380DI IOEX10 USB_C1_PPC_ILIM_3A_EN to set vbus source current limit 3A BUG=b:159634750 BRANCH=none TEST=make sure C1 ppc_config setup correctly on AOZ board. USB_C1_PPC_ILIM_3A_EN change level as plugging device in/out port 1. Change-Id: I1211ba39a02b8e42488dc56f110bc736e66ff41d Signed-off-by: Sue Chen <sue.chen@quanta.corp-partner.google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2253489 Reviewed-by: Edward Hill <ecgh@chromium.org> Commit-Queue: Edward Hill <ecgh@chromium.org>
Diffstat (limited to 'board/ezkinil')
-rw-r--r--board/ezkinil/board.c60
-rw-r--r--board/ezkinil/board.h1
-rw-r--r--board/ezkinil/gpio.inc3
3 files changed, 63 insertions, 1 deletions
diff --git a/board/ezkinil/board.c b/board/ezkinil/board.c
index 35194d42fb..6795f0dd9b 100644
--- a/board/ezkinil/board.c
+++ b/board/ezkinil/board.c
@@ -11,6 +11,8 @@
#include "driver/accelgyro_bmi_common.h"
#include "driver/accel_kionix.h"
#include "driver/accel_kx022.h"
+#include "driver/ppc/aoz1380.h"
+#include "driver/ppc/nx20p348x.h"
#include "driver/retimer/tusb544.h"
#include "driver/temp_sensor/sb_tsi.h"
#include "driver/usb_mux/amd_fp5.h"
@@ -32,6 +34,7 @@
#include "temp_sensor.h"
#include "usb_charge.h"
#include "usb_mux.h"
+#include "usbc_ppc.h"
#include "gpio_list.h"
@@ -338,6 +341,60 @@ const struct usb_mux usbc1_ps8743 = {
};
/*****************************************************************************
+ * PPC
+ */
+
+static int ppc_id;
+
+static void setup_c1_ppc_config(void)
+{
+ /*
+ * Read USB_C1_POWER_SWITCH_ID to choose DB ppc chip
+ * 0: NX20P3483UK
+ * 1: AOZ1380DI
+ */
+
+ ioex_get_level(IOEX_USB_C1_POWER_SWITCH_ID, &ppc_id);
+
+ ccprints("C1: PPC is %s", ppc_id ? "AOZ1380DI" : "NX20P3483UK");
+
+ if (ppc_id) {
+ ppc_chips[USBC_PORT_C1].drv = &aoz1380_drv;
+ ioex_set_flags(IOEX_USB_C1_PPC_ILIM_3A_EN, GPIO_OUT_LOW);
+ }
+}
+
+__override void ppc_interrupt(enum gpio_signal signal)
+{
+ switch (signal) {
+ case GPIO_USB_C0_PPC_FAULT_ODL:
+ aoz1380_interrupt(USBC_PORT_C0);
+ break;
+ case GPIO_USB_C1_PPC_INT_ODL:
+ if (ppc_id)
+ aoz1380_interrupt(USBC_PORT_C1);
+ else
+ nx20p348x_interrupt(USBC_PORT_C1);
+ break;
+ default:
+ break;
+ }
+}
+
+__override int board_aoz1380_set_vbus_source_current_limit(int port,
+ enum tcpc_rp_value rp)
+{
+ int rv;
+
+ /* Use the TCPC to set the current limit */
+ rv = ioex_set_level(port ? IOEX_USB_C1_PPC_ILIM_3A_EN
+ : IOEX_USB_C0_PPC_ILIM_3A_EN,
+ (rp == TYPEC_RP_3A0) ? 1 : 0);
+
+ return rv;
+}
+
+/*****************************************************************************
* Use FW_CONFIG to set correct configuration.
*/
@@ -357,6 +414,9 @@ void setup_fw_config(void)
setup_mux();
+ if (board_ver >= 3)
+ setup_c1_ppc_config();
+
if (ec_config_has_hdmi_conn_hpd()) {
if (board_ver < 3)
ioex_enable_interrupt(IOEX_HDMI_CONN_HPD_3V3_DB);
diff --git a/board/ezkinil/board.h b/board/ezkinil/board.h
index ecde44e55a..17a924e99d 100644
--- a/board/ezkinil/board.h
+++ b/board/ezkinil/board.h
@@ -57,6 +57,7 @@
#define GPIO_WP_L GPIO_EC_WP_L
#define GPIO_PACKET_MODE_EN GPIO_EC_H1_PACKET_MODE
#define GPIO_DP1_HPD GPIO_EC_DP1_HPD
+#define IOEX_HDMI_CONN_HPD_3V3_DB IOEX_USB_C1_PPC_ILIM_3A_EN
#ifndef __ASSEMBLER__
diff --git a/board/ezkinil/gpio.inc b/board/ezkinil/gpio.inc
index 86a8b6e97c..e0145ce3db 100644
--- a/board/ezkinil/gpio.inc
+++ b/board/ezkinil/gpio.inc
@@ -57,7 +57,7 @@ GPIO(LED_FULL_L, PIN(6, 0), GPIO_OUT_HIGH)
GPIO(LED_CHRG_L, PIN(C, 0), GPIO_OUT_HIGH)
IOEX_INT(USB_C0_SBU_FAULT_ODL, EXPIN(USBC_PORT_C0, 1, 2), GPIO_INT_FALLING, sbu_fault_interrupt)
-IOEX_INT(HDMI_CONN_HPD_3V3_DB, EXPIN(USBC_PORT_C1, 1, 0), GPIO_INT_BOTH, hdmi_hpd_interrupt_v2)
+IOEX_INT(USB_C1_PPC_ILIM_3A_EN, EXPIN(USBC_PORT_C1, 1, 0), GPIO_INT_BOTH, hdmi_hpd_interrupt_v2) /* v3:C1 3A Current Limit Enable; v2:HDMI_CONN_HPD_3V3_DB */
IOEX_INT(USB_C1_SBU_FAULT_DB_ODL, EXPIN(USBC_PORT_C1, 1, 2), GPIO_INT_FALLING, sbu_fault_interrupt)
IOEX(USB_C0_FAULT_ODL, EXPIN(USBC_PORT_C0, 0, 3), GPIO_ODR_HIGH) /* C0 Fault to SOC */
@@ -70,6 +70,7 @@ IOEX(USB_A0_CHARGE_EN_L, EXPIN(USBC_PORT_C0, 1, 6), GPIO_OUT_HIGH) /* A0 5V High
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_POWER_SWITCH_ID, EXPIN(USBC_PORT_C1, 0, 1), GPIO_INPUT) /* C1 PPC ID, 0: NX20P34, 1: AOZ1380 */
IOEX(USB_C1_HPD_IN_DB, EXPIN(USBC_PORT_C1, 0, 2), GPIO_OUT_LOW) /* C1 HPD */
IOEX(HDMI_POWER_EN_DB, EXPIN(USBC_PORT_C1, 0, 3), GPIO_OUT_LOW) /* HDMI retimer power enable */
IOEX(USB_C1_TCPC_FASTSW_CTL_EN, EXPIN(USBC_PORT_C1, 0, 4), GPIO_OUT_LOW) /* C1 FastSwitch Control */