From 003ec08f8c67845ae8481d3fb4124555213b04c4 Mon Sep 17 00:00:00 2001 From: Abe Levkoy Date: Fri, 27 Aug 2021 15:21:39 -0600 Subject: TCPM: Rename enum tcpm_sop_type and its constants As a followup to CL:3104290, give the TCPCI TRANSMIT and RX_BUF_FRAME_TYPE types more consistent names. Most of them can be used for receiving, not just transmitting. Fix lint errors thus revealed. BUG=b:155476419 TEST=make buildall BRANCH=none Signed-off-by: Abe Levkoy Change-Id: I399ec479eacc18622fc4d3f55f8bdabf4560fcff Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3125995 Reviewed-by: Keith Short --- chip/stm32/ucpd-stm32gx.c | 30 +++++++++++++++--------------- chip/stm32/ucpd-stm32gx.h | 2 +- 2 files changed, 16 insertions(+), 16 deletions(-) (limited to 'chip') diff --git a/chip/stm32/ucpd-stm32gx.c b/chip/stm32/ucpd-stm32gx.c index 84726d55be..ef6ec92a89 100644 --- a/chip/stm32/ucpd-stm32gx.c +++ b/chip/stm32/ucpd-stm32gx.c @@ -105,7 +105,7 @@ union buffer { }; struct ucpd_tx_desc { - enum tcpm_sop_type type; + enum tcpci_msg_type type; int msg_len; int msg_index; union buffer data; @@ -719,13 +719,13 @@ int stm32gx_ucpd_get_chip_info(int port, int live, static int stm32gx_ucpd_start_transmit(int port, enum ucpd_tx_msg msg_type) { - enum tcpm_sop_type type; + enum tcpci_msg_type type; /* Select the correct tx desciptor */ ucpd_tx_active_buffer = &ucpd_tx_buffers[msg_type]; type = ucpd_tx_active_buffer->type; - if (type == TCPC_TX_HARD_RESET) { + if (type == TCPCI_MSG_TX_HARD_RESET) { /* * From RM0440 45.4.4: * In order to facilitate generation of a Hard Reset, a special @@ -750,7 +750,7 @@ static int stm32gx_ucpd_start_transmit(int port, enum ucpd_tx_msg msg_type) STM32_UCPD_IMR_HRSTSENTIE; /* Initiate Hard Reset */ STM32_UCPD_CR(port) |= STM32_UCPD_CR_TXHRST; - } else if (type != TCPC_TX_INVALID) { + } else if (type != TCPCI_MSG_INVALID) { int msg_len = 0; int mode; @@ -774,9 +774,9 @@ static int stm32gx_ucpd_start_transmit(int port, enum ucpd_tx_msg msg_type) * the header is number of 32 bit objects. Also, the length * field must account for the 2 header bytes. */ - if (type == TCPC_TX_BIST_MODE_2) { + if (type == TCPCI_MSG_TX_BIST_MODE_2) { mode = STM32_UCPD_CR_TXMODE_BIST; - } else if (type == TCPC_TX_CABLE_RESET) { + } else if (type == TCPCI_MSG_CABLE_RESET) { mode = STM32_UCPD_CR_TXMODE_CBL_RST; } else { mode = STM32_UCPD_CR_TXMODE_DEF; @@ -790,7 +790,7 @@ static int stm32gx_ucpd_start_transmit(int port, enum ucpd_tx_msg msg_type) STM32_UCPD_CR(port) |= STM32_UCPD_CR_TXMODE_VAL(mode); /* Index into ordset enum for start of packet */ - if (type <= TCPC_TX_CABLE_RESET ) + if (type <= TCPCI_MSG_CABLE_RESET) STM32_UCPD_TX_ORDSETR(port) = ucpd_txorderset[type]; else STM32_UCPD_TX_ORDSETR(port) = @@ -1130,7 +1130,7 @@ static void ucpd_send_good_crc(int port, uint16_t rx_header) int msg_id; int rev_id; uint16_t tx_header; - enum tcpm_sop_type tx_type; + enum tcpci_msg_type tx_type; enum pd_power_role pr = 0; enum pd_data_role dr = 0; @@ -1146,7 +1146,7 @@ static void ucpd_send_good_crc(int port, uint16_t rx_header) /* * Get the rx ordered set code just detected. SOP -> SOP''_Debug are in - * the same order as enum tcpm_sop_type and so can be used + * the same order as enum tcpci_msg_type and so can be used * directly. */ tx_type = STM32_UCPD_RX_ORDSETR(port) & STM32_UCPD_RXORDSETR_MASK; @@ -1164,7 +1164,7 @@ static void ucpd_send_good_crc(int port, uint16_t rx_header) /* construct header message */ msg_id = PD_HEADER_ID(rx_header); rev_id = PD_HEADER_REV(rx_header); - if (tx_type == TCPC_TX_SOP) { + if (tx_type == TCPCI_MSG_SOP) { pr = msg_header.pr; dr = msg_header.dr; } @@ -1180,7 +1180,7 @@ static void ucpd_send_good_crc(int port, uint16_t rx_header) } int stm32gx_ucpd_transmit(int port, - enum tcpm_sop_type type, + enum tcpci_msg_type type, uint16_t header, const uint32_t *data) { @@ -1203,7 +1203,7 @@ int stm32gx_ucpd_transmit(int port, * resets as they are able to interrupt ongoing transmit, and should * have priority over any pending message. */ - if (type == TCPC_TX_HARD_RESET) + if (type == TCPCI_MSG_TX_HARD_RESET) task_set_event(TASK_ID_UCPD, UCPD_EVT_HR_REQ); else task_set_event(TASK_ID_UCPD, UCPD_EVT_TCPM_MSG_REQ); @@ -1319,7 +1319,7 @@ void stm32gx_ucpd1_irq(void) /* Check for errors */ if (!(sr & STM32_UCPD_SR_RXERR)) { uint16_t *rx_header = (uint16_t *)ucpd_rx_buffer; - enum tcpm_sop_type type; + enum tcpci_msg_type type; int good_crc = 0; type = STM32_UCPD_RX_ORDSETR(port) & @@ -1339,7 +1339,7 @@ void stm32gx_ucpd1_irq(void) * without disabling the ucpd peripheral. */ if (!good_crc && (ucpd_rx_sop_prime_enabled || - type == TCPC_TX_SOP)) { + type == TCPCI_MSG_SOP)) { /* * If BIST test mode is active, then still need @@ -1559,7 +1559,7 @@ static int command_ucpd(int argc, char **argv) * pd_dpm_request(port, DPM_REQUEST_BIST_TX); */ } else if (!strcasecmp(argv[1], "hard")) { - stm32gx_ucpd_transmit(port, TCPC_TX_HARD_RESET, 0, + stm32gx_ucpd_transmit(port, TCPCI_MSG_TX_HARD_RESET, 0, &tx_data); } else if (!strcasecmp(argv[1], "pol")) { if (argc < 3) diff --git a/chip/stm32/ucpd-stm32gx.h b/chip/stm32/ucpd-stm32gx.h index f7021136ad..d3af41e5bc 100644 --- a/chip/stm32/ucpd-stm32gx.h +++ b/chip/stm32/ucpd-stm32gx.h @@ -173,7 +173,7 @@ int stm32gx_ucpd_set_msg_header(int port, int power_role, int data_role); * @return EC_SUCCESS */ int stm32gx_ucpd_transmit(int port, - enum tcpm_sop_type type, + enum tcpci_msg_type type, uint16_t header, const uint32_t *data); -- cgit v1.2.1