822716d8e6e214a8c7d711fb7ad677646bc598e3
[openwrt/staging/thess.git] / target / linux / bcm53xx / patches-5.10 / 081-v5.15-Revert-pinctrl-bcm-ns-support-updated-DT-binding-as-.patch
1 From 6dba4bdfd7a30e77b848a45404b224588bf989e5 Mon Sep 17 00:00:00 2001
2 From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal@milecki.pl>
3 Date: Fri, 8 Oct 2021 22:59:38 +0200
4 Subject: [PATCH] Revert "pinctrl: bcm: ns: support updated DT binding as
5 syscon subnode"
6 MIME-Version: 1.0
7 Content-Type: text/plain; charset=UTF-8
8 Content-Transfer-Encoding: 8bit
9
10 This reverts commit a49d784d5a8272d0f63c448fe8dc69e589db006e.
11
12 The updated binding was wrong / invalid and has been reverted. There
13 isn't any upstream kernel DTS using it and Broadcom isn't known to use
14 it neither. There is close to zero chance this will cause regression for
15 anyone.
16
17 Actually in-kernel bcm5301x.dtsi still uses the old good binding and so
18 it's broken since the driver update. This revert fixes it.
19
20 Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
21 Link: https://lore.kernel.org/r/20211008205938.29925-3-zajec5@gmail.com
22 Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
23 ---
24 drivers/pinctrl/bcm/pinctrl-ns.c | 29 ++++++++++-------------------
25 1 file changed, 10 insertions(+), 19 deletions(-)
26
27 --- a/drivers/pinctrl/bcm/pinctrl-ns.c
28 +++ b/drivers/pinctrl/bcm/pinctrl-ns.c
29 @@ -5,7 +5,6 @@
30
31 #include <linux/err.h>
32 #include <linux/io.h>
33 -#include <linux/mfd/syscon.h>
34 #include <linux/module.h>
35 #include <linux/of.h>
36 #include <linux/of_device.h>
37 @@ -13,7 +12,6 @@
38 #include <linux/pinctrl/pinctrl.h>
39 #include <linux/pinctrl/pinmux.h>
40 #include <linux/platform_device.h>
41 -#include <linux/regmap.h>
42 #include <linux/slab.h>
43
44 #define FLAG_BCM4708 BIT(1)
45 @@ -24,8 +22,7 @@ struct ns_pinctrl {
46 struct device *dev;
47 unsigned int chipset_flag;
48 struct pinctrl_dev *pctldev;
49 - struct regmap *regmap;
50 - u32 offset;
51 + void __iomem *base;
52
53 struct pinctrl_desc pctldesc;
54 struct ns_pinctrl_group *groups;
55 @@ -232,9 +229,9 @@ static int ns_pinctrl_set_mux(struct pin
56 unset |= BIT(pin_number);
57 }
58
59 - regmap_read(ns_pinctrl->regmap, ns_pinctrl->offset, &tmp);
60 + tmp = readl(ns_pinctrl->base);
61 tmp &= ~unset;
62 - regmap_write(ns_pinctrl->regmap, ns_pinctrl->offset, tmp);
63 + writel(tmp, ns_pinctrl->base);
64
65 return 0;
66 }
67 @@ -266,13 +263,13 @@ static const struct of_device_id ns_pinc
68 static int ns_pinctrl_probe(struct platform_device *pdev)
69 {
70 struct device *dev = &pdev->dev;
71 - struct device_node *np = dev->of_node;
72 const struct of_device_id *of_id;
73 struct ns_pinctrl *ns_pinctrl;
74 struct pinctrl_desc *pctldesc;
75 struct pinctrl_pin_desc *pin;
76 struct ns_pinctrl_group *group;
77 struct ns_pinctrl_function *function;
78 + struct resource *res;
79 int i;
80
81 ns_pinctrl = devm_kzalloc(dev, sizeof(*ns_pinctrl), GFP_KERNEL);
82 @@ -290,18 +287,12 @@ static int ns_pinctrl_probe(struct platf
83 return -EINVAL;
84 ns_pinctrl->chipset_flag = (uintptr_t)of_id->data;
85
86 - ns_pinctrl->regmap = syscon_node_to_regmap(of_get_parent(np));
87 - if (IS_ERR(ns_pinctrl->regmap)) {
88 - int err = PTR_ERR(ns_pinctrl->regmap);
89 -
90 - dev_err(dev, "Failed to map pinctrl regs: %d\n", err);
91 -
92 - return err;
93 - }
94 -
95 - if (of_property_read_u32(np, "offset", &ns_pinctrl->offset)) {
96 - dev_err(dev, "Failed to get register offset\n");
97 - return -ENOENT;
98 + res = platform_get_resource_byname(pdev, IORESOURCE_MEM,
99 + "cru_gpio_control");
100 + ns_pinctrl->base = devm_ioremap_resource(dev, res);
101 + if (IS_ERR(ns_pinctrl->base)) {
102 + dev_err(dev, "Failed to map pinctrl regs\n");
103 + return PTR_ERR(ns_pinctrl->base);
104 }
105
106 memcpy(pctldesc, &ns_pinctrl_desc, sizeof(*pctldesc));