public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot-Users] PATCH: Add command support for second I2C controller
@ 2006-05-15 20:07 Ben Warren
  2006-05-17 22:24 ` Wolfgang Denk
  0 siblings, 1 reply; 9+ messages in thread
From: Ben Warren @ 2006-05-15 20:07 UTC (permalink / raw)
  To: u-boot

Hello,

Attached is a patch to common/cmd_i2c.c that allows access to two I2C
controllers on a board.  Note that this doesn't actually change any
hardware control - it just enhances the command set and passes more
information to whatever version of i2c_read(), i2c_write() etc. that
you're using.  I've implemented driver changes on MPC8349 hardware, but
they're not quite ready for review yet.  New definitions:
CONFIG_I2C_2_CTRLS - board has two I2C controllers
CFG_I2C2_NOPROBES {} - list of devices on bus 2 to ignore when probing

CHANGELOG: 
	If CONFIG_I2C_2_CTRLS is defined, the 'chip' parameter of all I2C
commands will accept an optional controller argument.    
e.g.  'imd 50.1 0' displays data at offset 0 of controller 1 device 50
      'imd 50.2 0' displays data at offset 0 of controller 2 device 50
      'iprobe 2' probes for devices on the second bus

regards,
Ben
-------------- next part --------------
A non-text attachment was scrubbed...
Name: CMD_I2C.patch
Type: text/x-patch
Size: 12679 bytes
Desc: not available
Url : http://lists.denx.de/pipermail/u-boot/attachments/20060515/5eb0fa18/attachment.bin 

^ permalink raw reply	[flat|nested] 9+ messages in thread
* [U-Boot-Users] PATCH: Add command support for second I2C controller
@ 2006-05-15 20:28 Ben Warren
  2006-05-16 16:16 ` Wolfgang Denk
  0 siblings, 1 reply; 9+ messages in thread
From: Ben Warren @ 2006-05-15 20:28 UTC (permalink / raw)
  To: u-boot


Hello,

Please ignore the previous patch - it contained a typo that would break
the compile.  Sorry... really - I did test this a lot but must have hit
a wrong key sequence in vim or something...  Really!


Attached is a patch to common/cmd_i2c.c that allows access to two I2C
controllers on a board.  Note that this doesn't actually change any
hardware control - it just enhances the command set and passes more
information to whatever version of i2c_read(), i2c_write() etc. that
you're using.  I've implemented driver changes on MPC8349 hardware, but
they're not quite ready for review yet.  New definitions:
CONFIG_I2C_2_CTRLS - board has two I2C controllers
CFG_I2C2_NOPROBES {} - list of devices on bus 2 to ignore when probing

CHANGELOG: 
        If CONFIG_I2C_2_CTRLS is defined, the 'chip' parameter of all
I2C
commands will accept an optional controller argument.    
e.g.  'imd 50.1 0' displays data at offset 0 of controller 1 device 50
      'imd 50.2 0' displays data at offset 0 of controller 2 device 50
      'iprobe 2' probes for devices on the second bus

regards,
Ben
-------------- next part --------------
A non-text attachment was scrubbed...
Name: CMD_I2C.patch
Type: text/x-patch
Size: 12674 bytes
Desc: not available
Url : http://lists.denx.de/pipermail/u-boot/attachments/20060515/a03d58a4/attachment.bin 

^ permalink raw reply	[flat|nested] 9+ messages in thread
* [U-Boot-Users] PATCH: Add command support for second I2C controller
@ 2006-05-16 15:10 Menon, Nishanth
  2006-05-16 15:34 ` Ben Warren
  0 siblings, 1 reply; 9+ messages in thread
From: Menon, Nishanth @ 2006-05-16 15:10 UTC (permalink / raw)
  To: u-boot

Hi Ben,
Some reasons why I am against the approach of giving i2c bus along with
the command itself:
1. Cannot handle scenarios of HS controllers.
2. cmd_i2c is a debug interface, once a bus is selected, we would like
to do read and write operations to a specific chip. To repeat the bus
number all the time is a overhead. 
3. To a smaller extent, older users need to be aware of the change
involved.
4. a simpler and lesser intrusive implementation adding an additional
command to select bus can achieve the same functionality. (I send a
previous mail with this).
> Attached is a patch to common/cmd_i2c.c that allows access to two I2C
> controllers on a board.  Note that this doesn't actually change any
5. importantly, common/cmd_i2c.c is a bad place to limit i2c busses..
each board/.. file should be given the functionality.
Regards,
Nishanth Menon

^ permalink raw reply	[flat|nested] 9+ messages in thread
* [U-Boot-Users] PATCH: Add command support for second I2C controller
@ 2006-05-16 15:14 Menon, Nishanth
  2006-05-16 15:36 ` Ben Warren
  0 siblings, 1 reply; 9+ messages in thread
