6235f91b9c121a7604d382dd0fb8720aef5a9f92
[openwrt/staging/dedeckeh.git] / target / linux / at91 / patches-5.10 / 154-pinctrl-at91-pio4-Fix-slew-rate-disablement.patch
1 From dc07cbae6e96843d26e8f10b16e901620bd16462 Mon Sep 17 00:00:00 2001
2 From: Tudor Ambarus <tudor.ambarus@microchip.com>
3 Date: Fri, 9 Apr 2021 11:25:22 +0300
4 Subject: [PATCH 154/247] pinctrl: at91-pio4: Fix slew rate disablement
5
6 The slew rate was enabled by default for each configuration of the
7 pin. In case the pin had more than one configuration, even if
8 we set the slew rate as disabled in the device tree, the next pin
9 configuration would set again the slew rate enabled by default,
10 overwriting the slew rate disablement.
11 Instead of enabling the slew rate by default for each pin configuration,
12 enable the slew rate by default just once per pin, regardless of the
13 number of configurations. This way the slew rate disablement will also
14 work for cases where pins have multiple configurations.
15
16 Fixes: c709135e576b ("pinctrl: at91-pio4: add support for slew-rate")
17 Signed-off-by: Tudor Ambarus <tudor.ambarus@microchip.com>
18 Reviewed-by: Claudiu Beznea <claudiu.beznea@microchip.com>
19 Acked-by: Ludovic Desroches <ludovic.desroches@microchip.com>
20 Link: https://lore.kernel.org/r/20210409082522.625168-1-tudor.ambarus@microchip.com
21 Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
22 ---
23 drivers/pinctrl/pinctrl-at91-pio4.c | 8 ++++----
24 1 file changed, 4 insertions(+), 4 deletions(-)
25
26 diff --git a/drivers/pinctrl/pinctrl-at91-pio4.c b/drivers/pinctrl/pinctrl-at91-pio4.c
27 index a5d328808e4c..4c01d8471ffa 100644
28 --- a/drivers/pinctrl/pinctrl-at91-pio4.c
29 +++ b/drivers/pinctrl/pinctrl-at91-pio4.c
30 @@ -801,6 +801,10 @@ static int atmel_conf_pin_config_group_set(struct pinctrl_dev *pctldev,
31
32 conf = atmel_pin_config_read(pctldev, pin_id);
33
34 + /* Keep slew rate enabled by default. */
35 + if (atmel_pioctrl->slew_rate_support)
36 + conf |= ATMEL_PIO_SR_MASK;
37 +
38 for (i = 0; i < num_configs; i++) {
39 unsigned int param = pinconf_to_config_param(configs[i]);
40 unsigned int arg = pinconf_to_config_argument(configs[i]);
41 @@ -808,10 +812,6 @@ static int atmel_conf_pin_config_group_set(struct pinctrl_dev *pctldev,
42 dev_dbg(pctldev->dev, "%s: pin=%u, config=0x%lx\n",
43 __func__, pin_id, configs[i]);
44
45 - /* Keep slew rate enabled by default. */
46 - if (atmel_pioctrl->slew_rate_support)
47 - conf |= ATMEL_PIO_SR_MASK;
48 -
49 switch (param) {
50 case PIN_CONFIG_BIAS_DISABLE:
51 conf &= (~ATMEL_PIO_PUEN_MASK);
52 --
53 2.32.0
54