bcm27xx: bcm2712: backport RP1 interrupt affinity
[openwrt/staging/xback.git] / target / linux / bcm27xx / patches-6.1 / 961-3-pinctrl-rp1-Allow-legacy-brcm-pins-on-all-banks.patch
1 From d81e2fafab376d3975c46c5f477945384a38524d Mon Sep 17 00:00:00 2001
2 From: Phil Elwell <phil@raspberrypi.com>
3 Date: Thu, 4 Apr 2024 10:50:32 +0100
4 Subject: [PATCH 3/5] pinctrl: rp1: Allow legacy brcm,pins on all banks
5
6 Support the use of the brcm,pins property for GPIOs in banks 1 and 2,
7 but only for inputs and outputs - no other legacy mapping.
8
9 Signed-off-by: Phil Elwell <phil@raspberrypi.com>
10 ---
11 drivers/pinctrl/pinctrl-rp1.c | 18 ++++++++++--------
12 1 file changed, 10 insertions(+), 8 deletions(-)
13
14 --- a/drivers/pinctrl/pinctrl-rp1.c
15 +++ b/drivers/pinctrl/pinctrl-rp1.c
16 @@ -981,7 +981,16 @@ static int rp1_pctl_legacy_map_func(stru
17 return -EINVAL;
18 }
19
20 - func = legacy_fsel_map[pin][fnum];
21 + if (pin < ARRAY_SIZE(legacy_fsel_map)) {
22 + func = legacy_fsel_map[pin][fnum];
23 + } else if (fnum < 2) {
24 + func = func_gpio;
25 + } else {
26 + dev_err(pc->dev, "%pOF: invalid brcm,pins value %d\n",
27 + np, pin);
28 + return -EINVAL;
29 + }
30 +
31 if (func == func_invalid) {
32 dev_err(pc->dev, "%pOF: brcm,function %d not supported on pin %d\n",
33 np, fnum, pin);
34 @@ -1104,13 +1113,6 @@ static int rp1_pctl_dt_node_to_map(struc
35 err = of_property_read_u32_index(np, "brcm,pins", i, &pin);
36 if (err)
37 goto out;
38 - if (pin >= ARRAY_SIZE(legacy_fsel_map)) {
39 - dev_err(pc->dev, "%pOF: invalid brcm,pins value %d\n",
40 - np, pin);
41 - err = -EINVAL;
42 - goto out;
43 - }
44 -
45 if (num_funcs) {
46 err = of_property_read_u32_index(np, "brcm,function",
47 (num_funcs > 1) ? i : 0,