* [PATCH] pinctrl: core: Handling pinmux and pinconf separately
@ 2021-03-10 8:16 Michal Simek
2021-03-11 0:01 ` Linus Walleij
0 siblings, 1 reply; 2+ messages in thread
From: Michal Simek @ 2021-03-10 8:16 UTC (permalink / raw)
To: linux-kernel, monstr, michal.simek, git, Linus Walleij; +Cc: linux-gpio
Right now the handling order depends on how entries are coming which is
corresponding with order in DT. We have reached the case with DT overlays
where conf and mux descriptions are exchanged which ends up in sequence
that firmware has been asked to perform configuration before requesting the
pin.
The patch is enforcing the order that pin is requested all the time first
followed by pin configuration. This change will ensure that firmware gets
requests in the right order.
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
---
drivers/pinctrl/core.c | 23 ++++++++++++++++++++++-
1 file changed, 22 insertions(+), 1 deletion(-)
diff --git a/drivers/pinctrl/core.c b/drivers/pinctrl/core.c
index 7d3370289938..f5c32d2a3c91 100644
--- a/drivers/pinctrl/core.c
+++ b/drivers/pinctrl/core.c
@@ -1258,13 +1258,34 @@ static int pinctrl_commit_state(struct pinctrl *p, struct pinctrl_state *state)
p->state = NULL;
- /* Apply all the settings for the new state */
+ /* Apply all the settings for the new state - pinmux first */
list_for_each_entry(setting, &state->settings, node) {
switch (setting->type) {
case PIN_MAP_TYPE_MUX_GROUP:
ret = pinmux_enable_setting(setting);
break;
case PIN_MAP_TYPE_CONFIGS_PIN:
+ case PIN_MAP_TYPE_CONFIGS_GROUP:
+ break;
+ default:
+ ret = -EINVAL;
+ break;
+ }
+
+ if (ret < 0)
+ goto unapply_new_state;
+
+ /* Do not link hogs (circular dependency) */
+ if (p != setting->pctldev->p)
+ pinctrl_link_add(setting->pctldev, p->dev);
+ }
+
+ /* Apply all the settings for the new state - pinconf after */
+ list_for_each_entry(setting, &state->settings, node) {
+ switch (setting->type) {
+ case PIN_MAP_TYPE_MUX_GROUP:
+ break;
+ case PIN_MAP_TYPE_CONFIGS_PIN:
case PIN_MAP_TYPE_CONFIGS_GROUP:
ret = pinconf_apply_setting(setting);
break;
--
2.30.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] pinctrl: core: Handling pinmux and pinconf separately
2021-03-10 8:16 [PATCH] pinctrl: core: Handling pinmux and pinconf separately Michal Simek
@ 2021-03-11 0:01 ` Linus Walleij
0 siblings, 0 replies; 2+ messages in thread
From: Linus Walleij @ 2021-03-11 0:01 UTC (permalink / raw)
To: Michal Simek
Cc: linux-kernel@vger.kernel.org, Michal Simek, git,
open list:GPIO SUBSYSTEM
On Wed, Mar 10, 2021 at 9:16 AM Michal Simek <michal.simek@xilinx.com> wrote:
> Right now the handling order depends on how entries are coming which is
> corresponding with order in DT. We have reached the case with DT overlays
> where conf and mux descriptions are exchanged which ends up in sequence
> that firmware has been asked to perform configuration before requesting the
> pin.
> The patch is enforcing the order that pin is requested all the time first
> followed by pin configuration. This change will ensure that firmware gets
> requests in the right order.
>
> Signed-off-by: Michal Simek <michal.simek@xilinx.com>
This looks right to me so I simply applied the patch so it gets some
testing in linux-next.
If there are problems on some platform(s) we will get to know.
Yours,
Linus Walleij
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2021-03-11 0:02 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-03-10 8:16 [PATCH] pinctrl: core: Handling pinmux and pinconf separately Michal Simek
2021-03-11 0:01 ` Linus Walleij
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).