public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot-Users] I2C scanning
@ 2007-10-22 14:44 Yasothabalan
  2007-10-22 14:57 ` Ben Warren
  0 siblings, 1 reply; 9+ messages in thread
From: Yasothabalan @ 2007-10-22 14:44 UTC (permalink / raw)
  To: u-boot


Hi all,

 

I am using MPC5200B CPU. 

 

I am using both the I2C buses present as defined below,

 

#define MPC5XXX_I2C1              (CFG_MBAR + 0x3D00)

#define MPC5XXX_I2C2              (CFG_MBAR + 0x3D40)

 

Is it possible to scan both the buses in the run time and do read/write
operation?

 

I am here able to scan only one bus. 

 

How can I fix this issue? 

 

 

Regards,

Yasotha Balan R

 



DISCLAIMER:
-----------------------------------------------------------------------------------------------------------------------

The contents of this e-mail and any attachment(s) are confidential and intended for the named recipient(s) only.
It shall not attach any liability on the originator or HCL or its affiliates. Any views or opinions presented in 
this email are solely those of the author and may not necessarily reflect the opinions of HCL or its affiliates.
Any form of reproduction, dissemination, copying, disclosure, modification, distribution and / or publication of 
this message without the prior written consent of the author of this e-mail is strictly prohibited. If you have 
received this email in error please delete it and notify the sender immediately. Before opening any mail and 
attachments please check them for viruses and defect.

-----------------------------------------------------------------------------------------------------------------------
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.denx.de/pipermail/u-boot/attachments/20071022/5569769e/attachment.htm 

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

* [U-Boot-Users] I2C scanning
  2007-10-22 14:44 [U-Boot-Users] I2C scanning Yasothabalan
@ 2007-10-22 14:57 ` Ben Warren
  2007-10-22 15:21   ` Yasothabalan
  2007-10-23 12:02   ` Yasothabalan
  0 siblings, 2 replies; 9+ messages in thread
From: Ben Warren @ 2007-10-22 14:57 UTC (permalink / raw)
  To: u-boot

Yasothabalan,

Yasothabalan Ramaswamy-TLS,Chennai wrote:
>
> Hi all,
>
>  
>
> I am using MPC5200B CPU.
>
>  
>
> I am using both the I2C buses present as defined below,
>
>  
>
> #define MPC5XXX_I2C1              (CFG_MBAR + 0x3D00)
>
> #define MPC5XXX_I2C2              (CFG_MBAR + 0x3D40)
>
>  
>
> Is it possible to scan both the buses in the run time and do 
> read/write operation?
>
>  
>
> I am here able to scan only one bus.
>
>  
>
> How can I fix this issue?
>
>  
>
I don't know anything about this CPU, but the following code in 
cpu/mpc5xxx/i2c.c makes me think you can't use both I2C buses on this chip:

#if (CFG_I2C_MODULE == 2)
#define I2C_BASE    MPC5XXX_I2C2
#elif (CFG_I2C_MODULE == 1)
#define I2C_BASE    MPC5XXX_I2C1
#else
#error CFG_I2C_MODULE is not properly configured
#endif

