summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDiana Z <dzigterman@chromium.org>2020-11-24 14:18:04 -0700
committerCommit Bot <commit-bot@chromium.org>2020-12-04 05:39:56 +0000
commit21cc691d17ec60a758934a1239e56afee1fb4ff0 (patch)
treeaf6ffa3a1ee082ed2f449bda3bac1f79651c344f
parentdefe99857e24f63ac85d460e3fdfeaa0b5b4dac1 (diff)
downloadchrome-ec-21cc691d17ec60a758934a1239e56afee1fb4ff0.tar.gz
COIL: Rename local variables in common i2c_controller
Rename local variables and related comments in common i2c_controller code. BRANCH=None BUG=None TEST=make -j buildall Signed-off-by: Diana Z <dzigterman@chromium.org> Change-Id: I712217d86f7232f509f1f649b772ec73204ceb53 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2558906 Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
-rw-r--r--common/i2c_controller.c210
1 files changed, 105 insertions, 105 deletions
diff --git a/common/i2c_controller.c b/common/i2c_controller.c
index ee54468dea..56c2a52f08 100644
--- a/common/i2c_controller.c
+++ b/common/i2c_controller.c
@@ -107,35 +107,35 @@ const struct i2c_port_t *get_i2c_port(const int port)
}
__maybe_unused static int chip_i2c_xfer_with_notify(
- const int port, const uint16_t slave_addr_flags,
+ const int port, const uint16_t addr_flags,
const uint8_t *out, int out_size,
uint8_t *in, int in_size, int flags)
{
int ret;
- uint16_t addr_flags = slave_addr_flags;
+ uint16_t no_pec_af = addr_flags;
const struct i2c_port_t *i2c_port = get_i2c_port(port);
if (IS_ENABLED(CONFIG_I2C_XFER_BOARD_CALLBACK))
- i2c_start_xfer_notify(port, slave_addr_flags);
+ i2c_start_xfer_notify(port, addr_flags);
if (IS_ENABLED(CONFIG_SMBUS_PEC))
/*
* Since we've done PEC processing here,
* remove the flag so it won't confuse chip driver.
*/
- addr_flags &= ~I2C_FLAG_PEC;
+ no_pec_af &= ~I2C_FLAG_PEC;
if (i2c_port->drv)
- ret = i2c_port->drv->xfer(i2c_port, addr_flags,
+ ret = i2c_port->drv->xfer(i2c_port, no_pec_af,
out, out_size, in, in_size, flags);
else
- ret = chip_i2c_xfer(port, addr_flags,
+ ret = chip_i2c_xfer(port, no_pec_af,
out, out_size, in, in_size, flags);
if (IS_ENABLED(CONFIG_I2C_XFER_BOARD_CALLBACK))
- i2c_end_xfer_notify(port, slave_addr_flags);
+ i2c_end_xfer_notify(port, addr_flags);
if (IS_ENABLED(CONFIG_I2C_DEBUG)) {
- i2c_trace_notify(port, slave_addr_flags, out, out_size,
+ i2c_trace_notify(port, addr_flags, out, out_size,
in, in_size);
}
@@ -148,7 +148,7 @@ __maybe_unused static int chip_i2c_xfer_with_notify(
* if in_size or out_size exceeds CONFIG_I2C_CHIP_MAX_TRANSFER_SIZE.
*/
static int i2c_xfer_no_retry(const int port,
- const uint16_t slave_addr_flags,
+ const uint16_t addr_flags,
const uint8_t *out, int out_size,
uint8_t *in, int in_size, int flags)
{
@@ -162,7 +162,7 @@ static int i2c_xfer_no_retry(const int port,
if (in_size == 0 && offset + chunk_size == out_size)
out_flags |= flags & I2C_XFER_STOP;
- RETURN_ERROR(chip_i2c_xfer_with_notify(port, slave_addr_flags,
+ RETURN_ERROR(chip_i2c_xfer_with_notify(port, addr_flags,
out + offset, chunk_size, NULL, 0,
out_flags));
offset += chunk_size;
@@ -177,7 +177,7 @@ static int i2c_xfer_no_retry(const int port,
if (offset + chunk_size == in_size)
in_flags |= flags & I2C_XFER_STOP;
- RETURN_ERROR(chip_i2c_xfer_with_notify(port, slave_addr_flags,
+ RETURN_ERROR(chip_i2c_xfer_with_notify(port, addr_flags,
NULL, 0, in + offset, chunk_size, in_flags));
offset += chunk_size;
}
@@ -186,13 +186,13 @@ static int i2c_xfer_no_retry(const int port,
#endif /* CONFIG_I2C_XFER_LARGE_TRANSFER */
int i2c_xfer_unlocked(const int port,
- const uint16_t slave_addr_flags,
+ const uint16_t addr_flags,
const uint8_t *out, int out_size,
uint8_t *in, int in_size, int flags)
{
int i;
int ret = EC_SUCCESS;
- uint16_t addr_flags = slave_addr_flags & ~I2C_FLAG_PEC;
+ uint16_t no_pec_af = addr_flags & ~I2C_FLAG_PEC;
if (!i2c_port_is_locked(port)) {
CPUTS("Access I2C without lock!");
@@ -201,14 +201,14 @@ int i2c_xfer_unlocked(const int port,
for (i = 0; i <= CONFIG_I2C_NACK_RETRY_COUNT; i++) {
#ifdef CONFIG_ZEPHYR
- ret = i2c_write_read(i2c_get_device_for_port(port), addr_flags,
+ ret = i2c_write_read(i2c_get_device_for_port(port), no_pec_af,
out, out_size, in, in_size);
#elif defined(CONFIG_I2C_XFER_LARGE_TRANSFER)
- ret = i2c_xfer_no_retry(port, addr_flags,
+ ret = i2c_xfer_no_retry(port, no_pec_af,
out, out_size, in,
in_size, flags);
#else
- ret = chip_i2c_xfer_with_notify(port, addr_flags,
+ ret = chip_i2c_xfer_with_notify(port, no_pec_af,
out, out_size,
in, in_size, flags);
#endif /* CONFIG_I2C_XFER_LARGE_TRANSFER */
@@ -219,14 +219,14 @@ int i2c_xfer_unlocked(const int port,
}
int i2c_xfer(const int port,
- const uint16_t slave_addr_flags,
+ const uint16_t addr_flags,
const uint8_t *out, int out_size,
uint8_t *in, int in_size)
{
int rv;
i2c_lock(port, 1);
- rv = i2c_xfer_unlocked(port, slave_addr_flags,
+ rv = i2c_xfer_unlocked(port, addr_flags,
out, out_size, in, in_size,
I2C_XFER_SINGLE);
i2c_lock(port, 0);
@@ -280,27 +280,27 @@ void i2c_prepare_sysjump(void)
}
/* i2c_readN with optional error checking */
-static int platform_ec_i2c_read(const int port, const uint16_t slave_addr_flags,
+static int platform_ec_i2c_read(const int port, const uint16_t addr_flags,
uint8_t reg, uint8_t *in, int in_size)
{
- if (!IS_ENABLED(CONFIG_SMBUS_PEC) && I2C_USE_PEC(slave_addr_flags))
+ if (!IS_ENABLED(CONFIG_SMBUS_PEC) && I2C_USE_PEC(addr_flags))
return EC_ERROR_UNIMPLEMENTED;
- if (IS_ENABLED(CONFIG_SMBUS_PEC) && I2C_USE_PEC(slave_addr_flags)) {
+ if (IS_ENABLED(CONFIG_SMBUS_PEC) && I2C_USE_PEC(addr_flags)) {
int i, rv;
/* addr_8bit = 7 bit addr_flags + 1 bit r/w */
- uint8_t addr_8bit = I2C_STRIP_FLAGS(slave_addr_flags) << 1;
+ uint8_t addr_8bit = I2C_STRIP_FLAGS(addr_flags) << 1;
uint8_t out[3] = {addr_8bit, reg, addr_8bit | 1};
uint8_t pec_local = 0, pec_remote;
i2c_lock(port, 1);
for (i = 0; i <= CONFIG_I2C_NACK_RETRY_COUNT; i++) {
- rv = i2c_xfer_unlocked(port, slave_addr_flags, &reg, 1,
+ rv = i2c_xfer_unlocked(port, addr_flags, &reg, 1,
in, in_size, I2C_XFER_START);
if (rv)
continue;
- rv = i2c_xfer_unlocked(port, slave_addr_flags, NULL, 0,
+ rv = i2c_xfer_unlocked(port, addr_flags, NULL, 0,
&pec_remote, 1, I2C_XFER_STOP);
if (rv)
continue;
@@ -317,20 +317,20 @@ static int platform_ec_i2c_read(const int port, const uint16_t slave_addr_flags,
return rv;
}
- return i2c_xfer(port, slave_addr_flags, &reg, 1, in, in_size);
+ return i2c_xfer(port, addr_flags, &reg, 1, in, in_size);
}
/* i2c_writeN with optional error checking */
static int platform_ec_i2c_write(const int port,
- const uint16_t slave_addr_flags,
+ const uint16_t addr_flags,
const uint8_t *out, int out_size)
{
- if (!IS_ENABLED(CONFIG_SMBUS_PEC) && I2C_USE_PEC(slave_addr_flags))
+ if (!IS_ENABLED(CONFIG_SMBUS_PEC) && I2C_USE_PEC(addr_flags))
return EC_ERROR_UNIMPLEMENTED;
- if (IS_ENABLED(CONFIG_SMBUS_PEC) && I2C_USE_PEC(slave_addr_flags)) {
+ if (IS_ENABLED(CONFIG_SMBUS_PEC) && I2C_USE_PEC(addr_flags)) {
int i, rv;
- uint8_t addr_8bit = I2C_STRIP_FLAGS(slave_addr_flags) << 1;
+ uint8_t addr_8bit = I2C_STRIP_FLAGS(addr_flags) << 1;
uint8_t pec;
pec = cros_crc8(&addr_8bit, 1);
@@ -338,13 +338,13 @@ static int platform_ec_i2c_write(const int port,
i2c_lock(port, 1);
for (i = 0; i <= CONFIG_I2C_NACK_RETRY_COUNT; i++) {
- rv = i2c_xfer_unlocked(port, slave_addr_flags,
+ rv = i2c_xfer_unlocked(port, addr_flags,
out, out_size, NULL, 0,
I2C_XFER_START);
if (rv)
continue;
- rv = i2c_xfer_unlocked(port, slave_addr_flags,
+ rv = i2c_xfer_unlocked(port, addr_flags,
&pec, 1, NULL, 0,
I2C_XFER_STOP);
if (!rv)
@@ -355,11 +355,11 @@ static int platform_ec_i2c_write(const int port,
return rv;
}
- return i2c_xfer(port, slave_addr_flags, out, out_size, NULL, 0);
+ return i2c_xfer(port, addr_flags, out, out_size, NULL, 0);
}
int i2c_read32(const int port,
- const uint16_t slave_addr_flags,
+ const uint16_t addr_flags,
int offset, int *data)
{
int rv;
@@ -367,13 +367,13 @@ int i2c_read32(const int port,
reg = offset & 0xff;
/* I2C read 32-bit word: transmit 8-bit offset, and read 32bits */
- rv = platform_ec_i2c_read(port, slave_addr_flags, reg, buf,
+ rv = platform_ec_i2c_read(port, addr_flags, reg, buf,
sizeof(uint32_t));
if (rv)
return rv;
- if (I2C_IS_BIG_ENDIAN(slave_addr_flags))
+ if (I2C_IS_BIG_ENDIAN(addr_flags))
*data = ((int)buf[0] << 24) | ((int)buf[1] << 16) |
((int)buf[0] << 8) | buf[1];
else
@@ -384,14 +384,14 @@ int i2c_read32(const int port,
}
int i2c_write32(const int port,
- const uint16_t slave_addr_flags,
+ const uint16_t addr_flags,
int offset, int data)
{
uint8_t buf[1 + sizeof(uint32_t)];
buf[0] = offset & 0xff;
- if (I2C_IS_BIG_ENDIAN(slave_addr_flags)) {
+ if (I2C_IS_BIG_ENDIAN(addr_flags)) {
buf[1] = (data >> 24) & 0xff;
buf[2] = (data >> 16) & 0xff;
buf[3] = (data >> 8) & 0xff;
@@ -403,12 +403,12 @@ int i2c_write32(const int port,
buf[4] = (data >> 24) & 0xff;
}
- return platform_ec_i2c_write(port, slave_addr_flags, buf,
+ return platform_ec_i2c_write(port, addr_flags, buf,
sizeof(uint32_t) + 1);
}
int i2c_read16(const int port,
- const uint16_t slave_addr_flags,
+ const uint16_t addr_flags,
int offset, int *data)
{
int rv;
@@ -416,13 +416,13 @@ int i2c_read16(const int port,
reg = offset & 0xff;
/* I2C read 16-bit word: transmit 8-bit offset, and read 16bits */
- rv = platform_ec_i2c_read(port, slave_addr_flags, reg, buf,
+ rv = platform_ec_i2c_read(port, addr_flags, reg, buf,
sizeof(uint16_t));
if (rv)
return rv;
- if (I2C_IS_BIG_ENDIAN(slave_addr_flags))
+ if (I2C_IS_BIG_ENDIAN(addr_flags))
*data = ((int)buf[0] << 8) | buf[1];
else
*data = ((int)buf[1] << 8) | buf[0];
@@ -431,14 +431,14 @@ int i2c_read16(const int port,
}
int i2c_write16(const int port,
- const uint16_t slave_addr_flags,
+ const uint16_t addr_flags,
int offset, int data)
{
uint8_t buf[1 + sizeof(uint16_t)];
buf[0] = offset & 0xff;
- if (I2C_IS_BIG_ENDIAN(slave_addr_flags)) {
+ if (I2C_IS_BIG_ENDIAN(addr_flags)) {
buf[1] = (data >> 8) & 0xff;
buf[2] = data & 0xff;
} else {
@@ -446,12 +446,12 @@ int i2c_write16(const int port,
buf[2] = (data >> 8) & 0xff;
}
- return platform_ec_i2c_write(port, slave_addr_flags, buf,
+ return platform_ec_i2c_write(port, addr_flags, buf,
1 + sizeof(uint16_t));
}
int i2c_read8(const int port,
- const uint16_t slave_addr_flags,
+ const uint16_t addr_flags,
int offset, int *data)
{
int rv;
@@ -460,7 +460,7 @@ int i2c_read8(const int port,
reg = offset;
- rv = platform_ec_i2c_read(port, slave_addr_flags, reg, &buf,
+ rv = platform_ec_i2c_read(port, addr_flags, reg, &buf,
sizeof(uint8_t));
if (!rv)
*data = buf;
@@ -469,7 +469,7 @@ int i2c_read8(const int port,
}
int i2c_write8(const int port,
- const uint16_t slave_addr_flags,
+ const uint16_t addr_flags,
int offset, int data)
{
uint8_t buf[2];
@@ -477,11 +477,11 @@ int i2c_write8(const int port,
buf[0] = offset;
buf[1] = data;
- return platform_ec_i2c_write(port, slave_addr_flags, buf, sizeof(buf));
+ return platform_ec_i2c_write(port, addr_flags, buf, sizeof(buf));
}
int i2c_update8(const int port,
- const uint16_t slave_addr_flags,
+ const uint16_t addr_flags,
const int offset,
const uint8_t mask,
const enum mask_update_action action)
@@ -490,7 +490,7 @@ int i2c_update8(const int port,
int read_val;
int write_val;
- rv = i2c_read8(port, slave_addr_flags, offset, &read_val);
+ rv = i2c_read8(port, addr_flags, offset, &read_val);
if (rv)
return rv;
@@ -500,11 +500,11 @@ int i2c_update8(const int port,
if (IS_ENABLED(CONFIG_I2C_UPDATE_IF_CHANGED) && write_val == read_val)
return EC_SUCCESS;
- return i2c_write8(port, slave_addr_flags, offset, write_val);
+ return i2c_write8(port, addr_flags, offset, write_val);
}
int i2c_update16(const int port,
- const uint16_t slave_addr_flags,
+ const uint16_t addr_flags,
const int offset,
const uint16_t mask,
const enum mask_update_action action)
@@ -513,7 +513,7 @@ int i2c_update16(const int port,
int read_val;
int write_val;
- rv = i2c_read16(port, slave_addr_flags, offset, &read_val);
+ rv = i2c_read16(port, addr_flags, offset, &read_val);
if (rv)
return rv;
@@ -523,11 +523,11 @@ int i2c_update16(const int port,
if (IS_ENABLED(CONFIG_I2C_UPDATE_IF_CHANGED) && write_val == read_val)
return EC_SUCCESS;
- return i2c_write16(port, slave_addr_flags, offset, write_val);
+ return i2c_write16(port, addr_flags, offset, write_val);
}
int i2c_field_update8(const int port,
- const uint16_t slave_addr_flags,
+ const uint16_t addr_flags,
const int offset,
const uint8_t field_mask,
const uint8_t set_value)
@@ -536,7 +536,7 @@ int i2c_field_update8(const int port,
int read_val;
int write_val;
- rv = i2c_read8(port, slave_addr_flags, offset, &read_val);
+ rv = i2c_read8(port, addr_flags, offset, &read_val);
if (rv)
return rv;
@@ -545,11 +545,11 @@ int i2c_field_update8(const int port,
if (IS_ENABLED(CONFIG_I2C_UPDATE_IF_CHANGED) && write_val == read_val)
return EC_SUCCESS;
- return i2c_write8(port, slave_addr_flags, offset, write_val);
+ return i2c_write8(port, addr_flags, offset, write_val);
}
int i2c_field_update16(const int port,
- const uint16_t slave_addr_flags,
+ const uint16_t addr_flags,
const int offset,
const uint16_t field_mask,
const uint16_t set_value)
@@ -558,7 +558,7 @@ int i2c_field_update16(const int port,
int read_val;
int write_val;
- rv = i2c_read16(port, slave_addr_flags, offset, &read_val);
+ rv = i2c_read16(port, addr_flags, offset, &read_val);
if (rv)
return rv;
@@ -567,11 +567,11 @@ int i2c_field_update16(const int port,
if (IS_ENABLED(CONFIG_I2C_UPDATE_IF_CHANGED) && write_val == read_val)
return EC_SUCCESS;
- return i2c_write16(port, slave_addr_flags, offset, write_val);
+ return i2c_write16(port, addr_flags, offset, write_val);
}
int i2c_read_offset16(const int port,
- const uint16_t slave_addr_flags,
+ const uint16_t addr_flags,
uint16_t offset, int *data, int len)
{
int rv;
@@ -584,7 +584,7 @@ int i2c_read_offset16(const int port,
addr[1] = offset & 0xff;
/* I2C read 16-bit word: transmit 16-bit offset, and read buffer */
- rv = i2c_xfer(port, slave_addr_flags, addr, 2, buf, len);
+ rv = i2c_xfer(port, addr_flags, addr, 2, buf, len);
if (rv)
return rv;
@@ -592,7 +592,7 @@ int i2c_read_offset16(const int port,
if (len == 1) {
*data = buf[0];
} else {
- if (I2C_IS_BIG_ENDIAN(slave_addr_flags))
+ if (I2C_IS_BIG_ENDIAN(addr_flags))
*data = ((int)buf[0] << 8) | buf[1];
else
*data = ((int)buf[1] << 8) | buf[0];
@@ -602,7 +602,7 @@ int i2c_read_offset16(const int port,
}
int i2c_write_offset16(const int port,
- const uint16_t slave_addr_flags,
+ const uint16_t addr_flags,
uint16_t offset, int data, int len)
{
uint8_t buf[2 + sizeof(uint16_t)];
@@ -616,7 +616,7 @@ int i2c_write_offset16(const int port,
if (len == 1) {
buf[2] = data & 0xff;
} else {
- if (I2C_IS_BIG_ENDIAN(slave_addr_flags)) {
+ if (I2C_IS_BIG_ENDIAN(addr_flags)) {
buf[2] = (data >> 8) & 0xff;
buf[3] = data & 0xff;
} else {
@@ -625,11 +625,11 @@ int i2c_write_offset16(const int port,
}
}
- return i2c_xfer(port, slave_addr_flags, buf, 2 + len, NULL, 0);
+ return i2c_xfer(port, addr_flags, buf, 2 + len, NULL, 0);
}
int i2c_read_offset16_block(const int port,
- const uint16_t slave_addr_flags,
+ const uint16_t addr_flags,
uint16_t offset, uint8_t *data, int len)
{
uint8_t addr[sizeof(uint16_t)];
@@ -637,11 +637,11 @@ int i2c_read_offset16_block(const int port,
addr[0] = (offset >> 8) & 0xff;
addr[1] = offset & 0xff;
- return i2c_xfer(port, slave_addr_flags, addr, 2, data, len);
+ return i2c_xfer(port, addr_flags, addr, 2, data, len);
}
int i2c_write_offset16_block(const int port,
- const uint16_t slave_addr_flags,
+ const uint16_t addr_flags,
uint16_t offset, const uint8_t *data, int len)
{
int rv;
@@ -655,10 +655,10 @@ int i2c_write_offset16_block(const int port,
* appending the destination address with the data array.
*/
i2c_lock(port, 1);
- rv = i2c_xfer_unlocked(port, slave_addr_flags, addr, 2, NULL, 0,
+ rv = i2c_xfer_unlocked(port, addr_flags, addr, 2, NULL, 0,
I2C_XFER_START);
if (!rv)
- rv = i2c_xfer_unlocked(port, slave_addr_flags,
+ rv = i2c_xfer_unlocked(port, addr_flags,
data, len, NULL, 0, I2C_XFER_STOP);
i2c_lock(port, 0);
@@ -666,13 +666,13 @@ int i2c_write_offset16_block(const int port,
}
int i2c_read_string(const int port,
- const uint16_t slave_addr_flags,
+ const uint16_t addr_flags,
int offset, uint8_t *data, int len)
{
int i, rv;
uint8_t reg, block_length;
- if (!IS_ENABLED(CONFIG_SMBUS_PEC) && I2C_USE_PEC(slave_addr_flags))
+ if (!IS_ENABLED(CONFIG_SMBUS_PEC) && I2C_USE_PEC(addr_flags))
return EC_ERROR_UNIMPLEMENTED;
reg = offset;
@@ -685,7 +685,7 @@ int i2c_read_string(const int port,
* Send device reg space offset, and read back block length.
* Keep this session open without a stop.
*/
- rv = i2c_xfer_unlocked(port, slave_addr_flags,
+ rv = i2c_xfer_unlocked(port, addr_flags,
&reg, 1, &block_length, 1,
I2C_XFER_START);
if (rv)
@@ -697,13 +697,13 @@ int i2c_read_string(const int port,
data_length = block_length;
if (IS_ENABLED(CONFIG_SMBUS_PEC) &&
- I2C_USE_PEC(slave_addr_flags)) {
+ I2C_USE_PEC(addr_flags)) {
uint8_t addr_8bit =
- I2C_STRIP_FLAGS(slave_addr_flags) << 1;
+ I2C_STRIP_FLAGS(addr_flags) << 1;
uint8_t out[3] = {addr_8bit, reg, addr_8bit | 1};
uint8_t pec, pec_remote;
- rv = i2c_xfer_unlocked(port, slave_addr_flags,
+ rv = i2c_xfer_unlocked(port, addr_flags,
0, 0, data, data_length, 0);
data[data_length] = 0;
if (rv)
@@ -718,7 +718,7 @@ int i2c_read_string(const int port,
while (block_length) {
uint8_t byte;
- rv = i2c_xfer_unlocked(port, slave_addr_flags,
+ rv = i2c_xfer_unlocked(port, addr_flags,
NULL, 0, &byte, 1, 0);
if (rv)
break;
@@ -728,7 +728,7 @@ int i2c_read_string(const int port,
if (rv)
continue;
- rv = i2c_xfer_unlocked(port, slave_addr_flags, NULL, 0,
+ rv = i2c_xfer_unlocked(port, addr_flags, NULL, 0,
&pec_remote, 1, I2C_XFER_STOP);
if (rv)
continue;
@@ -736,7 +736,7 @@ int i2c_read_string(const int port,
if (pec != pec_remote)
rv = EC_ERROR_CRC;
} else {
- rv = i2c_xfer_unlocked(port, slave_addr_flags,
+ rv = i2c_xfer_unlocked(port, addr_flags,
0, 0, data, data_length,
I2C_XFER_STOP);
data[data_length] = 0;
@@ -752,28 +752,28 @@ int i2c_read_string(const int port,
return rv;
}
-int i2c_read_block(const int port, const uint16_t slave_addr_flags, int offset,
+int i2c_read_block(const int port, const uint16_t addr_flags, int offset,
uint8_t *data, int len)
{
int rv;
uint8_t reg_address = offset;
- rv = i2c_xfer(port, slave_addr_flags, &reg_address, 1, data, len);
+ rv = i2c_xfer(port, addr_flags, &reg_address, 1, data, len);
return rv;
}
int i2c_write_block(const int port,
- const uint16_t slave_addr_flags,
+ const uint16_t addr_flags,
int offset, const uint8_t *data, int len)
{
int i, rv;
uint8_t reg_address = offset, pec = 0;
- if (!IS_ENABLED(CONFIG_SMBUS_PEC) && I2C_USE_PEC(slave_addr_flags))
+ if (!IS_ENABLED(CONFIG_SMBUS_PEC) && I2C_USE_PEC(addr_flags))
return EC_ERROR_UNIMPLEMENTED;
- if (IS_ENABLED(CONFIG_SMBUS_PEC) && I2C_USE_PEC(slave_addr_flags)) {
- uint8_t addr_8bit = I2C_STRIP_FLAGS(slave_addr_flags) << 1;
+ if (IS_ENABLED(CONFIG_SMBUS_PEC) && I2C_USE_PEC(addr_flags)) {
+ uint8_t addr_8bit = I2C_STRIP_FLAGS(addr_flags) << 1;
pec = cros_crc8(&addr_8bit, sizeof(uint8_t));
pec = cros_crc8_arg(data, len, pec);
@@ -785,25 +785,25 @@ int i2c_write_block(const int port,
*/
i2c_lock(port, 1);
for (i = 0; i <= CONFIG_I2C_NACK_RETRY_COUNT; i++) {
- rv = i2c_xfer_unlocked(port, slave_addr_flags,
+ rv = i2c_xfer_unlocked(port, addr_flags,
&reg_address, 1, NULL, 0,
I2C_XFER_START);
if (rv)
continue;
- if (I2C_USE_PEC(slave_addr_flags)) {
- rv = i2c_xfer_unlocked(port, slave_addr_flags,
+ if (I2C_USE_PEC(addr_flags)) {
+ rv = i2c_xfer_unlocked(port, addr_flags,
data, len, NULL, 0, 0);
if (rv)
continue;
- rv = i2c_xfer_unlocked(port, slave_addr_flags,
+ rv = i2c_xfer_unlocked(port, addr_flags,
&pec, sizeof(uint8_t), NULL, 0,
I2C_XFER_STOP);
if (rv)
continue;
} else {
- rv = i2c_xfer_unlocked(port, slave_addr_flags,
+ rv = i2c_xfer_unlocked(port, addr_flags,
data, len, NULL, 0,
I2C_XFER_STOP);
if (rv)
@@ -924,14 +924,14 @@ int i2c_raw_mode(int port, int enable)
* low).
*
* We attempt to unwedge the bus by doing:
- * - If SCL is being held low, then a slave is clock extending. The only
- * thing we can do is try to wait until the slave stops clock extending.
- * - Otherwise, we will toggle the clock until the slave releases the SDA line.
- * Once the SDA line is released, try to send a STOP bit. Rinse and repeat
- * until either the bus is normal, or we run out of attempts.
+ * - If SCL is being held low, then a peripheral is clock extending. The only
+ * thing we can do is try to wait until the peripheral stops clock extending.
+ * - Otherwise, we will toggle the clock until the peripheral releases the SDA
+ * line. Once the SDA line is released, try to send a STOP bit. Rinse and
+ * repeat until either the bus is normal, or we run out of attempts.
*
- * Note this should work for most devices, but depending on the slaves i2c
- * state machine, it may not be possible to unwedge the bus.
+ * Note this should work for most devices, but depending on the peripheral's
+ * i2c state machine, it may not be possible to unwedge the bus.
*/
int i2c_unwedge(int port)
{
@@ -954,14 +954,14 @@ int i2c_unwedge(int port)
/*
* If clock is low, wait for a while in case of clock stretched
- * by a slave.
+ * by a peripheral.
*/
if (!i2c_raw_get_scl(port)) {
for (i = 0;; i++) {
if (i >= UNWEDGE_SCL_ATTEMPTS) {
/*
- * If we get here, a slave is holding the clock
- * low and there is nothing we can do.
+ * If we get here, a peripheral is holding the
+ * clock low and there is nothing we can do.
*/
CPRINTS("I2C%d unwedge failed, "
"SCL is held low", port);
@@ -986,9 +986,9 @@ int i2c_unwedge(int port)
udelay(I2C_BITBANG_DELAY_US);
/*
- * Clock through the problem by clocking out 9 bits. If slave
- * releases the SDA line, then we can stop clocking bits and
- * send a STOP.
+ * Clock through the problem by clocking out 9 bits. If
+ * peripheral releases the SDA line, then we can stop clocking
+ * bits and send a STOP.
*/
for (j = 0; j < 9; j++) {
if (i2c_raw_get_sda(port))
@@ -1527,7 +1527,7 @@ static int command_i2cxfer(int argc, char **argv)
offset, v);
#ifdef CONFIG_CMD_I2C_XFER_RAW
} else if (strcasecmp(argv[1], "raw") == 0) {
- /* <port> <slave_addr> <read_count> [write_bytes..] */
+ /* <port> <addr_flags> <read_count> [write_bytes..] */
int i;
int write_count = 0, read_count = 0;
int xferflags = I2C_XFER_START;