mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Sascha Hauer <s.hauer@pengutronix.de>
To: Alexander Shiyan <shc_work@mail.ru>
Cc: barebox@lists.infradead.org
Subject: Re: [PATCH] i2c_probe: Use "read_byte" command for probing
Date: Mon, 9 Nov 2020 08:50:48 +0100	[thread overview]
Message-ID: <20201109075048.GE29830@pengutronix.de> (raw)
In-Reply-To: <20201104035928.20519-1-shc_work@mail.ru>

On Wed, Nov 04, 2020 at 06:59:28AM +0300, Alexander Shiyan wrote:
> 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>
> ---
>  commands/i2c.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)

Applied, thanks

Sascha

> 
> diff --git a/commands/i2c.c b/commands/i2c.c
> index 53f36dfaa..997d49a94 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)
> -- 
> 2.26.2
> 
> 
> _______________________________________________
> barebox mailing list
> barebox@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/barebox
> 

-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

      reply	other threads:[~2020-11-09  7:50 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-04  3:59 Alexander Shiyan
2020-11-09  7:50 ` Sascha Hauer [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20201109075048.GE29830@pengutronix.de \
    --to=s.hauer@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    --cc=shc_work@mail.ru \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox