public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot-Users] PATCH: Add command support for multiple I2C controllers
@ 2006-05-18  3:03 Menon, Nishanth
  0 siblings, 0 replies; 13+ messages in thread
From: Menon, Nishanth @ 2006-05-18  3:03 UTC (permalink / raw)
  To: u-boot

Hi Ben,

> #if defined(CFG_I2C_NOPROBES) || defined(CFG_I2C_MULTI_NOPROBES)
>                 skip = 0;
>                 for(k=0; ((k < sizeof(i2c_no_probes)) && (*(pNoProbes
>                 {
>                         if(*(pNoProbes + k) == j)
>                         {
> The scan for "don't probe addresses" stops at the first 0xff in the
Just relooked at your patched and realized that I was wrong.. my
apologies.. Trouble with scanning the code with a hood on brains :(
 
Regards,
Nishanth Menon

^ permalink raw reply	[flat|nested] 13+ messages in thread
* [U-Boot-Users] PATCH: Add command support for multiple I2C controllers
@ 2006-05-17 23:28 Menon, Nishanth
  2006-05-18 14:07 ` Ben Warren
  0 siblings, 1 reply; 13+ messages in thread
From: Menon, Nishanth @ 2006-05-17 23:28 UTC (permalink / raw)
  To: u-boot

Hi Ben,
Thanks for the patch, I think we are in the right direction.

Here are my comments:
+#if defined(CFG_I2C_NOPROBES) && defined(CFG_I2C_MULTI_NOPROBES)
+#error "Only one of CFG_I2C_NOPROBES or CFG_I2C_MULTI_NOPROBES may be
used"
+#endif
Multiprobe needs sanity check with CONFIG_I2C_MULTI_BUS..

#if defined(CFG_I2C_NOPROBES)
 static uchar i2c_no_probes[] = CFG_I2C_NOPROBES;
+static uchar *pNoProbes = i2c_no_probes;
+#elif defined(CFG_I2C_MULTI_NOPROBES)
+static uchar i2c_no_probes[] = CFG_I2C_MULTI_NOPROBES;
+static uchar *pNoProbes = i2c_no_probes;
 #endif

One problem: On 10 bit addressing mode, uchar is not enough to define
the address. This is present through out the cmd_i2c.c!

Line 556
+		return 0;
Return error value

#if defined(CFG_I2C_NOPROBES) || defined(CFG_I2C_MULTI_NOPROBES)     
                skip = 0;                                            
                for(k=0; ((k < sizeof(i2c_no_probes)) && (*(pNoProbes
                {                                                    
                        if(*(pNoProbes + k) == j)                    
                        {                                            
The scan for "don't probe addresses" stops at the first 0xff in the
pNoProbes array. This logic is fine for the first bus, how does it
handle the subsequent busses? I do "ibus 2 400" and then do a probe, how
will it pick up the non-probe-able addresses of bus 2?

I think since the context of the bus is known only to the platform
driver, the usage of the same should be passed on there/do something of
the following logic:
1. in ibus, store bus index (say bidx) in cmd_i2c.c
2. in iprobe, 
	a) use a local pNoProbes which is indexed@the (bidx -1)th 
	   occurance of 0xFF in the global pNoProbes
	b) use the rest of the scan logic..

Additional command for user to get i2c bus stats: ibi (i2c bus info)
which will call i2c_get_bus_num and i2c_get_bus_speed and provide users.

Regards,
Nishanth Menon

^ permalink raw reply	[flat|nested] 13+ messages in thread
* [U-Boot-Users] PATCH: Add command support for multiple I2C controllers
@ 2006-05-17 19:21 Ben Warren
  2006-05-17 22:52 ` Wolfgang Denk
  0 siblings, 1 reply; 13+ messages in thread
From: Ben Warren @ 2006-05-17 19:21 UTC (permalink / raw)
  To: u-boot

Hello,

Attached is a second stab at a patch to allow access to multiple I2C
controllers.  It enhances the command set by adding the following
command, which changes the 'current' I2C bus.  Further write, read,
probe etc. commands will deal with the newly selected bus:

ibus [bus_index] [speed in Hz]

In addition, the logic for ignoring I2C devices during a probe command
has been enhanced to work with multiple controllers.  The software has
been tested with new and old configurations (i.e. is backwards
compatible).

Old way of ignoring devices:

#define CFG_I2C_NOPROBES {0x11, 0x22}

New way:

#define CFG_I2C_MULTI_NOPROBES {0x11, 0x22, 0xff, 0x33, 0x44, 0xff}

where controller lists are delimited by '0xff', which is an invalid I2C
address.

Note: In order to use, drivers must be modified to implement the
following API extensions:

int	i2c_set_bus(uchar bus, int speed);
uchar	i2c_get_bus_num(void);
int	i2c_get_bus_speed(void);

Code is conditionally compiled using:

CONFIG_I2C_MULTI_BUS
CFG_I2C_MULTI_NOPROBES

CHANGELOG:
	If CONFIG_I2C_MULTI_BUS is defined, the 'ibus' command becomes
available, allowing the user to switch between I2C buses and to change
bus speeds.  Additionally, devices may be excluded from being probed by
defining a CFG_I2C_MULTI_NOPROBES array, where lists for each controller
are delimited by '0xff'

Please have a look and feed back any suggestions.

regards,
Ben


-------------- next part --------------
A non-text attachment was scrubbed...
Name: I2C_MULTIBUS.patch
Type: text/x-patch
Size: 5032 bytes
Desc: not available
Url : http://lists.denx.de/pipermail/u-boot/attachments/20060517/704f7a3c/attachment.bin 

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

end of thread, other threads:[~2006-05-23  6:59 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <20060517225207.3985A3525D9@atlas.denx.de>
2006-05-18 13:51 ` [U-Boot-Users] PATCH: Add command support for multiple I2C controllers Ben Warren
2006-05-18 16:19   ` Wolfgang Denk
2006-05-18 17:04     ` Ben Warren
2006-05-18 23:03       ` Wolfgang Denk
2006-05-19 12:07         ` Travis B. Sawyer
2006-05-23  6:59           ` Tolunay Orkun
2006-05-19 14:43         ` Ben Warren
2006-05-18  3:03 Menon, Nishanth
  -- strict thread matches above, loose matches on Subject: below --
2006-05-17 23:28 Menon, Nishanth
2006-05-18 14:07 ` Ben Warren
2006-05-18 22:55   ` Wolfgang Denk
2006-05-17 19:21 Ben Warren
2006-05-17 22:52 ` Wolfgang Denk

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