Add support for multiple I2C buses
PATCH 1/2 Add support for multiple I2C buses
Hello,
Attached is a patch providing support for multiple I2C buses at the command level. The second part of the patch includes an implementation for the MPC834x CPU and MPC8349EMDS board. Note - this does not include support for 10-bit addresses. That's too profound a change to include here... Hopefully this addresses concerns with my previous attempts.
Overview:
1. Include new 'i2c' command (based on USB implementation) using CONFIG_I2C_CMD_TREE. Note - I opted to not use the last remaining CMD bit in 'include/cmd_confdefs.h'.
2. Allow multiple buses by defining CONFIG_I2C_MULTI_BUS. Note that this is only available under the new 'i2c' command mentioned in bullet 1.
3. Allow by-passing of devices when probing a bus by defining CFG_I2C_MULTI_NOPROBES. This is an array of bus-device pairs that will be skipped by the 'i2c probe' command.
CHANGELOG:
Added new 'i2c' master command for all I2C interaction. This is
conditionally compiled with CONFIG_I2C_CMD_TREE. New commands added for setting I2C bus speed as well as changing the active bus if the board has more than one bus (conditionally compiled with CONFIG_I2C_MULTI_BUS). Added a list of devices to ignore when probing the buses when more than one bus is present. Updated README.
regards,
Ben
-------------- next part --------------
A non-text attachment was scrubbed...
Name: i2c_multibus.PATCH
Type: text/x-patch
Size: 9093 bytes
Desc: not available
Url : http://lists.denx.de/pipermail/u-boot/attachments/20060830/df28dfeb/attachment.bin
PATCH 1/2 Add support for multiple I2C buses
Ben Warren stated on 8/30/2006 4:35 PM:
Quoted 1 line
Overview:
<snip>
Quoted 1 line
be skipped by the 'i2c probe' command.
Thanks Ben, this is finally in tune with Denx requirements I guess ;)
Quoted 7 lines
------------------------------------------------------------------------
README +0
-0
README The following options need to be configu · line 1196
Quoted 10 lines
README +6
-1@@ -1188,7 +1188,12 @@ The following options need to be configu clock chips. See common/cmd_i2c.c for a description of the command line interface. - CONFIG_HARD_I2C selects the CPM hardware driver for I2C. + CONFIG_I2C_CMD_TREE is a recommended option that places + all I2C commands under a single 'i2c' root command. The + older 'imm', 'imd', 'iprobe' etc. commands are considered + deprecated and may disappear in the future. + + CONFIG_HARD_I2C selects a hardware I2C controller.
I guess I am slow abt this.... but !slow_i2c... is that not good enough? and I cant see any other part in the the common patch using it...
Quoted 15 lines
common/cmd_i2c.c +10
-0+int do_i2c_bus_speed (cmd_tbl_t * cmdtp,int flag,int argc,char *argv[]) +{ +int speed, ret=0 ; + +if (argc ==1 )/* querying current speed */ + { +printf ("Current bus speed=%d\n" ,i2c_get_bus_speed ()); + } +else + {
common/cmd_i2c.c
Quoted 10 lines
common/cmd_i2c.c +10
-0+ speed =simple_strtoul (argv[1 ],NULL ,10 ); +printf ("Setting bus speed to %d Hz\n" , speed); + ret =i2c_set_bus_speed (speed); +if (ret) + { +printf ("Failure changing bus speed (%d)\n" , ret); + } + } +return ret; +}
Err... Does this mean that all other folks who can only support a single speed need to implement this api (including all other existing drivers??)...... Lotsa people are not going to like this if that is so...
Looks good to me.. it should fit in OMAP2430 framework too :)
Some one gotta tell Denx to update this:
http://sourceforge.net/cvs/?group_id=65938. i thought we moved to git sometime back. Do we even look at cvs anymore??? :(
Regards,
Nishanth Menon
PATCH 1/2 Add support for multiple I2C buses
Quoted 6 lines · Nishanth Menon
Ben Warren stated on 8/30/2006 4:35 PM:
Quoted 1 line
Overview:
<snip>
Quoted 1 line
be skipped by the 'i2c probe' command.
Thanks Ben, this is finally in tune with Denx requirements I guess ;)
Hope so...
Quoted 10 lines
Quoted 10 lines
------------------------------------------------------------------------
README +0
-0@@ -1188,7 +1188,12 @@ The following options need to be configu clock chips. See common/cmd_i2c.c for a description of the command line interface.
Quoted 9 lines
README The following options need to be configu · line 1196
Quoted 7 lines
README +6
-1- CONFIG_HARD_I2C selects the CPM hardware driver for I2C. + CONFIG_I2C_CMD_TREE is a recommended option that places + all I2C commands under a single 'i2c' root command. The + older 'imm', 'imd', 'iprobe' etc. commands are considered + deprecated and may disappear in the future. + + CONFIG_HARD_I2C selects a hardware I2C controller.I guess I am slow abt this.... but !slow_i2c... is that not good enough? and I cant see any other part in the the common patch using it...
Sorry, I don't know what you're talking about. What's slow_i2c? I just grepped the source and didn't find it anywhere.
Quoted 20 lines
Quoted 20 lines
common/cmd_i2c.c +15
-0+int do_i2c_bus_speed (cmd_tbl_t * cmdtp,int flag,int argc,char *argv[]) +{ +int speed, ret=0 ; + +if (argc ==1 )/* querying current speed */ + { +printf ("Current bus speed=%d\n" ,i2c_get_bus_speed ()); + } +else + { + speed =simple_strtoul (argv[1 ],NULL ,10 ); +printf ("Setting bus speed to %d Hz\n" , speed); + ret =i2c_set_bus_speed (speed); +if (ret) + {
Quoted 8 lines
common/cmd_i2c.c
Quoted 5 lines
common/cmd_i2c.c +5
-0+printf ("Failure changing bus speed (%d)\n" , ret); + } + } +return ret; +}Err... Does this mean that all other folks who can only support a single speed need to implement this api (including all other existing drivers??)...... Lotsa people are not going to like this if that is so...
Yes. If you want to use the new command tree, you'll have to add a small number of stub functions to your driver. Or else use the old commands. Although I've mentioned deprecation, I suspect they'll be around longer than you or me. I guess if there's huge pushback we can always wrap these calls by yet another CONFIG option, but aren't there enough already?
Quoted 7 lines
Looks good to me.. it should fit in OMAP2430 framework too :)
Some one gotta tell Denx to update this:
http://sourceforge.net/cvs/?group_id=65938. i thought we moved to git sometime back. Do we even look at cvs anymore??? :(
Wolfgang has mentioned MANY times to people that the CVS isn't in use any more and to use git. I suspect it's hard if not impossible to remove that from Sourceforge, and obviously Wolfgang has lots of things on his plate that have a priority...
Quoted 2 lines
Regards,
Nishanth Menon
PATCH 1/2 Add support for multiple I2C buses
Quoted 5 lines · In message <[email protected]> you wrote:
Wolfgang has mentioned MANY times to people that the CVS isn't in use any more and to use git. I suspect it's hard if not impossible to remove that from Sourceforge, and obviously Wolfgang has lots of things on his plate that have a priority...
It's impossible to remove (and does not ake sense - IMHO it's actually a very good thing that projects cannot just disappear for example if someone retires or ries to convert it to another, non-open license model). Also, the web page mentioned cannot be edited by me, as it's one of the common site docs.
Best regards,
Wolfgang Denk
Signature · 3 lines
Software Engineering: Embedded and Realtime Systems, Embedded Linux Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de If all you have is a hammer, everything looks like a nail.
PATCH 1/2 Add support for multiple I2C buses
Wolfgang,
Quoted 11 lines · Wolfgang Denk
Quoted 4 lines · In message <[email protected]> you wrote:
Wolfgang has mentioned MANY times to people that the CVS isn't in use any more and to use git. I suspect it's hard if not impossible to remove that from Sourceforge, and obviously Wolfgang has lots of things on his plate that have a priority...
It's impossible to remove (and does not ake sense - IMHO it's actually a very good thing that projects cannot just disappear for example if someone retires or ries to convert it to another, non-open license model). Also, the web page mentioned cannot be edited by me, as it's one of the common site docs.
How about adding a warning text to the Makefile on CVS repository so that if someone checks out from CVS and does a build they are given warning that CVS repository is obsolete and they should use git repository only at denx.de
Best regards,
Tolunay
PATCH 1/2 Add support for multiple I2C buses
In reply to Ben WarrenQuoted 5 lines · Ben Warren
Quoted 3 lines
Quoted 1 line
+
CONFIG_HARD_I2Cselects a hardware I2C controller.I guess I am slow abt this.... but !slow_i2c... is that not good enough? and I cant see any other part in the the common patch using it...
Sorry, I don't know what you're talking about. What's
slow_i2c? I just grepped the source and didn't find it anywhere.
Voila, a typo :-) ! I should have stated soft_i2c. !CONFIG_SOFT_I2C should mean HARD_I2C.
Regards,
Nishanth Menon
PATCH 1/2 Add support for multiple I2C buses
Nishanth,
Quoted 7 lines · --- nishanth menon
Quoted 1 line · Ben Warren
Quoted 1 line
Quoted 1 line
+
CONFIG_HARD_I2Cselects a hardwareI2C controller.
Quoted 1 line
Quoted 1 line
I guess I am slow abt this.... but !slow_i2c...
is that not good enough?
Quoted 1 line
Quoted 1 line
and I cant see any other part in the the common
patch using it...
Quoted 8 lines
Quoted 1 line
Sorry, I don't know what you're talking about.
What's
slow_i2c? I justQuoted 1 line
grepped the source and didn't find it anywhere.
Voila, a typo :-) ! I should have stated
soft_i2c. !CONFIG_SOFT_I2C
should meanHARD_I2C.
Regards,
Nishanth Menon
OK... look a little more closely at the diff. All I did was change the word 'CPM' to 'hardware', because nowadays there are many more I2C controllers than the ones in QUICC engines. I was just cleaning up documentation, and didn't change any code regarding either HARD_I2C or SOFT_I2C.
Sorry for the confusion,
Ben
PATCH 1/2 Add support for multiple I2C buses
Hi Ben,
Ben Warren stated on 9/1/2006 10:18 PM:
Quoted 2 lines
OK... look a little more closely at the diff. All I did was change the word 'CPM' to 'hardware', because
Accepted :) But I still in my naivete question the sense of CONFIG_HARD_I2C? what is !HARD_I2C && !SOFT_I2C?? Regards,
Nishanth Menon
PATCH 1/2 Add support for multiple I2C buses
In reply to Ben WarrenHello,
Attached is a patch providing support for multiple I2C buses at the command level. The second part of the patch includes an implementation for the MPC834x CPU and MPC8349EMDS board.
/*** Note: This patch replaces ticket DNX#2006083042000018 ***/
Overview:
1. Include new 'i2c' command (based on USB implementation) using CONFIG_I2C_CMD_TREE.
2. Allow multiple buses by defining CONFIG_I2C_MULTI_BUS. Note that the commands to change bus number and speed are only available under the new 'i2c' command mentioned in the first bullet.
3. The option CFG_I2C_NOPROBES has been expanded to work in multi-bus systems. When CONFIG_I2C_MULTI_BUS is used, this option takes the form of an array of bus-device pairs. Otherwise, it is an array of uchar.
CHANGELOG:
Added new 'i2c' master command for all I2C interaction. This is
conditionally compiled with CONFIG_I2C_CMD_TREE. New commands added for setting I2C bus speed as well as changing the active bus if the board has more than one (conditionally compiled with CONFIG_I2C_MULTI_BUS). Updated NOPROBE logic to handle multiple buses. Updated README.
regards,
Ben
-------------- next part --------------
A non-text attachment was scrubbed...
Name: i2c_multibus.PATCH
Type: text/x-patch
Size: 9128 bytes
Desc: not available
Url : http://lists.denx.de/pipermail/u-boot/attachments/20060907/4a89a054/attachment.bin