summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSam Hurst <shurst@google.com>2016-09-26 09:55:06 -0700
committerchrome-bot <chrome-bot@chromium.org>2016-09-29 19:14:52 -0700
commitece9996136a1052cbe5688b26847bb75c63ba4d6 (patch)
tree33f88dc09e88e7a81b4ffde72f4f19da839bef14
parentc0f9e3f411b2470bdb39662a99929beb6825be9d (diff)
downloadchrome-ec-ece9996136a1052cbe5688b26847bb75c63ba4d6.tar.gz
ec: Remove fusb302 rev.A support
We're using fusb302 rev. >= B now, so let's remove rev. A support. BUG=chrome-os-partner:57492 BRANCH=none TEST=Manuel - plug USBC->DP cable into TV then into kevin localhost ~ # ectool usbpdmuxinfo Port 0: DP INV - plug USBC->DP cable into kevin then into TV localhost ~ # ectool usbpdmuxinfo Port 0: DP INV - unplug USBC->DP cable from TV Port 0: OPEN INV - plug USBC->ETHERNET into kevin and verified that network displayed ethernet Change-Id: Ia84dc2480c1a8b003ab8dfdcdaa9f82f6d429e4b Reviewed-on: https://chromium-review.googlesource.com/388925 Commit-Ready: Shawn N <shawnn@chromium.org> Tested-by: Sam Hurst <shurst@google.com> Reviewed-by: Shawn N <shawnn@chromium.org>
-rw-r--r--driver/tcpm/fusb302.c128
1 files changed, 26 insertions, 102 deletions
diff --git a/driver/tcpm/fusb302.c b/driver/tcpm/fusb302.c
index 4493adff52..728c1deb09 100644
--- a/driver/tcpm/fusb302.c
+++ b/driver/tcpm/fusb302.c
@@ -28,7 +28,6 @@ static struct fusb302_chip_state {
int togdone_pullup_cc1;
int togdone_pullup_cc2;
int tx_hard_reset_req;
- int device_id;
struct mutex set_cc_lock;
uint8_t mdac_vnc;
uint8_t mdac_rd;
@@ -173,24 +172,6 @@ static void detect_cc_pin_source_manual(int port, int *cc1_lvl, int *cc2_lvl)
}
-/* Determine cc pin state for source when autotoggle feature is enabled */
-static void detect_cc_pin_source_auto(int port, int *cc1_lvl, int *cc2_lvl)
-{
- *cc1_lvl = TYPEC_CC_VOLT_OPEN;
- *cc2_lvl = TYPEC_CC_VOLT_OPEN;
-
- if (state[port].togdone_pullup_cc1 == 1) {
- /* Measure CC1 */
- *cc1_lvl = measure_cc_pin_source(port,
- TCPC_REG_SWITCHES0_MEAS_CC1);
-
- } else if (state[port].togdone_pullup_cc2 == 1) {
- /* Measure CC2 */
- *cc2_lvl = measure_cc_pin_source(port,
- TCPC_REG_SWITCHES0_MEAS_CC2);
- }
-}
-
/* Determine cc pin state for sink */
static void detect_cc_pin_sink(int port, int *cc1, int *cc2)
{
@@ -392,10 +373,6 @@ static int fusb302_tcpm_init(int port)
/* all other variables assumed to default to 0 */
- /* Read the DeviceID register to get the chip version */
- tcpc_read(port, TCPC_REG_DEVICE_ID, &reg);
- state[port].device_id = (reg & 0xF0) >> 4;
-
/* Restore default settings */
tcpc_write(port, TCPC_REG_RESET, TCPC_REG_RESET_SW_RESET);
@@ -417,10 +394,6 @@ static int fusb302_tcpm_init(int port)
tcpc_write(port, TCPC_REG_MASK, reg);
reg = 0xFF;
- /* Only use autodetect feature for revA silicon */
- if (state[port].device_id == FUSB302_DEVID_302A)
- /* informs of attaches */
- reg &= ~TCPC_REG_MASKA_TOGDONE;
/* when all pd message retries fail... */
reg &= ~TCPC_REG_MASKA_RETRYFAIL;
/* when fusb302 send a hard reset. */
@@ -469,10 +442,7 @@ static int fusb302_tcpm_get_cc(int port, int *cc1, int *cc2)
if (state[port].pulling_up) {
/* Source mode? */
- if (state[port].device_id == FUSB302_DEVID_302A)
- detect_cc_pin_source_auto(port, cc1, cc2);
- else
- detect_cc_pin_source_manual(port, cc1, cc2);
+ detect_cc_pin_source_manual(port, cc1, cc2);
} else {
/* Sink mode? */
detect_cc_pin_sink(port, cc1, cc2);
@@ -499,56 +469,28 @@ static int fusb302_tcpm_set_cc(int port, int pull)
/* NOTE: FUSB302 Does not support Ra. */
switch (pull) {
case TYPEC_CC_RP:
+ /* enable the pull-up we know to be necessary */
+ tcpc_read(port, TCPC_REG_SWITCHES0, &reg);
- /* Only use autodetect feature for revA silicon */
- /* if fusb302 hasn't figured anything out yet */
- if ((state[port].device_id == FUSB302_DEVID_302A) &&
- !state[port].togdone_pullup_cc1 &&
- !state[port].togdone_pullup_cc2) {
-
- /* Enable DFP Toggle Mode */
- tcpc_read(port, TCPC_REG_CONTROL2, &reg);
-
- /* turn on toggle */
- reg |= (TCPC_REG_CONTROL2_MODE_DFP <<
- TCPC_REG_CONTROL2_MODE_POS);
- reg |= TCPC_REG_CONTROL2_TOGGLE;
- tcpc_write(port, TCPC_REG_CONTROL2, reg);
-
- state[port].pulling_up = 1;
- state[port].dfp_toggling_on = 1;
- } else {
-
- /* enable the pull-up we know to be necessary */
- tcpc_read(port, TCPC_REG_SWITCHES0, &reg);
-
- reg &= ~(TCPC_REG_SWITCHES0_CC2_PU_EN |
- TCPC_REG_SWITCHES0_CC1_PU_EN |
- TCPC_REG_SWITCHES0_CC1_PD_EN |
- TCPC_REG_SWITCHES0_CC2_PD_EN |
- TCPC_REG_SWITCHES0_VCONN_CC1 |
- TCPC_REG_SWITCHES0_VCONN_CC2);
+ reg &= ~(TCPC_REG_SWITCHES0_CC2_PU_EN |
+ TCPC_REG_SWITCHES0_CC1_PU_EN |
+ TCPC_REG_SWITCHES0_CC1_PD_EN |
+ TCPC_REG_SWITCHES0_CC2_PD_EN |
+ TCPC_REG_SWITCHES0_VCONN_CC1 |
+ TCPC_REG_SWITCHES0_VCONN_CC2);
- if (state[port].device_id == FUSB302_DEVID_302A) {
- if (state[port].togdone_pullup_cc1)
- reg |= TCPC_REG_SWITCHES0_CC1_PU_EN;
- else
- reg |= TCPC_REG_SWITCHES0_CC2_PU_EN;
- } else {
- reg |= TCPC_REG_SWITCHES0_CC1_PU_EN |
- TCPC_REG_SWITCHES0_CC2_PU_EN;
- }
- if (state[port].vconn_enabled)
- reg |= state[port].togdone_pullup_cc1 ?
- TCPC_REG_SWITCHES0_VCONN_CC2 :
- TCPC_REG_SWITCHES0_VCONN_CC1;
+ reg |= TCPC_REG_SWITCHES0_CC1_PU_EN |
+ TCPC_REG_SWITCHES0_CC2_PU_EN;
- tcpc_write(port, TCPC_REG_SWITCHES0, reg);
+ if (state[port].vconn_enabled)
+ reg |= state[port].togdone_pullup_cc1 ?
+ TCPC_REG_SWITCHES0_VCONN_CC2 :
+ TCPC_REG_SWITCHES0_VCONN_CC1;
- state[port].pulling_up = 1;
- state[port].dfp_toggling_on = 0;
- }
+ tcpc_write(port, TCPC_REG_SWITCHES0, reg);
+ state[port].pulling_up = 1;
+ state[port].dfp_toggling_on = 0;
break;
case TYPEC_CC_RD:
/* Enable UFP Mode */
@@ -963,15 +905,8 @@ void fusb302_tcpc_alert(int port)
TCPC_REG_SWITCHES0_VCONN_CC1 |
TCPC_REG_SWITCHES0_VCONN_CC2);
- if (state[port].device_id == FUSB302_DEVID_302A) {
- if (state[port].togdone_pullup_cc1)
- reg |= TCPC_REG_SWITCHES0_CC1_PU_EN;
- else
- reg |= TCPC_REG_SWITCHES0_CC2_PU_EN;
- } else {
- reg |= TCPC_REG_SWITCHES0_CC1_PU_EN |
- TCPC_REG_SWITCHES0_CC2_PU_EN;
- }
+ reg |= TCPC_REG_SWITCHES0_CC1_PU_EN |
+ TCPC_REG_SWITCHES0_CC2_PU_EN;
if (state[port].vconn_enabled)
reg |= state[port].togdone_pullup_cc1 ?
@@ -1032,25 +967,14 @@ void tcpm_set_bist_test_data(int port)
{
int reg;
- /* 302B Only */
- if (state[port].device_id == FUSB302_DEVID_302B) {
- /* Read control3 register */
- tcpc_read(port, TCPC_REG_CONTROL3, &reg);
+ /* Read control3 register */
+ tcpc_read(port, TCPC_REG_CONTROL3, &reg);
- /* Set the BIST_TMODE bit (Clears on Hard Reset) */
- reg |= TCPC_REG_CONTROL3_BIST_TMODE;
+ /* Set the BIST_TMODE bit (Clears on Hard Reset) */
+ reg |= TCPC_REG_CONTROL3_BIST_TMODE;
- /* Write the updated value */
- tcpc_write(port, TCPC_REG_CONTROL3, reg);
- } else {
- /*
- * For the 302A, in this test mode, we want to disable
- * the protocol layer (don't respond to messages), and
- * repeatedly write the CONTROL1_RX_FLUSH bit to clear
- * the receive FIFO and allow the part to continue
- * sending GoodCRC messages automatically.
- */
- }
+ /* Write the updated value */
+ tcpc_write(port, TCPC_REG_CONTROL3, reg);
}
const struct tcpm_drv fusb302_tcpm_drv = {