public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot-Users] errors in using DS1337
@ 2008-01-30 12:18 xiangguo_li at hotmail.com
  2008-01-30 14:23 ` Ben Warren
  0 siblings, 1 reply; 6+ messages in thread
From: xiangguo_li at hotmail.com @ 2008-01-30 12:18 UTC (permalink / raw)
  To: u-boot

hello,

when I choose to use DS1337, I add definitions in header file:

#define CONFIG_RTC_DS1337
#define CFG_I2C_RTC_ADDR    0x68 

but, during making process, error appears:

rtc/librtc.a(ds1337.o): in function 'rtc_read':
.../rtc/ds1337.c: 172: undefined reference to 'i2c_reg_read'
rtc/librtc.a(ds1337.o): in function 'rtc_write':
.../rtc/ds1337.c: 178: undefined reference tp 'i2c_reg_write'

how to solve this error?

thank you.

-lxg 

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

* [U-Boot-Users] errors in using DS1337
  2008-01-30 12:18 [U-Boot-Users] errors in using DS1337 xiangguo_li at hotmail.com
@ 2008-01-30 14:23 ` Ben Warren
  2008-01-30 14:43   ` xiangguo_li at hotmail.com
  0 siblings, 1 reply; 6+ messages in thread
From: Ben Warren @ 2008-01-30 14:23 UTC (permalink / raw)
  To: u-boot

Hi lxg,

xiangguo_li at hotmail.com wrote:
> hello,
>
> when I choose to use DS1337, I add definitions in header file:
>
> #define CONFIG_RTC_DS1337
> #define CFG_I2C_RTC_ADDR    0x68
> but, during making process, error appears:
>
> rtc/librtc.a(ds1337.o): in function 'rtc_read':
> .../rtc/ds1337.c: 172: undefined reference to 'i2c_reg_read'
> rtc/librtc.a(ds1337.o): in function 'rtc_write':
> .../rtc/ds1337.c: 178: undefined reference tp 'i2c_reg_write'
>
> how to solve this error?
>
It would help to know what platform you're building for.  The functions 
mentioned are prototyped in 'i2c.h', but don't appear in all  I2C 
drivers (I'm thinking of the ARM ones that are in drivers/i2c).  If 
you're using a controller that has these functions implemented, you 
probably don't have your I2C controller properly set up.

Since these functions are always 1-or-2 liner wrappers around 
i2c_read()/i2c_write() and always do the same thing, it would probably 
be helpful to implement them as static inlines in include/i2c.h.  I'll 
post a patch to do this some time soon.

regards,
Ben

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

* [U-Boot-Users] errors in using DS1337
  2008-01-30 14:23 ` Ben Warren
@ 2008-01-30 14:43   ` xiangguo_li at hotmail.com
  2008-01-30 14:48     ` Ben Warren
  0 siblings, 1 reply; 6+ messages in thread
From: xiangguo_li at hotmail.com @ 2008-01-30 14:43 UTC (permalink / raw)
  To: u-boot

hello,

I am porting on a PowerPC (MPC7448) platform.

thank you.  
>>
> It would help to know what platform you're building for.  The functions 
> mentioned are prototyped in 'i2c.h', but don't appear in all  I2C 
> drivers (I'm thinking of the ARM ones that are in drivers/i2c).  If 
> you're using a controller that has these functions implemented, you 
> probably don't have your I2C controller properly set up.
> 
> Since these functions are always 1-or-2 liner wrappers around 
> i2c_read()/i2c_write() and always do the same thing, it would probably 
> be helpful to implement them as static inlines in include/i2c.h.  I'll 
> post a patch to do this some time soon.
> 
> regards,
> Ben
> 

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

* [U-Boot-Users] errors in using DS1337
  2008-01-30 14:43   ` xiangguo_li at hotmail.com
@ 2008-01-30 14:48     ` Ben Warren
  2008-01-30 15:01       ` xiangguo_li at hotmail.com
  0 siblings, 1 reply; 6+ messages in thread
From: Ben Warren @ 2008-01-30 14:48 UTC (permalink / raw)
  To: u-boot

xiangguo_li at hotmail.com wrote:
> hello,
>
> I am porting on a PowerPC (MPC7448) platform.
>
OK, what type of southbridge are you using (and ultimately which I2C 
controller)?

regards,
Ben

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

* [U-Boot-Users] errors in using DS1337
  2008-01-30 14:48     ` Ben Warren
@ 2008-01-30 15:01       ` xiangguo_li at hotmail.com
  2008-01-30 15:12         ` Ben Warren
  0 siblings, 1 reply; 6+ messages in thread
From: xiangguo_li at hotmail.com @ 2008-01-30 15:01 UTC (permalink / raw)
  To: u-boot

hello,

the I2C interface is on hostbridge(Tsi109).

thank you.

----- Original Message -----
From: "Ben Warren" <biggerbadderben@gmail.com>
To: <xiangguo_li@hotmail.com>
Cc: <u-boot-users@lists.sourceforge.net>
Sent: Wednesday, January 30, 2008 10:48 PM
Subject: Re: [U-Boot-Users] errors in using DS1337

> xiangguo_li at hotmail.com wrote:
>> hello,
>>
>> I am porting on a PowerPC (MPC7448) platform.
>>
> OK, what type of southbridge are you using (and ultimately which I2C 
> controller)?
> 
> regards,
> Ben
> 

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

* [U-Boot-Users] errors in using DS1337
  2008-01-30 15:01       ` xiangguo_li at hotmail.com
@ 2008-01-30 15:12         ` Ben Warren
  0 siblings, 0 replies; 6+ messages in thread
From: Ben Warren @ 2008-01-30 15:12 UTC (permalink / raw)
  To: u-boot

xiangguo_li at hotmail.com wrote:
> hello,
>
> the I2C interface is on hostbridge(Tsi109).
>
> thank you.
>
I assume you're using the tsi108 driver.  Please try applying the 
following untested patch:

diff --git a/drivers/i2c/tsi108_i2c.c b/drivers/i2c/tsi108_i2c.c
index d6736b0..d337c1f 100644
--- a/drivers/i2c/tsi108_i2c.c
+++ b/drivers/i2c/tsi108_i2c.c
@@ -279,5 +279,20 @@ int i2c_probe (uchar chip)
        return i2c_read (chip, 0, 1, (uchar *)&tmp, 1);
 }
 
+uchar i2c_reg_read(uchar i2c_addr, uchar reg)
+{
+       uchar buf;
+
+       i2c_read(i2c_addr, reg, 1, &buf, 1);
+
+       return buf;
+}
+
+void i2c_reg_write(uchar i2c_addr, uchar reg, uchar val)
+{
+       i2c_write(i2c_addr, reg, 1, &val, 1);
+}
+
+

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

end of thread, other threads:[~2008-01-30 15:12 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-01-30 12:18 [U-Boot-Users] errors in using DS1337 xiangguo_li at hotmail.com
2008-01-30 14:23 ` Ben Warren
2008-01-30 14:43   ` xiangguo_li at hotmail.com
2008-01-30 14:48     ` Ben Warren
2008-01-30 15:01       ` xiangguo_li at hotmail.com
2008-01-30 15:12         ` Ben Warren

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