From: Menon, Nishanth @ 2006-05-16 15:14 UTC (permalink / raw)
  To: u-boot

Looks like my previous mail got blocked..
Here is the implementation I was speaking about:
common/cmd_i2c.c:
#if defined(CFG_I2C_BUS_SELECT)
int do_i2c_bus(cmd_tbl_t * cmdtp, int flag, int argc, char *argv[])
{
       int bus_idx, bus_spd, res = 0;
       if (argc < 3) {
               printf("Usage[%d]:\n%s\n", argc, cmdtp->usage);
               return 1;
       }
       bus_idx = simple_strtoul(argv[1], NULL, 16);
       bus_spd = simple_strtoul(argv[2], NULL, 16);
       printf("Setting bus[%d] to Speed[%d]: ", bus_idx, bus_spd);
       res = select_bus(bus_idx, bus_spd);
       if (res) {
               printf("FAILED\n");
       } else {
               printf("PASS\n");
       }
       return res;
}
#endif                         /* bus select */
#if defined(CFG_I2C_BUS_SELECT)
U_BOOT_CMD(ibus, 3, 1, do_i2c_bus,
          "ibus    - Select i2c Bus\n",
          "bus_index speed\n    - Selects the bus index and sets the
speed (0x64(ST),0x190(FS),0xD48(HS))\n"
          "      (reports success/failure)\n");
#endif
Each board implementation can choose to implement select_bus() and
implement logic to handle speed mods, once a user gives a ibus, they can
use old commands to control devices on the bus..
Regards,
Nishanth Menon

> -----Original Message-----
> From: u-boot-users-admin at lists.sourceforge.net [mailto:u-boot-users-
> admin at lists.sourceforge.net] On Behalf Of Menon, Nishanth
> Sent: Tuesday, May 16, 2006 10:11 AM
> To: bwarren at qstreams.com; u-boot-users at lists.sourceforge.net
> Subject: RE: [U-Boot-Users] PATCH: Add command support for second I2C
> controller
> 
> Hi Ben,
> Some reasons why I am against the approach of giving i2c bus along
with
> the command itself:
> 1. Cannot handle scenarios of HS controllers.
> 2. cmd_i2c is a debug interface, once a bus is selected, we would like
> to do read and write operations to a specific chip. To repeat the bus
> number all the time is a overhead.
> 3. To a smaller extent, older users need to be aware of the change
> involved.
> 4. a simpler and lesser intrusive implementation adding an additional
> command to select bus can achieve the same functionality. (I send a
> previous mail with this).
> > Attached is a patch to common/cmd_i2c.c that allows access to two
I2C
> > controllers on a board.  Note that this doesn't actually change any
> 5. importantly, common/cmd_i2c.c is a bad place to limit i2c busses..
> each board/.. file should be given the functionality.
> Regards,
> Nishanth Menon
> 
> 
> -------------------------------------------------------
> Using Tomcat but need to do more? Need to support web services,
security?
> Get stuff done quickly with pre-integrated technology to make your job
> easier
> Download IBM WebSphere Application Server v.1.0.1 based on Apache
Geronimo
> http://sel.as-us.falkag.net/sel?cmd=k&kid\x120709&bid&3057&dat\x121642
> _______________________________________________
> U-Boot-Users mailing list
> U-Boot-Users at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/u-boot-users

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

end of thread, other threads:[~2006-05-18 14:22 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-05-15 20:07 [U-Boot-Users] PATCH: Add command support for second I2C controller Ben Warren
2006-05-17 22:24 ` Wolfgang Denk
2006-05-18 14:22   ` Ben Warren
  -- strict thread matches above, loose matches on Subject: below --
2006-05-15 20:28 Ben Warren
2006-05-16 16:16 ` Wolfgang Denk
2006-05-16 15:10 Menon, Nishanth
2006-05-16 15:34 ` Ben Warren
2006-05-16 15:14 Menon, Nishanth
2006-05-16 15:36 ` Ben Warren

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox