Changes in the MPC8xx I2C driver

Kim Jørgensen KIJ at infocom.dk
Fri Jun 9 20:19:32 EST 2000


Hi,
I have made some changes in the MPC8xx I2C driver, mainly adding write
support and making the driver re-entrant. This might have some ones interest
so I'll post the driver here.

I don't use the minor number for the device address, instead I added an
ioctl function to allow set up of the device address, internal address
length and bus frequency. The setup data is saved in a struct, which is
accessed by the private pointer in the file pointer.
This allows several processes to talk to several i2c devices with different
bus frequency at the (almost) same time. I had a need for this, that's why I
made is that way.

I have removed all of the microcode relocation code in the driver, as I
couldn't make the driver work with this code and I had no need for applying
the patch.

I added these defines in commproc.h:
#define BD_SC_NAK       ((ushort)0x0004)        /* No Acknowledge */
#define BD_SC_UN        ((ushort)0x0002)        /* Underrun */
#define BD_SC_CL        ((ushort)0x0001)        /* Collision */

I made some clumsy code for converting offset to internal address, maybe
some one can tell me how to make this in a simpler way?

Any suggestions and comments are welcome.

--
Kim Jorgensen


-------------- next part --------------
A non-text attachment was scrubbed...
Name: iic.c
Type: application/octet-stream
Size: 13448 bytes
Desc: not available
Url : http://ozlabs.org/pipermail/linuxppc-embedded/attachments/20000609/7962b52b/attachment.obj 


More information about the Linuxppc-embedded mailing list