device tree nodes and platform drivers

Max Ruttenberg mruttenberg at emutechnology.com
Thu May 18 12:23:18 EDT 2017


Hi all,

I figured it out... the system I am working with never makes a call to
of_platform_populate(NULL, NULL, NULL, NULL) and instead ops for
subsystems manually probing the device tree. Live and learn.

Thanks,
Max

On Wed, May 17, 2017 at 7:01 PM, Max Ruttenberg
<mruttenberg at emutechnology.com> wrote:
> Hi all,
>
> I'm trying to write a platform driver for a device node that I have
> defined inside of a device tree.
>
> The node looks like this:
>
> my-node0 {
>       compatible = "my,id";
>       dcok-gpios = <&gpio1 6 0>;
> };
>
> In my kernel module I have something like this:
>
> const static struct of_device_id my_ids [] = {
>             { .compatible = "my,id" },
>             { /* sentinal */ }
> };
>
> struct platform_driver my_drv = {
>             .driver = {
>                         .name = "my-node",
>                         .owner = THIS_MODULE,
>                         .of_match_table = my_ids,
>             };
>             .probe = my_probe_func,
>             .remove = my_remove_func,
> };
>
> static int __init my_init(void)
> {
>             /* some extra stuff */
>             return platform_driver_register(&my_drv);
> }
>
> module_init(my_init);
>
> And yet... the driver for my probe function is never called! I've
> looked in /proc for device tree node, and I can see it there.
> Furthermore, just to be sure, I call
>
> of_find_compatbile_node(NULL,NULL,"my,id")
>
> and it returns my device node. I'm tempted to just extract what I need
> from it (i.e. those gpio descriptors) in my init function and skip the
> platform driver stuff. Can anyone help me understand what I might be
> missing?
>
> Thank you,
> Max



-- 
Max Ruttenberg,
Member of the Technical Staff
Emu Technology
270 W 39th St. #1302
New York, NY 10018



More information about the Kernelnewbies mailing list