mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Aleksander Morgado <aleksander@aleksander.es>
To: barebox@lists.infradead.org, s.hauer@pengutronix.de
Cc: Aleksander Morgado <aleksander@aleksander.es>
Subject: [PATCH 1/2] i2c_write: document master send mode
Date: Tue, 21 Aug 2018 17:18:25 +0200	[thread overview]
Message-ID: <20180821151826.5011-2-aleksander@aleksander.es> (raw)
In-Reply-To: <20180821151826.5011-1-aleksander@aleksander.es>

When no explicit start register is given, the i2c message is emitted
in master send mode.

Signed-off-by: Aleksander Morgado <aleksander@aleksander.es>
---
 commands/i2c.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/commands/i2c.c b/commands/i2c.c
index f0d16af0c..57dc092c2 100644
--- a/commands/i2c.c
+++ b/commands/i2c.c
@@ -145,8 +145,12 @@ static int do_i2c_write(int argc, char *argv[])
 	ret = 0;
 
 	if (verbose) {
-		printf("wrote %i bytes starting at reg 0x%04x to i2cdev 0x%02x on bus %i\n",
-			count, reg, addr, adapter->nr);
+		if (reg >= 0)
+			printf("wrote %i bytes starting at reg 0x%04x to i2cdev 0x%02x on bus %i\n",
+			       count, reg, addr, adapter->nr);
+		else
+			printf("sent %i bytes in master send mode to i2cdev 0x%02x on bus %i\n",
+			       count, addr, adapter->nr);
 		for (i = 0; i < count; i++)
 			printf("0x%02x ", *(buf + i));
 		printf("\n");
@@ -161,7 +165,7 @@ BAREBOX_CMD_HELP_START(i2c_write)
 BAREBOX_CMD_HELP_TEXT("Options:")
 BAREBOX_CMD_HELP_OPT ("-b BUS\t", "i2c bus number (default 0)")
 BAREBOX_CMD_HELP_OPT ("-a ADDR\t", "i2c device address")
-BAREBOX_CMD_HELP_OPT ("-r START", "start register")
+BAREBOX_CMD_HELP_OPT ("-r START", "start register (optional, master send mode if none given)")
 BAREBOX_CMD_HELP_OPT ("-w\t",       "use word (16 bit) wide access")
 BAREBOX_CMD_HELP_OPT ("-v\t",       "verbose")
 BAREBOX_CMD_HELP_END
-- 
2.18.0


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

  reply	other threads:[~2018-08-21 15:18 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-08-21 15:18 i2c master send/receive mode Aleksander Morgado
2018-08-21 15:18 ` Aleksander Morgado [this message]
2018-08-21 15:18 ` [PATCH 2/2] i2c_read: implement support for master receive mode Aleksander Morgado
2018-08-22  7:37 ` i2c master send/receive mode Sascha Hauer

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=20180821151826.5011-2-aleksander@aleksander.es \
    --to=aleksander@aleksander.es \
    --cc=barebox@lists.infradead.org \
    --cc=s.hauer@pengutronix.de \
    /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