|
@@ -365,9 +365,6 @@ static int mpc_write(struct mpc_i2c *i2c, int target,
|
|
unsigned timeout = i2c->adap.timeout;
|
|
unsigned timeout = i2c->adap.timeout;
|
|
u32 flags = restart ? CCR_RSTA : 0;
|
|
u32 flags = restart ? CCR_RSTA : 0;
|
|
|
|
|
|
- /* Start with MEN */
|
|
|
|
- if (!restart)
|
|
|
|
- writeccr(i2c, CCR_MEN);
|
|
|
|
/* Start as master */
|
|
/* Start as master */
|
|
writeccr(i2c, CCR_MIEN | CCR_MEN | CCR_MSTA | CCR_MTX | flags);
|
|
writeccr(i2c, CCR_MIEN | CCR_MEN | CCR_MSTA | CCR_MTX | flags);
|
|
/* Write target byte */
|
|
/* Write target byte */
|
|
@@ -396,9 +393,6 @@ static int mpc_read(struct mpc_i2c *i2c, int target,
|
|
int i, result;
|
|
int i, result;
|
|
u32 flags = restart ? CCR_RSTA : 0;
|
|
u32 flags = restart ? CCR_RSTA : 0;
|
|
|
|
|
|
- /* Start with MEN */
|
|
|
|
- if (!restart)
|
|
|
|
- writeccr(i2c, CCR_MEN);
|
|
|
|
/* Switch to read - restart */
|
|
/* Switch to read - restart */
|
|
writeccr(i2c, CCR_MIEN | CCR_MEN | CCR_MSTA | CCR_MTX | flags);
|
|
writeccr(i2c, CCR_MIEN | CCR_MEN | CCR_MSTA | CCR_MTX | flags);
|
|
/* Write target address byte - this time with the read flag set */
|
|
/* Write target address byte - this time with the read flag set */
|
|
@@ -425,9 +419,9 @@ static int mpc_read(struct mpc_i2c *i2c, int target,
|
|
/* Generate txack on next to last byte */
|
|
/* Generate txack on next to last byte */
|
|
if (i == length - 2)
|
|
if (i == length - 2)
|
|
writeccr(i2c, CCR_MIEN | CCR_MEN | CCR_MSTA | CCR_TXAK);
|
|
writeccr(i2c, CCR_MIEN | CCR_MEN | CCR_MSTA | CCR_TXAK);
|
|
- /* Generate stop on last byte */
|
|
|
|
|
|
+ /* Do not generate stop on last byte */
|
|
if (i == length - 1)
|
|
if (i == length - 1)
|
|
- writeccr(i2c, CCR_MIEN | CCR_MEN | CCR_TXAK);
|
|
|
|
|
|
+ writeccr(i2c, CCR_MIEN | CCR_MEN | CCR_MSTA | CCR_MTX);
|
|
data[i] = readb(i2c->base + MPC_I2C_DR);
|
|
data[i] = readb(i2c->base + MPC_I2C_DR);
|
|
}
|
|
}
|
|
|
|
|