[PATCH][RFC]Updated MPC I2C driver

Sylvain Munaut tnt at 246tnt.com
Fri Jul 2 08:32:32 EST 2004


Adrian Cox wrote:

>It seems that the MPC107 is happy with 8 bit accesses to the registers,
>so here's another version of the patch. This also changes the time
>calculations to use time_after().
>
>
The MPC5200 seems happy too ;) There is a eeprom on the board and it's
detected and I can access it. If I find a soldering iron, I'll hook up
another I2C device to test other devices.

Some gotchas though :

 - The FDR computation is completly different. Here is the code I
attached the code I used in my I2C driver. Basically, it takes as
argument the desired I2C clock rate ( was a module parameter ) and the
internal bus frequency and then compute the FDR.
 - During the scan, the first bus is scanned without devices and the
error when debug is active is I2C_MAL. From the moment the eeprom is
detected, the error code become I2C_NORXACK for the address wihout
device. Included dmesg

drivers/i2c/busses/i2c-mpc.c: Doing write 0 bytes to 0x57 - 1 of 1 messages
drivers/i2c/busses/i2c-mpc.c: I2C: MAL
i2c_adapter i2c-1: found normal i2c_range entry for adapter 1, addr 0050
i2c_adapter i2c-1: master_xfer: with 1 msgs.
drivers/i2c/busses/i2c-mpc.c: Doing write 0 bytes to 0x50 - 1 of 1 messages
i2c_adapter i2c-1: master_xfer: with 1 msgs.
drivers/i2c/busses/i2c-mpc.c: Doing write 0 bytes to 0x50 - 1 of 1 messages
i2c_adapter i2c-1: client [eeprom] registered to adapter
registering 1-0050
i2c_adapter i2c-1: found normal i2c_range entry for adapter 1, addr 0051
i2c_adapter i2c-1: master_xfer: with 1 msgs.
drivers/i2c/busses/i2c-mpc.c: Doing write 0 bytes to 0x51 - 1 of 1 messages
drivers/i2c/busses/i2c-mpc.c: I2C: No RXAK
i2c_adapter i2c-1: found normal i2c_range entry for adapter 1, addr 0052
i2c_adapter i2c-1: master_xfer: with 1 msgs.

 - The interrupt bit. BTW, on what event should the interrupt be fired ?
(I did my test without any interrupts )

>This still leaves the interrupt handling register of the MPC5200
>unsolved. I suggest introducing another flag for the MPC5200, and adding
>a small piece of extra setup code.
>
>
Yes, something like FS_I2C_IS_MPC52xx


Another remark : The register setup are done at every _start. Couldn't
they be done once for all during init ( just after the probe, call a
init_hardware functions ).



Sylvain Munaut
-------------- next part --------------
A non-text attachment was scrubbed...
Name: fdr_mpc5200.c
Type: text/x-csrc
Size: 864 bytes
Desc: not available
Url : http://ozlabs.org/pipermail/linuxppc-embedded/attachments/20040702/f5c933d0/attachment.c 


More information about the Linuxppc-embedded mailing list