[U-Boot-Users] errors in using DS1337

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

Hi lxg,
xiangguo_li@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

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

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@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

xiangguo_li@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); +} + +
participants (2)
-
Ben Warren
-
xiangguo_li@hotmail.com