problem opening I2C device on MPC8260

Vijay Padiyar vijay_padiyar at hotmail.com
Sat Mar 12 18:57:26 EST 2005


Hi there

I am running Linux-2.6.10 with BusyBox 1.0 on an MPC8260-based target. I'm
having problems opening the I2C controller device on the MPC8260.

I have now included I2C support in the kernel by setting the following
options:

CONFIG_I2C=y
CONFIG_I2C_CHARDEV=y

CONFIG_I2C_ALGOBIT=y

None of the options under "I2C Hardware Bus support" and "Hardware Sensor
Chip support" are set. Do I need to enable any of these for MPC8260?

I have also mounted the Sysfs filesystem using 'mount -t sysfs sysfs /sys'.
When the kernel boots up, I can see the following message:

"i2c /dev entries driver"

which is from the I2C module initialization function i2c_dev_init() in
i2c-dev.c. This means that the I2C module has been loaded and initialized
correctly. However, the /sys/class/i2c-dev folder is found to be *empty*.

I have also created the following I2C device files in my /dev folder:

mknod i2c-0 c 89 0
mknod i2c0 c 89 0
mknod i2c-1 c 89 1
mknod i2c1 c 89 1

When I try to open the I2C device from a user program in root mode, I get an
error and the value of errno is ENODEV.

if ((fd = open("/dev/i2c-0", O_RDWR)) < 0)
{
    printf ("Error: ");

    if (errno == ENODEV)
        printf ("No such device!\n");
}

Please tell me what I could be doing wrong? Is there anything I've missed in
setting up my configuration to use I2C? Is there anything more I need to do?

Regards

Vijay Padiyar

http://www.vijaypadiyar.eu.tf



More information about the Linuxppc-embedded mailing list