summaryrefslogtreecommitdiff
path: root/board
diff options
context:
space:
mode:
authorZick Wei <zick.wei@quanta.corp-partner.google.com>2020-06-18 11:33:54 +0800
committerCommit Bot <commit-bot@chromium.org>2020-06-19 06:37:12 +0000
commitb96bad8e0de4c89bd498e3d3acf9f56ded847e0e (patch)
tree35cb59ef429d40e4f085b2ff1097211eef15a986 /board
parent7431dd01830327bfadba5a995210517b8ae8c7cf (diff)
downloadchrome-ec-b96bad8e0de4c89bd498e3d3acf9f56ded847e0e.tar.gz
morphius: add ppc aoz1380
This patch add ppc aoz1380 on daughter board. BUG=b:156552519, b:159282505 BRANCH=none TEST=make buildall Signed-off-by: Zick Wei <zick.wei@quanta.corp-partner.google.com> Change-Id: I5ca87a2d524ee265626e5b163754a33dcb31853d Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2251127 Reviewed-by: Edward Hill <ecgh@chromium.org>
Diffstat (limited to 'board')
-rw-r--r--board/morphius/board.c51
-rw-r--r--board/morphius/board.h11
-rw-r--r--board/morphius/gpio.inc1
3 files changed, 62 insertions, 1 deletions
diff --git a/board/morphius/board.c b/board/morphius/board.c
index a4c0380ef6..e78bcc0546 100644
--- a/board/morphius/board.c
+++ b/board/morphius/board.c
@@ -12,6 +12,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/pi3dpx1207.h"
#include "driver/temp_sensor/sb_tsi.h"
#include "driver/temp_sensor/tmp432.h"
@@ -34,6 +36,7 @@
#include "temp_sensor.h"
#include "usb_mux.h"
#include "usb_charge.h"
+#include "usbc_ppc.h"
#include "gpio_list.h"
@@ -286,7 +289,6 @@ BUILD_ASSERT(ARRAY_SIZE(usb_muxes) == USBC_PORT_COUNT);
/*****************************************************************************
* Use FW_CONFIG to set correct configuration.
*/
-
void setup_fw_config(void)
{
/* Enable Gyro interrupts */
@@ -298,6 +300,12 @@ void setup_fw_config(void)
ps2_enable_channel(NPCX_PS2_CH0, 1, send_aux_data_to_host);
setup_mux();
+
+ if (ec_config_has_db_ppc_aoz1380()) {
+ ccprintf("DB USBC PPC aoz1380");
+ ppc_chips[USBC_PORT_C1].drv = &aoz1380_drv;
+ }
+
}
DECLARE_HOOK(HOOK_INIT, setup_fw_config, HOOK_PRIO_INIT_I2C + 2);
@@ -508,3 +516,44 @@ static void board_chipset_suspend(void)
ioex_set_level(IOEX_HDMI_POWER_EN_DB, 0);
}
DECLARE_HOOK(HOOK_CHIPSET_SUSPEND, board_chipset_suspend, HOOK_PRIO_DEFAULT);
+
+__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 (ec_config_has_db_ppc_aoz1380())
+ aoz1380_interrupt(USBC_PORT_C1);
+ else
+ nx20p348x_interrupt(USBC_PORT_C1);
+ break;
+
+ default:
+ break;
+ }
+}
+
+/*
+ * In the AOZ1380 PPC, there are no programmable features. We use
+ * the attached NCT3807 to control a GPIO to indicate 1A5 or 3A0
+ * current limits.
+ */
+__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 */
+ if (port == 0) {
+ rv = ioex_set_level(IOEX_USB_C0_PPC_ILIM_3A_EN,
+ (rp == TYPEC_RP_3A0) ? 1 : 0);
+ } else {
+ rv = ioex_set_level(IOEX_USB_C1_PPC_ILIM_3A_EN,
+ (rp == TYPEC_RP_3A0) ? 1 : 0);
+ }
+
+ return rv;
+}
diff --git a/board/morphius/board.h b/board/morphius/board.h
index ba89b057b2..33c733077a 100644
--- a/board/morphius/board.h
+++ b/board/morphius/board.h
@@ -158,6 +158,8 @@ enum ec_cfg_usb_mb_type {
enum ec_cfg_usb_db_type {
MORPHIUS_DB_T_OPT1_USBC_HDMI = 0,
MORPHIUS_DB_T_OPT3_USBC_HDMI_MSTHUB = 1,
+ MORPHIUS_DB_PICASSO_AOZ1380 = 2,
+ MORPHIUS_DB_DALI_AOZ1380 = 3,
};
@@ -206,6 +208,15 @@ static inline bool ec_config_has_hdmi_conn_hpd(void)
HAS_HDMI_CONN_HPD);
}
+#define HAS_DB_AOZ1380 \
+ (BIT(MORPHIUS_DB_PICASSO_AOZ1380) | BIT(MORPHIUS_DB_DALI_AOZ1380))
+
+static inline bool ec_config_has_db_ppc_aoz1380(void)
+{
+ return !!(BIT(ec_config_get_usb_db()) &
+ HAS_DB_AOZ1380);
+}
+
#define PORT_TO_HPD(port) ((port == 0) \
? GPIO_USB_C0_HPD \
: (ec_config_has_usbc1_retimer_ps8802()) \
diff --git a/board/morphius/gpio.inc b/board/morphius/gpio.inc
index 95dd1e2b1b..e5f21259e1 100644
--- a/board/morphius/gpio.inc
+++ b/board/morphius/gpio.inc
@@ -75,6 +75,7 @@ IOEX(USB_A1_RETIMER_RST_DB, EXPIN(USBC_PORT_C1, 0, 1), GPIO_OUT_LOW) /* A1 Retim
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 */
+IOEX(USB_C1_PPC_ILIM_3A_EN, EXPIN(USBC_PORT_C1, 1, 0), GPIO_OUT_LOW) /* C1 3A Current Limit Enable */
IOEX(USB_C1_MUX_RST_DB, EXPIN(USBC_PORT_C1, 1, 1), GPIO_OUT_LOW) /* C1 Mux Reset */
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 */