summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDiana Z <dzigterman@chromium.org>2020-10-16 12:58:20 -0600
committerCommit Bot <commit-bot@chromium.org>2020-10-28 19:14:28 +0000
commit3c79b8fbb955f18fc02d1c33449056f0b154d6b5 (patch)
tree4af9f950788d5c7636747ebcb91a5049ac8285fc
parentc9826aad176be771412d453f37bbc55714afc2b1 (diff)
downloadchrome-ec-3c79b8fbb955f18fc02d1c33449056f0b154d6b5.tar.gz
COIL: Re-name to TCPCI_I2C_PERIPHERAL
Boards which don't use a TCPM will define TCPCI_I2C_PERIPHERAL. BRANCH=None BUG=None TEST=make -j buildall Signed-off-by: Diana Z <dzigterman@chromium.org> Change-Id: If93e533e059888e8ad5166b29c37bc2243f46947 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2481940 Reviewed-by: Jett Rink <jettrink@chromium.org>
-rw-r--r--chip/stm32/i2c-stm32f0.c10
-rw-r--r--include/usb_pd_tcpc.h11
2 files changed, 12 insertions, 9 deletions
diff --git a/chip/stm32/i2c-stm32f0.c b/chip/stm32/i2c-stm32f0.c
index f722de2b54..36767aaa75 100644
--- a/chip/stm32/i2c-stm32f0.c
+++ b/chip/stm32/i2c-stm32f0.c
@@ -288,7 +288,7 @@ static void i2c_process_command(void)
host_packet_receive(&i2c_packet);
}
-#ifdef TCPCI_I2C_SLAVE
+#ifdef TCPCI_I2C_PERIPHERAL
static void i2c_send_tcpc_response(int len)
{
/* host_buffer data range, beyond this length, will return 0xec */
@@ -310,7 +310,7 @@ static void i2c_event_handler(int port)
{
int i2c_isr;
static int rx_pending, buf_idx;
-#ifdef TCPCI_I2C_SLAVE
+#ifdef TCPCI_I2C_PERIPHERAL
int addr;
#endif
@@ -360,7 +360,7 @@ static void i2c_event_handler(int port)
/* Stop condition on bus */
if (i2c_isr & STM32_I2C_ISR_STOP) {
-#ifdef TCPCI_I2C_SLAVE
+#ifdef TCPCI_I2C_PERIPHERAL
/*
* if tcpc is being addressed, and we received a stop
* while rx is pending, then this is a write only to
@@ -420,7 +420,7 @@ static void i2c_event_handler(int port)
*/
STM32_I2C_CR1(port) &= ~STM32_I2C_CR1_TXIE;
-#ifdef TCPCI_I2C_SLAVE
+#ifdef TCPCI_I2C_PERIPHERAL
addr = STM32_I2C_ISR_ADDCODE(
STM32_I2C_ISR(port));
if (ADDR_IS_TCPC(addr))
@@ -639,7 +639,7 @@ void i2c_init(void)
#endif
STM32_I2C_OAR1(I2C_PORT_EC) = 0x8000
| (I2C_GET_ADDR(CONFIG_HOSTCMD_I2C_SLAVE_ADDR_FLAGS) << 1);
-#ifdef TCPCI_I2C_SLAVE
+#ifdef TCPCI_I2C_PERIPHERAL
/*
* Configure TCPC address with OA2[1] masked so that we respond
* to CONFIG_TCPC_I2C_BASE_ADDR and CONFIG_TCPC_I2C_BASE_ADDR + 2.
diff --git a/include/usb_pd_tcpc.h b/include/usb_pd_tcpc.h
index 4ac22d4d86..e1e185d4d0 100644
--- a/include/usb_pd_tcpc.h
+++ b/include/usb_pd_tcpc.h
@@ -11,12 +11,12 @@
#include <stdint.h>
#include "usb_pd_tcpm.h"
-/* If we are a TCPC but do not a TCPM, then we implement the slave TCPCI */
+/* If we are a TCPC but not a TCPM, then we implement the peripheral TCPCI */
#if defined(CONFIG_USB_PD_TCPC) && !defined(CONFIG_USB_PD_TCPM_STUB)
-#define TCPCI_I2C_SLAVE
+#define TCPCI_I2C_PERIPHERAL
#endif
-#ifdef TCPCI_I2C_SLAVE
+#ifdef TCPCI_I2C_PERIPHERAL
/* Convert TCPC address to type-C port number */
#define TCPC_ADDR_TO_PORT(addr) ((addr) \
- I2C_GET_ADDR(CONFIG_TCPC_I2C_BASE_ADDR_FLAGS))
@@ -44,7 +44,10 @@ void tcpc_i2c_process(int read, int port, int len, uint8_t *payload,
void pd_vbus_evt_p0(enum gpio_signal signal);
void pd_vbus_evt_p1(enum gpio_signal signal);
-/* Methods for TCPCI slaves (e.g. zinger) to get/set their internal state */
+/*
+ * Methods for TCPCI peripherals (e.g. zinger) to get/set their internal
+ * state
+ */
int tcpc_alert_status(int port, int *alert);
int tcpc_alert_status_clear(int port, uint16_t mask);
int tcpc_alert_mask_set(int port, uint16_t mask);