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>
This commit is contained in:
Mario Six 2018-03-28 14:37:42 +02:00 committed by Heiko Schocher
parent aa54192d4a
commit 2df71d6d6a

View File

@ -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