* [PATCH 0/4] gpio-hog fixes
@ 2018-10-18 10:43 Marco Felsch
2018-10-18 10:43 ` [PATCH 1/4] gpiolib: fix of_gpio_hog error handling Marco Felsch
` (4 more replies)
0 siblings, 5 replies; 6+ messages in thread
From: Marco Felsch @ 2018-10-18 10:43 UTC (permalink / raw)
To: barebox
Hi,
in 2017 Andrey ported the linux gpio-hog functionality to barebox. So we
can set simple power-on/reset gpios from DT without specifying them in
the board file.
First this series do some fixes in the gpio-hog implementation. Then we
have to reorder the initcall sequence to make use of the above descrbied
feature. Since now the gpio devices depending on the pinctrl devices, so
we have to probe the pinctrl first.
I've tested it on a iMX6 based board, other testers are welcome.
Regrads,
Marco
Marco Felsch (4):
gpiolib: fix of_gpio_hog error handling
gpiolib: fix of_hog_gpio gpio label assignment
gpio: tree-wide don't probe devices during core_initcall
pinctrl: tree-wide probe devices during core_initcall
drivers/gpio/gpio-dw.c | 2 +-
drivers/gpio/gpio-imx.c | 2 +-
drivers/gpio/gpio-mxs.c | 2 +-
drivers/gpio/gpio-vf610.c | 2 +-
drivers/gpio/gpiolib.c | 13 ++++++++-----
drivers/pinctrl/imx-iomux-v1.c | 2 +-
drivers/pinctrl/imx-iomux-v2.c | 2 +-
drivers/pinctrl/imx-iomux-v3.c | 2 +-
drivers/pinctrl/mvebu/armada-370.c | 2 +-
drivers/pinctrl/mvebu/armada-xp.c | 2 +-
drivers/pinctrl/mvebu/dove.c | 2 +-
drivers/pinctrl/mvebu/kirkwood.c | 2 +-
drivers/pinctrl/pinctrl-at91.c | 4 ++--
drivers/pinctrl/pinctrl-mxs.c | 2 +-
drivers/pinctrl/pinctrl-single.c | 2 +-
drivers/pinctrl/pinctrl-tegra-xusb.c | 2 +-
drivers/pinctrl/pinctrl-tegra20.c | 2 +-
drivers/pinctrl/pinctrl-tegra30.c | 2 +-
drivers/pinctrl/pinctrl-vf610.c | 2 +-
19 files changed, 27 insertions(+), 24 deletions(-)
--
2.19.0
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH 1/4] gpiolib: fix of_gpio_hog error handling
2018-10-18 10:43 [PATCH 0/4] gpio-hog fixes Marco Felsch
@ 2018-10-18 10:43 ` Marco Felsch
2018-10-18 10:43 ` [PATCH 2/4] gpiolib: fix of_hog_gpio gpio label assignment Marco Felsch
` (3 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: Marco Felsch @ 2018-10-18 10:43 UTC (permalink / raw)
To: barebox
Currently the error handling of gpio_get_num() checks the return value
of the previous of_property_read_u32_index() which has it's own error
check. Fix it by using the correct return value variable.
Fixes: 37e6bee7e5 ("gpiolib: Add support for GPIO "hog" nodes")
Signed-off-by: Marco Felsch <m.felsch@pengutronix.de>
---
drivers/gpio/gpiolib.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c
index b83a27de7d..4e0bf73742 100644
--- a/drivers/gpio/gpiolib.c
+++ b/drivers/gpio/gpiolib.c
@@ -352,12 +352,12 @@ static int of_hog_gpio(struct device_node *np, struct gpio_chip *chip,
flags |= GPIOF_ACTIVE_LOW;
gpio = gpio_get_num(chip->dev, gpio_num);
- if (ret == -EPROBE_DEFER)
- return ret;
+ if (gpio == -EPROBE_DEFER)
+ return gpio;
- if (ret < 0) {
+ if (gpio < 0) {
dev_err(chip->dev, "unable to get gpio %u\n", gpio_num);
- return ret;
+ return gpio;
}
--
2.19.0
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH 2/4] gpiolib: fix of_hog_gpio gpio label assignment
2018-10-18 10:43 [PATCH 0/4] gpio-hog fixes Marco Felsch
2018-10-18 10:43 ` [PATCH 1/4] gpiolib: fix of_gpio_hog error handling Marco Felsch
@ 2018-10-18 10:43 ` Marco Felsch
2018-10-18 10:43 ` [PATCH 3/4] gpio: tree-wide don't probe devices during core_initcall Marco Felsch
` (2 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: Marco Felsch @ 2018-10-18 10:43 UTC (permalink / raw)
To: barebox
Current the label is retrieved by the line-name property but this is a
optional property. In case of a missing line-name property the label is
NULL. As the binding documentation told, the gpio-label must be set to
the device-node name in case of missing line-name property.
Fixes: 37e6bee7e5 ("gpiolib: Add support for GPIO "hog" nodes")
Signed-off-by: Marco Felsch <m.felsch@pengutronix.de>
---
drivers/gpio/gpiolib.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c
index 4e0bf73742..982bec0b69 100644
--- a/drivers/gpio/gpiolib.c
+++ b/drivers/gpio/gpiolib.c
@@ -382,7 +382,10 @@ static int of_hog_gpio(struct device_node *np, struct gpio_chip *chip,
else
return -EINVAL;
- of_property_read_string(np, "line-name", &name);
+ /* The line-name is optional and if not present the node name is used */
+ ret = of_property_read_string(np, "line-name", &name);
+ if (ret < 0)
+ name = np->name;
return gpio_request_one(gpio, flags, name);
}
--
2.19.0
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH 3/4] gpio: tree-wide don't probe devices during core_initcall
2018-10-18 10:43 [PATCH 0/4] gpio-hog fixes Marco Felsch
2018-10-18 10:43 ` [PATCH 1/4] gpiolib: fix of_gpio_hog error handling Marco Felsch
2018-10-18 10:43 ` [PATCH 2/4] gpiolib: fix of_hog_gpio gpio label assignment Marco Felsch
@ 2018-10-18 10:43 ` Marco Felsch
2018-10-18 10:43 ` [PATCH 4/4] pinctrl: tree-wide " Marco Felsch
2018-10-19 12:19 ` [PATCH 0/4] gpio-hog fixes Sascha Hauer
4 siblings, 0 replies; 6+ messages in thread
From: Marco Felsch @ 2018-10-18 10:43 UTC (permalink / raw)
To: barebox
Since commit 37e6bee7e5 ("gpiolib: Add support for GPIO "hog" nodes")
barebox can handle hog-gpios. To work correctly the pinctrl driver
must be initialised first. Reorder all core_initcall's so the pinctrl
driver can be called first.
find drivers/gpio/ -type f -name gpio-*.c -exec sed -i \
's/core_initcall/postcore_initcall/' "{}" +;
Signed-off-by: Marco Felsch <m.felsch@pengutronix.de>
---
drivers/gpio/gpio-dw.c | 2 +-
drivers/gpio/gpio-imx.c | 2 +-
drivers/gpio/gpio-mxs.c | 2 +-
drivers/gpio/gpio-vf610.c | 2 +-
4 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/gpio/gpio-dw.c b/drivers/gpio/gpio-dw.c
index f145c01232..b81e6a75c5 100644
--- a/drivers/gpio/gpio-dw.c
+++ b/drivers/gpio/gpio-dw.c
@@ -199,4 +199,4 @@ static int __init dwgpio_init(void)
{
return platform_driver_register(&dwgpio_driver);
}
-core_initcall(dwgpio_init);
+postcore_initcall(dwgpio_init);
diff --git a/drivers/gpio/gpio-imx.c b/drivers/gpio/gpio-imx.c
index d618e60119..2827e11e73 100644
--- a/drivers/gpio/gpio-imx.c
+++ b/drivers/gpio/gpio-imx.c
@@ -222,4 +222,4 @@ static int imx_gpio_add(void)
platform_driver_register(&imx_gpio_driver);
return 0;
}
-core_initcall(imx_gpio_add);
+postcore_initcall(imx_gpio_add);
diff --git a/drivers/gpio/gpio-mxs.c b/drivers/gpio/gpio-mxs.c
index b2b3ad3ac6..ef78873ad2 100644
--- a/drivers/gpio/gpio-mxs.c
+++ b/drivers/gpio/gpio-mxs.c
@@ -183,4 +183,4 @@ static int mxs_gpio_add(void)
platform_driver_register(&mxs_gpio_driver);
return 0;
}
-core_initcall(mxs_gpio_add);
+postcore_initcall(mxs_gpio_add);
diff --git a/drivers/gpio/gpio-vf610.c b/drivers/gpio/gpio-vf610.c
index 2aff62be59..ca2bf9ac69 100644
--- a/drivers/gpio/gpio-vf610.c
+++ b/drivers/gpio/gpio-vf610.c
@@ -161,4 +161,4 @@ static int __init gpio_vf610_init(void)
{
return platform_driver_register(&vf610_gpio_driver);
}
-core_initcall(gpio_vf610_init);
+postcore_initcall(gpio_vf610_init);
--
2.19.0
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH 4/4] pinctrl: tree-wide probe devices during core_initcall
2018-10-18 10:43 [PATCH 0/4] gpio-hog fixes Marco Felsch
` (2 preceding siblings ...)
2018-10-18 10:43 ` [PATCH 3/4] gpio: tree-wide don't probe devices during core_initcall Marco Felsch
@ 2018-10-18 10:43 ` Marco Felsch
2018-10-19 12:19 ` [PATCH 0/4] gpio-hog fixes Sascha Hauer
4 siblings, 0 replies; 6+ messages in thread
From: Marco Felsch @ 2018-10-18 10:43 UTC (permalink / raw)
To: barebox
Since commit 37e6bee7e5 ("gpiolib: Add support for GPIO "hog" nodes")
barebox can handle hog-gpios. To work correctly the pinctrl driver
must be initialised first. Reorder all pinctrl drivers so they will be
called first.
find drivers/pinctrl/ -type f -name *.c \
-exec sed -i 's/\bpostcore_initcall\b/core_initcall/' "{}" +;
Signed-off-by: Marco Felsch <m.felsch@pengutronix.de>
---
drivers/pinctrl/imx-iomux-v1.c | 2 +-
drivers/pinctrl/imx-iomux-v2.c | 2 +-
drivers/pinctrl/imx-iomux-v3.c | 2 +-
drivers/pinctrl/mvebu/armada-370.c | 2 +-
drivers/pinctrl/mvebu/armada-xp.c | 2 +-
drivers/pinctrl/mvebu/dove.c | 2 +-
drivers/pinctrl/mvebu/kirkwood.c | 2 +-
drivers/pinctrl/pinctrl-at91.c | 4 ++--
drivers/pinctrl/pinctrl-mxs.c | 2 +-
drivers/pinctrl/pinctrl-single.c | 2 +-
drivers/pinctrl/pinctrl-tegra-xusb.c | 2 +-
drivers/pinctrl/pinctrl-tegra20.c | 2 +-
drivers/pinctrl/pinctrl-tegra30.c | 2 +-
drivers/pinctrl/pinctrl-vf610.c | 2 +-
14 files changed, 15 insertions(+), 15 deletions(-)
diff --git a/drivers/pinctrl/imx-iomux-v1.c b/drivers/pinctrl/imx-iomux-v1.c
index a3f04802a2..61e8f9680f 100644
--- a/drivers/pinctrl/imx-iomux-v1.c
+++ b/drivers/pinctrl/imx-iomux-v1.c
@@ -314,4 +314,4 @@ static int imx_iomux_v1_init(void)
{
return platform_driver_register(&imx_iomux_v1_driver);
}
-postcore_initcall(imx_iomux_v1_init);
+core_initcall(imx_iomux_v1_init);
diff --git a/drivers/pinctrl/imx-iomux-v2.c b/drivers/pinctrl/imx-iomux-v2.c
index 0c985a69d3..60b635a8a8 100644
--- a/drivers/pinctrl/imx-iomux-v2.c
+++ b/drivers/pinctrl/imx-iomux-v2.c
@@ -154,4 +154,4 @@ static int imx_iomux_init(void)
{
return platform_driver_register(&imx_iomux_driver);
}
-postcore_initcall(imx_iomux_init);
+core_initcall(imx_iomux_init);
diff --git a/drivers/pinctrl/imx-iomux-v3.c b/drivers/pinctrl/imx-iomux-v3.c
index 0ab97040e0..b2a67fcccc 100644
--- a/drivers/pinctrl/imx-iomux-v3.c
+++ b/drivers/pinctrl/imx-iomux-v3.c
@@ -266,4 +266,4 @@ static int imx_iomux_v3_init(void)
{
return platform_driver_register(&imx_iomux_v3_driver);
}
-postcore_initcall(imx_iomux_v3_init);
+core_initcall(imx_iomux_v3_init);
diff --git a/drivers/pinctrl/mvebu/armada-370.c b/drivers/pinctrl/mvebu/armada-370.c
index 2fd07a7b87..4fde16ab5d 100644
--- a/drivers/pinctrl/mvebu/armada-370.c
+++ b/drivers/pinctrl/mvebu/armada-370.c
@@ -415,4 +415,4 @@ static int armada_370_pinctrl_init(void)
{
return platform_driver_register(&armada_370_pinctrl_driver);
}
-postcore_initcall(armada_370_pinctrl_init);
+core_initcall(armada_370_pinctrl_init);
diff --git a/drivers/pinctrl/mvebu/armada-xp.c b/drivers/pinctrl/mvebu/armada-xp.c
index 2657db5fcf..089942d696 100644
--- a/drivers/pinctrl/mvebu/armada-xp.c
+++ b/drivers/pinctrl/mvebu/armada-xp.c
@@ -405,4 +405,4 @@ static int armada_xp_pinctrl_init(void)
{
return platform_driver_register(&armada_xp_pinctrl_driver);
}
-postcore_initcall(armada_xp_pinctrl_init);
+core_initcall(armada_xp_pinctrl_init);
diff --git a/drivers/pinctrl/mvebu/dove.c b/drivers/pinctrl/mvebu/dove.c
index 8de01e74d6..2d9d8094f8 100644
--- a/drivers/pinctrl/mvebu/dove.c
+++ b/drivers/pinctrl/mvebu/dove.c
@@ -742,4 +742,4 @@ static int dove_pinctrl_init(void)
{
return platform_driver_register(&dove_pinctrl_driver);
}
-postcore_initcall(dove_pinctrl_init);
+core_initcall(dove_pinctrl_init);
diff --git a/drivers/pinctrl/mvebu/kirkwood.c b/drivers/pinctrl/mvebu/kirkwood.c
index 4b2618cd2e..a347239028 100644
--- a/drivers/pinctrl/mvebu/kirkwood.c
+++ b/drivers/pinctrl/mvebu/kirkwood.c
@@ -456,4 +456,4 @@ static int kirkwood_pinctrl_init(void)
{
return platform_driver_register(&kirkwood_pinctrl_driver);
}
-postcore_initcall(kirkwood_pinctrl_init);
+core_initcall(kirkwood_pinctrl_init);
diff --git a/drivers/pinctrl/pinctrl-at91.c b/drivers/pinctrl/pinctrl-at91.c
index 0303869774..84348a0530 100644
--- a/drivers/pinctrl/pinctrl-at91.c
+++ b/drivers/pinctrl/pinctrl-at91.c
@@ -538,7 +538,7 @@ static int at91_pinctrl_init(void)
{
return platform_driver_register(&at91_pinctrl_driver);
}
-postcore_initcall(at91_pinctrl_init);
+core_initcall(at91_pinctrl_init);
static int at91_gpio_get(struct gpio_chip *chip, unsigned offset)
{
@@ -718,4 +718,4 @@ static int at91_gpio_init(void)
{
return platform_driver_register(&at91_gpio_driver);
}
-postcore_initcall(at91_gpio_init);
+core_initcall(at91_gpio_init);
diff --git a/drivers/pinctrl/pinctrl-mxs.c b/drivers/pinctrl/pinctrl-mxs.c
index 479c31a426..b48ed2ace1 100644
--- a/drivers/pinctrl/pinctrl-mxs.c
+++ b/drivers/pinctrl/pinctrl-mxs.c
@@ -168,4 +168,4 @@ static int mxs_pinctrl_init(void)
{
return platform_driver_register(&mxs_pinctrl_driver);
}
-postcore_initcall(mxs_pinctrl_init);
+core_initcall(mxs_pinctrl_init);
diff --git a/drivers/pinctrl/pinctrl-single.c b/drivers/pinctrl/pinctrl-single.c
index 15b74cc1df..3c581ed5d3 100644
--- a/drivers/pinctrl/pinctrl-single.c
+++ b/drivers/pinctrl/pinctrl-single.c
@@ -167,4 +167,4 @@ static int pcs_init(void)
{
return platform_driver_register(&pcs_driver);
}
-postcore_initcall(pcs_init);
+core_initcall(pcs_init);
diff --git a/drivers/pinctrl/pinctrl-tegra-xusb.c b/drivers/pinctrl/pinctrl-tegra-xusb.c
index a7a75bb9c5..e477280e62 100644
--- a/drivers/pinctrl/pinctrl-tegra-xusb.c
+++ b/drivers/pinctrl/pinctrl-tegra-xusb.c
@@ -518,4 +518,4 @@ static int pinctrl_tegra_xusb_init(void)
{
return platform_driver_register(&pinctrl_tegra_xusb_driver);
}
-postcore_initcall(pinctrl_tegra_xusb_init);
+core_initcall(pinctrl_tegra_xusb_init);
diff --git a/drivers/pinctrl/pinctrl-tegra20.c b/drivers/pinctrl/pinctrl-tegra20.c
index eaaba9e7a7..337992c21f 100644
--- a/drivers/pinctrl/pinctrl-tegra20.c
+++ b/drivers/pinctrl/pinctrl-tegra20.c
@@ -350,4 +350,4 @@ static int pinctrl_tegra20_init(void)
{
return platform_driver_register(&pinctrl_tegra20_driver);
}
-postcore_initcall(pinctrl_tegra20_init);
+core_initcall(pinctrl_tegra20_init);
diff --git a/drivers/pinctrl/pinctrl-tegra30.c b/drivers/pinctrl/pinctrl-tegra30.c
index 4b271dd0b6..d9b49c57d9 100644
--- a/drivers/pinctrl/pinctrl-tegra30.c
+++ b/drivers/pinctrl/pinctrl-tegra30.c
@@ -935,4 +935,4 @@ static int pinctrl_tegra30_init(void)
{
return platform_driver_register(&pinctrl_tegra30_driver);
}
-postcore_initcall(pinctrl_tegra30_init);
+core_initcall(pinctrl_tegra30_init);
diff --git a/drivers/pinctrl/pinctrl-vf610.c b/drivers/pinctrl/pinctrl-vf610.c
index a46b0e2ca0..662fa9b6c9 100644
--- a/drivers/pinctrl/pinctrl-vf610.c
+++ b/drivers/pinctrl/pinctrl-vf610.c
@@ -165,4 +165,4 @@ static int pinctrl_vf610_init(void)
{
return platform_driver_register(&pinctrl_vf610_driver);
}
-postcore_initcall(pinctrl_vf610_init);
+core_initcall(pinctrl_vf610_init);
--
2.19.0
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 0/4] gpio-hog fixes
2018-10-18 10:43 [PATCH 0/4] gpio-hog fixes Marco Felsch
` (3 preceding siblings ...)
2018-10-18 10:43 ` [PATCH 4/4] pinctrl: tree-wide " Marco Felsch
@ 2018-10-19 12:19 ` Sascha Hauer
4 siblings, 0 replies; 6+ messages in thread
From: Sascha Hauer @ 2018-10-19 12:19 UTC (permalink / raw)
To: Marco Felsch; +Cc: barebox
On Thu, Oct 18, 2018 at 12:43:45PM +0200, Marco Felsch wrote:
> Hi,
>
> in 2017 Andrey ported the linux gpio-hog functionality to barebox. So we
> can set simple power-on/reset gpios from DT without specifying them in
> the board file.
>
> First this series do some fixes in the gpio-hog implementation. Then we
> have to reorder the initcall sequence to make use of the above descrbied
> feature. Since now the gpio devices depending on the pinctrl devices, so
> we have to probe the pinctrl first.
>
> I've tested it on a iMX6 based board, other testers are welcome.
>
> Regrads,
> Marco
>
> Marco Felsch (4):
> gpiolib: fix of_gpio_hog error handling
> gpiolib: fix of_hog_gpio gpio label assignment
> gpio: tree-wide don't probe devices during core_initcall
> pinctrl: tree-wide probe devices during core_initcall
Applied, thanks
Sascha
--
Pengutronix e.K. | |
Industrial Linux Solutions | http://www.pengutronix.de/ |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2018-10-19 12:19 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-10-18 10:43 [PATCH 0/4] gpio-hog fixes Marco Felsch
2018-10-18 10:43 ` [PATCH 1/4] gpiolib: fix of_gpio_hog error handling Marco Felsch
2018-10-18 10:43 ` [PATCH 2/4] gpiolib: fix of_hog_gpio gpio label assignment Marco Felsch
2018-10-18 10:43 ` [PATCH 3/4] gpio: tree-wide don't probe devices during core_initcall Marco Felsch
2018-10-18 10:43 ` [PATCH 4/4] pinctrl: tree-wide " Marco Felsch
2018-10-19 12:19 ` [PATCH 0/4] gpio-hog fixes Sascha Hauer
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox