mirror of
git://git.yoctoproject.org/linux-yocto.git
synced 2025-07-05 21:35:46 +02:00
i2c: au1550: reword according to newest specification
Change the wording of this driver wrt. the newest I2C v7 and SMBus 3.2 specifications and replace "master/slave" with more appropriate terms. Remove a useless comment while here. Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com> Reviewed-by: Andi Shyti <andi.shyti@kernel.org> Signed-off-by: Andi Shyti <andi.shyti@kernel.org>
This commit is contained in:
parent
d7f365fc37
commit
a4c98e4ada
|
@ -81,11 +81,10 @@ static int wait_ack(struct i2c_au1550_data *adap)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int wait_master_done(struct i2c_au1550_data *adap)
|
static int wait_controller_done(struct i2c_au1550_data *adap)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
/* Wait for Master Done. */
|
|
||||||
for (i = 0; i < 2 * adap->xfer_timeout; i++) {
|
for (i = 0; i < 2 * adap->xfer_timeout; i++) {
|
||||||
if ((RD(adap, PSC_SMBEVNT) & PSC_SMBEVNT_MD) != 0)
|
if ((RD(adap, PSC_SMBEVNT) & PSC_SMBEVNT_MD) != 0)
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -120,12 +119,12 @@ do_address(struct i2c_au1550_data *adap, unsigned int addr, int rd, int q)
|
||||||
if (q)
|
if (q)
|
||||||
addr |= PSC_SMBTXRX_STP;
|
addr |= PSC_SMBTXRX_STP;
|
||||||
|
|
||||||
/* Put byte into fifo, start up master. */
|
/* Put byte into fifo, start up controller */
|
||||||
WR(adap, PSC_SMBTXRX, addr);
|
WR(adap, PSC_SMBTXRX, addr);
|
||||||
WR(adap, PSC_SMBPCR, PSC_SMBPCR_MS);
|
WR(adap, PSC_SMBPCR, PSC_SMBPCR_MS);
|
||||||
if (wait_ack(adap))
|
if (wait_ack(adap))
|
||||||
return -EIO;
|
return -EIO;
|
||||||
return (q) ? wait_master_done(adap) : 0;
|
return (q) ? wait_controller_done(adap) : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int wait_for_rx_byte(struct i2c_au1550_data *adap, unsigned char *out)
|
static int wait_for_rx_byte(struct i2c_au1550_data *adap, unsigned char *out)
|
||||||
|
@ -175,7 +174,7 @@ static int i2c_read(struct i2c_au1550_data *adap, unsigned char *buf,
|
||||||
|
|
||||||
/* The last byte has to indicate transfer done. */
|
/* The last byte has to indicate transfer done. */
|
||||||
WR(adap, PSC_SMBTXRX, PSC_SMBTXRX_STP);
|
WR(adap, PSC_SMBTXRX, PSC_SMBTXRX_STP);
|
||||||
if (wait_master_done(adap))
|
if (wait_controller_done(adap))
|
||||||
return -EIO;
|
return -EIO;
|
||||||
|
|
||||||
buf[i] = (unsigned char)(RD(adap, PSC_SMBTXRX) & 0xff);
|
buf[i] = (unsigned char)(RD(adap, PSC_SMBTXRX) & 0xff);
|
||||||
|
@ -204,7 +203,7 @@ static int i2c_write(struct i2c_au1550_data *adap, unsigned char *buf,
|
||||||
data = buf[i];
|
data = buf[i];
|
||||||
data |= PSC_SMBTXRX_STP;
|
data |= PSC_SMBTXRX_STP;
|
||||||
WR(adap, PSC_SMBTXRX, data);
|
WR(adap, PSC_SMBTXRX, data);
|
||||||
if (wait_master_done(adap))
|
if (wait_controller_done(adap))
|
||||||
return -EIO;
|
return -EIO;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -246,8 +245,8 @@ static u32 au1550_func(struct i2c_adapter *adap)
|
||||||
}
|
}
|
||||||
|
|
||||||
static const struct i2c_algorithm au1550_algo = {
|
static const struct i2c_algorithm au1550_algo = {
|
||||||
.master_xfer = au1550_xfer,
|
.xfer = au1550_xfer,
|
||||||
.functionality = au1550_func,
|
.functionality = au1550_func,
|
||||||
};
|
};
|
||||||
|
|
||||||
static void i2c_au1550_setup(struct i2c_au1550_data *priv)
|
static void i2c_au1550_setup(struct i2c_au1550_data *priv)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user