diff options
author | Mario Six <mario.six@gdsys.cc> | 2018-03-28 14:37:42 +0200 |
---|---|---|
committer | Heiko Schocher <hs@denx.de> | 2018-04-11 11:34:37 +0200 |
commit | 2df71d6d6a364f92510cfa657d7407cf7e516570 (patch) | |
tree | a59ff17a909a244da2a989952a29a3a1800dbefd | |
parent | aa54192d4a87460e105264a8156f1d7b1d212b0b (diff) | |
download | u-boot-2df71d6d6a364f92510cfa657d7407cf7e516570.zip u-boot-2df71d6d6a364f92510cfa657d7407cf7e516570.tar.gz u-boot-2df71d6d6a364f92510cfa657d7407cf7e516570.tar.bz2 |
i2c: ihs_i2c: Use new fpgamap interface
The fpgamap interface has been switched to a "single function + data
size" interface. Reflect this change in the IHS I2C driver.
Signed-off-by: Mario Six <mario.six@gdsys.cc>
-rw-r--r-- | drivers/i2c/ihs_i2c.c | 45 |
1 files changed, 24 insertions, 21 deletions
diff --git a/drivers/i2c/ihs_i2c.c b/drivers/i2c/ihs_i2c.c index 9298521..82abb43 100644 --- a/drivers/i2c/ihs_i2c.c +++ b/drivers/i2c/ihs_i2c.c @@ -99,7 +99,8 @@ static int wait_for_int(bool read) #endif #ifdef CONFIG_DM_I2C - fpgamap_read16(fpga, priv->addr + REG_INTERRUPT_STATUS, &val); + fpgamap_read(fpga, priv->addr + REG_INTERRUPT_STATUS, &val, + FPGAMAP_SIZE_16); #else I2C_GET_REG(interrupt_status, &val); #endif @@ -110,7 +111,8 @@ static int wait_for_int(bool read) if (ctr++ > 5000) return 1; #ifdef CONFIG_DM_I2C - fpgamap_read16(fpga, priv->addr + REG_INTERRUPT_STATUS, &val); + fpgamap_read(fpga, priv->addr + REG_INTERRUPT_STATUS, &val, + FPGAMAP_SIZE_16); #else I2C_GET_REG(interrupt_status, &val); #endif @@ -128,6 +130,7 @@ static int ihs_i2c_transfer(uchar chip, uchar *buffer, int len, bool read, #endif { u16 val; + u16 data; #ifdef CONFIG_DM_I2C struct ihs_i2c_priv *priv = dev_get_priv(dev); struct udevice *fpga; @@ -136,13 +139,14 @@ static int ihs_i2c_transfer(uchar chip, uchar *buffer, int len, bool read, #endif /* Clear interrupt status */ + data = I2CINT_ERROR_EV | I2CINT_RECEIVE_EV | I2CINT_TRANSMIT_EV; #ifdef CONFIG_DM_I2C - fpgamap_write16(fpga, priv->addr + REG_INTERRUPT_STATUS, - I2CINT_ERROR_EV | I2CINT_RECEIVE_EV | I2CINT_TRANSMIT_EV); - fpgamap_read16(fpga, priv->addr + REG_INTERRUPT_STATUS, &val); + fpgamap_write(fpga, priv->addr + REG_INTERRUPT_STATUS, &data, + FPGAMAP_SIZE_16); + fpgamap_read(fpga, priv->addr + REG_INTERRUPT_STATUS, &val, + FPGAMAP_SIZE_16); #else - I2C_SET_REG(interrupt_status, I2CINT_ERROR_EV - | I2CINT_RECEIVE_EV | I2CINT_TRANSMIT_EV); + I2C_SET_REG(interrupt_status, data); I2C_GET_REG(interrupt_status, &val); #endif @@ -153,26 +157,24 @@ static int ihs_i2c_transfer(uchar chip, uchar *buffer, int len, bool read, if (len > 1) val |= buffer[1] << 8; #ifdef CONFIG_DM_I2C - fpgamap_write16(fpga, priv->addr + REG_WRITE_MAILBOX_EXT, val); + fpgamap_write(fpga, priv->addr + REG_WRITE_MAILBOX_EXT, &val, + FPGAMAP_SIZE_16); #else I2C_SET_REG(write_mailbox_ext, val); #endif } + data = I2CMB_NATIVE + | (read ? 0 : I2CMB_WRITE) + | (chip << 1) + | ((len > 1) ? I2CMB_2BYTE : 0) + | (is_last ? 0 : I2CMB_HOLD_BUS); + #ifdef CONFIG_DM_I2C - fpgamap_write16(fpga, priv->addr + REG_WRITE_MAILBOX, - I2CMB_NATIVE - | (read ? I2CMB_READ : I2CMB_WRITE) - | (chip << 1) - | ((len > 1) ? I2CMB_2BYTE : I2CMB_1BYTE) - | (!is_last ? I2CMB_HOLD_BUS : I2CMB_DONT_HOLD_BUS)); + fpgamap_write(fpga, priv->addr + REG_WRITE_MAILBOX, &data, + FPGAMAP_SIZE_16); #else - I2C_SET_REG(write_mailbox, - I2CMB_NATIVE - | (read ? 0 : I2CMB_WRITE) - | (chip << 1) - | ((len > 1) ? I2CMB_2BYTE : 0) - | (is_last ? 0 : I2CMB_HOLD_BUS)); + I2C_SET_REG(write_mailbox, data); #endif #ifdef CONFIG_DM_I2C @@ -185,7 +187,8 @@ static int ihs_i2c_transfer(uchar chip, uchar *buffer, int len, bool read, /* If we want to read, get the bytes from the mailbox */ if (read) { #ifdef CONFIG_DM_I2C - fpgamap_read16(fpga, priv->addr + REG_READ_MAILBOX_EXT, &val); + fpgamap_read(fpga, priv->addr + REG_READ_MAILBOX_EXT, &val, + FPGAMAP_SIZE_16); #else I2C_GET_REG(read_mailbox_ext, &val); #endif |