ipq40xx: fix invalid GPIO numbers since kernel 6.6
[openwrt/staging/xback.git] / target / linux / ath79 / patches-6.6 / 820-mfd-syscon-support-skip-reset-control-for-syscon-devices.patch
1 From: Shiji Yang <yangshiji66@outlook.com>
2 Date: Wed, 13 Mar 2024 22:36:31 +0800
3 Subject: [PATCH] mfd: syscon: support skip reset control for syscon devices
4
5 Some platform device drivers(e.g. ag71xx) expect exclusive reset
6 control. Fetching reset controller for syscon[1] will break these
7 drivers. This patch introduces a new property 'syscon-no-reset'
8 to skip it.
9
10 [1] https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit?id=7d1e3bd94828ad9fc86f55253cd6fec8edd65394
11
12 Signed-off-by: Shiji Yang <yangshiji66@outlook.com>
13 ---
14 drivers/mfd/syscon.c | 5 +++--
15 1 file changed, 3 insertions(+), 2 deletions(-)
16
17 --- a/drivers/mfd/syscon.c
18 +++ b/drivers/mfd/syscon.c
19 @@ -52,7 +52,7 @@ static struct syscon *of_syscon_register
20 int ret;
21 struct regmap_config syscon_config = syscon_regmap_config;
22 struct resource res;
23 - struct reset_control *reset;
24 + struct reset_control *reset = NULL;
25
26 syscon = kzalloc(sizeof(*syscon), GFP_KERNEL);
27 if (!syscon)
28 @@ -134,7 +134,8 @@ static struct syscon *of_syscon_register
29 goto err_attach_clk;
30 }
31
32 - reset = of_reset_control_get_optional_exclusive(np, NULL);
33 + if (!of_property_read_bool(np, "syscon-no-reset"))
34 + reset = of_reset_control_get_optional_exclusive(np, NULL);
35 if (IS_ERR(reset)) {
36 ret = PTR_ERR(reset);
37 goto err_attach_clk;