summaryrefslogtreecommitdiff
path: root/chip/it83xx/i2c.c
diff options
context:
space:
mode:
Diffstat (limited to 'chip/it83xx/i2c.c')
-rw-r--r--chip/it83xx/i2c.c25
1 files changed, 14 insertions, 11 deletions
diff --git a/chip/it83xx/i2c.c b/chip/it83xx/i2c.c
index 48d13d5fdd..6383b773d2 100644
--- a/chip/it83xx/i2c.c
+++ b/chip/it83xx/i2c.c
@@ -194,7 +194,7 @@ struct i2c_port_data {
int widx; /* Index into output data */
int ridx; /* Index into input data */
int err; /* Error code, if any */
- uint8_t addr; /* address of device */
+ uint8_t addr__8b; /* address of device */
uint32_t timeout_us; /* Transaction timeout, or 0 to use default */
uint8_t freq; /* Frequency setting */
@@ -274,7 +274,7 @@ static void i2c_w2r_change_direction(int p)
}
static void i2c_pio_trans_data(int p, enum enhanced_i2c_transfer_direct direct,
- uint8_t data, int first_byte)
+ uint8_t data, int first_byte)
{
struct i2c_port_data *pd = pdata + p;
int p_ch;
@@ -319,7 +319,7 @@ static int i2c_tran_write(int p)
* bit0, Direction of the host transfer.
* bit[1:7}, Address of the targeted slave.
*/
- IT83XX_SMB_TRASLA(p) = pd->addr;
+ IT83XX_SMB_TRASLA(p) = pd->addr__8b;
/* Send first byte */
IT83XX_SMB_HOBDB(p) = *(pd->out++);
pd->widx++;
@@ -379,7 +379,7 @@ static int i2c_tran_read(int p)
* bit0, Direction of the host transfer.
* bit[1:7}, Address of the targeted slave.
*/
- IT83XX_SMB_TRASLA(p) = pd->addr | 0x01;
+ IT83XX_SMB_TRASLA(p) = pd->addr__8b | 0x01;
/* clear start flag */
pd->flags &= ~I2C_XFER_START;
/*
@@ -468,7 +468,7 @@ static int enhanced_i2c_tran_write(int p)
pd->flags &= ~I2C_XFER_START;
enhanced_i2c_start(p);
/* Send ID */
- i2c_pio_trans_data(p, TX_DIRECT, pd->addr, 1);
+ i2c_pio_trans_data(p, TX_DIRECT, pd->addr__8b, 1);
} else {
/* Host has completed the transmission of a byte */
if (pd->widx < pd->out_size) {
@@ -488,7 +488,8 @@ static int enhanced_i2c_tran_write(int p)
/* Write to read protocol */
pd->i2ccs = I2C_CH_REPEAT_START;
/* Repeat Start */
- i2c_pio_trans_data(p, RX_DIRECT, pd->addr, 1);
+ i2c_pio_trans_data(p, RX_DIRECT,
+ pd->addr__8b, 1);
} else {
if (pd->flags & I2C_XFER_STOP) {
IT83XX_I2C_CTR(p_ch) = E_FINISH;
@@ -520,7 +521,7 @@ static int enhanced_i2c_tran_read(int p)
/* Direct read */
pd->i2ccs = I2C_CH_WAIT_READ;
/* Send ID */
- i2c_pio_trans_data(p, RX_DIRECT, pd->addr, 1);
+ i2c_pio_trans_data(p, RX_DIRECT, pd->addr__8b, 1);
} else {
if (pd->i2ccs) {
if (pd->i2ccs == I2C_CH_REPEAT_START) {
@@ -537,7 +538,8 @@ static int enhanced_i2c_tran_read(int p)
/* Write to read */
pd->i2ccs = I2C_CH_WAIT_READ;
/* Send ID */
- i2c_pio_trans_data(p, RX_DIRECT, pd->addr, 1);
+ i2c_pio_trans_data(p, RX_DIRECT,
+ pd->addr__8b, 1);
task_enable_irq(i2c_ctrl_regs[p].irq);
}
} else {
@@ -639,8 +641,9 @@ int i2c_is_busy(int port)
return (IT83XX_I2C_STR(p_ch) & E_HOSTA_BB);
}
-int chip_i2c_xfer(int port, int slave_addr, const uint8_t *out, int out_size,
- uint8_t *in, int in_size, int flags)
+int chip_i2c_xfer__7bf(int port, uint16_t slave_addr__7bf,
+ const uint8_t *out, int out_size,
+ uint8_t *in, int in_size, int flags)
{
struct i2c_port_data *pd = pdata + port;
uint32_t events = 0;
@@ -662,7 +665,7 @@ int chip_i2c_xfer(int port, int slave_addr, const uint8_t *out, int out_size,
pd->widx = 0;
pd->ridx = 0;
pd->err = 0;
- pd->addr = slave_addr;
+ pd->addr__8b = I2C_GET_ADDR__7b(slave_addr__7bf) << 1;
/* Make sure we're in a good state to start */
if ((flags & I2C_XFER_START) && (i2c_is_busy(port)