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
7 Content-Type: text/plain; charset=UTF-8
8 Content-Transfer-Encoding: 8bit
10 This reverts commit a49d784d5a8272d0f63c448fe8dc69e589db006e.
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
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.
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>
24 drivers/pinctrl/bcm/pinctrl-ns.c | 29 ++++++++++-------------------
25 1 file changed, 10 insertions(+), 19 deletions(-)
27 --- a/drivers/pinctrl/bcm/pinctrl-ns.c
28 +++ b/drivers/pinctrl/bcm/pinctrl-ns.c
31 #include <linux/err.h>
33 -#include <linux/mfd/syscon.h>
34 #include <linux/module.h>
36 #include <linux/of_device.h>
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>
44 #define FLAG_BCM4708 BIT(1)
45 @@ -24,8 +22,7 @@ struct ns_pinctrl {
47 unsigned int chipset_flag;
48 struct pinctrl_dev *pctldev;
49 - struct regmap *regmap;
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);
59 - regmap_read(ns_pinctrl->regmap, ns_pinctrl->offset, &tmp);
60 + tmp = readl(ns_pinctrl->base);
62 - regmap_write(ns_pinctrl->regmap, ns_pinctrl->offset, tmp);
63 + writel(tmp, ns_pinctrl->base);
67 @@ -266,13 +263,13 @@ static const struct of_device_id ns_pinc
68 static int ns_pinctrl_probe(struct platform_device *pdev)
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;
81 ns_pinctrl = devm_kzalloc(dev, sizeof(*ns_pinctrl), GFP_KERNEL);
82 @@ -290,18 +287,12 @@ static int ns_pinctrl_probe(struct platf
84 ns_pinctrl->chipset_flag = (uintptr_t)of_id->data;
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);
90 - dev_err(dev, "Failed to map pinctrl regs: %d\n", err);
95 - if (of_property_read_u32(np, "offset", &ns_pinctrl->offset)) {
96 - dev_err(dev, "Failed to get register offset\n");
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);
106 memcpy(pctldesc, &ns_pinctrl_desc, sizeof(*pctldesc));