* [PATCH] gpio: pxa: change initcall level second attempt
@ 2015-11-13 20:22 Robert Jarzmik
2015-11-17 13:56 ` Linus Walleij
0 siblings, 1 reply; 3+ messages in thread
From: Robert Jarzmik @ 2015-11-13 20:22 UTC (permalink / raw)
To: Linus Walleij, Alexandre Courbot; +Cc: linux-gpio, linux-kernel, Robert Jarzmik
This patch is a second attempt at what was previously in commit
6c7e660a27da ("gpio: pxa: set initcall level to module init").
The goal is the same : enable gpio & pinctrl driver to work
together. As pinctrl driver will be initialized at device level, the
gpio should be as well, so that the deferring mechanism is honored.
Yet this patch should also respect the legacy platforms, so the set of
constraints is :
- in legacy platforms (ie. non dt), gpio_[gs]et_*() should be available
for machine code => core initcall
- in new platforms (ie. dt based), pinctrl will be available and no
machine code => device initcall
In order to fullfill all these constraints, the initcall level is either
postcore for non devicetree platforms, and device for devicetree platforms.
Signed-off-by: Robert Jarzmik <robert.jarzmik@free.fr>
---
drivers/gpio/gpio-pxa.c | 16 ++++++++++++++--
1 file changed, 14 insertions(+), 2 deletions(-)
diff --git a/drivers/gpio/gpio-pxa.c b/drivers/gpio/gpio-pxa.c
index df2ce550f309..bce99182578b 100644
--- a/drivers/gpio/gpio-pxa.c
+++ b/drivers/gpio/gpio-pxa.c
@@ -690,11 +690,23 @@ static struct platform_driver pxa_gpio_driver = {
.id_table = gpio_id_table,
};
-static int __init pxa_gpio_init(void)
+static int __init pxa_gpio_legacy_init(void)
{
+ if (of_have_populated_dt())
+ return 0;
+
return platform_driver_register(&pxa_gpio_driver);
}
-postcore_initcall(pxa_gpio_init);
+postcore_initcall(pxa_gpio_legacy_init);
+
+static int __init pxa_gpio_dt_init(void)
+{
+ if (of_have_populated_dt())
+ return platform_driver_register(&pxa_gpio_driver);
+
+ return 0;
+}
+device_initcall(pxa_gpio_dt_init);
#ifdef CONFIG_PM
static int pxa_gpio_suspend(void)
--
2.1.4
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] gpio: pxa: change initcall level second attempt
2015-11-13 20:22 [PATCH] gpio: pxa: change initcall level second attempt Robert Jarzmik
@ 2015-11-17 13:56 ` Linus Walleij
2015-11-17 20:37 ` Robert Jarzmik
0 siblings, 1 reply; 3+ messages in thread
From: Linus Walleij @ 2015-11-17 13:56 UTC (permalink / raw)
To: Robert Jarzmik
Cc: Alexandre Courbot, linux-gpio@vger.kernel.org,
linux-kernel@vger.kernel.org
On Fri, Nov 13, 2015 at 9:22 PM, Robert Jarzmik <robert.jarzmik@free.fr> wrote:
> This patch is a second attempt at what was previously in commit
> 6c7e660a27da ("gpio: pxa: set initcall level to module init").
>
> The goal is the same : enable gpio & pinctrl driver to work
> together. As pinctrl driver will be initialized at device level, the
> gpio should be as well, so that the deferring mechanism is honored.
>
> Yet this patch should also respect the legacy platforms, so the set of
> constraints is :
> - in legacy platforms (ie. non dt), gpio_[gs]et_*() should be available
> for machine code => core initcall
> - in new platforms (ie. dt based), pinctrl will be available and no
> machine code => device initcall
>
> In order to fullfill all these constraints, the initcall level is either
> postcore for non devicetree platforms, and device for devicetree platforms.
>
> Signed-off-by: Robert Jarzmik <robert.jarzmik@free.fr>
Kludgy, but what can we do.
Patch applied.
Yours,
Linus Walleij
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] gpio: pxa: change initcall level second attempt
2015-11-17 13:56 ` Linus Walleij
@ 2015-11-17 20:37 ` Robert Jarzmik
0 siblings, 0 replies; 3+ messages in thread
From: Robert Jarzmik @ 2015-11-17 20:37 UTC (permalink / raw)
To: Linus Walleij
Cc: Alexandre Courbot, linux-gpio@vger.kernel.org,
linux-kernel@vger.kernel.org
Linus Walleij <linus.walleij@linaro.org> writes:
> Kludgy, but what can we do.
Indeed.
> Patch applied.
Thanks. I'll follow up with the current pinmux + partly pinconf implementation
to gather comments to amend/change/rework my current pxa2xx implementation.
I just need to split the patch into smaller chunks for easier review.
Cheers.
--
Robert
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2015-11-17 20:37 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-11-13 20:22 [PATCH] gpio: pxa: change initcall level second attempt Robert Jarzmik
2015-11-17 13:56 ` Linus Walleij
2015-11-17 20:37 ` Robert Jarzmik
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).