If, however, this chip shares the same I2C controller  as the MPC8xxx 
chips (I have no idea if it does or doesn't), with a little Makefile 
magic you could use the fsl_i2c.c driver, which supports multiple buses.

regards,
Ben

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

* [U-Boot-Users] I2C scanning
  2007-10-22 14:57 ` Ben Warren
@ 2007-10-22 15:21   ` Yasothabalan
  2007-10-22 15:30     ` Ben Warren
  2007-10-23 12:02   ` Yasothabalan
  1 sibling, 1 reply; 9+ messages in thread
From: Yasothabalan @ 2007-10-22 15:21 UTC (permalink / raw)
  To: u-boot


I am able to switch between both the buses, by CONFIG_I2C_MODULE to 1 or
2.

#if (CFG_I2C_MODULE == 2)
#define I2C_BASE    MPC5XXX_I2C2
#elif (CFG_I2C_MODULE == 1)
#define I2C_BASE    MPC5XXX_I2C1
#else
#error CFG_I2C_MODULE is not properly configured
#endif

But my problem is I have to scan both the buses dynamically in the run
time.


Regards,
Yasotha Balan R
Member Technical Staff - HPEG
HCL Technologies Ltd.
73,74, South Phase Road, Ambattur Indutrial Estate, Chennai 600058.
Tel: +91-044-43935000 Extn. (5076)
Mob: +91-9994309885
www.hcltech.com
www.hcl.in

 

-----Original Message-----
From: Ben Warren [mailto:bwarren at qstreams.com] 
Sent: Monday, October 22, 2007 8:27 PM
To: Yasothabalan Ramaswamy-TLS,Chennai
Cc: u-boot-users at lists.sourceforge.net
Subject: Re: [U-Boot-Users] I2C scanning

Yasothabalan,

Yasothabalan Ramaswamy-TLS,Chennai wrote:
>
> Hi all,
>
>  
>
> I am using MPC5200B CPU.
>
>  
>
> I am using both the I2C buses present as defined below,
>
>  
>
> #define MPC5XXX_I2C1              (CFG_MBAR + 0x3D00)
>
> #define MPC5XXX_I2C2              (CFG_MBAR + 0x3D40)
>
>  
>
> Is it possible to scan both the buses in the run time and do 
> read/write operation?
>
>  
>
> I am here able to scan only one bus.
>
>  
>
> How can I fix this issue?
>
>  
>
I don't know anything about this CPU, but the following code in 
cpu/mpc5xxx/i2c.c makes me think you can't use both I2C buses on this
chip:

#if (CFG_I2C_MODULE == 2)
#define I2C_BASE    MPC5XXX_I2C2
#elif (CFG_I2C_MODULE == 1)
#define I2C_BASE    MPC5XXX_I2C1
#else
#error CFG_I2C_MODULE is not properly configured
#endif

If, however, this chip shares the same I2C controller  as the MPC8xxx 
chips (I have no idea if it does or doesn't), with a little Makefile 
magic you could use the fsl_i2c.c driver, which supports multiple buses.

regards,
Ben




DISCLAIMER:
-----------------------------------------------------------------------------------------------------------------------

The contents of this e-mail and any attachment(s) are confidential and intended for the named recipient(s) only.
It shall not attach any liability on the originator or HCL or its affiliates. Any views or opinions presented in 
this email are solely those of the author and may not necessarily reflect the opinions of HCL or its affiliates.
Any form of reproduction, dissemination, copying, disclosure, modification, distribution and / or publication of 
this message without the prior written consent of the author of this e-mail is strictly prohibited. If you have 
received this email in error please delete it and notify the sender immediately. Before opening any mail and 
attachments please check them for viruses and defect.

-----------------------------------------------------------------------------------------------------------------------

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

* [U-Boot-Users] I2C scanning
  2007-10-22 15:21   ` Yasothabalan
@ 2007-10-22 15:30     ` Ben Warren
  0 siblings, 0 replies; 9+ messages in thread
From: Ben Warren @ 2007-10-22 15:30 UTC (permalink / raw)
  To: u-boot

Yasothabalan Ramaswamy-TLS,Chennai wrote:
> I am able to switch between both the buses, by CONFIG_I2C_MODULE to 1 or
> 2.
>
> #if (CFG_I2C_MODULE == 2)
> #define I2C_BASE    MPC5XXX_I2C2
> #elif (CFG_I2C_MODULE == 1)
> #define I2C_BASE    MPC5XXX_I2C1
> #else
> #error CFG_I2C_MODULE is not properly configured
> #endif
>
> But my problem is I have to scan both the buses dynamically in the run
> time.
>
>   
I understand. Please re-read my earlier response, and do some research 
into your I2C controller. The other I2C controller (fsl_i2c.c), supports 
run-time switching between buses, and may or not be applicable to your 
CPU. If it's not, here's an opportunity for you to update the 5xxx driver.

regards,
Ben

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

* [U-Boot-Users] I2C scanning
  2007-10-22 14:57 ` Ben Warren
  2007-10-22 15:21   ` Yasothabalan
@ 2007-10-23 12:02   ` Yasothabalan
  2007-10-23 14:25     ` Ben Warren
  1 sibling, 1 reply; 9+ messages in thread
From: Yasothabalan @ 2007-10-23 12:02 UTC (permalink / raw)
  To: u-boot


Thanks Ben.

Can you please help how to proceed with fsl_i2c.c driver file?
I have defined CFG_I2C_OFFSET 3D00 &
		   CFG_I2C2_OFFSET 3D40
When I give command i2c dev 0 I am getting the response as
=> i2c dev 0
Setting bus to 0

But when I give command as follows, I get nothing

=> i2c probe

Can you please help me?

Regards,
Yasotha Balan R

 

-----Original Message-----
From: Ben Warren [mailto:bwarren at qstreams.com] 
Sent: Monday, October 22, 2007 8:27 PM
To: Yasothabalan Ramaswamy-TLS,Chennai
Cc: u-boot-users at lists.sourceforge.net
Subject: Re: [U-Boot-Users] I2C scanning

Yasothabalan,

Yasothabalan Ramaswamy-TLS,Chennai wrote:
>
> Hi all,
>
>  
>
> I am using MPC5200B CPU.
>
>  
>
> I am using both the I2C buses present as defined below,
>
>  
>
> #define MPC5XXX_I2C1              (CFG_MBAR + 0x3D00)
>
> #define MPC5XXX_I2C2              (CFG_MBAR + 0x3D40)
>
>  
>
> Is it possible to scan both the buses in the run time and do 
> read/write operation?
>
>  
>
> I am here able to scan only one bus.
>
>  
>
> How can I fix this issue?
>
>  
>
I don't know anything about this CPU, but the following code in 
cpu/mpc5xxx/i2c.c makes me think you can't use both I2C buses on this
chip:

#if (CFG_I2C_MODULE == 2)
#define I2C_BASE    MPC5XXX_I2C2
#elif (CFG_I2C_MODULE == 1)
#define I2C_BASE    MPC5XXX_I2C1
#else
#error CFG_I2C_MODULE is not properly configured
#endif

If, however, this chip shares the same I2C controller  as the MPC8xxx 
chips (I have no idea if it does or doesn't), with a little Makefile 
magic you could use the fsl_i2c.c driver, which supports multiple buses.

regards,
Ben




DISCLAIMER:
-----------------------------------------------------------------------------------------------------------------------

The contents of this e-mail and any attachment(s) are confidential and intended for the named recipient(s) only.
It shall not attach any liability on the originator or HCL or its affiliates. Any views or opinions presented in 
this email are solely those of the author and may not necessarily reflect the opinions of HCL or its affiliates.
Any form of reproduction, dissemination, copying, disclosure, modification, distribution and / or publication of 
this message without the prior written consent of the author of this e-mail is strictly prohibited. If you have
received this email in error please delete it and notify the sender immediately. Before opening any mail and 
attachments please check them for viruses and defect.

-----------------------------------------------------------------------------------------------------------------------

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

* [U-Boot-Users] I2C scanning
  2007-10-23 12:02   ` Yasothabalan
@ 2007-10-23 14:25     ` Ben Warren
  2007-10-24  9:18       ` Yasothabalan
  0 siblings, 1 reply; 9+ messages in thread
From: Ben Warren @ 2007-10-23 14:25 UTC (permalink / raw)
  To: u-boot

Yasothabalan Ramaswamy-TLS,Chennai wrote:
> Thanks Ben.
>
> Can you please help how to proceed with fsl_i2c.c driver file?
> I have defined CFG_I2C_OFFSET 3D00 &
> 		   CFG_I2C2_OFFSET 3D40
> When I give command i2c dev 0 I am getting the response as
> => i2c dev 0
> Setting bus to 0
>
> But when I give command as follows, I get nothing
>
> => i2c probe
>
> Can you please help me?
>
> Regards,
> Yasotha Balan R
>
>   
Have you done a register-by-register comparison of the MPC5200B's I2C 
controller to verify that it's compatible with this driver? Download the 
MPC8349's datasheet from Freescale's website to compare. As I mentioned 
before, I have no idea if it is or not.

On the one hand, chip companies tend to re-use control blocks across 
multiple product lines, but on the other, the MPC5200-based boards in 
the U-boot tree use the driver in cpu/mpc5xxx. If the registers don't 
match, the fsl_i2c.c driver won't work.

If the driver is compatible, make sure you have the right CONFIGs in 
your header file (CONFIG_HARD_I2C, CONFIG_FSL_I2C etc.), then debug 
using the best tools for the job (my preferred order: printf, 
oscilloscope, BDI-2000/gdb).

If the driver isn't compatible, you can do the U-boot community a 
service by updating the cpu/mpc5xxx/i2c.c driver to handle multiple buses.

regards,
Ben

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

* [U-Boot-Users] I2C scanning
  2007-10-23 14:25     ` Ben Warren
@ 2007-10-24  9:18       ` Yasothabalan
  2007-10-24 13:52         ` Ben Warren
  2007-10-24 20:52         ` Wolfgang Denk
  0 siblings, 2 replies; 9+ messages in thread
From: Yasothabalan @ 2007-10-24  9:18 UTC (permalink / raw)
  To: u-boot



Thanks Ben.

I fixed my problem, now I am able to scan both the buses dynamically in
the run time.

I change cpu/mpc5xxx/i2c.c file according to the file fsl_i2c.c driver,
based on your idea.

Thank you, once again. 

Regards,
Yasotha Balan R

 

-----Original Message-----
From: Ben Warren [mailto:bwarren at qstreams.com] 
Sent: Tuesday, October 23, 2007 7:55 PM
To: Yasothabalan Ramaswamy-TLS,Chennai
Cc: u-boot-users at lists.sourceforge.net
Subject: Re: [U-Boot-Users] I2C scanning

Yasothabalan Ramaswamy-TLS,Chennai wrote:
> Thanks Ben.
>
> Can you please help how to proceed with fsl_i2c.c driver file?
> I have defined CFG_I2C_OFFSET 3D00 &
> 		   CFG_I2C2_OFFSET 3D40
> When I give command i2c dev 0 I am getting the response as
> => i2c dev 0
> Setting bus to 0
>
> But when I give command as follows, I get nothing
>
> => i2c probe
>
> Can you please help me?
>
> Regards,
> Yasotha Balan R
>
>   
Have you done a register-by-register comparison of the MPC5200B's I2C 
controller to verify that it's compatible with this driver? Download the

MPC8349's datasheet from Freescale's website to compare. As I mentioned 
before, I have no idea if it is or not.

On the one hand, chip companies tend to re-use control blocks across 
multiple product lines, but on the other, the MPC5200-based boards in 
the U-boot tree use the driver in cpu/mpc5xxx. If the registers don't 
match, the fsl_i2c.c driver won't work.

If the driver is compatible, make sure you have the right CONFIGs in 
your header file (CONFIG_HARD_I2C, CONFIG_FSL_I2C etc.), then debug 
using the best tools for the job (my preferred order: printf, 
oscilloscope, BDI-2000/gdb).

If the driver isn't compatible, you can do the U-boot community a 
service by updating the cpu/mpc5xxx/i2c.c driver to handle multiple
buses.

regards,
Ben

DISCLAIMER:
-----------------------------------------------------------------------------------------------------------------------

The contents of this e-mail and any attachment(s) are confidential and intended for the named recipient(s) only.
It shall not attach any liability on the originator or HCL or its affiliates. Any views or opinions presented in 
this email are solely those of the author and may not necessarily reflect the opinions of HCL or its affiliates.
Any form of reproduction, dissemination, copying, disclosure, modification, distribution and / or publication of 
this message without the prior written consent of the author of this e-mail is strictly prohibited. If you have 
received this email in error please delete it and notify the sender immediately. Before opening any mail and 
attachments please check them for viruses and defect.

-----------------------------------------------------------------------------------------------------------------------

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

* [U-Boot-Users] I2C scanning
  2007-10-24  9:18       ` Yasothabalan
@ 2007-10-24 13:52         ` Ben Warren
  2007-10-24 20:52         ` Wolfgang Denk
  1 sibling, 0 replies; 9+ messages in thread
From: Ben Warren @ 2007-10-24 13:52 UTC (permalink / raw)
  To: u-boot

Yasothabalan Ramaswamy-TLS,Chennai wrote:
> Thanks Ben.
>
> I fixed my problem, now I am able to scan both the buses dynamically in
> the run time.
>
> I change cpu/mpc5xxx/i2c.c file according to the file fsl_i2c.c driver,
> based on your idea.
>   
That's great. Would you be able to supply your change as a patch so that 
others can use it?
> Thank you, once again. 
>
>   
You're welcome, although I really didn't do anything.

regards,
Ben

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

* [U-Boot-Users] I2C scanning
  2007-10-24  9:18       ` Yasothabalan
  2007-10-24 13:52         ` Ben Warren
@ 2007-10-24 20:52         ` Wolfgang Denk
  1 sibling, 0 replies; 9+ messages in thread
From: Wolfgang Denk @ 2007-10-24 20:52 UTC (permalink / raw)
  To: u-boot

In message <CE54F2377C0FB8439A290BF5A88BF13D07208C31@CHN-HCLT-EVS01.HCLT.CORP.HCL.IN> you wrote:
> 
> I fixed my problem, now I am able to scan both the buses dynamically in
> the run time.
> 
> I change cpu/mpc5xxx/i2c.c file according to the file fsl_i2c.c driver,
> based on your idea.
> 
> Thank you, once again. 

It seems you forgot to attach your patch?

Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
If a packet hits a pocket on a socket on a port,
And the bus is interrupted as a very last resort,
And the address of the memory makes your floppy disk abort,
Then the socket packet pocket has an error to report! - Ken Burchill?

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

end of thread, other threads:[~2007-10-24 20:52 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-10-22 14:44 [U-Boot-Users] I2C scanning Yasothabalan
2007-10-22 14:57 ` Ben Warren
2007-10-22 15:21   ` Yasothabalan
2007-10-22 15:30     ` Ben Warren
2007-10-23 12:02   ` Yasothabalan
2007-10-23 14:25     ` Ben Warren
2007-10-24  9:18       ` Yasothabalan
2007-10-24 13:52         ` Ben Warren
2007-10-24 20: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