i2c child devices: binding to uio device driver

Thomas De Schampheleire patrickdepinguin+devicetree at gmail.com
Fri May 20 01:32:32 EST 2011


Hi,

I am using the uio framework (userspace i/o) to handle devices in
userspace. This includes memory access and interrupt handling.
For i2c devices, I'm using the i2c-dev interface, to talk to these
devices from userspace. This already works fine.

One of my i2c devices also has an interrupt line connected to the
processor. To be able to handle this interrupt with uio, I need to
have a kernel driver matched against the i2c device. However, the i2c
device described in the device tree does not bind with the driver. Is
this behavior supported, and if so, what am I doing wrong? Do I have
to create a dummy bus (non-i2c) and add a shadow node for the
interrupt?

My device tree nodes look like this:

        soc at fe000000 {
                i2c at 118100 {
                        #address-cells = <1>;
                        #size-cells = <0>;
                        cell-index = <1>;
                        compatible = "fsl-i2c";
                        reg = <0x118100 0x100>;
                        interrupts = <38 2 0 0>;
                        dfsrr;
                        mydevice at 68 {
                                compatible = "mymanufacturer,mydevice";
                                reg = <0x68>;
                                interrupts = <7 1 0 0>; /* External
IRQ7, active-low level */
                        };
                };

The device driver then has:

static const struct of_device_id mydevice_ids[] = {
        {
                .compatible = "mymanufacturer,mydevice"
        },
        {},
};
static struct of_platform_driver mydevice_driver = {
        .owner          = THIS_MODULE,
        .name           = "mydevice",
        .match_table    = mydevice_ids,
        .probe          = mydevice_probe,
        .remove         = __devexit_p(mydevice_remove),
};

static int __init mydevice_init(void)
{
        printk(KERN_INFO "mydevice: driver init\n");
        return of_register_platform_driver(&mydevice_driver);
}

Note that the init function is called correctly, but the probe
function is never called.

All this is on a p4080ds-based system, with linux 2.6.34.6.

Best regards,
Thomas


More information about the devicetree-discuss mailing list