device tree nodes and platform drivers
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
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@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
On Thu, 18 May 2017 12:23:18 -0400, Max Ruttenberg said:
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.
So submit a patch to add the call. :)
On Thu, May 18, 2017 at 12:34 PM, <valdis.kletnieks@vt.edu> wrote:
On Thu, 18 May 2017 12:23:18 -0400, Max Ruttenberg said:
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.
So submit a patch to add the call. :)
That's a cool idea. Where would one add such a call? In an early_initcall? -- Max Ruttenberg, Member of the Technical Staff Emu Technology 270 W 39th St. #1302 New York, NY 10018
On Thu, 18 May 2017 12:38:01 -0400, Max Ruttenberg said:
On Thu, May 18, 2017 at 12:34 PM, <valdis.kletnieks@vt.edu> wrote:
On Thu, 18 May 2017 12:23:18 -0400, Max Ruttenberg said:
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.
So submit a patch to add the call. :)
That's a cool idea. Where would one add such a call? In an early_initcall?
Look at where other similar systems do it.
participants (2)
-
Max Ruttenberg -
valdis.kletnieks@vt.edu