Hi, Patrick, This web page seems to have some good info about using i2c from user space in linux...
https://xgoat.com/wp/2007/11/11/using-i2c-from-userspace-in-linux/ Dave On Jan 9, 2012, at 9:32 AM, Patrick Brandt wrote: > David George wrote: >> Hi Patrick. >> First up; are you using IIC driven from the PPC or the FPGA? > > We plan to use the IIc driven by the PPC. > >> If you plan on using the PPC, the easiest way to go about it initially >> would be to use the i2c commands in u-boot which are very user >> friendly: >> i2c probe #list all the device on the iic bus >> i2c md# read a register on a given device >> i2c mw# write a register on a given device >> Uboot will be very useful initially for debug/testing but you will >> need kernel support for the final app. You have two options here. >> Either write/use a kernel driver to export the IIC function to >> userspace e.g. a GPIO device or hw sensor exported to sysfs or use the >> i2c-dev driver to access the raw IIC device from userspace. I would >> probably go for i2c-dev. Have a look the kernel doc below: >> http://www.mjmwired.net/kernel/Documentation/i2c/dev-interface > > For anyone else who may be interested in doing this: > > Getting i2c-dev working was trivial. All that was needed was to create the > device file. > > $ mknod /dev/i2c-0 c 89 0 > > However, for some reason the SMBus commands described in David's link are > reserved for kernel space only in the /usr/include/linux/i2c.h file. I was > still able to use the standard read and write just fine. > > I was also able to easily add KATCP commands for reading and writing IIc > under the tcp borph server. > > Thanks, > --Patrick Brandt >