summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVijay Hiremath <vijay.p.hiremath@intel.com>2015-07-16 13:34:15 -0700
committerChromeOS Commit Bot <chromeos-commit-bot@chromium.org>2015-07-22 05:02:42 +0000
commitdfcb1dc9e16a0e0f1bdf95033d60663ce5b76f93 (patch)
tree6ffdbfa8c1cd72403ba688e98da550d309bc0e72
parentd1002e798ec91e9c570f11613f80e73f381123ae (diff)
downloadchrome-ec-dfcb1dc9e16a0e0f1bdf95033d60663ce5b76f93.tar.gz
Kunimitsu: Add support for USB-C muxes
Ported the USB-C muxes from Glados Change-Id: I9d42108688a9070b982ae77f77633654bc6505ed Reviewed-on: https://chromium-review.googlesource.com/282281 BUG=none TEST=Tested the USB & DP status from "typec" console command. Observed usb_mux_set() & usb_mux_get() function are getting called and also the polarity of the USB-C is getting detected properly. BRANCH=none Change-Id: I56da12f4fe20a05a73e8b93893ba5a425a20808f Signed-off-by: Vijay Hiremath <vijay.p.hiremath@intel.com> Reviewed-on: https://chromium-review.googlesource.com/287360 Reviewed-by: Shawn N <shawnn@chromium.org>
-rw-r--r--board/kunimitsu/board.c12
-rw-r--r--board/kunimitsu/board.h3
-rw-r--r--board/kunimitsu/usb_pd_policy.c10
3 files changed, 22 insertions, 3 deletions
diff --git a/board/kunimitsu/board.c b/board/kunimitsu/board.c
index 4ac8b58cea..ff739e1a42 100644
--- a/board/kunimitsu/board.c
+++ b/board/kunimitsu/board.c
@@ -33,6 +33,7 @@
#include "thermal.h"
#include "timer.h"
#include "usb_charge.h"
+#include "usb_mux.h"
#include "usb_pd.h"
#include "usb_pd_tcpm.h"
#include "util.h"
@@ -152,6 +153,17 @@ struct pi3usb9281_config pi3usb9281_chips[] = {
BUILD_ASSERT(ARRAY_SIZE(pi3usb9281_chips) ==
CONFIG_USB_SWITCH_PI3USB9281_CHIP_COUNT);
+struct usb_mux usb_muxes[CONFIG_USB_PD_PORT_COUNT] = {
+ {
+ .port_addr = 0xa8,
+ .driver = &pi3usb30532_usb_mux_driver,
+ },
+ {
+ .port_addr = 0xaa,
+ .driver = &pi3usb30532_usb_mux_driver,
+ }
+};
+
void board_set_usb_switches(int port, enum usb_switch setting)
{
/* TODO: Set open / close USB switches based on param */
diff --git a/board/kunimitsu/board.h b/board/kunimitsu/board.h
index 8c0664b19d..87af8b45c1 100644
--- a/board/kunimitsu/board.h
+++ b/board/kunimitsu/board.h
@@ -41,6 +41,7 @@
#define CONFIG_POWER_COMMON
#define CONFIG_POWER_SHUTDOWN_PAUSE_IN_S5
#define CONFIG_USB_CHARGER
+#define CONFIG_USB_MUX_PI3USB30532
#define CONFIG_USB_POWER_DELIVERY
#define CONFIG_USB_PD_ALT_MODE
#define CONFIG_USB_PD_ALT_MODE_DFP
@@ -50,6 +51,7 @@
#define CONFIG_USB_PD_TCPM_TCPCI
#define CONFIG_USB_SWITCH_PI3USB9281
#define CONFIG_USB_SWITCH_PI3USB9281_CHIP_COUNT 2
+#define CONFIG_USBC_SS_MUX
#define CONFIG_SCI_GPIO GPIO_PCH_SCI_L
#define CONFIG_SPI_PORT 1
@@ -73,6 +75,7 @@
#define I2C_PORT_CHARGER MEC1322_I2C0_0
#define I2C_PORT_THERMAL MEC1322_I2C0_0
#define I2C_PORT_USB_CHARGER_1 MEC1322_I2C0_1
+#define I2C_PORT_USB_MUX MEC1322_I2C0_1
#define I2C_PORT_PD_MCU MEC1322_I2C1
#define I2C_PORT_TCPC MEC1322_I2C1
#define I2C_PORT_ALS MEC1322_I2C2
diff --git a/board/kunimitsu/usb_pd_policy.c b/board/kunimitsu/usb_pd_policy.c
index d5e0a235a9..304b809994 100644
--- a/board/kunimitsu/usb_pd_policy.c
+++ b/board/kunimitsu/usb_pd_policy.c
@@ -15,6 +15,7 @@
#include "task.h"
#include "timer.h"
#include "util.h"
+#include "usb_mux.h"
#include "usb_pd.h"
#define CPRINTF(format, args...) cprintf(CC_USBPD, format, ## args)
@@ -216,7 +217,7 @@ int pd_custom_vdm(int port, int cnt, uint32_t *payload,
CPRINTF("Current: %dmA\n", payload[1]);
break;
case VDO_CMD_FLIP:
- /* board_flip_usb_mux(port); */
+ usb_mux_flip(port);
break;
#ifdef CONFIG_USB_PD_LOGGING
case VDO_CMD_GET_LOG:
@@ -235,7 +236,8 @@ static void svdm_safe_dp_mode(int port)
{
/* make DP interface safe until configure */
dp_flags[port] = 0;
- /* board_set_usb_mux(port, TYPEC_MUX_NONE, pd_get_polarity(port)); */
+ usb_mux_set(port, TYPEC_MUX_NONE,
+ USB_SWITCH_CONNECT, pd_get_polarity(port));
}
static int svdm_enter_dp_mode(int port, uint32_t mode_caps)
@@ -268,7 +270,9 @@ static int svdm_dp_status(int port, uint32_t *payload)
static int svdm_dp_config(int port, uint32_t *payload)
{
int opos = pd_alt_mode(port, USB_SID_DISPLAYPORT);
- /* board_set_usb_mux(port, TYPEC_MUX_DP, pd_get_polarity(port)); */
+
+ usb_mux_set(port, TYPEC_MUX_DP,
+ USB_SWITCH_CONNECT, pd_get_polarity(port));
payload[0] = VDO(USB_SID_DISPLAYPORT, 1,
CMD_DP_CONFIG | VDO_OPOS(opos));
payload[1] = VDO_DP_CFG(MODE_DP_PIN_E, /* pin mode */