On Tue, Jan 24, 2017 at 08:19:50PM +0000, Chris Brandt wrote: > Hi Daniel, > > On Tuesday, January 24, 2017, Daniel Lezcano wrote: > > > > > +early_platform_init("earlytimer", &ostm_timer); > > > > > +subsys_initcall(ostm_init); module_exit(ostm_exit); > > > > > + > > > > > +MODULE_AUTHOR("Chris Brandt"); > > > > > +MODULE_DESCRIPTION("Renesas OSTM Timer Driver"); > > > > > +MODULE_LICENSE("GPL v2"); > > > > > > > > Maybe you can try with builtin_platform ? > > > > > > Good idea. But, now I get a "Section mismatch" during link time so > > > I'll have to figure out why that is. > > > > Mmh, I think it would be more consistent to convert this to: > > > > CLOCKSOURCE_OF_DECLARE(ostm, "renesas,ostm", ostm_init); > > > > The only problem is to get the struct device associated to the of_node > > passed as parameter to ostm_init in order to use the devm_* API. > > > > I think of_find_device_by_node should return the platform_device, then > > pdev->dev. If that works the other drivers will benefit from that to > > pdev->remove all > > the rollback code everywhere. > > > It was a good idea....but it will not work. > > While CLOCKSOURCE_OF_DECLARE is good at putting the driver at the > front of the line for loading, it's too early in boot to detect > a platform_device. > > of_find_device_by_node calls bus_find_device. But the first thing that > bus_find_device does is: > > if (!bus || !bus->p) > return NULL; > > But bus->p=0 so it returns immediately. > > > Of course changing the code over to: > devm_kzalloc -> devm_kzalloc > devm_ioremap_nocache -> of_io_request_and_map > platform_get_irq -> irq_of_parse_and_map > dev_err -> pr_err > > > Then things work, but I'm back to managing the rollback code manually. > > > Any other ideas on how to get the corresponding platform_device for > a DT node? No :/ So up to you. - CLOCKSOURCE_OF_DECLARE consistent but need rollback or - platform_device but with another timer available at early time -- <http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs Follow Linaro: <http://www.facebook.com/pages/Linaro> Facebook | <http://twitter.com/#!/linaroorg> Twitter | <http://www.linaro.org/linaro-blog/> Blog -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html