Lines Matching refs:bus

25 static int at91_wait_for_xfer(struct at91_i2c_bus *bus, u32 status)  in at91_wait_for_xfer()  argument
27 struct at91_i2c_regs *reg = bus->regs; in at91_wait_for_xfer()
31 bus->status = 0; in at91_wait_for_xfer()
35 bus->status |= sr; in at91_wait_for_xfer()
46 static int at91_i2c_xfer_msg(struct at91_i2c_bus *bus, struct i2c_msg *msg) in at91_i2c_xfer_msg() argument
48 struct at91_i2c_regs *reg = bus->regs; in at91_i2c_xfer_msg()
58 ret = at91_wait_for_xfer(bus, TWI_SR_RXRDY); in at91_i2c_xfer_msg()
67 ret = at91_wait_for_xfer(bus, TWI_SR_RXRDY); in at91_i2c_xfer_msg()
77 ret = at91_wait_for_xfer(bus, TWI_SR_TXRDY); in at91_i2c_xfer_msg()
87 ret = at91_wait_for_xfer(bus, TWI_SR_TXCOMP); in at91_i2c_xfer_msg()
92 if (bus->status & (TWI_SR_OVRE | TWI_SR_UNRE | TWI_SR_LOCK)) { in at91_i2c_xfer_msg()
100 if (bus->status & TWI_SR_LOCK) in at91_i2c_xfer_msg()
108 struct at91_i2c_bus *bus = dev_get_priv(dev); in at91_i2c_xfer() local
109 struct at91_i2c_regs *reg = bus->regs; in at91_i2c_xfer()
141 ret = at91_i2c_xfer_msg(bus, m_start); in at91_i2c_xfer()
152 struct at91_i2c_bus *bus = dev_get_priv(dev); in at91_calc_i2c_clock() local
153 const struct at91_i2c_pdata *pdata = bus->pdata; in at91_calc_i2c_clock()
159 src_rate = bus->bus_clk_rate; in at91_calc_i2c_clock()
170 bus->speed = DIV_ROUND_UP(src_rate, in at91_calc_i2c_clock()
173 bus->cwgr_val = (ckdiv << 16) | (cdiv << 8) | cdiv; in at91_calc_i2c_clock()
178 struct at91_i2c_bus *bus = dev_get_priv(dev); in at91_i2c_enable_clk() local
195 bus->bus_clk_rate = clk_rate; in at91_i2c_enable_clk()
204 struct at91_i2c_bus *bus = dev_get_priv(dev); in at91_i2c_probe_chip() local
205 struct at91_i2c_regs *reg = bus->regs; in at91_i2c_probe_chip()
214 at91_calc_i2c_clock(dev, bus->clock_frequency); in at91_i2c_probe_chip()
216 writel(bus->cwgr_val, &reg->cwgr); in at91_i2c_probe_chip()
225 struct at91_i2c_bus *bus = dev_get_priv(dev); in at91_i2c_set_bus_speed() local
229 writel(bus->cwgr_val, &bus->regs->cwgr); in at91_i2c_set_bus_speed()
236 struct at91_i2c_bus *bus = dev_get_priv(dev); in at91_i2c_get_bus_speed() local
238 return bus->speed; in at91_i2c_get_bus_speed()
244 struct at91_i2c_bus *bus = dev_get_priv(dev); in at91_i2c_ofdata_to_platdata() local
247 bus->regs = (struct at91_i2c_regs *)devfdt_get_addr(dev); in at91_i2c_ofdata_to_platdata()
248 bus->pdata = (struct at91_i2c_pdata *)dev_get_driver_data(dev); in at91_i2c_ofdata_to_platdata()
249 bus->clock_frequency = fdtdec_get_int(blob, node, in at91_i2c_ofdata_to_platdata()
264 struct at91_i2c_bus *bus = dev_get_priv(dev); in at91_i2c_probe() local
265 struct at91_i2c_regs *reg = bus->regs; in at91_i2c_probe()
274 at91_calc_i2c_clock(dev, bus->clock_frequency); in at91_i2c_probe()
276 writel(bus->cwgr_val, &reg->cwgr); in at91_i2c_probe()