From cb5112309fd345411361029fe8b281501cd1ba1f Mon Sep 17 00:00:00 2001 From: Aseda Aboagye Date: Thu, 16 Jan 2020 21:41:26 -0800 Subject: [PATCH] waddledoo: Enable TCPCI Rev2 v1.0 for TCPCs The RAA489000 TCPCs that waddledoo is using are a TCPCI Rev2 TCPC. Unfortunately, there seems to be some problems with the TCPCI Rev1 mode, so enable TCPCI Rev2 mode instead which seems to work with the newly added TCPCI Rev2 support. BUG=b:147316570 BRANCH=None TEST=Build and flash waddledoo, verify that TCPC can receive and transmit PD messages. Change-Id: If8fb434d865bf5a6f0439707581ca92cb3e7731d Signed-off-by: Aseda Aboagye Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2006711 Tested-by: Aseda Aboagye Reviewed-by: Diana Z Commit-Queue: Aseda Aboagye --- board/waddledoo/board.c | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/board/waddledoo/board.c b/board/waddledoo/board.c index 6734eec156..711b0dccf3 100644 --- a/board/waddledoo/board.c +++ b/board/waddledoo/board.c @@ -292,6 +292,7 @@ const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_MAX_COUNT] = { .port = I2C_PORT_USB_C0, .addr_flags = RAA489000_TCPC0_I2C_FLAGS, }, + .flags = TCPC_FLAGS_TCPCI_V2_0, .drv = &raa489000_tcpm_drv, }, @@ -301,6 +302,7 @@ const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_MAX_COUNT] = { .port = I2C_PORT_SUB_USB_C1, .addr_flags = RAA489000_TCPC0_I2C_FLAGS, }, + .flags = TCPC_FLAGS_TCPCI_V2_0, .drv = &raa489000_tcpm_drv, }, }; @@ -327,13 +329,10 @@ uint16_t tcpc_get_alert_status(void) * alert status. */ if (!gpio_get_level(GPIO_USB_C0_INT_ODL)) { - /* - * TODO(b:147716486) If we decide to handle TCPCIv2.0, we cannot - * ignore bits 14:12 any longer. - */ if (!tcpc_read16(0, TCPC_REG_ALERT, ®val)) { /* The TCPCI v1.0 spec says to ignore bits 14:12. */ - regval &= ~((1 << 14) | (1 << 13) | (1 << 12)); + if (!(tcpc_config[0].flags & TCPC_FLAGS_TCPCI_V2_0)) + regval &= ~((1 << 14) | (1 << 13) | (1 << 12)); if (regval) status |= PD_STATUS_TCPC_ALERT_0; @@ -341,13 +340,10 @@ uint16_t tcpc_get_alert_status(void) } if (!gpio_get_level(GPIO_SUB_USB_C1_INT_ODL)) { - /* - * TODO(b:147716486) If we decide to handle TCPCIv2.0, we cannot - * ignore bits 14:12 any longer. - */ if (!tcpc_read16(1, TCPC_REG_ALERT, ®val)) { /* TCPCI spec v1.0 says to ignore bits 14:12. */ - regval &= ~((1 << 14) | (1 << 13) | (1 << 12)); + if (!(tcpc_config[1].flags & TCPC_FLAGS_TCPCI_V2_0)) + regval &= ~((1 << 14) | (1 << 13) | (1 << 12)); if (regval) status |= PD_STATUS_TCPC_ALERT_1;