i2c linux drivers

Seb James seb at peak.uklinux.net
Mon Jul 7 19:19:05 EST 2003


Hello all,

I'm trying to write an i2c driver to interface a ds1307 realtime clock
to linux. I'm having no luck getting linux to do anything at all on the
i2c bus.

System:
mpc823e on tqm823 module. ds1307 in a custom designed circuit. Linux
kernel 2.4.4 from Denx cvs, with label: LABEL_2003_05_01_1320

I've verified the i2c hardware as the bootloader u-boot (v 0.4.0) will
talk quite happily with the realtime clock.

In order to get some sort of traffic I decided to modify i2c-r360.c so
that it would do something (anything really would do) on the i2c bus.
Now, i2c-r360.c on its own doesn't do much and insmods and rmmods fine
on my target. If I apply this diff:

-----------------------------------------------------------------------------------------------------
[seb at mst26 i2c]$ diff -puN i2c-r360.c i2c-r360.c.new
--- i2c-r360.c  2003-07-07 09:57:30.000000000 +0100
+++ i2c-r360.c.new      2003-07-07 09:54:51.000000000 +0100
@@ -103,7 +103,7 @@ static struct i2c_adapter r360_ops = {
        r360_unreg,
 };

-#define I2C_PWM_ADDR        0x58    /* Power management coprocessor */
+#define I2C_PWM_ADDR        0x68    /* Not: Power management coprocessor */
 #define I2C_KBD_ADDR        0x50    /* Keyboard coprocessor */
 #define I2C_TERM_ADDR       0x49    /* Temperature Sensors */

@@ -217,6 +217,9 @@ int __init i2c_r360_init(void)
                return -ENODEV;
        }

+       /* ssj adds: */
+       r360_pwm_write(0,0);
+
        return 0;
 }
-----------------------------------------------------------------------------------------------------


....then I think it should be writing a 0 to register 0 of an i2c device
on the bus with address 0x68 when the module is initialized.

Unfortunately my system hangs as it waits for an interrupt that never
arrives.

I'm wondering if I have missed something in my kernel configuration? My
.config is attached.

Can anyone confirm that this is a reasonable change to make to
i2c-r360.c in order to get some traffic on the i2c bus to look at on my
'scope?

I'm getting rather fed up with i2c now....

regards,

Seb James.
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: i2c-r360.diff
Url: http://ozlabs.org/pipermail/linuxppc-embedded/attachments/20030707/d8194114/attachment.txt 
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: I2C_ENET.config
Url: http://ozlabs.org/pipermail/linuxppc-embedded/attachments/20030707/d8194114/attachment-0001.txt 


More information about the Linuxppc-embedded mailing list