BBB DT approach

I have successfully implemented a GPIO based driver for my custom protocol using the platform model. I want to update it using a device tree approach. So for starters I have beaglebone black and I cross-compiled the kernel using the device tree configuration enabled and checked during the uboot console messages showing

Checksum check ... OK

Solid tree of device tree at 80f80000

Boot using fdt blob at 0x80f80000

XIP Core Image ... OK

OK

Using device tree in place at 80f80000, end 80f899de

I added my entry to the common node my_gpio {compatible = "my_gpio"}

Then I create a normal process making uImages dtbs LOADADDR ....

Finally, I am getting uImage with dtb. In my driver, I used the same string "my_gpio" as the .name property.

but my probing method is not called, and AFAIK it is because it does not find compatible devices.

Any hints will help you.

In my driver:

static struct platform_driver d_driver = {
        .driver = {
                        .name = "d_gpio",
                        .of_match_table = d_of_match,
        },
        .probe = D_probe,
        .remove = D_remove
};
      

Run codeHide result


thank

+3


source to share


2 answers


You need to prepare the type structure struct of_device_id

and use the property for that compatible

. Try the following:

static struct of_device_id my_devs[] = {
    { .compatible = "my_gpio" }, /* This should be the name given in the device tree */
    { }
};
MODULE_DEVICE_TABLE(of, my_devs);

      



Now we create a structure platform_driver

and pass the above table into it:

static struct platform_driver my_plat_driver = {
    .probe = my_probe,
    .remove = my_remove,
    .driver = {
        .name = "my_gpio_driver",    /* This name is for sysfs, not for matching */
        .of_match_table = my_devs    /* This turns out as the matching logic */   
    }
};

      

0


source


Maybe your support in the council doesn't understand this protocol, so it takes a node to insert the place where the platform code actually handles it. Please go to the discussion and add "virtual devices" node to dtb, hope it helps.



http://web.archiveorange.com/archive/v/9IQA2s6aeZUFXdm6P87Z

0


source







All Articles