summaryrefslogtreecommitdiff
path: root/chip/stm32/i2c-stm32l.c
diff options
context:
space:
mode:
Diffstat (limited to 'chip/stm32/i2c-stm32l.c')
-rw-r--r--chip/stm32/i2c-stm32l.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/chip/stm32/i2c-stm32l.c b/chip/stm32/i2c-stm32l.c
index 42fe3513a9..d56d78d8eb 100644
--- a/chip/stm32/i2c-stm32l.c
+++ b/chip/stm32/i2c-stm32l.c
@@ -98,7 +98,7 @@ static int wait_sr1(int port, int mask)
*
* @return Non-zero if error.
*/
-static int send_start(int port, int slave_addr)
+static int send_start__8b(int port, uint16_t slave_addr__8b)
{
int rv;
@@ -110,7 +110,7 @@ static int send_start(int port, int slave_addr)
return I2C_ERROR_FAILED_START;
/* Write slave address */
- STM32_I2C_DR(port) = slave_addr & 0xff;
+ STM32_I2C_DR(port) = slave_addr__8b & 0xff;
rv = wait_sr1(port, STM32_I2C_SR1_ADDR);
if (rv)
return rv;
@@ -164,9 +164,12 @@ static void i2c_init_port(const struct i2c_port_t *p)
/*****************************************************************************/
/* Interface */
-int chip_i2c_xfer(int port, int slave_addr, const uint8_t *out, int out_bytes,
+int chip_i2c_xfer__7bf(const int port,
+ const uint16_t slave_addr__7bf,
+ const uint8_t *out, int out_bytes,
uint8_t *in, int in_bytes, int flags)
{
+ int addr__8b == I2C_GET_ADDR__7b(slave_addr__7bf) << 1;
int started = (flags & I2C_XFER_START) ? 0 : 1;
int rv = EC_SUCCESS;
int i;
@@ -193,7 +196,7 @@ int chip_i2c_xfer(int port, int slave_addr, const uint8_t *out, int out_bytes,
/* No out bytes and no in bytes means just check for active */
if (out_bytes || !in_bytes) {
if (!started) {
- rv = send_start(port, slave_addr);
+ rv = send_start__8b(port, addr__8b);
if (rv)
goto xfer_exit;
}
@@ -225,7 +228,7 @@ int chip_i2c_xfer(int port, int slave_addr, const uint8_t *out, int out_bytes,
STM32_I2C_CR1(port) |= STM32_I2C_CR1_ACK;
if (!started) {
- rv = send_start(port, slave_addr | 0x01);
+ rv = send_start__8b(port, addr__8b | 0x01);
if (rv)
goto xfer_exit;
}