diff options
author | Wai-Hong Tam <waihong@google.com> | 2020-07-17 15:26:55 -0700 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2020-07-21 20:38:59 +0000 |
commit | e2d358b2d8c78067a19defb0beeb15428459ae26 (patch) | |
tree | 7de1f8465dfdd340cbf76772874131e39a59c15b /driver | |
parent | acec93ba1ad7ca3e42892a63d86b45967a0b70c5 (diff) | |
download | chrome-ec-e2d358b2d8c78067a19defb0beeb15428459ae26.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>
Diffstat (limited to 'driver')
-rw-r--r-- | driver/tcpm/ps8xxx.c | 27 |
1 files changed, 23 insertions, 4 deletions
diff --git a/driver/tcpm/ps8xxx.c b/driver/tcpm/ps8xxx.c index 6a4eb4e1c1..8d68701153 100644 --- a/driver/tcpm/ps8xxx.c +++ b/driver/tcpm/ps8xxx.c @@ -322,11 +322,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; - /* 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); + /* 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, + ®val); + if (rv) + return rv; + + 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 */ |