diff options
Diffstat (limited to 'drivers/i2c/s3c24x0_i2c.c')
-rw-r--r-- | drivers/i2c/s3c24x0_i2c.c | 21 |
1 files changed, 6 insertions, 15 deletions
diff --git a/drivers/i2c/s3c24x0_i2c.c b/drivers/i2c/s3c24x0_i2c.c index 769a2ba5ba..46d25061ee 100644 --- a/drivers/i2c/s3c24x0_i2c.c +++ b/drivers/i2c/s3c24x0_i2c.c @@ -86,13 +86,6 @@ static int GetI2CSDA(void) #endif } -#if 0 -static void SetI2CSDA(int x) -{ - rGPEDAT = (rGPEDAT & ~0x8000) | (x & 1) << 15; -} -#endif - static void SetI2CSCL(int x) { struct s3c24x0_gpio *gpio = s3c24x0_get_base_gpio(); @@ -331,7 +324,7 @@ static int i2c_transfer(struct s3c24x0_i2c *i2c, writel(I2C_MODE_MT | I2C_TXRX_ENA | I2C_START_STOP, &i2c->iicstat); i = 0; - while ((i < data_len) && (result = I2C_OK)) { + while ((i < data_len) && (result == I2C_OK)) { result = WaitForXfer(i2c); writel(data[i], &i2c->iicds); ReadWriteByte(i2c); @@ -343,17 +336,16 @@ static int i2c_transfer(struct s3c24x0_i2c *i2c, result = WaitForXfer(i2c); /* send STOP */ - writel(I2C_MODE_MR | I2C_TXRX_ENA, &i2c->iicstat); + writel(I2C_MODE_MT | I2C_TXRX_ENA, &i2c->iicstat); ReadWriteByte(i2c); break; case I2C_READ: if (addr && addr_len) { - writel(I2C_MODE_MT | I2C_TXRX_ENA, &i2c->iicstat); writel(chip, &i2c->iicds); /* send START */ - writel(readl(&i2c->iicstat) | I2C_START_STOP, - &i2c->iicstat); + writel(I2C_MODE_MT | I2C_TXRX_ENA | I2C_START_STOP, + &i2c->iicstat); result = WaitForXfer(i2c); if (IsACK(i2c)) { i = 0; @@ -387,11 +379,10 @@ static int i2c_transfer(struct s3c24x0_i2c *i2c, } } else { - writel(I2C_MODE_MR | I2C_TXRX_ENA, &i2c->iicstat); writel(chip, &i2c->iicds); /* send START */ - writel(readl(&i2c->iicstat) | I2C_START_STOP, - &i2c->iicstat); + writel(I2C_MODE_MR | I2C_TXRX_ENA | I2C_START_STOP, + &i2c->iicstat); result = WaitForXfer(i2c); if (IsACK(i2c)) { |