ARM: shmobile: Move gpio ranges from C code to DT
Subsystems (4)
cover ARM: shmobile: Move gpio ranges from C code to DT
Hi Linus, Alex, Laurent, Simon, Magnus,
This patch series moves the setup of the GPIO-PFC pin mapping for Renesas PFC/GPIO combos from C code to DT, and does some cleanups. The move to DT is needed to make the GPIO hogging mechanism work, cfr. the discussion following "[PATCH] [RFC] gpio: Retry deferred GPIO hogging on pin range change" (https://lkml.org/lkml/2015/6/16/455).
The series consists of 3 parts:
a. Patches 1-3 add the missing "gpio-ranges" properties to the dtsi
files for all affected SoCs,
b. Patch 4 disables the C code to set up the mapping on DT platforms
(it's still needed on SH or ARM-legacy),
c. Patches 5-7 do a few more cleanups in the sh-pfc gpio code.
Dependencies:
- This series applies against next-next-20150630.
- Part a must go in first, to avoid regressions.
In addition, it's a prerequisite for "ARM: shmobile: armadillo800eva
dts: Add pinctrl and gpio-hog for lcdc0", which has been queued up already in Simon's dt-for-v4.3 branch. Perhaps it can still be reordered?
- While I didn't notice any bad behavior by having part a only, part b should go in immediately after part a. Hence I think it's best if Simon can take this one, too.
- Part c is independent (it doesn't touch the same code), so it can go in before or after the other parts, or in parallel.
Thanks for applying!
Geert Uytterhoeven (7):
ARM: shmobile: r8a73a4 dtsi: Add missing "gpio-ranges" to gpio node
ARM: shmobile: r8a7740 dtsi: Add missing "gpio-ranges" to gpio node
ARM: shmobile: sh73a0 dtsi: Add missing "gpio-ranges" to gpio node
pinctrl: sh-pfc: Stop calling gpiochip_add_pin_range() on DT platforms
pinctrl: sh-pfc: Remove empty gpio_function_free()
pinctrl: sh-pfc: Move sh_pfc_add_gpiochip() up
pinctrl: sh-pfc: Confine legacy function GPIOs to SH
arch/arm/boot/dts/r8a73a4.dtsi | 7 +++ arch/arm/boot/dts/r8a7740.dtsi | 1 + arch/arm/boot/dts/sh73a0.dtsi | 3 + drivers/pinctrl/sh-pfc/core.h | 2 + drivers/pinctrl/sh-pfc/gpio.c | 128 ++++++++++++++++++++++------------------ drivers/pinctrl/sh-pfc/sh_pfc.h | 2 + 6 files changed, 87 insertions(+), 56 deletions(-)
Signature · 12 lines
1.9.1
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert at linux-m68k.org
In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus TorvaldsPATCH 1/7 ARM: shmobile: r8a73a4 dtsi: Add missing "gpio-ranges" to gpio node
If a GPIO driver uses gpiochip_add_pin_range() (which is usually the case for GPIO/PFC combos), the GPIO hogging mechanism configured from DT doesn't work:
requesting hog GPIO led1-high (chip r8a73a4_pfc, offset 28) failed
The actual error code is -517 == -EPROBE_DEFER.
The problem is that PFC+GPIO registration is handled in multiple steps:
1. pinctrl_register(),
2. gpiochip_add(),
3. gpiochip_add_pin_range().
Configuration of the hogs is handled in gpiochip_add():
gpiochip_add
of_gpiochip_add
of_gpiochip_scan_hogs
gpiod_hog
gpiochip_request_own_desc
__gpiod_request
chip->request
pinctrl_request_gpio
pinctrl_get_device_gpio_rangeHowever, at this point the GPIO controller hasn't been added to pinctrldev_list yet, so the range can't be found, and the operation fails with -EPROBE_DEFER.
To fix this, add a "gpio-ranges" property to the gpio device node, so the ranges are added by of_gpiochip_add_pin_range(), which is called by of_gpiochip_add() before the call to of_gpiochip_scan_hogs().
--- arch/arm/boot/dts/r8a73a4.dtsi | 7 +++++++ 1 file changed, 7 insertions(+)
arch/arm/boot/dts/r8a73a4.dtsi +7 -0
@@ -207,6 +207,13 @@ reg = <0 0xe6050000 0 0x9000>; gpio-controller; #gpio-cells = <2>; + gpio-ranges = + <&pfc 0 0 31>, <&pfc 32 32 9>, + <&pfc 64 64 22>, <&pfc 96 96 31>, + <&pfc 128 128 7>, <&pfc 160 160 19>, + <&pfc 192 192 31>, <&pfc 224 224 27>, + <&pfc 256 256 28>, <&pfc 288 288 21>, + <&pfc 320 320 10>; interrupts-extended = <&irqc0 0 0>, <&irqc0 1 0>, <&irqc0 2 0>, <&irqc0 3 0>, <&irqc0 4 0>, <&irqc0 5 0>, <&irqc0 6 0>, <&irqc0 7 0>,
Signature · 1 line
1.9.1
PATCH 1/7 ARM: shmobile: r8a73a4 dtsi: Add missing "gpio-ranges" to gpio node
Hi Geert,
Thank you for the patch.
Quoted 29 lines · On Tuesday 30 June 2015 09:45:21 Geert Uytterhoeven wrote:
If a GPIO driver uses
gpiochip_add_pin_range()(which is usually the case for GPIO/PFC combos), the GPIO hogging mechanism configured from DT doesn't work:requesting hog GPIO led1-high (chip
r8a73a4_pfc, offset 28) failedThe actual error code is -517 == -EPROBE_DEFER.
The problem is that PFC+GPIO registration is handled in multiple steps:
1.pinctrl_register(),
2.gpiochip_add(),
3.gpiochip_add_pin_range().Configuration of the hogs is handled in
gpiochip_add():gpiochip_add of_gpiochip_add of_gpiochip_scan_hogs gpiod_hog gpiochip_request_own_desc __gpiod_request chip->request pinctrl_request_gpio pinctrl_get_device_gpio_rangeHowever, at this point the GPIO controller hasn't been added to
pinctrldev_listyet, so the range can't be found, and the operation fails with -EPROBE_DEFER.
Quoted 5 lines
To fix this, add a "gpio-ranges" property to the gpio device node, so the ranges are added by
of_gpiochip_add_pin_range(), which is called byof_gpiochip_add()before the call toof_gpiochip_scan_hogs().Signed-off-by Geert Uytterhoeven <[email protected]>
This looks sane to me, even though referencing the same DT node seems a bit dodgy. I'll let Linus comment on that, but for the implementation itself,
Quoted 22 lines
--- arch/arm/boot/dts/r8a73a4.dtsi | 7 +++++++ 1 file changed, 7 insertions(+)arch/arm/boot/dts/r8a73a4.dtsi +7
-0@@ -207,6 +207,13 @@ reg = <0 0xe6050000 0 0x9000>; gpio-controller; #gpio-cells = <2>; + gpio-ranges = + <&pfc 0 0 31>, <&pfc 32 32 9>, + <&pfc 64 64 22>, <&pfc 96 96 31>, + <&pfc 128 128 7>, <&pfc 160 160 19>, + <&pfc 192 192 31>, <&pfc 224 224 27>, + <&pfc 256 256 28>, <&pfc 288 288 21>, + <&pfc 320 320 10>; interrupts-extended = <&irqc0 0 0>, <&irqc0 1 0>, <&irqc0 2 0>, <&irqc0 3 0>, <&irqc0 4 0>, <&irqc0 5 0>, <&irqc0 6 0>, <&irqc0 7 0>,
Signature · 3 lines
Regards, Laurent Pinchart
PATCH 1/7 ARM: shmobile: r8a73a4 dtsi: Add missing "gpio-ranges" to gpio node
Hi Laurent, Linus,
Quoted 34 lines · Laurent Pinchart
Quoted 33 lines · On Tuesday 30 June 2015 09:45:21 Geert Uytterhoeven wrote:
If a GPIO driver uses
gpiochip_add_pin_range()(which is usually the case for GPIO/PFC combos), the GPIO hogging mechanism configured from DT doesn't work:requesting hog GPIO led1-high (chip
r8a73a4_pfc, offset 28) failedThe actual error code is -517 == -EPROBE_DEFER.
The problem is that PFC+GPIO registration is handled in multiple steps:
1.pinctrl_register(),
2.gpiochip_add(),
3.gpiochip_add_pin_range().Configuration of the hogs is handled in
gpiochip_add():gpiochip_add of_gpiochip_add of_gpiochip_scan_hogs gpiod_hog gpiochip_request_own_desc __gpiod_request chip->request pinctrl_request_gpio pinctrl_get_device_gpio_rangeHowever, at this point the GPIO controller hasn't been added to
pinctrldev_listyet, so the range can't be found, and the operation fails with -EPROBE_DEFER.To fix this, add a "gpio-ranges" property to the gpio device node, so the ranges are added by
of_gpiochip_add_pin_range(), which is called byof_gpiochip_add()before the call toof_gpiochip_scan_hogs().
Quoted 6 lines
Quoted 1 line
Signed-off-by Geert Uytterhoeven <[email protected]>This looks sane to me, even though referencing the same DT node seems a bit dodgy. I'll let Linus comment on that, but for the implementation itself,
Acked-by Laurent Pinchart <[email protected]>
Thank you!
Any wise words from Linus?
Thanks again!
Quoted 15 lines
Quoted 15 lines
--- arch/arm/boot/dts/r8a73a4.dtsi | 7 +++++++ 1 file changed, 7 insertions(+)arch/arm/boot/dts/r8a73a4.dtsi +2
-0@@ -207,6 +207,13 @@ reg = <0 0xe6050000 0 0x9000>; gpio-controller; #gpio-cells = <2>; + gpio-ranges = + <&pfc 0 0 31>, <&pfc 32 32 9>,
Quoted 8 lines
arch/arm/boot/dts/r8a73a4.dtsi line 219
Quoted 8 lines
arch/arm/boot/dts/r8a73a4.dtsi +5
-0+ <&pfc 64 64 22>, <&pfc 96 96 31>, + <&pfc 128 128 7>, <&pfc 160 160 19>, + <&pfc 192 192 31>, <&pfc 224 224 27>, + <&pfc 256 256 28>, <&pfc 288 288 21>, + <&pfc 320 320 10>; interrupts-extended = <&irqc0 0 0>, <&irqc0 1 0>, <&irqc0 2 0>, <&irqc0 3 0>, <&irqc0 4 0>, <&irqc0 5 0>, <&irqc0 6 0>, <&irqc0 7 0>,
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert at linux-m68k.org
In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
PATCH 1/7 ARM: shmobile: r8a73a4 dtsi: Add missing "gpio-ranges" to gpio node
Quoted 9 lines · Geert Uytterhoeven
Quoted 6 lines · Laurent Pinchart
Quoted 5 lines
To fix this, add a "gpio-ranges" property to the gpio device node, so the ranges are added by
of_gpiochip_add_pin_range(), which is called byof_gpiochip_add()before the call toof_gpiochip_scan_hogs().Signed-off-by Geert Uytterhoeven <[email protected]>
Quoted 8 lines
Quoted 4 lines
This looks sane to me, even though referencing the same DT node seems a bit dodgy. I'll let Linus comment on that, but for the implementation itself,
Acked-by Laurent Pinchart <[email protected]>Thank you!
Any wise words from Linus?
I don't know if I'm wise but I'm OK with this:
Yours,
Linus Walleij
PATCH 2/7 ARM: shmobile: r8a7740 dtsi: Add missing "gpio-ranges" to gpio node
In reply to Geert UytterhoevenIf a GPIO driver uses gpiochip_add_pin_range() (which is usually the case for GPIO/PFC combos), the GPIO hogging mechanism configured from DT doesn't work:
requesting hog GPIO lcd0 (chip r8a7740_pfc, offset 176) failed
The actual error code is -517 == -EPROBE_DEFER.
The problem is that PFC+GPIO registration is handled in multiple steps:
1. pinctrl_register(),
2. gpiochip_add(),
3. gpiochip_add_pin_range().
Configuration of the hogs is handled in gpiochip_add():
gpiochip_add
of_gpiochip_add
of_gpiochip_scan_hogs
gpiod_hog
gpiochip_request_own_desc
__gpiod_request
chip->request
pinctrl_request_gpio
pinctrl_get_device_gpio_rangeHowever, at this point the GPIO controller hasn't been added to pinctrldev_list yet, so the range can't be found, and the operation fails with -EPROBE_DEFER.
To fix this, add a "gpio-ranges" property to the gpio device node, so the range is added by of_gpiochip_add_pin_range(), which is called by of_gpiochip_add() before the call to of_gpiochip_scan_hogs().
--- arch/arm/boot/dts/r8a7740.dtsi | 1 + 1 file changed, 1 insertion(+)
arch/arm/boot/dts/r8a7740.dtsi +1 -0
@@ -316,6 +316,7 @@ <0xe605800c 0x20>; gpio-controller; #gpio-cells = <2>; + gpio-ranges = <&pfc 0 0 212>; interrupts-extended = <&irqpin0 0 0>, <&irqpin0 1 0>, <&irqpin0 2 0>, <&irqpin0 3 0>, <&irqpin0 4 0>, <&irqpin0 5 0>, <&irqpin0 6 0>, <&irqpin0 7 0>,
Signature · 1 line
1.9.1
PATCH 2/7 ARM: shmobile: r8a7740 dtsi: Add missing "gpio-ranges" to gpio node
Hi Geert,
Thank you for the patch.
Quoted 29 lines · On Tuesday 30 June 2015 09:45:22 Geert Uytterhoeven wrote:
If a GPIO driver uses
gpiochip_add_pin_range()(which is usually the case for GPIO/PFC combos), the GPIO hogging mechanism configured from DT doesn't work:requesting hog GPIO lcd0 (chip
r8a7740_pfc, offset 176) failedThe actual error code is -517 == -EPROBE_DEFER.
The problem is that PFC+GPIO registration is handled in multiple steps:
1.pinctrl_register(),
2.gpiochip_add(),
3.gpiochip_add_pin_range().Configuration of the hogs is handled in
gpiochip_add():gpiochip_add of_gpiochip_add of_gpiochip_scan_hogs gpiod_hog gpiochip_request_own_desc __gpiod_request chip->request pinctrl_request_gpio pinctrl_get_device_gpio_rangeHowever, at this point the GPIO controller hasn't been added to
pinctrldev_listyet, so the range can't be found, and the operation fails with -EPROBE_DEFER.
Quoted 5 lines
To fix this, add a "gpio-ranges" property to the gpio device node, so the range is added by
of_gpiochip_add_pin_range(), which is called byof_gpiochip_add()before the call toof_gpiochip_scan_hogs().Signed-off-by Geert Uytterhoeven <[email protected]>
This looks sane to me, even though referencing the same DT node seems a bit dodgy. I'll let Linus comment on that, but for the implementation itself,
Quoted 16 lines
--- arch/arm/boot/dts/r8a7740.dtsi | 1 + 1 file changed, 1 insertion(+)arch/arm/boot/dts/r8a7740.dtsi +1
-0@@ -316,6 +316,7 @@ <0xe605800c 0x20>; gpio-controller; #gpio-cells = <2>; + gpio-ranges = <&pfc 0 0 212>; interrupts-extended = <&irqpin0 0 0>, <&irqpin0 1 0>, <&irqpin0 2 0>, <&irqpin0 3 0>, <&irqpin0 4 0>, <&irqpin0 5 0>, <&irqpin0 6 0>, <&irqpin0 7 0>,
Signature · 3 lines
Regards, Laurent Pinchart
PATCH 3/7 ARM: shmobile: sh73a0 dtsi: Add missing "gpio-ranges" to gpio node
In reply to Geert UytterhoevenIf a GPIO driver uses gpiochip_add_pin_range() (which is usually the case for GPIO/PFC combos), the GPIO hogging mechanism configured from DT doesn't work:
requesting hog GPIO led1-high (chip sh73a0_pfc, offset 20) failed
The actual error code is -517 == -EPROBE_DEFER.
The problem is that PFC+GPIO registration is handled in multiple steps:
1. pinctrl_register(),
2. gpiochip_add(),
3. gpiochip_add_pin_range().
Configuration of the hogs is handled in gpiochip_add():
gpiochip_add
of_gpiochip_add
of_gpiochip_scan_hogs
gpiod_hog
gpiochip_request_own_desc
__gpiod_request
chip->request
pinctrl_request_gpio
pinctrl_get_device_gpio_rangeHowever, at this point the GPIO controller hasn't been added to pinctrldev_list yet, so the range can't be found, and the operation fails with -EPROBE_DEFER.
To fix this, add a "gpio-ranges" property to the gpio device node, so the ranges are added by of_gpiochip_add_pin_range(), which is called by of_gpiochip_add() before the call to of_gpiochip_scan_hogs().
--- arch/arm/boot/dts/sh73a0.dtsi | 3 +++ 1 file changed, 3 insertions(+)
arch/arm/boot/dts/sh73a0.dtsi +3 -0
@@ -392,6 +392,9 @@ <0xe605801c 0x1c>; gpio-controller; #gpio-cells = <2>; + gpio-ranges = + <&pfc 0 0 119>, <&pfc 128 128 37>, <&pfc 192 192 91>, + <&pfc 288 288 22>; interrupts-extended = <&irqpin0 0 0>, <&irqpin0 1 0>, <&irqpin0 2 0>, <&irqpin0 3 0>, <&irqpin0 4 0>, <&irqpin0 5 0>, <&irqpin0 6 0>, <&irqpin0 7 0>,
Signature · 1 line
1.9.1
PATCH 3/7 ARM: shmobile: sh73a0 dtsi: Add missing "gpio-ranges" to gpio node
Hi Geert,
Thank you for the patch.
Quoted 29 lines · On Tuesday 30 June 2015 09:45:23 Geert Uytterhoeven wrote:
If a GPIO driver uses
gpiochip_add_pin_range()(which is usually the case for GPIO/PFC combos), the GPIO hogging mechanism configured from DT doesn't work:requesting hog GPIO led1-high (chip
sh73a0_pfc, offset 20) failedThe actual error code is -517 == -EPROBE_DEFER.
The problem is that PFC+GPIO registration is handled in multiple steps:
1.pinctrl_register(),
2.gpiochip_add(),
3.gpiochip_add_pin_range().Configuration of the hogs is handled in
gpiochip_add():gpiochip_add of_gpiochip_add of_gpiochip_scan_hogs gpiod_hog gpiochip_request_own_desc __gpiod_request chip->request pinctrl_request_gpio pinctrl_get_device_gpio_rangeHowever, at this point the GPIO controller hasn't been added to
pinctrldev_listyet, so the range can't be found, and the operation fails with -EPROBE_DEFER.
Quoted 5 lines
To fix this, add a "gpio-ranges" property to the gpio device node, so the ranges are added by
of_gpiochip_add_pin_range(), which is called byof_gpiochip_add()before the call toof_gpiochip_scan_hogs().Signed-off-by Geert Uytterhoeven <[email protected]>
This looks sane to me, even though referencing the same DT node seems a bit dodgy. I'll let Linus comment on that, but for the implementation itself,
Quoted 18 lines
--- arch/arm/boot/dts/sh73a0.dtsi | 3 +++ 1 file changed, 3 insertions(+)arch/arm/boot/dts/sh73a0.dtsi +3
-0@@ -392,6 +392,9 @@ <0xe605801c 0x1c>; gpio-controller; #gpio-cells = <2>; + gpio-ranges = + <&pfc 0 0 119>, <&pfc 128 128 37>, <&pfc 192 192 91>, + <&pfc 288 288 22>; interrupts-extended = <&irqpin0 0 0>, <&irqpin0 1 0>, <&irqpin0 2 0>, <&irqpin0 3 0>, <&irqpin0 4 0>, <&irqpin0 5 0>, <&irqpin0 6 0>, <&irqpin0 7 0>,
Signature · 3 lines
Regards, Laurent Pinchart
PATCH 4/7 pinctrl: sh-pfc: Stop calling gpiochip_add_pin_range() on DT platforms
In reply to Geert UytterhoevenOn platforms where the PFC/GPIO controller is instantiated from DT, the mapping between GPIOs and pins is set up using the "gpio-ranges" property in DT.
Hence stop setting up the mapping from C code on DT platforms. This code is still used for SH or ARM-legacy platforms.
--- drivers/pinctrl/sh-pfc/gpio.c | 36 ++++++++++++++++++++---------------- 1 file changed, 20 insertions(+), 16 deletions(-)
drivers/pinctrl/sh-pfc/gpio.c +20 -16
@@ -379,22 +379,26 @@ int sh_pfc_register_gpiochip(struct sh_pfc *pfc) pfc->gpio = chip; -/* Register the GPIO to pin mappings. As pins with GPIO ports must come -* first in the ranges, skip the pins without GPIO ports by stopping at -* the first range that contains such a pin. -*/ -for (i =0 ; i < pfc->nr_ranges; ++i) { -const struct sh_pfc_pin_range *range = &pfc->ranges[i]; - -if (range->start >= pfc->nr_gpio_pins) -break ; - - ret =gpiochip_add_pin_range (&chip->gpio_chip, -dev_name (pfc->dev), - range->start, range->start, - range->end - range->start +1 ); -if (ret <0 ) -return ret; +if (IS_ENABLED (CONFIG_SUPERH ) || +IS_ENABLED (CONFIG_ARCH_SHMOBILE_LEGACY )) { +/* +* Register the GPIO to pin mappings. As pins with GPIO ports +* must come first in the ranges, skip the pins without GPIO +* ports by stopping@the first range that contains such a +* pin. +*/ +for (i =0 ; i < pfc->nr_ranges; ++i) { +const struct sh_pfc_pin_range *range = &pfc->ranges[i]; + +if (range->start >= pfc->nr_gpio_pins) +break ; + + ret =gpiochip_add_pin_range (&chip->gpio_chip, +dev_name (pfc->dev), range->start, range->start, + range->end - range->start +1 ); +if (ret <0 ) +return ret; + } }/* Register the function GPIOs chip. */
Signature · 1 line
1.9.1
PATCH 4/7 pinctrl: sh-pfc: Stop calling gpiochip_add_pin_range() on DT platforms
Hi Geert,
Thank you for the patch.
Quoted 28 lines · On Tuesday 30 June 2015 09:45:24 Geert Uytterhoeven wrote:
On platforms where the PFC/GPIO controller is instantiated from DT, the mapping between GPIOs and pins is set up using the "gpio-ranges" property in DT.
Hence stop setting up the mapping from C code on DT platforms. This code is still used for SH or ARM-legacy platforms.
Signed-off-by Geert Uytterhoeven <[email protected]>--- drivers/pinctrl/sh-pfc/gpio.c | 36 ++++++++++++++++++++---------------- 1 file changed, 20 insertions(+), 16 deletions(-)drivers/pinctrl/sh-pfc/gpio.c +0
-8@@ -379,22 +379,26 @@ int sh_pfc_register_gpiochip(struct sh_pfc *pfc) pfc->gpio = chip; -/* Register the GPIO to pin mappings. As pins with GPIO ports must come -* first in the ranges, skip the pins without GPIO ports by stopping at -* the first range that contains such a pin. -*/ -for (i =0 ; i < pfc->nr_ranges; ++i) { -const struct sh_pfc_pin_range *range = &pfc->ranges[i]; - -if (range->start >= pfc->nr_gpio_pins)
drivers/pinctrl/sh-pfc/gpio.c int sh_pfc_register_gpiochip(struct sh_pfc *pfc) · line 383
Quoted 10 lines
drivers/pinctrl/sh-pfc/gpio.c +2
-8-break ; - - ret =gpiochip_add_pin_range (&chip->gpio_chip, -dev_name (pfc->dev), - range->start, range->start, - range->end - range->start +1 ); -if (ret <0 ) -return ret; +if (IS_ENABLED (CONFIG_SUPERH ) || +IS_ENABLED (CONFIG_ARCH_SHMOBILE_LEGACY )) {
I'd prefer checking IS_ENABLED(CONFIG_OF) && pfc->dev->of_node as that doesn't explicitly depend on the platform type.
As the code after this if block also don't need to run on non-DT platforms, how about just using
if (IS_ENABLED(CONFIG_OF) && pfc->dev->of_node) return 0;
?
Quoted 21 lines
drivers/pinctrl/sh-pfc/gpio.c +18
-0+/* +* Register the GPIO to pin mappings. As pins with GPIO ports +* must come first in the ranges, skip the pins without GPIO +* ports by stopping at the first range that contains such a +* pin. +*/ +for (i =0 ; i < pfc->nr_ranges; ++i) { +const struct sh_pfc_pin_range *range = &pfc->ranges[i]; + +if (range->start >= pfc->nr_gpio_pins) +break ; + + ret =gpiochip_add_pin_range (&chip->gpio_chip, +dev_name (pfc->dev), range->start, range->start, + range->end - range->start +1 ); +if (ret <0 ) +return ret; + } }/* Register the function GPIOs chip. */
Signature · 3 lines
Regards, Laurent Pinchart
PATCH 4/7 pinctrl: sh-pfc: Stop calling gpiochip_add_pin_range() on DT platforms
Hi Laurent,
Quoted 34 lines · Laurent Pinchart
Quoted 33 lines · On Tuesday 30 June 2015 09:45:24 Geert Uytterhoeven wrote:
On platforms where the PFC/GPIO controller is instantiated from DT, the mapping between GPIOs and pins is set up using the "gpio-ranges" property in DT.
Hence stop setting up the mapping from C code on DT platforms. This code is still used for SH or ARM-legacy platforms.
Signed-off-by Geert Uytterhoeven <[email protected]>--- drivers/pinctrl/sh-pfc/gpio.c | 36 ++++++++++++++++++++---------------- 1 file changed, 20 insertions(+), 16 deletions(-)drivers/pinctrl/sh-pfc/gpio.c +0
-13@@ -379,22 +379,26 @@ int sh_pfc_register_gpiochip(struct sh_pfc *pfc) pfc->gpio = chip; -/* Register the GPIO to pin mappings. As pins with GPIO ports must come -* first in the ranges, skip the pins without GPIO ports by stopping at -* the first range that contains such a pin. -*/ -for (i =0 ; i < pfc->nr_ranges; ++i) { -const struct sh_pfc_pin_range *range = &pfc->ranges[i]; - -if (range->start >= pfc->nr_gpio_pins) -break ; - - ret = gpiochip_add_pin_range(&chip->gpio_chip, - dev_name(pfc->dev), - range->start, range->start,
Quoted 8 lines
drivers/pinctrl/sh-pfc/gpio.c int sh_pfc_register_gpiochip(struct sh_pfc *pfc) · line 383
Quoted 5 lines
drivers/pinctrl/sh-pfc/gpio.c +2
-3- range->end - range->start + 1); -if (ret <0 ) -return ret; +if (IS_ENABLED (CONFIG_SUPERH ) || +IS_ENABLED (CONFIG_ARCH_SHMOBILE_LEGACY )) {I'd prefer checking
IS_ENABLED(CONFIG_OF)&&pfc->dev->of_nodeas that doesn't explicitly depend on the platform type.
Note that CONFIG_OF is also set for ARM-legacy (and soon for SH). But that's a minor problem. But due to the runtime check on pfc->dev->of_node, the unused code below won't be left out by the compiler, and I want to get rid of that code.
The platform check make it clear when the code can be removed.
Quoted 7 lines
As the code after this if block also don't need to run on non-DT platforms, how about just using
if (IS_ENABLED(CONFIG_OF) && pfc->dev->of_node) return 0;?
Early return is indeed an option, as we don't need the function GPIOs on DT platforms.
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert at linux-m68k.org
In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
PATCH 4/7 pinctrl: sh-pfc: Stop calling gpiochip_add_pin_range() on DT platforms
Hi Geert,
Quoted 49 lines · On Tuesday 30 June 2015 11:44:24 Geert Uytterhoeven wrote:
Quoted 39 lines · Laurent Pinchart
Quoted 38 lines · On Tuesday 30 June 2015 09:45:24 Geert Uytterhoeven wrote:
On platforms where the PFC/GPIO controller is instantiated from DT, the mapping between GPIOs and pins is set up using the "gpio-ranges" property in DT.
Hence stop setting up the mapping from C code on DT platforms. This code is still used for SH or ARM-legacy platforms.
Signed-off-by Geert Uytterhoeven <[email protected]>---
drivers/pinctrl/sh-pfc/gpio.c | 36 ++++++++++++++++++++---------------- 1 file changed, 20 insertions(+), 16 deletions(-)drivers/pinctrl/sh-pfc/gpio.c +0
-1@@ -379,22 +379,26 @@ int sh_pfc_register_gpiochip(struct sh_pfc *pfc) pfc->gpio = chip; -/* Register the GPIO to pin mappings. As pins with GPIO ports must come
- * first in the ranges, skip the pins without GPIO ports by
stopping atdrivers/pinctrl/sh-pfc/gpio.c +0
-12-* the first range that contains such a pin. -*/ -for (i =0 ; i < pfc->nr_ranges; ++i) { -const struct sh_pfc_pin_range *range = &pfc->ranges[i]; - -if (range->start >= pfc->nr_gpio_pins) -break ; - - ret = gpiochip_add_pin_range(&chip->gpio_chip, - dev_name(pfc->dev), - range->start, range->start, - range->end - range->start +Quoted 8 lines
drivers/pinctrl/sh-pfc/gpio.c int sh_pfc_register_gpiochip(struct sh_pfc *pfc) · line 383
Quoted 5 lines
1);
drivers/pinctrl/sh-pfc/gpio.c +2
-2-if (ret <0 ) -return ret; +if (IS_ENABLED (CONFIG_SUPERH ) || +IS_ENABLED (CONFIG_ARCH_SHMOBILE_LEGACY )) {I'd prefer checking
IS_ENABLED(CONFIG_OF)&&pfc->dev->of_nodeas that doesn't explicitly depend on the platform type.
Quoted 6 lines
Note that
CONFIG_OFis also set for ARM-legacy (and soon for SH). But that's a minor problem. But due to the runtime check onpfc->dev->of_node, the unused code below won't be left out by the compiler, and I want to get rid of that code.The platform check make it clear when the code can be removed.
Not any time soon I'm afraid as arch/sh won't fully move to DT in the near future, but ARCH_SHMOBILE_LEGACY should go away soon, so I'm fine with compile-time optimization.
Quoted 12 lines
Quoted 9 lines
As the code after this if block also don't need to run on non-DT platforms,
how about just usingif (IS_ENABLED(CONFIG_OF) && pfc->dev->of_node) return 0;?
Early return is indeed an option, as we don't need the function GPIOs on DT platforms.
Signature · 3 lines
Regards, Laurent Pinchart
PATCH 5/7 pinctrl: sh-pfc: Remove empty gpio_function_free()
In reply to Geert Uytterhoevengpio_chip.free() is optional, and can just be left unimplemented.
---
Untested due to lack of hardware (used on sh only).
--- drivers/pinctrl/sh-pfc/gpio.c | 5 ----- 1 file changed, 5 deletions(-)
drivers/pinctrl/sh-pfc/gpio.c +0 -5
@@ -286,17 +286,12 @@ static int gpio_function_request(struct gpio_chip *gc, unsigned offset)return ret; } -static void gpio_function_free (struct gpio_chip *gc,unsigned offset) -{ -} -static int gpio_function_setup (struct sh_pfc_chip *chip) {struct sh_pfc *pfc = chip->pfc;struct gpio_chip *gc = &chip->gpio_chip; gc->request = gpio_function_request; - gc->free = gpio_function_free; gc->label = pfc->info->name; gc->owner =THIS_MODULE ;
Signature · 1 line
1.9.1
PATCH 5/7 pinctrl: sh-pfc: Remove empty gpio_function_free()
Hi Geert,
Thank you for the patch.
Quoted 3 lines · On Tuesday 30 June 2015 09:45:25 Geert Uytterhoeven wrote:
gpio_chip.free()is optional, and can just be left unimplemented.Signed-off-by Geert Uytterhoeven <[email protected]>
Quoted 28 lines
---
Untested due to lack of hardware (used on sh only).--- drivers/pinctrl/sh-pfc/gpio.c | 5 ----- 1 file changed, 5 deletions(-)drivers/pinctrl/sh-pfc/gpio.c +0
-5@@ -286,17 +286,12 @@ static int gpio_function_request(struct gpio_chip *gc, unsigned offset) return ret; } -static void gpio_function_free (struct gpio_chip *gc,unsigned offset) -{ -} -static int gpio_function_setup (struct sh_pfc_chip *chip) {struct sh_pfc *pfc = chip->pfc;struct gpio_chip *gc = &chip->gpio_chip; gc->request = gpio_function_request; - gc->free = gpio_function_free; gc->label = pfc->info->name; gc->owner =THIS_MODULE ;
Signature · 3 lines
Regards, Laurent Pinchart
PATCH 6/7 pinctrl: sh-pfc: Move sh_pfc_add_gpiochip() up
In reply to Geert UytterhoevenMove sh_pfc_add_gpiochip() to the generic helper section at the top of the file, so it can be called from the "Function GPIOs" section later.
--- drivers/pinctrl/sh-pfc/gpio.c | 58 +++++++++++++++++++++---------------------- 1 file changed, 29 insertions(+), 29 deletions(-)
drivers/pinctrl/sh-pfc/gpio.c +29 -29
@@ -131,6 +131,35 @@ static int gpio_setup_data_regs(struct sh_pfc_chip *chip)return 0 ; } +static struct sh_pfc_chip * +sh_pfc_add_gpiochip (struct sh_pfc *pfc,int (*setup)(struct sh_pfc_chip *), +struct sh_pfc_window *mem) +{ +struct sh_pfc_chip *chip; +int ret; + + chip =devm_kzalloc (pfc->dev,sizeof (*chip),GFP_KERNEL ); +if (unlikely (!chip)) +return ERR_PTR (-ENOMEM ); + + chip->mem = mem; + chip->pfc = pfc; + + ret =setup (chip); +if (ret <0 ) +return ERR_PTR (ret); + + ret =gpiochip_add (&chip->gpio_chip); +if (unlikely (ret <0 )) +return ERR_PTR (ret); + +dev_info (pfc->dev,"%s handling gpio %u -> %u\n" , + chip->gpio_chip.label, chip->gpio_chip.base, + chip->gpio_chip.base + chip->gpio_chip.ngpio -1 ); + +return chip; +} +/* ----------------------------------------------------------------------------- * Pin GPIOs */
@@ -305,35 +334,6 @@ static int gpio_function_setup(struct sh_pfc_chip *chip)* Register/unregister */ -static struct sh_pfc_chip * -sh_pfc_add_gpiochip (struct sh_pfc *pfc,int (*setup)(struct sh_pfc_chip *), -struct sh_pfc_window *mem) -{ -struct sh_pfc_chip *chip; -int ret; - - chip =devm_kzalloc (pfc->dev,sizeof (*chip),GFP_KERNEL ); -if (unlikely (!chip)) -return ERR_PTR (-ENOMEM ); - - chip->mem = mem; - chip->pfc = pfc; - - ret =setup (chip); -if (ret <0 ) -return ERR_PTR (ret); - - ret =gpiochip_add (&chip->gpio_chip); -if (unlikely (ret <0 )) -return ERR_PTR (ret); - -dev_info (pfc->dev,"%s handling gpio %u -> %u\n" , - chip->gpio_chip.label, chip->gpio_chip.base, - chip->gpio_chip.base + chip->gpio_chip.ngpio -1 ); - -return chip; -} -int sh_pfc_register_gpiochip (struct sh_pfc *pfc) {struct sh_pfc_chip *chip;
Signature · 1 line
1.9.1
PATCH 6/7 pinctrl: sh-pfc: Move sh_pfc_add_gpiochip() up
Hi Geert,
Thank you for the patch.
Quoted 4 lines · On Tuesday 30 June 2015 09:45:26 Geert Uytterhoeven wrote:
Move
sh_pfc_add_gpiochip()to the generic helper section at the top of the file, so it can be called from the "Function GPIOs" section later.Signed-off-by Geert Uytterhoeven <[email protected]>
Quoted 81 lines
--- drivers/pinctrl/sh-pfc/gpio.c | 58 +++++++++++++++++++-------------------- 1 file changed, 29 insertions(+), 29 deletions(-)drivers/pinctrl/sh-pfc/gpio.c +29
-31@@ -131,6 +131,35 @@ static int gpio_setup_data_regs(struct sh_pfc_chip *chip) return 0; } +static struct sh_pfc_chip * +sh_pfc_add_gpiochip (struct sh_pfc *pfc,int (*setup)(struct sh_pfc_chip *), +struct sh_pfc_window *mem) +{ +struct sh_pfc_chip *chip; +int ret; + + chip =devm_kzalloc (pfc->dev,sizeof (*chip),GFP_KERNEL ); +if (unlikely (!chip)) +return ERR_PTR (-ENOMEM ); + + chip->mem = mem; + chip->pfc = pfc; + + ret =setup (chip); +if (ret <0 ) +return ERR_PTR (ret); + + ret =gpiochip_add (&chip->gpio_chip); +if (unlikely (ret <0 )) +return ERR_PTR (ret); + +dev_info (pfc->dev,"%s handling gpio %u -> %u\n" , + chip->gpio_chip.label, chip->gpio_chip.base, + chip->gpio_chip.base + chip->gpio_chip.ngpio -1 ); + +return chip; +} +/* --------------------------------------------------------------------------- -- * Pin GPIOs */ @@ -305,35 +334,6 @@ static int gpio_function_setup(struct sh_pfc_chip*chip) * Register/unregister */ -static struct sh_pfc_chip * -sh_pfc_add_gpiochip (struct sh_pfc *pfc,int (*setup)(struct sh_pfc_chip *), -struct sh_pfc_window *mem) -{ -struct sh_pfc_chip *chip; -int ret; - - chip =devm_kzalloc (pfc->dev,sizeof (*chip),GFP_KERNEL ); -if (unlikely (!chip)) -return ERR_PTR (-ENOMEM ); - - chip->mem = mem; - chip->pfc = pfc; - - ret =setup (chip); -if (ret <0 ) -return ERR_PTR (ret); - - ret =gpiochip_add (&chip->gpio_chip); -if (unlikely (ret <0 )) -return ERR_PTR (ret); - -dev_info (pfc->dev,"%s handling gpio %u -> %u\n" , - chip->gpio_chip.label, chip->gpio_chip.base, - chip->gpio_chip.base + chip->gpio_chip.ngpio -1 ); - -return chip; -} -int sh_pfc_register_gpiochip (struct sh_pfc *pfc) {struct sh_pfc_chip *chip;
Signature · 3 lines
Regards, Laurent Pinchart
PATCH 7/7 pinctrl: sh-pfc: Confine legacy function GPIOs to SH
In reply to Geert UytterhoevenLegacy function GPIOs are no longer used on ARM since commit a27c5cd1a08cc95c ("sh-pfc: sh73a0: Remove function GPIOs"). Extract its setup code into a separate function, and make all function GPIO related code and data depend on CONFIG_SUPERH.
---
Compile-tested on sh using se7724_defconfig.
--- drivers/pinctrl/sh-pfc/core.h | 2 ++ drivers/pinctrl/sh-pfc/gpio.c | 39 ++++++++++++++++++++++++++++----------- drivers/pinctrl/sh-pfc/sh_pfc.h | 2 ++ 3 files changed, 32 insertions(+), 11 deletions(-)
drivers/pinctrl/sh-pfc/core.h +2 -0
@@ -46,7 +46,9 @@ struct sh_pfc {unsigned int nr_gpio_pins;struct sh_pfc_chip *gpio; +#ifdef CONFIG_SUPERH struct sh_pfc_chip *func; +#endif struct sh_pfc_pinctrl *pinctrl; };
drivers/pinctrl/sh-pfc/gpio.c +28 -11
@@ -290,6 +290,7 @@ static int gpio_pin_setup(struct sh_pfc_chip *chip)* Function GPIOs */ +#ifdef CONFIG_SUPERH static int gpio_function_request (struct gpio_chip *gc,unsigned offset) {static bool __print_once;
@@ -330,6 +331,31 @@ static int gpio_function_setup(struct sh_pfc_chip *chip) return 0; } +static int sh_pfc_add_function_gpios (struct sh_pfc *pfc) +{ +struct sh_pfc_chip *chip; + +if (!pfc->info->nr_func_gpios) +return 0 ; + + chip =sh_pfc_add_gpiochip (pfc, gpio_function_setup,NULL ); +if (IS_ERR (chip)) +return PTR_ERR (chip); + + pfc->func = chip; + +return 0 ; +} + +static void sh_pfc_remove_function_gpios (struct sh_pfc *pfc) +{ +gpiochip_remove (&pfc->func->gpio_chip); +} +#else +static inline int sh_pfc_add_function_gpios (struct sh_pfc *pfc) {return 0 ; } +static inline int sh_pfc_remove_function_gpios (struct sh_pfc *pfc) {return 0 ; } +#endif +/* ----------------------------------------------------------------------------- * Register/unregister */
@@ -397,22 +423,13 @@ int sh_pfc_register_gpiochip(struct sh_pfc *pfc) }/* Register the function GPIOs chip. */ -if (pfc->info->nr_func_gpios ==0 ) -return 0 ; - - chip =sh_pfc_add_gpiochip (pfc, gpio_function_setup,NULL ); -if (IS_ERR (chip)) -return PTR_ERR (chip); - - pfc->func = chip; - -return 0 ; +return sh_pfc_add_function_gpios (pfc); }int sh_pfc_unregister_gpiochip (struct sh_pfc *pfc) {gpiochip_remove (&pfc->gpio->gpio_chip); -gpiochip_remove (&pfc->func->gpio_chip); +sh_pfc_remove_function_gpios (pfc);return 0 ; }
drivers/pinctrl/sh-pfc/sh_pfc.h +2 -0
@@ -138,8 +138,10 @@ struct sh_pfc_soc_info {const struct sh_pfc_function *functions;unsigned int nr_functions; +#ifdef CONFIG_SUPERH const struct pinmux_func *func_gpios;unsigned int nr_func_gpios; +#endif const struct pinmux_cfg_reg *cfg_regs;const struct pinmux_data_reg *data_regs;
Signature · 1 line
1.9.1
PATCH 7/7 pinctrl: sh-pfc: Confine legacy function GPIOs to SH
Hi Geert,
Thank you for the patch.
Quoted 59 lines · On Tuesday 30 June 2015 09:45:27 Geert Uytterhoeven wrote:
Legacy function GPIOs are no longer used on ARM since commit
a27c5cd1a08cc95c("sh-pfc: sh73a0: Remove function GPIOs"). Extract its setup code into a separate function, and make all function GPIO related code and data depend onCONFIG_SUPERH.Signed-off-by Geert Uytterhoeven <[email protected]>---
Compile-tested on sh usingse7724_defconfig.--- drivers/pinctrl/sh-pfc/core.h | 2 ++ drivers/pinctrl/sh-pfc/gpio.c | 39 ++++++++++++++++++++++++++---------- drivers/pinctrl/sh-pfc/sh_pfc.h | 2 ++ 3 files changed, 32 insertions(+), 11 deletions(-)drivers/pinctrl/sh-pfc/core.h +2
-0@@ -46,7 +46,9 @@ struct sh_pfc {unsigned int nr_gpio_pins;struct sh_pfc_chip *gpio; +#ifdef CONFIG_SUPERH struct sh_pfc_chip *func; +#endif struct sh_pfc_pinctrl *pinctrl; };drivers/pinctrl/sh-pfc/gpio.c +16
-0@@ -290,6 +290,7 @@ static int gpio_pin_setup(struct sh_pfc_chip *chip)* Function GPIOs */ +#ifdef CONFIG_SUPERH static int gpio_function_request (struct gpio_chip *gc,unsigned offset) {static bool __print_once;@@ -330,6 +331,31 @@ static int gpio_function_setup(struct sh_pfc_chip *chip) return 0; } +static int sh_pfc_add_function_gpios (struct sh_pfc *pfc) +{ +struct sh_pfc_chip *chip; + +if (!pfc->info->nr_func_gpios) +return 0 ; + + chip =sh_pfc_add_gpiochip (pfc, gpio_function_setup,NULL ); +if (IS_ERR (chip)) +return PTR_ERR (chip); + + pfc->func = chip; + +return 0 ; +}
drivers/pinctrl/sh-pfc/gpio.c static int gpio_function_setup(struct sh_pfc_chip · line 358
Quoted 10 lines
drivers/pinctrl/sh-pfc/gpio.c +8
-0+ +static void sh_pfc_remove_function_gpios (struct sh_pfc *pfc) +{ +gpiochip_remove (&pfc->func->gpio_chip); +} +#else +static inline int sh_pfc_add_function_gpios (struct sh_pfc *pfc) {return 0 ; } +static inline int sh_pfc_remove_function_gpios (struct sh_pfc *pfc) {return 0 ; }
Given that those functions are only called from a single location, would it make sense to just compile the calls conditionally instead ? I would find that slightly more readable as it would be more explicit.
Quoted 47 lines
drivers/pinctrl/sh-pfc/gpio.c +4
-13+#endif +/* --------------------------------------------------------------------------- -- * Register/unregister */ @@ -397,22 +423,13 @@ int sh_pfc_register_gpiochip(struct sh_pfc *pfc) }/* Register the function GPIOs chip. */ -if (pfc->info->nr_func_gpios ==0 ) -return 0 ; - - chip =sh_pfc_add_gpiochip (pfc, gpio_function_setup,NULL ); -if (IS_ERR (chip)) -return PTR_ERR (chip); - - pfc->func = chip; - -return 0 ; +return sh_pfc_add_function_gpios (pfc); }int sh_pfc_unregister_gpiochip (struct sh_pfc *pfc) {gpiochip_remove (&pfc->gpio->gpio_chip); -gpiochip_remove (&pfc->func->gpio_chip); +sh_pfc_remove_function_gpios (pfc);return 0 ; }(quoted diff) +0
-0
b/drivers/pinctrl/sh-pfc/sh_pfc.hindexc7508d5f688613b2..c6f9163b3e23041f100644drivers/pinctrl/sh-pfc/sh_pfc.h +2
-0@@ -138,8 +138,10 @@ struct sh_pfc_soc_info {const struct sh_pfc_function *functions;unsigned int nr_functions; +#ifdef CONFIG_SUPERH const struct pinmux_func *func_gpios;unsigned int nr_func_gpios; +#endif const struct pinmux_cfg_reg *cfg_regs;const struct pinmux_data_reg *data_regs;
Signature · 3 lines
Regards, Laurent Pinchart
PATCH 7/7 pinctrl: sh-pfc: Confine legacy function GPIOs to SH
Hi Laurent,
Quoted 35 lines · Laurent Pinchart
Quoted 35 lines
drivers/pinctrl/sh-pfc/gpio.c +22
-0@@ -290,6 +290,7 @@ static int gpio_pin_setup(struct sh_pfc_chip *chip)* Function GPIOs */ +#ifdef CONFIG_SUPERH static int gpio_function_request (struct gpio_chip *gc,unsigned offset) {static bool __print_once;@@ -330,6 +331,31 @@ static int gpio_function_setup(struct sh_pfc_chip *chip) return 0; } +static int sh_pfc_add_function_gpios (struct sh_pfc *pfc) +{ +struct sh_pfc_chip *chip; + +if (!pfc->info->nr_func_gpios) +return 0 ; + + chip =sh_pfc_add_gpiochip (pfc, gpio_function_setup,NULL ); +if (IS_ERR (chip)) +return PTR_ERR (chip); + + pfc->func = chip; + +return 0 ; +} + +static void sh_pfc_remove_function_gpios (struct sh_pfc *pfc) +{ +gpiochip_remove (&pfc->func->gpio_chip); +} +#else
Quoted 8 lines
drivers/pinctrl/sh-pfc/gpio.c static int gpio_function_setup(struct sh_pfc_chip · line 358
Quoted 4 lines
drivers/pinctrl/sh-pfc/gpio.c +2
-0+static inline int sh_pfc_add_function_gpios (struct sh_pfc *pfc) {return 0 ; } +static inline int sh_pfc_remove_function_gpios (struct sh_pfc *pfc) {return 0 ; }Given that those functions are only called from a single location, would it make sense to just compile the calls conditionally instead ? I would find that slightly more readable as it would be more explicit.
If that's acceptable for you, that would be fine for me, too. One (or two) more visual cues for future removal of legacy code.
And then I can drop "[PATCH 6/7] pinctrl: sh-pfc: Move sh_pfc_add_gpiochip() up".
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert at linux-m68k.org
In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
cover ARM: shmobile: Move gpio ranges from C code to DT
In reply to Geert UytterhoevenQuoted 30 lines · Geert Uytterhoeven
Hi Linus, Alex, Laurent, Simon, Magnus,
This patch series moves the setup of the GPIO-PFC pin mapping for Renesas PFC/GPIO combos from C code to DT, and does some cleanups. The move to DT is needed to make the GPIO hogging mechanism work, cfr. the discussion following "[PATCH] [RFC] gpio: Retry deferred GPIO hogging on pin range change" (https://lkml.org/lkml/2015/6/16/455).
The series consists of 3 parts:
a. Patches 1-3 add the missing "gpio-ranges" properties to the dtsi
files for all affected SoCs,
b. Patch 4 disables the C code to set up the mapping on DT platforms
(it's still needed on SH or ARM-legacy),
c. Patches 5-7 do a few more cleanups in the sh-pfc gpio code.Dependencies:
- This series applies against next-next-20150630.
- Part a must go in first, to avoid regressions.
In addition, it's a prerequisite for "ARM: shmobile: armadillo800eva
dts: Add pinctrl and gpio-hog for lcdc0", which has been queued up already in Simon's dt-for-v4.3 branch. Perhaps it can still be reordered?
- While I didn't notice any bad behavior by having part a only, part b should go in immediately after part a. Hence I think it's best if Simon can take this one, too.
- Part c is independent (it doesn't touch the same code), so it can go in before or after the other parts, or in parallel.Thanks for applying!
Quoted 8 lines
Geert Uytterhoeven (7):
ARM: shmobile: r8a73a4 dtsi: Add missing "gpio-ranges" to gpio node
ARM: shmobile: r8a7740 dtsi: Add missing "gpio-ranges" to gpio node
ARM: shmobile: sh73a0 dtsi: Add missing "gpio-ranges" to gpio node
pinctrl: sh-pfc: Stop callinggpiochip_add_pin_range()on DT platforms
pinctrl: sh-pfc: Remove emptygpio_function_free()
pinctrl: sh-pfc: Movesh_pfc_add_gpiochip()up
pinctrl: sh-pfc: Confine legacy function GPIOs to SH
I'm happy of shmobile people are happy.
For all.
Yours,
Linus Walleij
cover ARM: shmobile: Move gpio ranges from C code to DT
Hi Linus,
Quoted 39 lines · Linus Walleij
Quoted 28 lines · Geert Uytterhoeven
This patch series moves the setup of the GPIO-PFC pin mapping for Renesas PFC/GPIO combos from C code to DT, and does some cleanups. The move to DT is needed to make the GPIO hogging mechanism work, cfr. the discussion following "[PATCH] [RFC] gpio: Retry deferred GPIO hogging on pin range change" (https://lkml.org/lkml/2015/6/16/455).
The series consists of 3 parts:
a. Patches 1-3 add the missing "gpio-ranges" properties to the dtsi
files for all affected SoCs,
b. Patch 4 disables the C code to set up the mapping on DT platforms
(it's still needed on SH or ARM-legacy),
c. Patches 5-7 do a few more cleanups in the sh-pfc gpio code.Dependencies:
- This series applies against next-next-20150630.
- Part a must go in first, to avoid regressions.
In addition, it's a prerequisite for "ARM: shmobile: armadillo800eva
dts: Add pinctrl and gpio-hog for lcdc0", which has been queued up already in Simon's dt-for-v4.3 branch. Perhaps it can still be reordered?
- While I didn't notice any bad behavior by having part a only, part b should go in immediately after part a. Hence I think it's best if Simon can take this one, too.
- Part c is independent (it doesn't touch the same code), so it can go in before or after the other parts, or in parallel.Thanks for applying!
Quoted 8 lines
Geert Uytterhoeven (7):
ARM: shmobile: r8a73a4 dtsi: Add missing "gpio-ranges" to gpio node
ARM: shmobile: r8a7740 dtsi: Add missing "gpio-ranges" to gpio node
ARM: shmobile: sh73a0 dtsi: Add missing "gpio-ranges" to gpio node
pinctrl: sh-pfc: Stop callinggpiochip_add_pin_range()on DT platforms
pinctrl: sh-pfc: Remove emptygpio_function_free()
pinctrl: sh-pfc: Movesh_pfc_add_gpiochip()up
pinctrl: sh-pfc: Confine legacy function GPIOs to SH
Quoted 1 line
I'm happy of shmobile people are happy.
Laurent was mostly worried about the phandle in the "gpio-ranges" property pointing to the gpio/pfc combo node itself. Do you see any issues with that?
As there were comments on some of the patches, I have to resend this series anyway...
Quoted 1 line
Acked-by Linus Walleij <[email protected]>
Thanks!
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert at linux-m68k.org
In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds