Skip to content

Commit 8df639a

Browse files
committed
pinctrl: rp1: Allow legacy brcm,pins on all banks
Support the use of the brcm,pins property for GPIOs in banks 1 and 2, but only for inputs and outputs - no other legacy mapping. Signed-off-by: Phil Elwell <[email protected]>
1 parent 3465153 commit 8df639a

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

drivers/pinctrl/pinctrl-rp1.c

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -981,7 +981,16 @@ static int rp1_pctl_legacy_map_func(struct rp1_pinctrl *pc,
981981
return -EINVAL;
982982
}
983983

984-
func = legacy_fsel_map[pin][fnum];
984+
if (pin < ARRAY_SIZE(legacy_fsel_map)) {
985+
func = legacy_fsel_map[pin][fnum];
986+
} else if (fnum < 2) {
987+
func = func_gpio;
988+
} else {
989+
dev_err(pc->dev, "%pOF: invalid brcm,pins value %d\n",
990+
np, pin);
991+
return -EINVAL;
992+
}
993+
985994
if (func == func_invalid) {
986995
dev_err(pc->dev, "%pOF: brcm,function %d not supported on pin %d\n",
987996
np, fnum, pin);
@@ -1104,13 +1113,6 @@ static int rp1_pctl_dt_node_to_map(struct pinctrl_dev *pctldev,
11041113
err = of_property_read_u32_index(np, "brcm,pins", i, &pin);
11051114
if (err)
11061115
goto out;
1107-
if (pin >= ARRAY_SIZE(legacy_fsel_map)) {
1108-
dev_err(pc->dev, "%pOF: invalid brcm,pins value %d\n",
1109-
np, pin);
1110-
err = -EINVAL;
1111-
goto out;
1112-
}
1113-
11141116
if (num_funcs) {
11151117
err = of_property_read_u32_index(np, "brcm,function",
11161118
(num_funcs > 1) ? i : 0,

0 commit comments

Comments
 (0)