All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/3] some i2c patches
@ 2014-07-10 14:19 Silvio Fricke
  2014-07-10 14:19 ` [PATCH 1/3] commands: i2c: verbose option doesn't need argument Silvio Fricke
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Silvio Fricke @ 2014-07-10 14:19 UTC (permalink / raw)
  To: barebox; +Cc: Silvio Fricke

Hi,

here three patches for the i2c subsystem. Please review and pull into git
repository.


Thanks and bye,
Silvio

Silvio Fricke (3):
  commands: i2c: verbose option doesn't need argument
  commands: i2c: simplify i2c wide access logic
  commands: i2c: add message if write is not successful

 commands/i2c.c | 19 ++++++++++++-------
 1 file changed, 12 insertions(+), 7 deletions(-)

-- 
2.0.1


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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH 1/3] commands: i2c: verbose option doesn't need argument
  2014-07-10 14:19 [PATCH 0/3] some i2c patches Silvio Fricke
@ 2014-07-10 14:19 ` Silvio Fricke
  2014-07-10 14:19 ` [PATCH 2/3] commands: i2c: simplify i2c wide access logic Silvio Fricke
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Silvio Fricke @ 2014-07-10 14:19 UTC (permalink / raw)
  To: barebox; +Cc: Silvio Fricke

Signed-off-by: Silvio Fricke <silvio.fricke@gmail.com>
---
 commands/i2c.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/commands/i2c.c b/commands/i2c.c
index 2811f6a..7a39e6e 100644
--- a/commands/i2c.c
+++ b/commands/i2c.c
@@ -75,7 +75,7 @@ static int do_i2c_write(int argc, char *argv[])
 	int addr = -1, reg = -1, count = -1, verbose = 0, ret, opt, i, bus = 0, wide = 0;
 	u8 *buf;
 
-	while ((opt = getopt(argc, argv, "a:b:r:v:w")) > 0) {
+	while ((opt = getopt(argc, argv, "a:b:r:vw")) > 0) {
 		switch (opt) {
 		case 'a':
 			addr = simple_strtol(optarg, NULL, 0);
@@ -155,7 +155,7 @@ static int do_i2c_read(int argc, char *argv[])
 	u8 *buf;
 	int count = -1, addr = -1, reg = -1, verbose = 0, ret, opt, bus = 0, wide = 0;
 
-	while ((opt = getopt(argc, argv, "a:b:c:r:v:w")) > 0) {
+	while ((opt = getopt(argc, argv, "a:b:c:r:vw")) > 0) {
 		switch (opt) {
 		case 'a':
 			addr = simple_strtol(optarg, NULL, 0);
-- 
2.0.1


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

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 2/3] commands: i2c: simplify i2c wide access logic
  2014-07-10 14:19 [PATCH 0/3] some i2c patches Silvio Fricke
  2014-07-10 14:19 ` [PATCH 1/3] commands: i2c: verbose option doesn't need argument Silvio Fricke
