summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDossym Nurmukhanov <dossym@google.com>2021-01-12 00:43:34 +0000
committerCommit Bot <commit-bot@chromium.org>2021-01-12 02:36:52 +0000
commite5384a04f1412b8e1a01f23afebead17ace242d7 (patch)
treec88e64da7f5b294d61d96dc5cec69ce7d3a5cde5
parentfeef1acd80857cac4b5626880bf60efaf4b116b9 (diff)
downloadchrome-ec-e5384a04f1412b8e1a01f23afebead17ace242d7.tar.gz
COIL: Remove non-inclusive words from i2c code
BUG=none BRANCH=none TEST=Build npcx9 and coachz boards Signed-off-by: dossym@chromium.org Change-Id: I7f2ccd80e595e0ee24ff56ecde8d810a1f8b98cb Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2622067 Reviewed-by: Nicolas Boichat <drinkcat@chromium.org>
-rw-r--r--common/i2c_trace.c56
-rw-r--r--common/i2c_wedge.c44
2 files changed, 50 insertions, 50 deletions
diff --git a/common/i2c_trace.c b/common/i2c_trace.c
index d5d5e5d8f2..67b8864b22 100644
--- a/common/i2c_trace.c
+++ b/common/i2c_trace.c
@@ -17,24 +17,24 @@
struct i2c_trace_range {
bool enabled;
int port;
- int slave_addr_lo; /* Inclusive */
- int slave_addr_hi; /* Inclusive */
+ int addr_lo; /* Inclusive */
+ int addr_hi; /* Inclusive */
};
static struct i2c_trace_range trace_entries[8];
-void i2c_trace_notify(int port, uint16_t slave_addr_flags,
+void i2c_trace_notify(int port, uint16_t addr_flags,
const uint8_t *out_data, size_t out_size,
const uint8_t *in_data, size_t in_size)
{
size_t i;
- uint16_t addr = I2C_STRIP_FLAGS(slave_addr_flags);
+ uint16_t addr = I2C_STRIP_FLAGS(addr_flags);
for (i = 0; i < ARRAY_SIZE(trace_entries); i++)
if (trace_entries[i].enabled
&& trace_entries[i].port == port
- && trace_entries[i].slave_addr_lo <= addr
- && trace_entries[i].slave_addr_hi >= addr)
+ && trace_entries[i].addr_lo <= addr
+ && trace_entries[i].addr_hi >= addr)
goto trace_enabled;
return;
@@ -68,11 +68,11 @@ static int command_i2ctrace_list(void)
i,
trace_entries[i].port,
i2c_port->name,
- trace_entries[i].slave_addr_lo);
- if (trace_entries[i].slave_addr_hi
- != trace_entries[i].slave_addr_lo)
+ trace_entries[i].addr_lo);
+ if (trace_entries[i].addr_hi
+ != trace_entries[i].addr_lo)
ccprintf(" to 0x%X",
- trace_entries[i].slave_addr_hi);
+ trace_entries[i].addr_hi);
ccprintf("\n");
}
}
@@ -89,8 +89,8 @@ static int command_i2ctrace_disable(size_t id)
return EC_SUCCESS;
}
-static int command_i2ctrace_enable(int port, int slave_addr_lo,
- int slave_addr_hi)
+static int command_i2ctrace_enable(int port, int addr_lo,
+ int addr_hi)
{
struct i2c_trace_range *t;
struct i2c_trace_range *new_entry = NULL;
@@ -98,7 +98,7 @@ static int command_i2ctrace_enable(int port, int slave_addr_lo,
if (!get_i2c_port(port))
return EC_ERROR_PARAM2;
- if (slave_addr_lo > slave_addr_hi)
+ if (addr_lo > addr_hi)
return EC_ERROR_PARAM3;
/*
@@ -110,36 +110,36 @@ static int command_i2ctrace_enable(int port, int slave_addr_lo,
t++) {
if (t->enabled && t->port == port) {
/* Subset of existing range, do nothing */
- if (t->slave_addr_lo <= slave_addr_lo &&
- t->slave_addr_hi >= slave_addr_hi)
+ if (t->addr_lo <= addr_lo &&
+ t->addr_hi >= addr_hi)
return EC_SUCCESS;
/* Extends exising range on both directions, replace */
- if (t->slave_addr_lo >= slave_addr_lo &&
- t->slave_addr_hi <= slave_addr_hi) {
+ if (t->addr_lo >= addr_lo &&
+ t->addr_hi <= addr_hi) {
t->enabled = 0;
return command_i2ctrace_enable(
- port, slave_addr_lo, slave_addr_hi);
+ port, addr_lo, addr_hi);
}
/* Extends existing range below */
- if (t->slave_addr_lo - 1 <= slave_addr_hi &&
- t->slave_addr_hi >= slave_addr_hi) {
+ if (t->addr_lo - 1 <= addr_hi &&
+ t->addr_hi >= addr_hi) {
t->enabled = 0;
return command_i2ctrace_enable(
port,
- slave_addr_lo,
- t->slave_addr_hi);
+ addr_lo,
+ t->addr_hi);
}
/* Extends existing range above */
- if (t->slave_addr_lo <= slave_addr_lo &&
- t->slave_addr_hi + 1 >= slave_addr_lo) {
+ if (t->addr_lo <= addr_lo &&
+ t->addr_hi + 1 >= addr_lo) {
t->enabled = 0;
return command_i2ctrace_enable(
port,
- t->slave_addr_lo,
- slave_addr_hi);
+ t->addr_lo,
+ addr_hi);
}
} else if (!t->enabled && !new_entry) {
new_entry = t;
@@ -150,8 +150,8 @@ static int command_i2ctrace_enable(int port, int slave_addr_lo,
if (new_entry) {
new_entry->enabled = 1;
new_entry->port = port;
- new_entry->slave_addr_lo = slave_addr_lo;
- new_entry->slave_addr_hi = slave_addr_hi;
+ new_entry->addr_lo = addr_lo;
+ new_entry->addr_hi = addr_hi;
return EC_SUCCESS;
}
diff --git a/common/i2c_wedge.c b/common/i2c_wedge.c
index ef87234cce..48bcac090c 100644
--- a/common/i2c_wedge.c
+++ b/common/i2c_wedge.c
@@ -10,7 +10,7 @@
* pit:
*
* #define CONFIG_CMD_I2CWEDGE
- * #define I2C_PORT_HOST I2C_PORT_MASTER
+ * #define I2C_PORT_HOST I2C_PORT_CONTROLLER
*
*/
@@ -117,7 +117,7 @@ static int i2c_bang_in_bit(void)
{
int bit;
- /* Let the slave drive data */
+ /* Let the peripheral drive data */
i2c_raw_set_sda(I2C_PORT_HOST, 1);
i2c_bang_delay();
@@ -134,7 +134,7 @@ static int i2c_bang_in_bit(void)
return bit;
}
-/* Write a byte to I2C bus. Return 0 if ack by the slave. */
+/* Write a byte to I2C bus. Return 0 if ack by the peripheral. */
static int i2c_bang_out_byte(int send_start, int send_stop, unsigned char byte)
{
unsigned bit;
@@ -178,19 +178,19 @@ static void i2c_bang_init(void)
i2c_raw_mode(I2C_PORT_HOST, 1);
}
-static void i2c_bang_xfer(int slave_addr, int reg)
+static void i2c_bang_xfer(int addr, int reg)
{
int byte;
i2c_bang_init();
- /* State a write command to 'slave_addr' */
- i2c_bang_out_byte(1 /*start*/, 0 /*stop*/, slave_addr);
+ /* State a write command to 'addr' */
+ i2c_bang_out_byte(1 /*start*/, 0 /*stop*/, addr);
/* Write 'reg' */
i2c_bang_out_byte(0 /*start*/, 0 /*stop*/, reg);
/* Start a read command */
- i2c_bang_out_byte(1 /*start*/, 0 /*stop*/, slave_addr | 1);
+ i2c_bang_out_byte(1 /*start*/, 0 /*stop*/, addr | 1);
/* Read two bytes */
byte = i2c_bang_in_byte(0, 0); /* ack and no stop */
@@ -199,15 +199,15 @@ static void i2c_bang_xfer(int slave_addr, int reg)
ccprintf(" read byte: %d\n", byte);
}
-static void i2c_bang_wedge_write(int slave_addr, int byte, int bit_count,
+static void i2c_bang_wedge_write(int addr, int byte, int bit_count,
int reboot)
{
int i;
i2c_bang_init();
- /* State a write command to 'slave_addr' */
- i2c_bang_out_byte(1 /*start*/, 0 /*stop*/, slave_addr);
+ /* State a write command to 'addr' */
+ i2c_bang_out_byte(1 /*start*/, 0 /*stop*/, addr);
/* Send a few bits and stop */
for (i = 0; i < bit_count; ++i) {
i2c_bang_out_bit((byte & 0x80) != 0);
@@ -219,20 +219,20 @@ static void i2c_bang_wedge_write(int slave_addr, int byte, int bit_count,
system_reset(0);
}
-static void i2c_bang_wedge_read(int slave_addr, int reg, int bit_count,
+static void i2c_bang_wedge_read(int addr, int reg, int bit_count,
int reboot)
{
int i;
i2c_bang_init();
- /* State a write command to 'slave_addr' */
- i2c_bang_out_byte(1 /*start*/, 0 /*stop*/, slave_addr);
+ /* State a write command to 'addr' */
+ i2c_bang_out_byte(1 /*start*/, 0 /*stop*/, addr);
/* Write 'reg' */
i2c_bang_out_byte(0 /*start*/, 0 /*stop*/, reg);
/* Start a read command */
- i2c_bang_out_byte(1 /*start*/, 0 /*stop*/, slave_addr | 1);
+ i2c_bang_out_byte(1 /*start*/, 0 /*stop*/, addr | 1);
/* Read bit_count bits and stop */
for (i = 0; i < bit_count; ++i)
@@ -250,7 +250,7 @@ static void i2c_bang_wedge_read(int slave_addr, int reg, int bit_count,
static int command_i2c_wedge(int argc, char **argv)
{
- int slave_addr, reg, wedge_flag = 0, wedge_bit_count = -1;
+ int addr, reg, wedge_flag = 0, wedge_bit_count = -1;
char *e;
enum gpio_signal tmp;
@@ -263,7 +263,7 @@ static int command_i2c_wedge(int argc, char **argv)
}
if (argc < 3) {
- ccputs("Usage: i2cwedge slave_addr out_byte "
+ ccputs("Usage: i2cwedge addr out_byte "
"[wedge_flag [wedge_bit_count]]\n");
ccputs(" wedge_flag - (1: wedge out; 2: wedge in;"
" 5: wedge out+reboot; 6: wedge in+reboot)]\n");
@@ -271,9 +271,9 @@ static int command_i2c_wedge(int argc, char **argv)
return EC_ERROR_UNKNOWN;
}
- slave_addr = strtoi(argv[1], &e, 0);
+ addr = strtoi(argv[1], &e, 0);
if (*e) {
- ccprintf("Invalid slave_addr %s\n", argv[1]);
+ ccprintf("Invalid addr %s\n", argv[1]);
return EC_ERROR_INVAL;
}
reg = strtoi(argv[2], &e, 0);
@@ -301,15 +301,15 @@ static int command_i2c_wedge(int argc, char **argv)
if (wedge_flag & WEDGE_WRITE) {
if (wedge_bit_count < 0)
wedge_bit_count = 8;
- i2c_bang_wedge_write(slave_addr, reg, wedge_bit_count,
+ i2c_bang_wedge_write(addr, reg, wedge_bit_count,
(wedge_flag & WEDGE_REBOOT));
} else if (wedge_flag & WEDGE_READ) {
if (wedge_bit_count < 0)
wedge_bit_count = 2;
- i2c_bang_wedge_read(slave_addr, reg, wedge_bit_count,
+ i2c_bang_wedge_read(addr, reg, wedge_bit_count,
(wedge_flag & WEDGE_REBOOT));
} else {
- i2c_bang_xfer(slave_addr, reg);
+ i2c_bang_xfer(addr, reg);
}
/* Put it back into normal mode */
@@ -325,7 +325,7 @@ static int command_i2c_wedge(int argc, char **argv)
return EC_SUCCESS;
}
DECLARE_CONSOLE_COMMAND(i2cwedge, command_i2c_wedge,
- "i2cwedge slave_addr out_byte "
+ "i2cwedge addr out_byte "
"[wedge_flag [wedge_bit_count]]",
"Wedge host I2C bus");