summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWai-Hong Tam <waihong@google.com>2020-07-17 15:26:55 -0700
committerCommit Bot <commit-bot@chromium.org>2020-09-11 01:46:15 +0000
commit8c8653b921c4819f62bf3d556ee4a66eed487a83 (patch)
tree56cc733ccf5f6495a7f128218110a146a0e63d6e
parent8e38c1c5966baf5ee4854ed53258b52b6fa0e963 (diff)
downloadchrome-ec-8c8653b921c4819f62bf3d556ee4a66eed487a83.tar.gz
ps8805: Follow the sequence to enable the DCI register access
Follow the sequence in the programming guide to enable the DCI register access, even they are always enabled in the firmware. BRANCH=None BUG=b:161202452, b:147772854 TEST=Tested Trogdor negotiate >5V charging and source power to USB devices. Change-Id: Ia121855cf097fe4b517ceefa461568fbec67b63d Signed-off-by: Wai-Hong Tam <waihong@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2304264 Reviewed-by: Marco Chen <marcochen@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2393395 Tested-by: Devin Lu <Devin.Lu@quantatw.com> Commit-Queue: Edward Hill <ecgh@chromium.org>
-rw-r--r--driver/tcpm/ps8xxx.c27
1 files changed, 23 insertions, 4 deletions
diff --git a/driver/tcpm/ps8xxx.c b/driver/tcpm/ps8xxx.c
index 6b274cd405..7e65b7373b 100644
--- a/driver/tcpm/ps8xxx.c
+++ b/driver/tcpm/ps8xxx.c
@@ -209,11 +209,30 @@ static int ps8xxx_dci_disable(int port)
static int ps8xxx_dci_disable(int port)
{
int p1_addr;
+ int p3_addr;
+ int regval;
+ int rv;
+
+ /* Enable access to debug pages. */
+ p3_addr = tcpc_config[port].i2c_info.addr_flags;
+ rv = tcpc_addr_read(port, p3_addr, PS8XXX_REG_I2C_DEBUGGING_ENABLE,
+ &regval);
+ if (rv)
+ return rv;
- /* DCI registers are always accessible on PS8805 */
- p1_addr = PS8751_P3_TO_P1_FLAGS(tcpc_config[port].i2c_info.addr_flags);
- return ps8xxx_addr_dci_disable(port, p1_addr,
- PS8805_P1_REG_MUX_USB_DCI_CFG);
+ rv = tcpc_addr_write(port, p3_addr, PS8XXX_REG_I2C_DEBUGGING_ENABLE,
+ PS8XXX_REG_I2C_DEBUGGING_ENABLE_ON);
+
+ /* Disable Auto DCI */
+ p1_addr = PS8751_P3_TO_P1_FLAGS(p3_addr);
+ rv = ps8xxx_addr_dci_disable(port, p1_addr,
+ PS8805_P1_REG_MUX_USB_DCI_CFG);
+
+ /*
+ * PS8805 will automatically re-assert bit:0 on the
+ * PS8XXX_REG_I2C_DEBUGGING_ENABLE register.
+ */
+ return rv;
}
#endif /* CONFIG_USB_PD_TCPM_PS8805 */