Commit 0581b16b authored by Sebastian Hesselbarth's avatar Sebastian Hesselbarth Committed by Linus Walleij

pinctrl: mvebu: complain about missing group after checking variant

Common MVEBU pinctrl driver core gets an array of controls to modify
a specific set of registers and an array of modes for each pingroup
from each of the different SoC families of MVEBU.

Some SoC families comprise different variants that differ in available
pingroups and also controls, but to ease driver development, we can
pass a variant mask to disable specific pingroups for some variants.
However, controls are limited to the true number of pinctrl groups
avaiable on a variant.

Now, when pinctrl core driver parses over above arrays, it tries to
match modes with available controls and complains about missing
controls for modes that are passed to the core but actually are not
avaiable on a variant with:

kirkwood-pinctrl f1010000.pin-controller: unknown pinctrl group 36

This warning is a false-positive and annoying, so move the warning
after we checked the variant mask for each mode setting. Also, if
there is no supported setting for this variant, do not complain at
all.
Signed-off-by: default avatarSebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
Reported-by: default avatarLinus Walleij <linus.walleij@linaro.org>
Signed-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
parent c5cdcba3
...@@ -663,28 +663,20 @@ int mvebu_pinctrl_probe(struct platform_device *pdev) ...@@ -663,28 +663,20 @@ int mvebu_pinctrl_probe(struct platform_device *pdev)
/* assign mpp modes to groups */ /* assign mpp modes to groups */
for (n = 0; n < soc->nmodes; n++) { for (n = 0; n < soc->nmodes; n++) {
struct mvebu_mpp_mode *mode = &soc->modes[n]; struct mvebu_mpp_mode *mode = &soc->modes[n];
struct mvebu_pinctrl_group *grp = struct mvebu_mpp_ctrl_setting *set = &mode->settings[0];
mvebu_pinctrl_find_group_by_pid(pctl, mode->pid); struct mvebu_pinctrl_group *grp;
unsigned num_settings; unsigned num_settings;
if (!grp) { for (num_settings = 0; ; set++) {
dev_warn(&pdev->dev, "unknown pinctrl group %d\n",
mode->pid);
continue;
}
for (num_settings = 0; ;) {
struct mvebu_mpp_ctrl_setting *set =
&mode->settings[num_settings];
if (!set->name) if (!set->name)
break; break;
num_settings++;
/* skip unsupported settings for this variant */ /* skip unsupported settings for this variant */
if (pctl->variant && !(pctl->variant & set->variant)) if (pctl->variant && !(pctl->variant & set->variant))
continue; continue;
num_settings++;
/* find gpio/gpo/gpi settings */ /* find gpio/gpo/gpi settings */
if (strcmp(set->name, "gpio") == 0) if (strcmp(set->name, "gpio") == 0)
set->flags = MVEBU_SETTING_GPI | set->flags = MVEBU_SETTING_GPI |
...@@ -695,6 +687,17 @@ int mvebu_pinctrl_probe(struct platform_device *pdev) ...@@ -695,6 +687,17 @@ int mvebu_pinctrl_probe(struct platform_device *pdev)
set->flags = MVEBU_SETTING_GPI; set->flags = MVEBU_SETTING_GPI;
} }
/* skip modes with no settings for this variant */
if (!num_settings)
continue;
grp = mvebu_pinctrl_find_group_by_pid(pctl, mode->pid);
if (!grp) {
dev_warn(&pdev->dev, "unknown pinctrl group %d\n",
mode->pid);
continue;
}
grp->settings = mode->settings; grp->settings = mode->settings;
grp->num_settings = num_settings; grp->num_settings = num_settings;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment