summaryrefslogtreecommitdiff
path: root/board
diff options
context:
space:
mode:
authorDivya Sasidharan <divya.s.sasidharan@intel.com>2017-05-09 17:19:44 -0700
committerchrome-bot <chrome-bot@chromium.org>2017-08-21 22:03:53 -0700
commit577a7418553ab2f6198c422f33fd64907506e11a (patch)
treec344bfa446394f00e4bfa28af3a7fe1ce46d8b39 /board
parent59ce941927d5ccf332498e4326560e46095ca0e3 (diff)
downloadchrome-ec-577a7418553ab2f6198c422f33fd64907506e11a.tar.gz
glkrvp: Enable USB MUX PS8743 driver
Add Parade PS8743 USB Type-C Redriving Switch for USB Host / DisplayPort. BUG=b:64598680 BRANCH=glkrvp TEST=On glkrvp, Connect Apple dongle and verify mux setting with i2c read. 1. i2cxfer r 1 0x20 0 -> 0x50 (DP/USB enabled) 2. flip i2cxfer r 1 0x20 0 -> 0x54 (Flip bit enabled) Connect pluggable and verify the same. Similar testing was successful on second type-c port. Change-Id: I96ec380024eb659e071b019dd58b3c640fa1cc03 Signed-off-by: Divya Sasidharan <divya.s.sasidharan@intel.com> Reviewed-on: https://chromium-review.googlesource.com/616075 Commit-Ready: Vijay P Hiremath <vijay.p.hiremath@intel.com> Tested-by: Vijay P Hiremath <vijay.p.hiremath@intel.com> Reviewed-by: Shawn N <shawnn@chromium.org>
Diffstat (limited to 'board')
-rw-r--r--board/glkrvp/board.h5
-rw-r--r--board/glkrvp/chg_usb_pd.c17
-rw-r--r--board/glkrvp/usb_pd_policy.c14
3 files changed, 27 insertions, 9 deletions
diff --git a/board/glkrvp/board.h b/board/glkrvp/board.h
index 9cee863bd8..32a7b8793d 100644
--- a/board/glkrvp/board.h
+++ b/board/glkrvp/board.h
@@ -66,6 +66,10 @@
#define CONFIG_USB_PD_VBUS_DETECT_TCPC
#define CONFIG_USB_POWER_DELIVERY
+/* USB MUX */
+#define CONFIG_USBC_SS_MUX
+#define CONFIG_USB_MUX_PS8743
+
/* SoC / PCH */
#define CONFIG_LPC
#define CONFIG_CHIPSET_APOLLOLAKE
@@ -106,6 +110,7 @@
/* I2C ports */
#define I2C_PORT_CHARGER NPCX_I2C_PORT3
#define I2C_PORT_BATTERY NPCX_I2C_PORT3
+#define I2C_PORT_USB_MUX NPCX_I2C_PORT0_1
/* EC exclude modules */
#undef CONFIG_ADC
diff --git a/board/glkrvp/chg_usb_pd.c b/board/glkrvp/chg_usb_pd.c
index fd972fd76b..097b7ee1be 100644
--- a/board/glkrvp/chg_usb_pd.c
+++ b/board/glkrvp/chg_usb_pd.c
@@ -10,6 +10,7 @@
#include "task.h"
#include "tcpci.h"
#include "system.h"
+#include "usb_mux.h"
#include "util.h"
#define CPRINTF(format, args...) cprintf(CC_USBPD, format, ## args)
@@ -29,6 +30,22 @@ const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_COUNT] = {
};
BUILD_ASSERT(ARRAY_SIZE(tcpc_config) == CONFIG_USB_PD_PORT_COUNT);
+struct usb_mux usb_muxes[CONFIG_USB_PD_PORT_COUNT] = {
+ {
+ .port_addr = 0x20,
+ .driver = &ps874x_usb_mux_driver,
+ },
+ {
+ .port_addr = 0x22,
+ .driver = &ps874x_usb_mux_driver,
+ },
+};
+
+/* TODO: Implement this function and move to appropriate file */
+void usb_charger_set_switches(int port, enum usb_switch setting)
+{
+}
+
static int board_charger_port_is_sourcing_vbus(int port)
{
int reg;
diff --git a/board/glkrvp/usb_pd_policy.c b/board/glkrvp/usb_pd_policy.c
index fe66a7a5cc..8162495d33 100644
--- a/board/glkrvp/usb_pd_policy.c
+++ b/board/glkrvp/usb_pd_policy.c
@@ -288,19 +288,17 @@ static int svdm_dp_config(int port, uint32_t *payload)
static void svdm_dp_post_config(int port)
{
- const struct usb_mux *mux = &usb_muxes[port];
-
dp_flags[port] |= DP_FLAGS_DP_ON;
if (!(dp_flags[port] & DP_FLAGS_HPD_HI_PENDING))
return;
- mux->hpd_update(port, 1, 0);
+ /* TODO: Update HPD to host */
}
static int svdm_dp_attention(int port, uint32_t *payload)
{
int lvl = PD_VDO_DPSTS_HPD_LVL(payload[1]);
- int irq = PD_VDO_DPSTS_HPD_IRQ(payload[1]);
- const struct usb_mux *mux = &usb_muxes[port];
+
+ /* TODO: Read HPD IRQ */
dp_status[port] = payload[1];
if (!(dp_flags[port] & DP_FLAGS_DP_ON)) {
@@ -308,7 +306,7 @@ static int svdm_dp_attention(int port, uint32_t *payload)
dp_flags[port] |= DP_FLAGS_HPD_HI_PENDING;
return 1;
}
- mux->hpd_update(port, lvl, irq);
+ /* TODO: Update HPD to host */
/* ack */
return 1;
@@ -316,10 +314,8 @@ static int svdm_dp_attention(int port, uint32_t *payload)
static void svdm_exit_dp_mode(int port)
{
- const struct usb_mux *mux = &usb_muxes[port];
-
svdm_safe_dp_mode(port);
- mux->hpd_update(port, 0, 0);
+ /* TODO: Update HPD to host */
}
static int svdm_enter_gfu_mode(int port, uint32_t mode_caps)