forked from Openwrt/openwrt
8c405cdccc
The patches were generated from the RPi repo with the following command: git format-patch v6.6.34..rpi-6.1.y Some patches needed rebasing and, as usual, the applied and reverted, wireless drivers, Github workflows, READMEs and defconfigs patches were removed. Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
48 lines
1.5 KiB
Diff
48 lines
1.5 KiB
Diff
From d81e2fafab376d3975c46c5f477945384a38524d Mon Sep 17 00:00:00 2001
|
|
From: Phil Elwell <phil@raspberrypi.com>
|
|
Date: Thu, 4 Apr 2024 10:50:32 +0100
|
|
Subject: [PATCH 1007/1085] 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 <phil@raspberrypi.com>
|
|
---
|
|
drivers/pinctrl/pinctrl-rp1.c | 18 ++++++++++--------
|
|
1 file changed, 10 insertions(+), 8 deletions(-)
|
|
|
|
--- a/drivers/pinctrl/pinctrl-rp1.c
|
|
+++ b/drivers/pinctrl/pinctrl-rp1.c
|
|
@@ -981,7 +981,16 @@ static int rp1_pctl_legacy_map_func(stru
|
|
return -EINVAL;
|
|
}
|
|
|
|
- func = legacy_fsel_map[pin][fnum];
|
|
+ if (pin < ARRAY_SIZE(legacy_fsel_map)) {
|
|
+ func = legacy_fsel_map[pin][fnum];
|
|
+ } else if (fnum < 2) {
|
|
+ func = func_gpio;
|
|
+ } else {
|
|
+ dev_err(pc->dev, "%pOF: invalid brcm,pins value %d\n",
|
|
+ np, pin);
|
|
+ return -EINVAL;
|
|
+ }
|
|
+
|
|
if (func == func_invalid) {
|
|
dev_err(pc->dev, "%pOF: brcm,function %d not supported on pin %d\n",
|
|
np, fnum, pin);
|
|
@@ -1104,13 +1113,6 @@ static int rp1_pctl_dt_node_to_map(struc
|
|
err = of_property_read_u32_index(np, "brcm,pins", i, &pin);
|
|
if (err)
|
|
goto out;
|
|
- if (pin >= ARRAY_SIZE(legacy_fsel_map)) {
|
|
- dev_err(pc->dev, "%pOF: invalid brcm,pins value %d\n",
|
|
- np, pin);
|
|
- err = -EINVAL;
|
|
- goto out;
|
|
- }
|
|
-
|
|
if (num_funcs) {
|
|
err = of_property_read_u32_index(np, "brcm,function",
|
|
(num_funcs > 1) ? i : 0,
|