pinctrl: imx: use generic pinctrl helpers
Subsystems (4)
cover pinctrl: imx: use generic pinctrl helpers
Hi all,
This series is a follow-up to Linus suggestion to use the generic helpers introduced by Tony [1].
Mainly I've used the generic functions in pinctrl_ops and pinmux_ops and switched to the generic group/function_desc structures instead of the imx-specific one that didn't bring anything special.
However I couldn't use the 'add' functions to add elements since the parsing is done at probe time in its own way. So I've kept the radix_insert functions. This could be modified in the future though.
Regards,
Gary
[1] http://www.spinics.net/lists/devicetree/msg155984.html
Gary Bisson (2):
pinctrl: imx: use generic pinctrl helpers for managing groups
pinctrl: imx: use generic pinmux helpers for managing functions
drivers/pinctrl/freescale/Kconfig | 3 +- drivers/pinctrl/freescale/pinctrl-imx.c | 286 ++++++++++---------------------- drivers/pinctrl/freescale/pinctrl-imx.h | 33 +--- 3 files changed, 87 insertions(+), 235 deletions(-)
Signature · 1 line
2.11.0
PATCH 1/2 pinctrl: imx: use generic pinctrl helpers for managing groups
Now using group_desc structure instead of imx_pin_group.
Also leveraging generic functions to retrieve groups count/name/pins.
The imx_free_pingroups function can be removed since it is now handled by the core driver during unregister.
Finally the device tree parsing is moved after the pinctrl driver registration since this latter initializes the radix trees.
--- drivers/pinctrl/freescale/Kconfig | 1 + drivers/pinctrl/freescale/pinctrl-imx.c | 190 +++++++++++--------------------- drivers/pinctrl/freescale/pinctrl-imx.h | 19 +--- 3 files changed, 69 insertions(+), 141 deletions(-)
drivers/pinctrl/freescale/Kconfig +1 -0
@@ -1,5 +1,6 @@ config PINCTRL_IMX bool + select GENERIC_PINCTRL_GROUPS select PINMUX select PINCONF select REGMAP
drivers/pinctrl/freescale/pinctrl-imx.c +67 -123
385 lines not on this page · raw message
drivers/pinctrl/freescale/pinctrl-imx.h +1 -18
@@ -18,7 +18,7 @@struct platform_device ;/** -* struct imx_pin_group - describes a single i.MX pin +* struct imx_pin - describes a single i.MX pin * @pin: the pin_id of this pin * @mux_mode: the mux mode for this pin. * @input_reg: the select input register offset for this pin if any
@@ -35,21 +35,6 @@ struct imx_pin { };/** -* struct imx_pin_group - describes an IMX pin group -* @name: the name of this specific pin group -* @npins: the number of pins in this group array, i.e. the number of -* elements in .pins so we can iterate over that array -* @pin_ids: array of pin_ids. pinctrl forces us to maintain such an array -* @pins: array of pins -*/ -struct imx_pin_group { -const char *name; -unsigned npins; -unsigned int *pin_ids; -struct imx_pin *pins; -}; - -/** * struct imx_pmx_func - describes IMX pinmux functions * @name: the name of this specific function * @groups: corresponding pin groups
@@ -76,13 +61,11 @@ struct imx_pinctrl_soc_info {const struct pinctrl_pin_desc *pins;unsigned int npins;struct imx_pin_reg *pin_regs; -unsigned int ngroups;unsigned int group_index;unsigned int nfunctions;unsigned int flags;const char *gpr_compatible;struct radix_tree_root ftree; -struct radix_tree_root pgtree;struct mutex mutex; };
Signature · 1 line
2.11.0
PATCH 2/2 pinctrl: imx: use generic pinmux helpers for managing functions
In reply to Gary BissonNow using function_desc structure instead of imx_pmx_func.
Also leveraging generic functions to retrieve functions count/name/groups.
The imx_free_funcs function can be removed since it is now handled by the core driver during unregister.
--- drivers/pinctrl/freescale/Kconfig | 2 +- drivers/pinctrl/freescale/pinctrl-imx.c | 96 ++++++--------------------------- drivers/pinctrl/freescale/pinctrl-imx.h | 14 ----- 3 files changed, 18 insertions(+), 94 deletions(-)
drivers/pinctrl/freescale/Kconfig +1 -1
@@ -1,7 +1,7 @@ config PINCTRL_IMX bool select GENERIC_PINCTRL_GROUPS - select PINMUX + select GENERIC_PINMUX_FUNCTIONS select PINCONF select REGMAP
drivers/pinctrl/freescale/pinctrl-imx.c +17 -79
179 lines not on this page · raw message
drivers/pinctrl/freescale/pinctrl-imx.h +0 -14
@@ -35,18 +35,6 @@ struct imx_pin { };/** -* struct imx_pmx_func - describes IMX pinmux functions -* @name: the name of this specific function -* @groups: corresponding pin groups -* @num_groups: the number of groups -*/ -struct imx_pmx_func { -const char *name; -const char **groups; -unsigned num_groups; -}; - -/** * struct imx_pin_reg - describe a pin reg map * @mux_reg: mux register offset * @conf_reg: config register offset
@@ -62,10 +50,8 @@ struct imx_pinctrl_soc_info {unsigned int npins;struct imx_pin_reg *pin_regs;unsigned int group_index; -unsigned int nfunctions;unsigned int flags;const char *gpr_compatible; -struct radix_tree_root ftree;struct mutex mutex; };
Signature · 1 line
2.11.0
Re: [PATCH 1/2] pinctrl: imx: use generic pinctrl helpers for managing groups
In reply to Gary BissonQuoted 11 lines · Gary Bisson
Now using
group_descstructure instead ofimx_pin_group.Also leveraging generic functions to retrieve groups count/name/pins.
The
imx_free_pingroupsfunction can be removed since it is now handled by the core driver during unregister.Finally the device tree parsing is moved after the pinctrl driver registration since this latter initializes the radix trees.
Signed-off-by Gary Bisson <[email protected]>
Patch applied.
Yours,
Linus Walleij
Re: [PATCH 2/2] pinctrl: imx: use generic pinmux helpers for managing functions
In reply to Gary BissonQuoted 8 lines · Gary Bisson
Now using
function_descstructure instead ofimx_pmx_func.Also leveraging generic functions to retrieve functions count/name/groups.
The
imx_free_funcsfunction can be removed since it is now handled by the core driver during unregister.Signed-off-by Gary Bisson <[email protected]>
Patch applied.
Yours,
Linus Walleij
Quoted 6 lines · Gary Bisson
This series is a follow-up to Linus suggestion to use the generic helpers introduced by Tony [1].
Mainly I've used the generic functions in
pinctrl_opsandpinmux_opsand switched to the generic group/function_desc structures instead of the imx-specific one that didn't bring anything special.
Awesome job. Really nice!
Quoted 3 lines
However I couldn't use the 'add' functions to add elements since the parsing is done at probe time in its own way. So I've kept the
radix_insertfunctions. This could be modified in the future though.
Let's see if Tony has some ideas. We already save a bunch of code by this which is very nice.
Yours,
Linus Walleij
Quoted 10 lines · Linus Walleij
Quoted 6 lines · Gary Bisson
This series is a follow-up to Linus suggestion to use the generic helpers introduced by Tony [1].
Mainly I've used the generic functions in
pinctrl_opsandpinmux_opsand switched to the generic group/function_desc structures instead of the imx-specific one that didn't bring anything special.
Quoted 8 lines
Awesome job. Really nice!
Quoted 3 lines
However I couldn't use the 'add' functions to add elements since the parsing is done at probe time in its own way. So I've kept the
radix_insertfunctions. This could be modified in the future though.Let's see if Tony has some ideas. We already save a bunch of code by this which is very nice.
I attempted a generic iterator in the ti-iodelay.c but so far did not really manage to simplify it at all..
Tony
Fabio Estevam
maintainerRe: [PATCH 1/2] pinctrl: imx: use generic pinctrl helpers for managing groups
In reply to Gary BissonHi Gary,
Quoted 11 lines · Gary Bisson
Now using
group_descstructure instead ofimx_pin_group.Also leveraging generic functions to retrieve groups count/name/pins.
The
imx_free_pingroupsfunction can be removed since it is now handled by the core driver during unregister.Finally the device tree parsing is moved after the pinctrl driver registration since this latter initializes the radix trees.
Signed-off-by Gary Bisson <[email protected]>
This patch is in 4.11-rc1 now and it causes a regression on the hog group:
[ 0.061005] imx6q-pinctrl 20e0000.iomuxc: unable to find group for
node hoggrp
The hog pins can no longer be initialized.
Could you take a look, please?
Fabio Estevam
maintainerRe: [PATCH 1/2] pinctrl: imx: use generic pinctrl helpers for managing groups
In reply to Gary BissonHi Gary,
Quoted 5 lines · Gary Bisson
No it isn't because of the use of radix but instead of:
http://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=950b0d91dc10It has been discussed here:
https://lkml.org/lkml/2017/2/28/140
Thanks for the clarification.
Quoted 2 lines
Tony offered a patch in that thread which works. Tony, have you submitted it yet?
Looking forward to this one :-)
Thanks
Re: [PATCH 1/2] pinctrl: imx: use generic pinctrl helpers for managing groups
Quoted 11 lines · Fabio Estevam
Hi Gary,
Quoted 5 lines · Gary Bisson
No it isn't because of the use of radix but instead of:
http://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=950b0d91dc10It has been discussed here:
https://lkml.org/lkml/2017/2/28/140
Quoted 6 lines
Thanks for the clarification.
Quoted 2 lines
Tony offered a patch in that thread which works. Tony, have you submitted it yet?
Looking forward to this one :-)
Still waiting to hear back from Linus on what he prefers.
Regards,
Tony
Re: [PATCH 1/2] pinctrl: imx: use generic pinctrl helpers for managing groups
In reply to Fabio EstevamHi Fabio,
Quoted 16 lines · Fabio Estevam
Hi Gary,
Quoted 11 lines · Gary Bisson
Now using
group_descstructure instead ofimx_pin_group.Also leveraging generic functions to retrieve groups count/name/pins.
The
imx_free_pingroupsfunction can be removed since it is now handled by the core driver during unregister.Finally the device tree parsing is moved after the pinctrl driver registration since this latter initializes the radix trees.
Signed-off-by Gary Bisson <[email protected]>
Quoted 8 lines
This patch is in 4.11-rc1 now and it causes a regression on the hog group:
[ 0.061005] imx6q-pinctrl 20e0000.iomuxc: unable to find group fornode hoggrp
The hog pins can no longer be initialized.
Could you take a look, please?
No it isn't because of the use of radix but instead of:
http://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=950b0d91dc10
It has been discussed here:
https://lkml.org/lkml/2017/2/28/140
Tony offered a patch in that thread which works. Tony, have you submitted it yet?
Regards,
Gary
Re: [PATCH 1/2] pinctrl: imx: use generic pinctrl helpers for managing groups
In reply to Tony LindgrenQuoted 12 lines · Tony Lindgren
Quoted 11 lines · Fabio Estevam
Hi Gary,
Quoted 5 lines · Gary Bisson
No it isn't because of the use of radix but instead of:
http://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=950b0d91dc10It has been discussed here:
https://lkml.org/lkml/2017/2/28/140
Quoted 8 lines
Quoted 6 lines
Thanks for the clarification.
Quoted 2 lines
Tony offered a patch in that thread which works. Tony, have you submitted it yet?
Looking forward to this one :-)
Still waiting to hear back from Linus on what he prefers.
I am snowed under by mail and might be missing stuff at the moment...
If there is some especially urgent fix patch I need to look into can you please point it out?
Yours,
Linus Walleij
Fabio Estevam
maintainerRe: [PATCH 1/2] pinctrl: imx: use generic pinctrl helpers for managing groups
Tony/Linus
Quoted 7 lines · Linus Walleij
Quoted 1 line
Still waiting to hear back from Linus on what he prefers.
I am snowed under by mail and might be missing stuff at the moment...
If there is some especially urgent fix patch I need to look into can you please point it out?
Has this issue been solved in linux-next? Still seeing this regression in 4.11-rc4.
Thanks
Re: [PATCH 1/2] pinctrl: imx: use generic pinctrl helpers for managing groups
Quoted 6 lines · Fabio Estevam
Tony/Linus
Quoted 2 lines · Linus Walleij
Quoted 1 line
Still waiting to hear back from Linus on what he prefers.
Quoted 8 lines
Quoted 5 lines
I am snowed under by mail and might be missing stuff at the moment...
If there is some especially urgent fix patch I need to look into can you please point it out?
Has this issue been solved in linux-next? Still seeing this regression in 4.11-rc4.
Yeah I was wondering about that too. We discussed using Mika's patch
[0] but with minor changes [1]. But we have not heard back from Mika, I wonder if he is travelling or something?
Would be nice to get this regression fixed.
Regards,
Tony
[0] https://lkml.org/lkml/2017/2/28/24
[1] https://lkml.org/lkml/2017/3/16/285
Re: [PATCH 1/2] pinctrl: imx: use generic pinctrl helpers for managing groups
In reply to Fabio EstevamQuoted 6 lines · Fabio Estevam
Tony/Linus
Quoted 2 lines · Linus Walleij
Quoted 1 line
Still waiting to hear back from Linus on what he prefers.
Quoted 8 lines
Quoted 5 lines
I am snowed under by mail and might be missing stuff at the moment...
If there is some especially urgent fix patch I need to look into can you please point it out?
Has this issue been solved in linux-next? Still seeing this regression in 4.11-rc4.
I'm a bit relying on others to test and supply patches here, if Tony's patch works for you you can send it with your own Signed-off-by and suggest that I merge it.
Yours,
Linus Walleij
Re: [PATCH 1/2] pinctrl: imx: use generic pinctrl helpers for managing groups
Quoted 13 lines · Linus Walleij
Quoted 12 lines · Fabio Estevam
Tony/Linus
Quoted 7 lines · Linus Walleij
Quoted 1 line
Still waiting to hear back from Linus on what he prefers.
I am snowed under by mail and might be missing stuff at the moment...
If there is some especially urgent fix patch I need to look into can you please point it out?
Quoted 6 lines
Quoted 2 lines
Has this issue been solved in linux-next? Still seeing this regression in 4.11-rc4.
I'm a bit relying on others to test and supply patches here, if Tony's patch works for you you can send it with your own Signed-off-by and suggest that I merge it.
I'll send a patch for testing shortly.
Regards,
Tony