Lines Matching refs:msg

125 static int i2c_transfer(struct mv_i2c *base, struct mv_i2c_msg *msg)  in i2c_transfer()  argument
129 if (!msg) in i2c_transfer()
132 switch (msg->direction) { in i2c_transfer()
141 writel(msg->data, &base->idbr); in i2c_transfer()
142 if (msg->condition == I2C_COND_START) in i2c_transfer()
144 if (msg->condition == I2C_COND_STOP) in i2c_transfer()
146 if (msg->acknack == I2C_ACKNAK_SENDNAK) in i2c_transfer()
148 if (msg->acknack == I2C_ACKNAK_SENDACK) in i2c_transfer()
161 if (msg->acknack == I2C_ACKNAK_WAITACK) in i2c_transfer()
175 if (msg->condition == I2C_COND_START) in i2c_transfer()
177 if (msg->condition == I2C_COND_STOP) in i2c_transfer()
179 if (msg->acknack == I2C_ACKNAK_SENDNAK) in i2c_transfer()
181 if (msg->acknack == I2C_ACKNAK_SENDACK) in i2c_transfer()
190 msg->data = readl(&base->idbr); in i2c_transfer()
240 struct mv_i2c_msg msg; in __i2c_read() local
254 msg.condition = I2C_COND_START; in __i2c_read()
255 msg.acknack = I2C_ACKNAK_WAITACK; in __i2c_read()
256 msg.direction = I2C_WRITE; in __i2c_read()
257 msg.data = (chip << 1); in __i2c_read()
258 msg.data &= 0xFE; in __i2c_read()
259 if (i2c_transfer(base, &msg)) in __i2c_read()
269 msg.condition = I2C_COND_NORMAL; in __i2c_read()
270 msg.acknack = I2C_ACKNAK_WAITACK; in __i2c_read()
271 msg.direction = I2C_WRITE; in __i2c_read()
272 msg.data = addr[alen]; in __i2c_read()
273 if (i2c_transfer(base, &msg)) in __i2c_read()
279 msg.condition = I2C_COND_START; in __i2c_read()
280 msg.acknack = I2C_ACKNAK_WAITACK; in __i2c_read()
281 msg.direction = I2C_WRITE; in __i2c_read()
282 msg.data = (chip << 1); in __i2c_read()
283 msg.data |= 0x01; in __i2c_read()
284 if (i2c_transfer(base, &msg)) in __i2c_read()
290 msg.condition = I2C_COND_STOP; in __i2c_read()
291 msg.acknack = I2C_ACKNAK_SENDNAK; in __i2c_read()
293 msg.condition = I2C_COND_NORMAL; in __i2c_read()
294 msg.acknack = I2C_ACKNAK_SENDACK; in __i2c_read()
297 msg.direction = I2C_READ; in __i2c_read()
298 msg.data = 0x00; in __i2c_read()
299 if (i2c_transfer(base, &msg)) in __i2c_read()
302 *buffer = msg.data; in __i2c_read()
316 struct mv_i2c_msg msg; in __i2c_write() local
325 msg.condition = I2C_COND_START; in __i2c_write()
326 msg.acknack = I2C_ACKNAK_WAITACK; in __i2c_write()
327 msg.direction = I2C_WRITE; in __i2c_write()
328 msg.data = (chip << 1); in __i2c_write()
329 msg.data &= 0xFE; in __i2c_write()
330 if (i2c_transfer(base, &msg)) in __i2c_write()
340 msg.condition = I2C_COND_NORMAL; in __i2c_write()
341 msg.acknack = I2C_ACKNAK_WAITACK; in __i2c_write()
342 msg.direction = I2C_WRITE; in __i2c_write()
343 msg.data = addr[alen]; in __i2c_write()
344 if (i2c_transfer(base, &msg)) in __i2c_write()
354 msg.condition = I2C_COND_STOP; in __i2c_write()
356 msg.condition = I2C_COND_NORMAL; in __i2c_write()
358 msg.acknack = I2C_ACKNAK_WAITACK; in __i2c_write()
359 msg.direction = I2C_WRITE; in __i2c_write()
360 msg.data = *(buffer++); in __i2c_write()
362 if (i2c_transfer(base, &msg)) in __i2c_write()
448 struct mv_i2c_msg msg; in __i2c_probe_chip() local
452 msg.condition = I2C_COND_START; in __i2c_probe_chip()
453 msg.acknack = I2C_ACKNAK_WAITACK; in __i2c_probe_chip()
454 msg.direction = I2C_WRITE; in __i2c_probe_chip()
455 msg.data = (chip << 1) + 1; in __i2c_probe_chip()
456 if (i2c_transfer(base, &msg)) in __i2c_probe_chip()
459 msg.condition = I2C_COND_STOP; in __i2c_probe_chip()
460 msg.acknack = I2C_ACKNAK_SENDNAK; in __i2c_probe_chip()
461 msg.direction = I2C_READ; in __i2c_probe_chip()
462 msg.data = 0x00; in __i2c_probe_chip()
463 if (i2c_transfer(base, &msg)) in __i2c_probe_chip()
536 static int mv_i2c_xfer(struct udevice *bus, struct i2c_msg *msg, int nmsgs) in mv_i2c_xfer() argument
552 omsg = nmsgs == 1 ? &dummy : msg; in mv_i2c_xfer()
553 dmsg = nmsgs == 1 ? msg : msg + 1; in mv_i2c_xfer()