c61e6b1c9052ed834ae32a6add527521d284143e
[openwrt/openwrt.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 --- a/drivers/pinctrl/pinctrl-at91-pio4.c
27 +++ b/drivers/pinctrl/pinctrl-at91-pio4.c
28 @@ -801,6 +801,10 @@ static int atmel_conf_pin_config_group_s
29
30 conf = atmel_pin_config_read(pctldev, pin_id);
31
32 + /* Keep slew rate enabled by default. */
33 + if (atmel_pioctrl->slew_rate_support)
34 + conf |= ATMEL_PIO_SR_MASK;
35 +
36 for (i = 0; i < num_configs; i++) {
37 unsigned int param = pinconf_to_config_param(configs[i]);
38 unsigned int arg = pinconf_to_config_argument(configs[i]);
39 @@ -808,10 +812,6 @@ static int atmel_conf_pin_config_group_s
40 dev_dbg(pctldev->dev, "%s: pin=%u, config=0x%lx\n",
41 __func__, pin_id, configs[i]);
42
43 - /* Keep slew rate enabled by default. */
44 - if (atmel_pioctrl->slew_rate_support)
45 - conf |= ATMEL_PIO_SR_MASK;
46 -
47 switch (param) {
48 case PIN_CONFIG_BIAS_DISABLE:
49 conf &= (~ATMEL_PIO_PUEN_MASK);