mirror of
https://github.com/linux-sunxi/u-boot-sunxi.git
synced 2024-02-12 11:16:03 +08:00
dm: i2c: Add a message debug function
Add a way to dump the contents of an I2C message for debugging purposes. Signed-off-by: Simon Glass <sjg@chromium.org> Acked-by: Heiko Schocher <hs@denx.de>
This commit is contained in:
@ -18,6 +18,22 @@ DECLARE_GLOBAL_DATA_PTR;
|
|||||||
|
|
||||||
#define I2C_MAX_OFFSET_LEN 4
|
#define I2C_MAX_OFFSET_LEN 4
|
||||||
|
|
||||||
|
/* Useful debugging function */
|
||||||
|
void i2c_dump_msgs(struct i2c_msg *msg, int nmsgs)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
|
||||||
|
for (i = 0; i < nmsgs; i++) {
|
||||||
|
struct i2c_msg *m = &msg[i];
|
||||||
|
|
||||||
|
printf(" %s %x len=%x", m->flags & I2C_M_RD ? "R" : "W",
|
||||||
|
msg->addr, msg->len);
|
||||||
|
if (!(m->flags & I2C_M_RD))
|
||||||
|
printf(": %x", m->buf[0]);
|
||||||
|
printf("\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* i2c_setup_offset() - Set up a new message with a chip offset
|
* i2c_setup_offset() - Set up a new message with a chip offset
|
||||||
*
|
*
|
||||||
|
@ -473,6 +473,16 @@ int i2c_get_chip_for_busnum(int busnum, int chip_addr, uint offset_len,
|
|||||||
int i2c_chip_ofdata_to_platdata(const void *blob, int node,
|
int i2c_chip_ofdata_to_platdata(const void *blob, int node,
|
||||||
struct dm_i2c_chip *chip);
|
struct dm_i2c_chip *chip);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* i2c_dump_msgs() - Dump a list of I2C messages
|
||||||
|
*
|
||||||
|
* This may be useful for debugging.
|
||||||
|
*
|
||||||
|
* @msg: Message list to dump
|
||||||
|
* @nmsgs: Number of messages
|
||||||
|
*/
|
||||||
|
void i2c_dump_msgs(struct i2c_msg *msg, int nmsgs);
|
||||||
|
|
||||||
#ifndef CONFIG_DM_I2C
|
#ifndef CONFIG_DM_I2C
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
Reference in New Issue
Block a user