• Home
  • Raw
  • Download

Lines Matching refs:i2c

39 static int WaitForXfer(struct s3c24x0_i2c *i2c)  in WaitForXfer()  argument
44 if (readl(&i2c->iiccon) & I2CCON_IRPND) in WaitForXfer()
45 return (readl(&i2c->iicstat) & I2CSTAT_NACK) ? in WaitForXfer()
52 static void read_write_byte(struct s3c24x0_i2c *i2c) in read_write_byte() argument
54 clrbits_le32(&i2c->iiccon, I2CCON_IRPND); in read_write_byte()
57 static void i2c_ch_init(struct s3c24x0_i2c *i2c, int speed, int slaveadd) in i2c_ch_init() argument
75 writel((div & 0x0F) | 0xA0 | ((pres == 512) ? 0x40 : 0), &i2c->iiccon); in i2c_ch_init()
78 writel(0, &i2c->iicstat); in i2c_ch_init()
79 writel(slaveadd, &i2c->iicadd); in i2c_ch_init()
81 writel(I2C_MODE_MT | I2C_TXRX_ENA, &i2c->iicstat); in i2c_ch_init()
103 static int i2c_transfer(struct s3c24x0_i2c *i2c, in i2c_transfer() argument
120 while (readl(&i2c->iicstat) & I2CSTAT_BSY) { in i2c_transfer()
125 writel(readl(&i2c->iiccon) | I2CCON_ACKGEN, &i2c->iiccon); in i2c_transfer()
128 writel(chip, &i2c->iicds); in i2c_transfer()
131 &i2c->iicstat); in i2c_transfer()
134 &i2c->iicstat); in i2c_transfer()
137 result = WaitForXfer(i2c); in i2c_transfer()
144 writel(addr[i++], &i2c->iicds); in i2c_transfer()
145 read_write_byte(i2c); in i2c_transfer()
146 result = WaitForXfer(i2c); in i2c_transfer()
156 writel(data[i++], &i2c->iicds); in i2c_transfer()
157 read_write_byte(i2c); in i2c_transfer()
158 result = WaitForXfer(i2c); in i2c_transfer()
168 writel(chip, &i2c->iicds); in i2c_transfer()
172 &i2c->iicstat); in i2c_transfer()
173 read_write_byte(i2c); in i2c_transfer()
174 result = WaitForXfer(i2c); in i2c_transfer()
183 writel(readl(&i2c->iiccon) in i2c_transfer()
185 &i2c->iiccon); in i2c_transfer()
186 read_write_byte(i2c); in i2c_transfer()
187 result = WaitForXfer(i2c); in i2c_transfer()
188 data[i++] = readl(&i2c->iicds); in i2c_transfer()
202 writel(I2C_MODE_MR | I2C_TXRX_ENA, &i2c->iicstat); in i2c_transfer()
203 read_write_byte(i2c); in i2c_transfer()
229 struct s3c24x0_i2c *i2c = i2c_bus->regs; in s3c24x0_do_msg() local
236 setbits_le32(&i2c->iiccon, I2CCON_ACKGEN); in s3c24x0_do_msg()
240 writel(addr, &i2c->iicds); in s3c24x0_do_msg()
246 writel(status, &i2c->iicstat); in s3c24x0_do_msg()
248 read_write_byte(i2c); in s3c24x0_do_msg()
251 ret = WaitForXfer(i2c); in s3c24x0_do_msg()
259 clrbits_le32(&i2c->iiccon, I2CCON_ACKGEN); in s3c24x0_do_msg()
260 read_write_byte(i2c); in s3c24x0_do_msg()
261 ret = WaitForXfer(i2c); in s3c24x0_do_msg()
262 msg->buf[i] = readl(&i2c->iicds); in s3c24x0_do_msg()
268 writel(msg->buf[i], &i2c->iicds); in s3c24x0_do_msg()
269 read_write_byte(i2c); in s3c24x0_do_msg()
270 ret = WaitForXfer(i2c); in s3c24x0_do_msg()
282 struct s3c24x0_i2c *i2c = i2c_bus->regs; in s3c24x0_i2c_xfer() local
287 while (readl(&i2c->iicstat) & I2CSTAT_BSY) { in s3c24x0_i2c_xfer()
298 writel(I2C_MODE_MR | I2C_TXRX_ENA, &i2c->iicstat); in s3c24x0_i2c_xfer()
299 read_write_byte(i2c); in s3c24x0_i2c_xfer()