From: cym <709866821@qq.com> Date: Thu, 5 Aug 2010 08:02:55 +0000 (+0800) Subject: modify i2c for read bug by kfx X-Git-Tag: firefly_0821_release~11303 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=f224f84325ca98f360f43343072c6720d5b7df55;p=firefly-linux-kernel-4.4.55.git modify i2c for read bug by kfx --- diff --git a/drivers/i2c/busses/i2c-rk2818.c b/drivers/i2c/busses/i2c-rk2818.c index cf79536d3494..46bbb80556c0 100755 --- a/drivers/i2c/busses/i2c-rk2818.c +++ b/drivers/i2c/busses/i2c-rk2818.c @@ -318,7 +318,10 @@ static int rk2818_send_address(struct rk2818_i2c_data *i2c, return ret; } } - writel(I2C_LCMR_START, i2c->regs + I2C_LCMR); + if (msg->flags & I2C_M_RD) + writel(I2C_LCMR_START|I2C_LCMR_RESUME, i2c->regs + I2C_LCMR); + else + writel(I2C_LCMR_START, i2c->regs + I2C_LCMR); /* if(msg->flags & I2C_M_TEN) { @@ -327,7 +330,7 @@ static int rk2818_send_address(struct rk2818_i2c_data *i2c, { return ret; } - addr_2nd = msg->addr & 0xff; + addr_2nd = msg->addr & 0xff;if (msg->flags & I2C_M_RD) writel(addr_2nd, i2c->regs + I2C_MTXR); writel(I2C_LCMR_RESUME, i2c->regs + I2C_LCMR); if (msg->flags & I2C_M_RD) @@ -426,6 +429,8 @@ static int rk2818_xfer_msg(struct i2c_adapter *adap, conr = readl(i2c->regs + I2C_CONR); conr |= I2C_CONR_NAK; writel(conr, i2c->regs + I2C_CONR); + if(!stop) + return 0; if(msg->flags & I2C_M_TEN) writel(I2C_LCMR_START|I2C_LCMR_RESUME , i2c->regs + I2C_LCMR); else