summaryrefslogtreecommitdiffstats
path: root/commands
diff options
context:
space:
mode:
authorAlexander Shiyan <shc_work@mail.ru>2020-11-04 06:59:28 +0300
committerSascha Hauer <s.hauer@pengutronix.de>2020-11-09 08:50:35 +0100
commit9c26bdabd8dd4dc3aa52513c02dce2a8741d45b0 (patch)
tree38260a5d7b149ec824fa9f52efb8da9260abb003 /commands
parentb7c83c6bf2c5a6e4d9289a3c458843b90ba2b32a (diff)
downloadbarebox-9c26bdabd8dd4dc3aa52513c02dce2a8741d45b0.tar.gz
barebox-9c26bdabd8dd4dc3aa52513c02dce2a8741d45b0.tar.xz
i2c_probe: Use "read_byte" command for probing
Some I2C adapters do not allow zero length data transfers, such as the AM335X. To use the i2c_probe command, let's use byte reading for this purpose. Signed-off-by: Alexander Shiyan <shc_work@mail.ru> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'commands')
-rw-r--r--commands/i2c.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/commands/i2c.c b/commands/i2c.c
index 53f36dfaab..997d49a949 100644
--- a/commands/i2c.c
+++ b/commands/i2c.c
@@ -16,10 +16,12 @@ static void i2c_probe_range(struct i2c_adapter *adapter, int startaddr, int stop
printf("probing i2c%d range 0x%02x-0x%02x: ", adapter->nr, startaddr, stopaddr);
for (addr = startaddr; addr <= stopaddr && !ctrlc(); addr++) {
+ u8 buf[1];
struct i2c_msg msg = {
.addr = addr,
- .buf = NULL,
- .len = 0,
+ .buf = buf,
+ .len = sizeof(buf),
+ .flags = I2C_M_RD,
};
int ret = i2c_transfer(adapter, &msg, 1);
if (ret == 1)