summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVijay Hiremath <vijay.p.hiremath@intel.com>2015-07-21 20:38:47 -0700
committerChromeOS Commit Bot <chromeos-commit-bot@chromium.org>2015-07-25 23:48:59 +0000
commitaff095dd9bd02da76d69d0cbdd6c5b7094da0abd (patch)
tree95807f5bb74b28a639008644ec535683d9497a85
parent065b177a4d49e1b6c18eef6a5afe18963cbfdf69 (diff)
downloadchrome-ec-aff095dd9bd02da76d69d0cbdd6c5b7094da0abd.tar.gz
Strago: 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: I0b169032ff77af9895311680413aed6c7d0fd4e2 Signed-off-by: Vijay Hiremath <vijay.p.hiremath@intel.com> Reviewed-on: https://chromium-review.googlesource.com/287464 Reviewed-by: Shawn N <shawnn@chromium.org> Reviewed-by: Alec Berg <alecaberg@chromium.org>
-rw-r--r--board/strago/board.c8
-rw-r--r--board/strago/board.h5
-rw-r--r--board/strago/usb_pd_policy.c10
3 files changed, 19 insertions, 4 deletions
diff --git a/board/strago/board.c b/board/strago/board.c
index 89e447f91a..783b2152bb 100644
--- a/board/strago/board.c
+++ b/board/strago/board.c
@@ -34,6 +34,7 @@
#include "temp_sensor_chip.h"
#include "thermal.h"
#include "usb_charge.h"
+#include "usb_mux.h"
#include "usb_pd.h"
#include "usb_pd_tcpm.h"
#include "util.h"
@@ -141,6 +142,13 @@ 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 = 0xaa,
+ .driver = &pi3usb30532_usb_mux_driver,
+ },
+};
+
/*
* Temperature sensors data; must be in same order as enum temp_sensor_id.
* Sensor index and name must match those present in coreboot:
diff --git a/board/strago/board.h b/board/strago/board.h
index 864a32ad83..0acf17eaf1 100644
--- a/board/strago/board.h
+++ b/board/strago/board.h
@@ -10,7 +10,7 @@
/* Optional features */
#define CONFIG_SYSTEM_UNLOCKED /* Allow dangerous commands */
-#define CONFIG_WATCHDOG_HELP
+#undef CONFIG_WATCHDOG_HELP
#define CONFIG_CLOCK_CRYSTAL
#define CONFIG_CHIPSET_BRASWELL
#define CONFIG_SCI_GPIO GPIO_PCH_SCI_L
@@ -32,6 +32,7 @@
#define CONFIG_PORT80_TASK_EN
#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
@@ -41,6 +42,7 @@
#define CONFIG_USB_PD_TCPM_TCPCI
#define CONFIG_USB_SWITCH_PI3USB9281
#define CONFIG_USB_SWITCH_PI3USB9281_CHIP_COUNT 1
+#define CONFIG_USBC_SS_MUX
#define CONFIG_SPI_PORT 1
#define CONFIG_SPI_CS_GPIO GPIO_PVT_CS0
@@ -117,6 +119,7 @@
#define I2C_PORT_PD_MCU MEC1322_I2C2
#define I2C_PORT_TCPC MEC1322_I2C2
#define I2C_PORT_THERMAL MEC1322_I2C3
+#define I2C_PORT_USB_MUX MEC1322_I2C2
/* ADC signal */
enum adc_channel {
diff --git a/board/strago/usb_pd_policy.c b/board/strago/usb_pd_policy.c
index ba7a162fab..03aa64fcf5 100644
--- a/board/strago/usb_pd_policy.c
+++ b/board/strago/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)
@@ -205,7 +206,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:
@@ -224,7 +225,8 @@ static void svdm_safe_dp_mode(int port)
{
/* make DP interface safe until configure */
dp_flags = 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)
@@ -257,7 +259,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 */