struct rcar_i2c_priv {
void __iomem *io;
struct i2c_adapter adap;
- struct i2c_msg *msg;
+ struct i2c_msg *msg;
+ int msgs_left;
struct clk *clk;
wait_queue_head_t wait;
{
int read = !!rcar_i2c_is_recv(priv);
+ priv->pos = 0;
+ priv->flags = 0;
+ if (priv->msgs_left == 1)
+ rcar_i2c_flags_set(priv, ID_LAST_MSG);
+
rcar_i2c_write(priv, ICMAR, (priv->msg->addr << 1) | read);
rcar_i2c_write(priv, ICMSR, 0);
rcar_i2c_write(priv, ICMCR, RCAR_BUS_PHASE_START);
}
/* init each data */
- priv->msg = &msgs[i];
- priv->pos = 0;
- priv->flags = 0;
- if (i == num - 1)
- rcar_i2c_flags_set(priv, ID_LAST_MSG);
+ priv->msg = &msgs[i];
+ priv->msgs_left = num - i;
rcar_i2c_prepare_msg(priv);