diff options
author | Vincent Palatin <vpalatin@chromium.org> | 2016-08-15 14:25:32 +0200 |
---|---|---|
committer | chrome-bot <chrome-bot@chromium.org> | 2016-08-16 00:58:14 -0700 |
commit | 81421ba013fb536c38b509165d385caf78f723e6 (patch) | |
tree | 58a8b7e20d8744d7e0c264b9d6340652a5ee0b72 | |
parent | b23470dab7878f3a93475369db4c43468e960dbf (diff) | |
download | chrome-ec-81421ba013fb536c38b509165d385caf78f723e6.tar.gz |
fusb302: enable setting Rp value
Configure the FUSB302 current source used for Rp according to the
CONFIG_USB_PD_PULLUP_xxx value.
Set the default Rp for Kevin to 1.5A.
Signed-off-by: Vincent Palatin <vpalatin@chromium.org>
BRANCH=none
BUG=chrome-os-partner:54452 chrome-os-partner:56110
TEST=manual: plug to Samus, enable charging on the Samus side,
measure the CC voltage with Twinkie, get 950mV instead of 450mV.
Change-Id: I98faf18132a097e49e9c0fa8e1395d230608ee9e
Reviewed-on: https://chromium-review.googlesource.com/369190
Commit-Ready: Vincent Palatin <vpalatin@chromium.org>
Tested-by: Vincent Palatin <vpalatin@chromium.org>
Reviewed-by: David Schneider <dnschneid@chromium.org>
Reviewed-by: Shawn N <shawnn@chromium.org>
-rw-r--r-- | board/kevin/board.h | 1 | ||||
-rw-r--r-- | driver/tcpm/fusb302.c | 9 | ||||
-rw-r--r-- | driver/tcpm/fusb302.h | 4 |
3 files changed, 14 insertions, 0 deletions
diff --git a/board/kevin/board.h b/board/kevin/board.h index 3ddcad4d5c..6788e391d8 100644 --- a/board/kevin/board.h +++ b/board/kevin/board.h @@ -84,6 +84,7 @@ #define CONFIG_USB_PD_DUAL_ROLE #define CONFIG_USB_PD_LOGGING #define CONFIG_USB_PD_LOG_SIZE 512 +#define CONFIG_USB_PD_PULLUP_1_5A #define CONFIG_USB_PD_PORT_COUNT 2 #define CONFIG_USB_PD_TCPM_FUSB302 #define CONFIG_USB_PD_VBUS_DETECT_CHARGER diff --git a/driver/tcpm/fusb302.c b/driver/tcpm/fusb302.c index 424c203496..a174e5193e 100644 --- a/driver/tcpm/fusb302.c +++ b/driver/tcpm/fusb302.c @@ -397,6 +397,15 @@ static int fusb302_tcpm_init(int port) /* Interrupt Enable */ tcpc_read(port, TCPC_REG_CONTROL0, ®); reg &= ~TCPC_REG_CONTROL0_INT_MASK; + /* Set the current source for Rp value */ + reg &= ~TCPC_REG_CONTROL0_HOST_CUR_MASK; +#ifdef CONFIG_USB_PD_PULLUP_1_5A + reg |= TCPC_REG_CONTROL0_HOST_CUR_1A5; +#elif defined(CONFIG_USB_PD_PULLUP_3A) + reg |= TCPC_REG_CONTROL0_HOST_CUR_3A0; +#else + reg |= TCPC_REG_CONTROL0_HOST_CUR_USB; +#endif tcpc_write(port, TCPC_REG_CONTROL0, reg); /* Set VCONN switch defaults */ diff --git a/driver/tcpm/fusb302.h b/driver/tcpm/fusb302.h index 56f1813d7b..edf8c3fdf8 100644 --- a/driver/tcpm/fusb302.h +++ b/driver/tcpm/fusb302.h @@ -60,6 +60,10 @@ #define TCPC_REG_CONTROL0 0x06 #define TCPC_REG_CONTROL0_TX_FLUSH (1<<6) #define TCPC_REG_CONTROL0_INT_MASK (1<<5) +#define TCPC_REG_CONTROL0_HOST_CUR_MASK (3<<2) +#define TCPC_REG_CONTROL0_HOST_CUR_3A0 (3<<2) +#define TCPC_REG_CONTROL0_HOST_CUR_1A5 (2<<2) +#define TCPC_REG_CONTROL0_HOST_CUR_USB (1<<2) #define TCPC_REG_CONTROL0_TX_START (1<<0) #define TCPC_REG_CONTROL1 0x07 |