@ 2014-07-10 14:19 ` Silvio Fricke
  2014-07-10 14:19 ` [PATCH 3/3] commands: i2c: add message if write is not successful Silvio Fricke
  2014-07-11  5:41 ` [PATCH 0/3] some i2c patches Sascha Hauer
  3 siblings, 0 replies; 5+ messages in thread
From: Silvio Fricke @ 2014-07-10 14:19 UTC (permalink / raw)
  To: barebox; +Cc: Silvio Fricke

Signed-off-by: Silvio Fricke <silvio.fricke@gmail.com>
---
 commands/i2c.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/commands/i2c.c b/commands/i2c.c
index 7a39e6e..e3d79b0 100644
--- a/commands/i2c.c
+++ b/commands/i2c.c
@@ -90,7 +90,7 @@ static int do_i2c_write(int argc, char *argv[])
 			verbose = 1;
 			break;
 		case 'w':
-			wide = 1;
+			wide = I2C_ADDR_16_BIT;
 			break;
 		}
 	}
@@ -113,7 +113,7 @@ static int do_i2c_write(int argc, char *argv[])
 	for (i = 0; i < count; i++)
 		*(buf + i) = (char) simple_strtol(argv[optind+i], NULL, 16);
 
-	ret = i2c_write_reg(&client, reg | (wide ? I2C_ADDR_16_BIT : 0), buf, count);
+	ret = i2c_write_reg(&client, reg | wide, buf, count);
 	if (ret != count)
 		goto out;
 	ret = 0;
@@ -173,7 +173,7 @@ static int do_i2c_read(int argc, char *argv[])
 			verbose = 1;
 			break;
 		case 'w':
-			wide = 1;
+			wide = I2C_ADDR_16_BIT;
 			break;
 		}
 	}
@@ -191,7 +191,7 @@ static int do_i2c_read(int argc, char *argv[])
 	client.addr = addr;
 
 	buf = xmalloc(count);
-	ret = i2c_read_reg(&client, reg | (wide ? I2C_ADDR_16_BIT : 0), buf, count);
+	ret = i2c_read_reg(&client, reg | wide, buf, count);
 	if (ret == count) {
 		int i;
 		if (verbose)
-- 
2.0.1


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

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 3/3] commands: i2c: add message if write is not successful
  2014-07-10 14:19 [PATCH 0/3] some i2c patches Silvio Fricke
  2014-07-10 14:19 ` [PATCH 1/3] commands: i2c: verbose option doesn't need argument Silvio Fricke
  2014-07-10 14:19 ` [PATCH 2/3] commands: i2c: simplify i2c wide access logic Silvio Fricke
@ 2014-07-10 14:19 ` Silvio Fricke
  2014-07-11  5:41 ` [PATCH 0/3] some i2c patches Sascha Hauer
  3 siblings, 0 replies; 5+ messages in thread
From: Silvio Fricke @ 2014-07-10 14:19 UTC (permalink / raw)
  To: barebox; +Cc: Silvio Fricke

Signed-off-by: Silvio Fricke <silvio.fricke@gmail.com>
---
 commands/i2c.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/commands/i2c.c b/commands/i2c.c
index e3d79b0..d6c5412 100644
--- a/commands/i2c.c
+++ b/commands/i2c.c
@@ -114,8 +114,12 @@ static int do_i2c_write(int argc, char *argv[])
 		*(buf + i) = (char) simple_strtol(argv[optind+i], NULL, 16);
 
 	ret = i2c_write_reg(&client, reg | wide, buf, count);
-	if (ret != count)
+	if (ret != count) {
+		if (verbose)
+			printf("write aborted, count(%i) != writestatus(%i)\n",
+				count, ret);
 		goto out;
+	}
 	ret = 0;
 
 	if (verbose) {
-- 
2.0.1


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

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH 0/3] some i2c patches
  2014-07-10 14:19 [PATCH 0/3] some i2c patches Silvio Fricke
                   ` (2 preceding siblings ...)
  2014-07-10 14:19 ` [PATCH 3/3] commands: i2c: add message if write is not successful Silvio Fricke
@ 2014-07-11  5:41 ` Sascha Hauer
  3 siblings, 0 replies; 5+ messages in thread
From: Sascha Hauer @ 2014-07-11  5:41 UTC (permalink / raw)
  To: Silvio Fricke; +Cc: barebox

On Thu, Jul 10, 2014 at 04:19:53PM +0200, Silvio Fricke wrote:
> Hi,
> 
> here three patches for the i2c subsystem. Please review and pull into git
> repository.

Applied all three. Thanks

Sascha

> 
> 
> Thanks and bye,
> Silvio
> 
> Silvio Fricke (3):
>   commands: i2c: verbose option doesn't need argument
>   commands: i2c: simplify i2c wide access logic
>   commands: i2c: add message if write is not successful
> 
>  commands/i2c.c | 19 ++++++++++++-------
>  1 file changed, 12 insertions(+), 7 deletions(-)
> 
> -- 
> 2.0.1
> 
> 
> _______________________________________________
> barebox mailing list
> barebox@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/barebox
> 

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 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

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2014-07-11  5:42 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-07-10 14:19 [PATCH 0/3] some i2c patches Silvio Fricke
2014-07-10 14:19 ` [PATCH 1/3] commands: i2c: verbose option doesn't need argument Silvio Fricke
2014-07-10 14:19 ` [PATCH 2/3] commands: i2c: simplify i2c wide access logic Silvio Fricke
2014-07-10 14:19 ` [PATCH 3/3] commands: i2c: add message if write is not successful Silvio Fricke
2014-07-11  5:41 ` [PATCH 0/3] some i2c patches Sascha Hauer

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.