summaryrefslogtreecommitdiff
path: root/driver
diff options
context:
space:
mode:
authorShawn Nematbakhsh <shawnn@chromium.org>2016-09-02 11:16:12 -0700
committerchrome-bot <chrome-bot@chromium.org>2016-09-23 21:09:29 -0700
commita87663f6dc431e8154b77c49ad7eaa8eb0e7bc4e (patch)
tree3e476dfe22e508953b33181a520dca4d6832a526 /driver
parent838babebd90885abad19ba3c6ab92865be2fe03e (diff)
downloadchrome-ec-a87663f6dc431e8154b77c49ad7eaa8eb0e7bc4e.tar.gz
tcpm: anx74xx: Initialize regs for proper CC cye diagram
BUG=chrome-os-partner:56788 BRANCH=None TEST=Verify CC eye diagram looks better. Change-Id: I4880e81b0a4737a303027513e77c9a66845472e2 Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/380352 Commit-Ready: Shawn N <shawnn@chromium.org> Tested-by: Kevin K Wong <kevin.k.wong@intel.com> Tested-by: Shawn N <shawnn@chromium.org> Reviewed-by: Shawn N <shawnn@chromium.org>
Diffstat (limited to 'driver')
-rw-r--r--driver/tcpm/anx74xx.c24
-rw-r--r--driver/tcpm/anx74xx.h1
2 files changed, 23 insertions, 2 deletions
diff --git a/driver/tcpm/anx74xx.c b/driver/tcpm/anx74xx.c
index 689d6d1799..889d4f0bd4 100644
--- a/driver/tcpm/anx74xx.c
+++ b/driver/tcpm/anx74xx.c
@@ -150,10 +150,17 @@ static int anx74xx_tcpm_mux_exit(int port)
rv = tcpc_read(port, ANX74XX_REG_ANALOG_CTRL_2, &reg);
if (rv)
return EC_ERROR_UNKNOWN;
-
rv |= tcpc_write(port, ANX74XX_REG_ANALOG_CTRL_2, reg | ANX74XX_REG_MODE_TRANS);
+
+ /* Clear Bit[7:0] R_SWITCH */
rv |= tcpc_write(port, ANX74XX_REG_ANALOG_CTRL_1, 0x0);
- rv |= tcpc_write(port, ANX74XX_REG_ANALOG_CTRL_5, 0x04);
+
+ /* Clear Bit[7:4] R_SWITCH_H */
+ rv |= tcpc_read(port, ANX74XX_REG_ANALOG_CTRL_5, &reg);
+ if (rv)
+ return EC_ERROR_UNKNOWN;
+ rv |= tcpc_write(port, ANX74XX_REG_ANALOG_CTRL_5, (reg & 0x0f));
+
rv |= tcpc_write(port, ANX74XX_REG_ANALOG_CTRL_2, reg & 0x09);
if (rv)
return EC_ERROR_UNKNOWN;
@@ -848,6 +855,14 @@ int anx74xx_tcpm_init(int port)
if (rv)
return EC_ERROR_UNKNOWN;
+ /* Set AVDD10_BMC to 1.08 */
+ rv |= tcpc_read(port, ANX74XX_REG_ANALOG_CTRL_5, &reg);
+ if (rv)
+ return EC_ERROR_UNKNOWN;
+ rv = tcpc_write(port, ANX74XX_REG_ANALOG_CTRL_5, (reg & 0xf3));
+ if (rv)
+ return EC_ERROR_UNKNOWN;
+
/* Decrease BMC TX lowest swing voltage */
rv |= tcpc_read(port, ANX74XX_REG_ANALOG_CTRL_11, &reg);
if (rv)
@@ -856,6 +871,11 @@ int anx74xx_tcpm_init(int port)
if (rv)
return EC_ERROR_UNKNOWN;
+ /* Set BMC TX cap slew rate to 400ns */
+ rv = tcpc_write(port, ANX74XX_REG_ANALOG_CTRL_12, 0x4);
+ if (rv)
+ return EC_ERROR_UNKNOWN;
+
#ifdef CONFIG_USB_PD_TCPC_FW_VERSION
board_print_tcpc_fw_version(port);
#endif
diff --git a/driver/tcpm/anx74xx.h b/driver/tcpm/anx74xx.h
index 76bb44067e..8fc81c0bc0 100644
--- a/driver/tcpm/anx74xx.h
+++ b/driver/tcpm/anx74xx.h
@@ -82,6 +82,7 @@
#define ANX74XX_REG_AUX_SWAP_SET_CC2 0xc0
#define ANX74XX_REG_ANALOG_CTRL_11 0x4c
+#define ANX74XX_REG_ANALOG_CTRL_12 0x4d
#define ANX74XX_REG_MUX_DP_MODE_ACE_CC1 0x49
#define ANX74XX_REG_MUX_DP_MODE_ACE_CC2 0x86