* [BUG] omap: mfd/regulator: twl/core: init order @ 2013-04-13 18:27 Christoph Fritz 2013-04-15 10:20 ` Grygorii Strashko 0 siblings, 1 reply; 8+ messages in thread From: Christoph Fritz @ 2013-04-13 18:27 UTC (permalink / raw) To: Tony Lindgren, Javier Martinez Canillas, Liam Girdwood, Benoît Cousson, Tomi Valkeinen, Alessandro Zummo, Peter Ujfalusi, Samuel Ortiz Cc: linux-omap@vger.kernel.org, devicetree-discuss, Daniel Mack, Hans J. Koch Hi while testing an omap3 board with device tree support I stumbled upon a bug which is due to wrong initialization order of twl-core and twl-regulator (I suppose): In the boot process they get loaded way too late so that a lot of drivers before where configured wrong or just refuse to load. For example the real time clock driver: The RTC kicks in way before twl_probe() and due to that it configures its register map wrong (at this time twl_priv->twl_id isn't configured yet). Another example is the omap display subsystem. It (DSS) fails loading while trying to register some not yet existent regulators and because it lacks EPROBE_DEFER. USB and MMC is also not working and I'm suspicious of the same cause. Any ideas? Thanks -- Christoph ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [BUG] omap: mfd/regulator: twl/core: init order 2013-04-13 18:27 [BUG] omap: mfd/regulator: twl/core: init order Christoph Fritz @ 2013-04-15 10:20 ` Grygorii Strashko 2013-04-15 10:56 ` Christoph Fritz 0 siblings, 1 reply; 8+ messages in thread From: Grygorii Strashko @ 2013-04-15 10:20 UTC (permalink / raw) To: Christoph Fritz Cc: Tony Lindgren, Javier Martinez Canillas, Liam Girdwood, Benoît Cousson, Tomi Valkeinen, Alessandro Zummo, Peter Ujfalusi, Samuel Ortiz, linux-omap@vger.kernel.org, devicetree-discuss, Daniel Mack, Hans J. Koch On 04/13/2013 09:27 PM, Christoph Fritz wrote: > Hi > > while testing an omap3 board with device tree support I stumbled upon a > bug which is due to wrong initialization order of twl-core and > twl-regulator (I suppose): In the boot process they get loaded way too > late so that a lot of drivers before where configured wrong or just > refuse to load. > > For example the real time clock driver: The RTC kicks in way before > twl_probe() and due to that it configures its register map wrong > (at this time twl_priv->twl_id isn't configured yet). > > Another example is the omap display subsystem. It (DSS) fails loading > while trying to register some not yet existent regulators and because it > lacks EPROBE_DEFER. > > USB and MMC is also not working and I'm suspicious of the same cause. > > Any ideas? Hi Christoph, It happens, because I2C probes execution have been deferred due to "pinctrl-single" driver (, which is not ready at i2c bus initialization time: [ 0.525939] omap_i2c 48070000.i2c: could not find pctldev for node /ocp/pinmux@4a100040/pinmux_i2c1_pins, deferring probe [ 0.526000] platform 48070000.i2c: Driver omap_i2c requests probe deferral [ 0.526062] omap_i2c 48072000.i2c: could not find pctldev for node /ocp/pinmux@4a100040/pinmux_i2c2_pins, deferring probe [ 0.526092] platform 48072000.i2c: Driver omap_i2c requests probe deferral [ 0.526153] omap_i2c 48060000.i2c: could not find pctldev for node /ocp/pinmux@4a100040/pinmux_i2c3_pins, deferring probe [ 0.526184] platform 48060000.i2c: Driver omap_i2c requests probe deferral [ 0.526245] omap_i2c 48350000.i2c: could not find pctldev for node /ocp/pinmux@4a100040/pinmux_i2c4_pins, deferring probe [ 0.526275] platform 48350000.i2c: Driver omap_i2c requests probe deferral I think following change should fix it, could you try it, pls: diff --git a/drivers/pinctrl/pinctrl-single.c b/drivers/pinctrl/pinctrl-single.c index 5c32e88..b2a9d4b 100644 --- a/drivers/pinctrl/pinctrl-single.c +++ b/drivers/pinctrl/pinctrl-single.c @@ -1014,7 +1014,18 @@ static struct platform_driver pcs_driver = { }, }; -module_platform_driver(pcs_driver); +static int __init pcs_driver_drv_init(void) +{ + return platform_driver_register(&pcs_driver); +} +postcore_initcall(pcs_driver_drv_init); + +static void __exit pcs_driver_drv_exit(void) +{ + platform_driver_unregister(&pcs_driver); +} +module_exit(pcs_driver_drv_exit); + MODULE_AUTHOR("Tony Lindgren <tony@atomide.com>"); MODULE_DESCRIPTION("One-register-per-pin type device tree based pinctrl driver"); > Thanks > -- Christoph > > -- > To unsubscribe from this list: send the line "unsubscribe linux-omap" in > the body of a message to majordomo@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html ^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [BUG] omap: mfd/regulator: twl/core: init order 2013-04-15 10:20 ` Grygorii Strashko @ 2013-04-15 10:56 ` Christoph Fritz 2013-04-15 10:59 ` Grygorii Strashko 0 siblings, 1 reply; 8+ messages in thread From: Christoph Fritz @ 2013-04-15 10:56 UTC (permalink / raw) To: Grygorii Strashko Cc: Tony Lindgren, Javier Martinez Canillas, Liam Girdwood, Benoît Cousson, Tomi Valkeinen, Alessandro Zummo, Peter Ujfalusi, Samuel Ortiz, linux-omap@vger.kernel.org, devicetree-discuss, Daniel Mack, Hans J. Koch On Mon, 2013-04-15 at 13:20 +0300, Grygorii Strashko wrote: > On 04/13/2013 09:27 PM, Christoph Fritz wrote: > > Hi > > > > while testing an omap3 board with device tree support I stumbled upon a > > bug which is due to wrong initialization order of twl-core and > > twl-regulator (I suppose): In the boot process they get loaded way too > > late so that a lot of drivers before where configured wrong or just > > refuse to load. > > > > For example the real time clock driver: The RTC kicks in way before > > twl_probe() and due to that it configures its register map wrong > > (at this time twl_priv->twl_id isn't configured yet). > > > > Another example is the omap display subsystem. It (DSS) fails loading > > while trying to register some not yet existent regulators and because it > > lacks EPROBE_DEFER. > > > > USB and MMC is also not working and I'm suspicious of the same cause. > > > > Any ideas? > Hi Christoph, > > It happens, because I2C probes execution have been deferred due to > "pinctrl-single" driver (, which is not ready at i2c bus initialization > time: > > [ 0.525939] omap_i2c 48070000.i2c: could not find pctldev for node > /ocp/pinmux@4a100040/pinmux_i2c1_pins, deferring probe > [ 0.526000] platform 48070000.i2c: Driver omap_i2c requests probe > deferral > [ 0.526062] omap_i2c 48072000.i2c: could not find pctldev for node > /ocp/pinmux@4a100040/pinmux_i2c2_pins, deferring probe > [ 0.526092] platform 48072000.i2c: Driver omap_i2c requests probe > deferral > [ 0.526153] omap_i2c 48060000.i2c: could not find pctldev for node > /ocp/pinmux@4a100040/pinmux_i2c3_pins, deferring probe > [ 0.526184] platform 48060000.i2c: Driver omap_i2c requests probe > deferral > [ 0.526245] omap_i2c 48350000.i2c: could not find pctldev for node > /ocp/pinmux@4a100040/pinmux_i2c4_pins, deferring probe > [ 0.526275] platform 48350000.i2c: Driver omap_i2c requests probe > deferral > > I think following change should fix it, could you try it, pls: > diff --git a/drivers/pinctrl/pinctrl-single.c > b/drivers/pinctrl/pinctrl-single.c > index 5c32e88..b2a9d4b 100644 > --- a/drivers/pinctrl/pinctrl-single.c > +++ b/drivers/pinctrl/pinctrl-single.c > @@ -1014,7 +1014,18 @@ static struct platform_driver pcs_driver = { > }, > }; > > -module_platform_driver(pcs_driver); > +static int __init pcs_driver_drv_init(void) > +{ > + return platform_driver_register(&pcs_driver); > +} > +postcore_initcall(pcs_driver_drv_init); > + > +static void __exit pcs_driver_drv_exit(void) > +{ > + platform_driver_unregister(&pcs_driver); > +} > +module_exit(pcs_driver_drv_exit); > + Hi Grygorii, thanks - indeed it does fix the problem. I checked at least the rtc which is now configured right and working :-) Do you consider the patch above as a hack or will it go mainline? Thanks -- Christoph ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [BUG] omap: mfd/regulator: twl/core: init order 2013-04-15 10:56 ` Christoph Fritz @ 2013-04-15 10:59 ` Grygorii Strashko 2013-04-15 16:25 ` Tony Lindgren 0 siblings, 1 reply; 8+ messages in thread From: Grygorii Strashko @ 2013-04-15 10:59 UTC (permalink / raw) To: Christoph Fritz Cc: Tony Lindgren, Javier Martinez Canillas, Liam Girdwood, Benoît Cousson, Tomi Valkeinen, Alessandro Zummo, Peter Ujfalusi, Samuel Ortiz, linux-omap@vger.kernel.org, devicetree-discuss, Daniel Mack, Hans J. Koch On 04/15/2013 01:56 PM, Christoph Fritz wrote: > On Mon, 2013-04-15 at 13:20 +0300, Grygorii Strashko wrote: >> On 04/13/2013 09:27 PM, Christoph Fritz wrote: >>> Hi >>> >>> while testing an omap3 board with device tree support I stumbled upon a >>> bug which is due to wrong initialization order of twl-core and >>> twl-regulator (I suppose): In the boot process they get loaded way too >>> late so that a lot of drivers before where configured wrong or just >>> refuse to load. >>> >>> For example the real time clock driver: The RTC kicks in way before >>> twl_probe() and due to that it configures its register map wrong >>> (at this time twl_priv->twl_id isn't configured yet). >>> >>> Another example is the omap display subsystem. It (DSS) fails loading >>> while trying to register some not yet existent regulators and because it >>> lacks EPROBE_DEFER. >>> >>> USB and MMC is also not working and I'm suspicious of the same cause. >>> >>> Any ideas? >> Hi Christoph, >> >> It happens, because I2C probes execution have been deferred due to >> "pinctrl-single" driver (, which is not ready at i2c bus initialization >> time: >> >> [ 0.525939] omap_i2c 48070000.i2c: could not find pctldev for node >> /ocp/pinmux@4a100040/pinmux_i2c1_pins, deferring probe >> [ 0.526000] platform 48070000.i2c: Driver omap_i2c requests probe >> deferral >> [ 0.526062] omap_i2c 48072000.i2c: could not find pctldev for node >> /ocp/pinmux@4a100040/pinmux_i2c2_pins, deferring probe >> [ 0.526092] platform 48072000.i2c: Driver omap_i2c requests probe >> deferral >> [ 0.526153] omap_i2c 48060000.i2c: could not find pctldev for node >> /ocp/pinmux@4a100040/pinmux_i2c3_pins, deferring probe >> [ 0.526184] platform 48060000.i2c: Driver omap_i2c requests probe >> deferral >> [ 0.526245] omap_i2c 48350000.i2c: could not find pctldev for node >> /ocp/pinmux@4a100040/pinmux_i2c4_pins, deferring probe >> [ 0.526275] platform 48350000.i2c: Driver omap_i2c requests probe >> deferral >> >> I think following change should fix it, could you try it, pls: >> diff --git a/drivers/pinctrl/pinctrl-single.c >> b/drivers/pinctrl/pinctrl-single.c >> index 5c32e88..b2a9d4b 100644 >> --- a/drivers/pinctrl/pinctrl-single.c >> +++ b/drivers/pinctrl/pinctrl-single.c >> @@ -1014,7 +1014,18 @@ static struct platform_driver pcs_driver = { >> }, >> }; >> >> -module_platform_driver(pcs_driver); >> +static int __init pcs_driver_drv_init(void) >> +{ >> + return platform_driver_register(&pcs_driver); >> +} >> +postcore_initcall(pcs_driver_drv_init); >> + >> +static void __exit pcs_driver_drv_exit(void) >> +{ >> + platform_driver_unregister(&pcs_driver); >> +} >> +module_exit(pcs_driver_drv_exit); >> + > Hi Grygorii, > thanks - indeed it does fix the problem. I checked at least the rtc > which is now configured right and working :-) > > Do you consider the patch above as a hack or will it go mainline? I think, need more opinions on this from community ) I'm just trying to solve my problem and found similar issue. > > Thanks > -- Christoph > > > ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [BUG] omap: mfd/regulator: twl/core: init order 2013-04-15 10:59 ` Grygorii Strashko @ 2013-04-15 16:25 ` Tony Lindgren [not found] ` <20130415162541.GO10155-4v6yS6AI5VpBDgjK7y7TUQ@public.gmane.org> 0 siblings, 1 reply; 8+ messages in thread From: Tony Lindgren @ 2013-04-15 16:25 UTC (permalink / raw) To: Grygorii Strashko Cc: Christoph Fritz, Javier Martinez Canillas, Liam Girdwood, Benoît Cousson, Tomi Valkeinen, Alessandro Zummo, Peter Ujfalusi, Samuel Ortiz, linux-omap@vger.kernel.org, devicetree-discuss, Daniel Mack, Hans J. Koch * Grygorii Strashko <grygorii.strashko@ti.com> [130415 04:05]: > On 04/15/2013 01:56 PM, Christoph Fritz wrote: > >On Mon, 2013-04-15 at 13:20 +0300, Grygorii Strashko wrote: > >>--- a/drivers/pinctrl/pinctrl-single.c > >>+++ b/drivers/pinctrl/pinctrl-single.c > >>@@ -1014,7 +1014,18 @@ static struct platform_driver pcs_driver = { > >> }, > >> }; > >> > >>-module_platform_driver(pcs_driver); > >>+static int __init pcs_driver_drv_init(void) > >>+{ > >>+ return platform_driver_register(&pcs_driver); > >>+} > >>+postcore_initcall(pcs_driver_drv_init); > >>+ > >>+static void __exit pcs_driver_drv_exit(void) > >>+{ > >>+ platform_driver_unregister(&pcs_driver); > >>+} > >>+module_exit(pcs_driver_drv_exit); > >>+ > >Hi Grygorii, > > thanks - indeed it does fix the problem. I checked at least the rtc > >which is now configured right and working :-) > > > >Do you consider the patch above as a hack or will it go mainline? > I think, need more opinions on this from community ) > I'm just trying to solve my problem and found similar issue. This fix should not be needed. It just means the real problem is somewhere else. Pinctrl is already before the i2c in drivers/Makefile. Maybe one of the MFD drivers has a wrong initcall level? Regards, Tony ^ permalink raw reply [flat|nested] 8+ messages in thread
[parent not found: <20130415162541.GO10155-4v6yS6AI5VpBDgjK7y7TUQ@public.gmane.org>]
* Re: [BUG] omap: mfd/regulator: twl/core: init order [not found] ` <20130415162541.GO10155-4v6yS6AI5VpBDgjK7y7TUQ@public.gmane.org> @ 2013-04-16 7:45 ` Peter Ujfalusi 2013-04-16 8:33 ` Grygorii Strashko 0 siblings, 1 reply; 8+ messages in thread From: Peter Ujfalusi @ 2013-04-16 7:45 UTC (permalink / raw) To: Tony Lindgren Cc: Alessandro Zummo, Grygorii Strashko, Javier Martinez Canillas, devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ, Hans J. Koch, Tomi Valkeinen, linux-omap-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, Daniel Mack, Samuel Ortiz On 04/15/2013 06:25 PM, Tony Lindgren wrote: > This fix should not be needed. It just means the real > problem is somewhere else. Pinctrl is already before the i2c > in drivers/Makefile. Maybe one of the MFD drivers has > a wrong initcall level? FYI; I just sent a patch which I believe is the correct way to fix this issue. -- Péter ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [BUG] omap: mfd/regulator: twl/core: init order 2013-04-16 7:45 ` Peter Ujfalusi @ 2013-04-16 8:33 ` Grygorii Strashko 2013-04-16 17:54 ` Tony Lindgren 0 siblings, 1 reply; 8+ messages in thread From: Grygorii Strashko @ 2013-04-16 8:33 UTC (permalink / raw) To: Peter Ujfalusi Cc: Tony Lindgren, Christoph Fritz, Javier Martinez Canillas, Benoît Cousson, Tomi Valkeinen, Alessandro Zummo, Samuel Ortiz, linux-omap@vger.kernel.org, devicetree-discuss, Daniel Mack, Hans J. Koch On 04/16/2013 10:45 AM, Peter Ujfalusi wrote: > On 04/15/2013 06:25 PM, Tony Lindgren wrote: >> This fix should not be needed. It just means the real >> problem is somewhere else. Pinctrl is already before the i2c >> in drivers/Makefile. Maybe one of the MFD drivers has >> a wrong initcall level? > FYI; I just sent a patch which I believe is the correct way to fix this issue. > Hi Tony, Peter OMAP i2c/pin-control initialization isn't controlled by Makefiles now (: - i2c initialized at subsys_initcall(omap_i2c_init_driver); - pinctrl-single at module_platform_driver(pcs_driver) => module_init => device_initcall (if built-in) And pls, pay attention on overall BUG description - twl-regulators initialization has been delayed as result all Regulators consumers (drivers which use regulators) will need to defer it's probe correctly too. For now it isn't true for many drivers and, for example, omap_hsmmc driver's probe will just fail if it can't get regulator. (+ problems with DSS - most probably Panel/DSI driver probe can't handle pin configuration) Before, on early kernel versions, the OMAP pinmux was ready to work at arch_initcall time and most of the code has been created with this assumption. Unfortunately, RTC is just a small part of problem. -grygorii ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [BUG] omap: mfd/regulator: twl/core: init order 2013-04-16 8:33 ` Grygorii Strashko @ 2013-04-16 17:54 ` Tony Lindgren 0 siblings, 0 replies; 8+ messages in thread From: Tony Lindgren @ 2013-04-16 17:54 UTC (permalink / raw) To: Grygorii Strashko Cc: Peter Ujfalusi, Christoph Fritz, Javier Martinez Canillas, Benoît Cousson, Tomi Valkeinen, Alessandro Zummo, Samuel Ortiz, linux-omap@vger.kernel.org, devicetree-discuss, Daniel Mack, Hans J. Koch * Grygorii Strashko <grygorii.strashko@ti.com> [130416 01:39]: > On 04/16/2013 10:45 AM, Peter Ujfalusi wrote: > >On 04/15/2013 06:25 PM, Tony Lindgren wrote: > >>This fix should not be needed. It just means the real > >>problem is somewhere else. Pinctrl is already before the i2c > >>in drivers/Makefile. Maybe one of the MFD drivers has > >>a wrong initcall level? > >FYI; I just sent a patch which I believe is the correct way to fix this issue. > > > Hi Tony, Peter > > OMAP i2c/pin-control initialization isn't controlled by Makefiles now (: > - i2c initialized at subsys_initcall(omap_i2c_init_driver); AFAIK there should be no reason to have this as subsys_initcall any longer. It should be just regular module init. > - pinctrl-single at module_platform_driver(pcs_driver) => > module_init => device_initcall (if built-in) Yes but still, the deferred probe should handle this case too, I wonder why we're not seeing this issue on omap4 for example? > And pls, pay attention on overall BUG description - twl-regulators > initialization has been delayed as result all Regulators consumers > (drivers which use regulators) will need to defer it's probe correctly too. > For now it isn't true for many drivers and, for example, > omap_hsmmc driver's probe will just fail if it can't get regulator. > (+ problems with DSS - most probably Panel/DSI driver probe can't > handle pin configuration) Sounds like there are a few places to fix. Got something available for these? > Before, on early kernel versions, the OMAP pinmux was ready to work > at arch_initcall time > and most of the code has been created with this assumption. Yes. In general we've been moving to initializing things later on rather than earlier so we have a real console available for error messages instead of earlyprintk if something goes wrong. BTW, the legacy omap pinmux code will be going away as soon as we have moved platforms to use DT only booting. I think we can make omap4 DT only after v3.10, omap3 later on. > Unfortunately, RTC is just a small part of problem. Can you try just setting the related drivers to be regular module initcalls and see if that solves the problem? Regards, Tony ^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2013-04-16 17:54 UTC | newest] Thread overview: 8+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2013-04-13 18:27 [BUG] omap: mfd/regulator: twl/core: init order Christoph Fritz 2013-04-15 10:20 ` Grygorii Strashko 2013-04-15 10:56 ` Christoph Fritz 2013-04-15 10:59 ` Grygorii Strashko 2013-04-15 16:25 ` Tony Lindgren [not found] ` <20130415162541.GO10155-4v6yS6AI5VpBDgjK7y7TUQ@public.gmane.org> 2013-04-16 7:45 ` Peter Ujfalusi 2013-04-16 8:33 ` Grygorii Strashko 2013-04-16 17:54 ` Tony Lindgren
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).