Lines Matching refs:msg

126 static int i2c_transfer(struct mv_i2c *base, struct mv_i2c_msg *msg)  in i2c_transfer()  argument
130 if (!msg) in i2c_transfer()
133 switch (msg->direction) { in i2c_transfer()
142 writel(msg->data, &base->idbr); in i2c_transfer()
143 if (msg->condition == I2C_COND_START) in i2c_transfer()
145 if (msg->condition == I2C_COND_STOP) in i2c_transfer()
147 if (msg->acknack == I2C_ACKNAK_SENDNAK) in i2c_transfer()
149 if (msg->acknack == I2C_ACKNAK_SENDACK) in i2c_transfer()
162 if (msg->acknack == I2C_ACKNAK_WAITACK) in i2c_transfer()
176 if (msg->condition == I2C_COND_START) in i2c_transfer()
178 if (msg->condition == I2C_COND_STOP) in i2c_transfer()
180 if (msg->acknack == I2C_ACKNAK_SENDNAK) in i2c_transfer()
182 if (msg->acknack == I2C_ACKNAK_SENDACK) in i2c_transfer()
191 msg->data = readl(&base->idbr); in i2c_transfer()
241 struct mv_i2c_msg msg; in __i2c_read() local
255 msg.condition = I2C_COND_START; in __i2c_read()
256 msg.acknack = I2C_ACKNAK_WAITACK; in __i2c_read()
257 msg.direction = I2C_WRITE; in __i2c_read()
258 msg.data = (chip << 1); in __i2c_read()
259 msg.data &= 0xFE; in __i2c_read()
260 if (i2c_transfer(base, &msg)) in __i2c_read()
270 msg.condition = I2C_COND_NORMAL; in __i2c_read()
271 msg.acknack = I2C_ACKNAK_WAITACK; in __i2c_read()
272 msg.direction = I2C_WRITE; in __i2c_read()
273 msg.data = addr[alen]; in __i2c_read()
274 if (i2c_transfer(base, &msg)) in __i2c_read()
280 msg.condition = I2C_COND_START; in __i2c_read()
281 msg.acknack = I2C_ACKNAK_WAITACK; in __i2c_read()
282 msg.direction = I2C_WRITE; in __i2c_read()
283 msg.data = (chip << 1); in __i2c_read()
284 msg.data |= 0x01; in __i2c_read()
285 if (i2c_transfer(base, &msg)) in __i2c_read()
291 msg.condition = I2C_COND_STOP; in __i2c_read()
292 msg.acknack = I2C_ACKNAK_SENDNAK; in __i2c_read()
294 msg.condition = I2C_COND_NORMAL; in __i2c_read()
295 msg.acknack = I2C_ACKNAK_SENDACK; in __i2c_read()
298 msg.direction = I2C_READ; in __i2c_read()
299 msg.data = 0x00; in __i2c_read()
300 if (i2c_transfer(base, &msg)) in __i2c_read()
303 *buffer = msg.data; in __i2c_read()
317 struct mv_i2c_msg msg; in __i2c_write() local
326 msg.condition = I2C_COND_START; in __i2c_write()
327 msg.acknack = I2C_ACKNAK_WAITACK; in __i2c_write()
328 msg.direction = I2C_WRITE; in __i2c_write()
329 msg.data = (chip << 1); in __i2c_write()
330 msg.data &= 0xFE; in __i2c_write()
331 if (i2c_transfer(base, &msg)) in __i2c_write()
341 msg.condition = I2C_COND_NORMAL; in __i2c_write()
342 msg.acknack = I2C_ACKNAK_WAITACK; in __i2c_write()
343 msg.direction = I2C_WRITE; in __i2c_write()
344 msg.data = addr[alen]; in __i2c_write()
345 if (i2c_transfer(base, &msg)) in __i2c_write()
355 msg.condition = I2C_COND_STOP; in __i2c_write()
357 msg.condition = I2C_COND_NORMAL; in __i2c_write()
359 msg.acknack = I2C_ACKNAK_WAITACK; in __i2c_write()
360 msg.direction = I2C_WRITE; in __i2c_write()
361 msg.data = *(buffer++); in __i2c_write()
363 if (i2c_transfer(base, &msg)) in __i2c_write()
392 struct mv_i2c_msg msg; in __i2c_probe_chip() local
396 msg.condition = I2C_COND_START; in __i2c_probe_chip()
397 msg.acknack = I2C_ACKNAK_WAITACK; in __i2c_probe_chip()
398 msg.direction = I2C_WRITE; in __i2c_probe_chip()
399 msg.data = (chip << 1) + 1; in __i2c_probe_chip()
400 if (i2c_transfer(base, &msg)) in __i2c_probe_chip()
403 msg.condition = I2C_COND_STOP; in __i2c_probe_chip()
404 msg.acknack = I2C_ACKNAK_SENDNAK; in __i2c_probe_chip()
405 msg.direction = I2C_READ; in __i2c_probe_chip()
406 msg.data = 0x00; in __i2c_probe_chip()
407 if (i2c_transfer(base, &msg)) in __i2c_probe_chip()
480 static int mv_i2c_xfer(struct udevice *bus, struct i2c_msg *msg, int nmsgs) in mv_i2c_xfer() argument
496 omsg = nmsgs == 1 ? &dummy : msg; in mv_i2c_xfer()
497 dmsg = nmsgs == 1 ? msg : msg + 1; in mv_i2c_xfer()