
Thanks for the help Wolfgang,
Wolfgang Denk wrote:
Dear Seb,
in message 3F002BCA.9070609@peak.uklinux.net you wrote:
I'm working on getting a ds1307 realtime clock working with a tqm823l as a new user to u-boot (I've never compiled u-boot or ppcboot before).
This is not correct. You compiled and installed PPCBoot in our training a year and a couple of days ago :-)
That's true. Ok, not for a while though...
Firstly, the ds1307 code compiles fine, but of course it needs the i2c code to be compiled alongside it. Although this is obvious, the newcomer to u-boot doesn't (i.e. I didn't) know that calling for ds1307.c to be compiled doesn't in itself cause the i2c code to be compiled, so a note to this effect in the realtime clock section of the README would be a helpful addition.
Please feel free to submit a patch...
Yes, I'll do that when I'm sure I think there needs to be one and what it should be :)
Here's a line from the README (starting at line 907):
"If this is selected, either CONFIG_HARD_I2C or CONFIG_SOFT_I2C must be defined to include the appropriate I2C driver."
No mention is made of what values the 'appropriate driver' might have or where to look for them. I assume you might define something like this:
#define CONFIG_HARD_I2C mpc8xx
No. Just "#define CONFIG_HARD_I2C" is OK, as for each CPU there is always exactly one hard-i2c and one soft-i2c driver.
But I can't see what you'd write for CONFIG_SOFT_I2C. A bit more clarification here would be useful.
Just: #define CONFIG_SOFT_I2C
It must be defined - that's all :-)
Ok, well I've successfully compiled with CONFIG_HARD_I2C and have communicated with my clock, so that is good. Next up is transferring the date in u-boot to linux, but I'm sure that will be documented somewhere.
As for CONFIG_SOFT_I2C; Attached (really this time) is a diff between the original u-boot-0.4.0/include/configs/TQM823L.h and the one that I have altered. The compile of soft_i2c.c fails with the following error messages:
ppc_8xx-gcc -g -Os -mrelocatable -ffixed-r14 -meabi -D__KERNEL__ -DTEXT_BASE=0x40000000 -I/eldk/ppc_8xx/usr/src/u-boot-0.4.0/include -fno-builtin -nostdinc -isystem /eldk/usr/lib/gcc-lib/ppc-linux/2.95.4/include -pipe -DCONFIG_PPC -D__powerpc__ -DCONFIG_8xx -ffixed-r2 -ffixed-r29 -mstring -mcpu=860 -msoft-float -Wall -Wstrict-prototypes -c -o soft_i2c.o soft_i2c.c soft_i2c.c: In function `send_reset': soft_i2c.c:86: warning: implicit declaration of function `I2C_SCL' soft_i2c.c:87: warning: implicit declaration of function `I2C_SDA' soft_i2c.c:91: `I2C_TRISTATE' undeclared (first use in this function) soft_i2c.c:91: (Each undeclared identifier is reported only once soft_i2c.c:91: for each function it appears in.) soft_i2c.c:94: `I2C_DELAY' undeclared (first use in this function) soft_i2c.c:82: warning: unused variable `immr' soft_i2c.c: In function `send_start': soft_i2c.c:116: `I2C_DELAY' undeclared (first use in this function) soft_i2c.c:118: `I2C_ACTIVE' undeclared (first use in this function) soft_i2c.c:113: warning: unused variable `immr' soft_i2c.c: In function `send_stop': soft_i2c.c:139: `I2C_DELAY' undeclared (first use in this function) soft_i2c.c:141: `I2C_ACTIVE' undeclared (first use in this function) soft_i2c.c:147: `I2C_TRISTATE' undeclared (first use in this function) soft_i2c.c:135: warning: unused variable `immr' soft_i2c.c: In function `send_ack': soft_i2c.c:163: `I2C_ACTIVE' undeclared (first use in this function) soft_i2c.c:165: `I2C_DELAY' undeclared (first use in this function) soft_i2c.c:160: warning: unused variable `immr' soft_i2c.c: In function `write_byte': soft_i2c.c:193: `I2C_ACTIVE' undeclared (first use in this function) soft_i2c.c:196: `I2C_DELAY' undeclared (first use in this function) soft_i2c.c:212: `I2C_TRISTATE' undeclared (first use in this function) soft_i2c.c:217: `I2C_READ' undeclared (first use in this function) soft_i2c.c:188: warning: unused variable `immr' soft_i2c.c:191: warning: `nack' might be used uninitialized in this function soft_i2c.c: In function `read_byte': soft_i2c.c:244: `I2C_TRISTATE' undeclared (first use in this function) soft_i2c.c:248: `I2C_DELAY' undeclared (first use in this function) soft_i2c.c:252: `I2C_READ' undeclared (first use in this function) soft_i2c.c:236: warning: unused variable `immr' make[1]: *** [soft_i2c.o] Error 1 make[1]: Leaving directory `/eldk/ppc_8xx/usr/src/u-boot-0.4.0/common' make: *** [subdirs] Error 1 [seb@mst26 u-boot-0.4.0]$
50c50 < #define CONFIG_BOOTDELAY 5 /* autoboot after 5 seconds */ ---
#define CONFIG_BOOTDELAY 1 /* autoboot after 1 second */
73,74c73,74 < "rootpath=/opt/eldk/ppc_8xx\0" \ < "bootfile=/tftpboot/TQM860L/uImage\0" \ ---
"rootpath=/eldk/ppc_8xx\0" \ "bootfile=/tftpboot/pImage\0" \
98c98,112 < #define CONFIG_RTC_MPC8xx /* use internal RTC of MPC8xx */ ---
#define CONFIG_RTC_DS1307 /* Use ds1307 as realtime clock */
#define CONFIG_SOFT_I2C /* Include I2C functionality */ //#define CONFIG_HARD_I2C
#define CFG_I2C_SPEED 100000 /* I want to run at 100 kHz */ #define CFG_I2C_SLAVE 0 /* My mpc8xx should be the i2c master */
//#define I2C_TRISTATE NULL /* mpc8xx has open drain output */ //#define I2C_ACTIVE NULL /* mpc8xx has open drain output */ //#define I2C_READ some_macro /* if you want this function defined */ //#define I2C_SDA some_macro /* if you want this function defined */ //#define I2C_SCL some_macro /* if you want this function defined */ //#define I2C_DELAY 0.0000025 /* I want 100 kHz, so this is the // delay in seconds that I think is required */
103a118
CFG_CMD_I2C | \