summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDiana Z <dzigterman@chromium.org>2021-05-26 10:54:43 -0600
committerCommit Bot <commit-bot@chromium.org>2021-05-27 16:25:36 +0000
commitcd3ee59dbd87f115a99b7f3014af1116702d1f6a (patch)
tree480ef970c2b0c8f2f60606bda898b88ffecba17d
parent83e0789cfa7801aa8ebe10fcde7d63e28f83f024 (diff)
downloadchrome-ec-cd3ee59dbd87f115a99b7f3014af1116702d1f6a.tar.gz
TCPCI: Move debug accessory control set to NCT38xx driver
This debug accessory control setting was initially added to the TCPCI driver to support the NCT3807, but now should move into the NCT driver since it will need to be conditional on specific register conditions. Note that NCT is the only driver currently implementing the debug_accessory driver field, so it's not expected to affect other TCPCs. BRANCH=None BUG=b:186799392 TEST=make -j buildall Signed-off-by: Diana Z <dzigterman@chromium.org> Change-Id: Id5832c474378a3f8735c6c72c5535ddb5d9229d4 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2919940 Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
-rw-r--r--driver/tcpm/nct38xx.c8
-rw-r--r--driver/tcpm/tcpci.c17
2 files changed, 13 insertions, 12 deletions
diff --git a/driver/tcpm/nct38xx.c b/driver/tcpm/nct38xx.c
index f4e3382d3a..7ec5174bbb 100644
--- a/driver/tcpm/nct38xx.c
+++ b/driver/tcpm/nct38xx.c
@@ -28,6 +28,14 @@ static int nct38xx_init(int port)
int reg;
/*
+ * Set TCPC_CONTROL.DebugAccessoryControl = 1 to control by TCPM,
+ * not TCPC.
+ */
+ RETURN_ERROR(tcpc_update8(port, TCPC_REG_TCPC_CTRL,
+ TCPC_REG_TCPC_CTRL_DEBUG_ACC_CONTROL,
+ MASK_SET));
+
+ /*
* Write to the CONTROL_OUT_EN register to enable:
* [6] - CONNDIREN : Connector direction indication output enable
* [2] - SNKEN : VBUS sink enable output enable
diff --git a/driver/tcpm/tcpci.c b/driver/tcpm/tcpci.c
index 7c6fe6be10..6e73f2be72 100644
--- a/driver/tcpm/tcpci.c
+++ b/driver/tcpm/tcpci.c
@@ -1373,7 +1373,6 @@ int tcpci_tcpm_init(int port)
int error;
int power_status;
int tries = TCPM_INIT_TRIES;
- int tcpc_ctrl;
if (port >= board_get_usb_pd_port_count())
return EC_ERROR_INVAL;
@@ -1393,24 +1392,18 @@ int tcpci_tcpm_init(int port)
}
/*
- * Set TCPC_CONTROL.DebugAccessoryControl = 1 to control by TCPM,
- * not TCPC.
- */
- tcpc_ctrl = TCPC_REG_TCPC_CTRL_DEBUG_ACC_CONTROL;
-
- /*
* For TCPCI Rev 2.0, unless the TCPM sets
* TCPC_CONTROL.EnableLooking4ConnectionAlert bit, TCPC by default masks
* Alert assertion when CC_STATUS.Looking4Connection changes state.
*/
if (tcpc_config[port].flags & TCPC_FLAGS_TCPCI_REV2_0) {
- tcpc_ctrl |= TCPC_REG_TCPC_CTRL_EN_LOOK4CONNECTION_ALERT;
+ error = tcpc_update8(port, TCPC_REG_TCPC_CTRL,
+ TCPC_REG_TCPC_CTRL_EN_LOOK4CONNECTION_ALERT,
+ MASK_SET);
+ if (error)
+ CPRINTS("C%d: Failed to init TCPC_CTRL!", port);
}
- error = tcpc_update8(port, TCPC_REG_TCPC_CTRL, tcpc_ctrl, MASK_SET);
- if (error)
- CPRINTS("C%d: Failed to init TCPC_CTRL!", port);
-
/*
* Handle and clear any alerts, since we might be coming out of low
* power mode in response to an alert interrupt from the TCPC.