some i2c patches
cover some i2c patches
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(-)
Signature · 7 lines
2.0.1 _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
PATCH 1/3 commands: i2c: verbose option doesn't need argument
--- commands/i2c.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
commands/i2c.c +2 -2
@@ -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 );
Signature · 7 lines
2.0.1 _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
PATCH 2/3 commands: i2c: simplify i2c wide access logic
In reply to Silvio Fricke--- commands/i2c.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
commands/i2c.c +4 -4
@@ -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)
Signature · 7 lines
2.0.1 _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
PATCH 3/3 commands: i2c: add message if write is not successful
In reply to Silvio Fricke--- commands/i2c.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
commands/i2c.c +5 -1
@@ -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) {
Signature · 7 lines
2.0.1 _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
Sascha Hauer
AppliedQuoted 4 lines · Silvio Fricke
Hi,
here three patches for the i2c subsystem. Please review and pull into git repository.
Applied all three. Thanks
Sascha
Quoted 22 lines
Thanks and bye,
SilvioSilvio 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 successfulcommands/i2c.c | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-)Signature · 7 lines
2.0.1 _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
Signature · 9 lines
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 [email protected] http://lists.infradead.org/mailman/listinfo/barebox