Lines Matching refs:bus

26 static int at91_wait_for_xfer(struct at91_i2c_bus *bus, u32 status)  in at91_wait_for_xfer()  argument
28 struct at91_i2c_regs *reg = bus->regs; in at91_wait_for_xfer()
32 bus->status = 0; in at91_wait_for_xfer()
36 bus->status |= sr; in at91_wait_for_xfer()
47 static int at91_i2c_xfer_msg(struct at91_i2c_bus *bus, struct i2c_msg *msg) in at91_i2c_xfer_msg() argument
49 struct at91_i2c_regs *reg = bus->regs; in at91_i2c_xfer_msg()
63 ret = at91_wait_for_xfer(bus, TWI_SR_RXRDY); in at91_i2c_xfer_msg()
72 ret = at91_wait_for_xfer(bus, TWI_SR_RXRDY); in at91_i2c_xfer_msg()
80 ret = at91_wait_for_xfer(bus, TWI_SR_TXRDY); in at91_i2c_xfer_msg()
84 ret = at91_wait_for_xfer(bus, TWI_SR_TXRDY); in at91_i2c_xfer_msg()
94 ret = at91_wait_for_xfer(bus, TWI_SR_TXCOMP); in at91_i2c_xfer_msg()
99 if (bus->status & (TWI_SR_OVRE | TWI_SR_UNRE | TWI_SR_LOCK)) { in at91_i2c_xfer_msg()
107 if (bus->status & TWI_SR_LOCK) in at91_i2c_xfer_msg()
115 struct at91_i2c_bus *bus = dev_get_priv(dev); in at91_i2c_xfer() local
116 struct at91_i2c_regs *reg = bus->regs; in at91_i2c_xfer()
148 ret = at91_i2c_xfer_msg(bus, m_start); in at91_i2c_xfer()
159 struct at91_i2c_bus *bus = dev_get_priv(dev); in at91_calc_i2c_clock() local
160 const struct at91_i2c_pdata *pdata = bus->pdata; in at91_calc_i2c_clock()
166 src_rate = bus->bus_clk_rate; in at91_calc_i2c_clock()
177 bus->speed = DIV_ROUND_UP(src_rate, in at91_calc_i2c_clock()
180 bus->cwgr_val = (ckdiv << 16) | (cdiv << 8) | cdiv; in at91_calc_i2c_clock()
185 struct at91_i2c_bus *bus = dev_get_priv(dev); in at91_i2c_enable_clk() local
202 bus->bus_clk_rate = clk_rate; in at91_i2c_enable_clk()
211 struct at91_i2c_bus *bus = dev_get_priv(dev); in at91_i2c_set_bus_speed() local
215 writel(bus->cwgr_val, &bus->regs->cwgr); in at91_i2c_set_bus_speed()
222 struct at91_i2c_bus *bus = dev_get_priv(dev); in at91_i2c_get_bus_speed() local
224 return bus->speed; in at91_i2c_get_bus_speed()
230 struct at91_i2c_bus *bus = dev_get_priv(dev); in at91_i2c_of_to_plat() local
233 bus->regs = dev_read_addr_ptr(dev); in at91_i2c_of_to_plat()
234 bus->pdata = (struct at91_i2c_pdata *)dev_get_driver_data(dev); in at91_i2c_of_to_plat()
235 bus->clock_frequency = fdtdec_get_int(blob, node, in at91_i2c_of_to_plat()
249 struct at91_i2c_bus *bus = dev_get_priv(dev); in at91_i2c_probe() local
250 struct at91_i2c_regs *reg = bus->regs; in at91_i2c_probe()
259 at91_calc_i2c_clock(dev, bus->clock_frequency); in at91_i2c_probe()
261 writel(bus->cwgr_val, &reg->cwgr); in at91_i2c_probe()