0d594a20bf1590ff289e1bfecb6d48e3db41d41e
[openwrt/staging/pepe2k.git] /
1 From 947c93eb29c2a581c0b0b6d5f21af3c2b7ff6d25 Mon Sep 17 00:00:00 2001
2 From: Gabor Juhos <j4g8y7@gmail.com>
3 Date: Wed, 14 May 2025 21:18:32 +0200
4 Subject: [PATCH 1/7] pinctrl: armada-37xx: use correct OUTPUT_VAL register for
5 GPIOs > 31
6
7 The controller has two consecutive OUTPUT_VAL registers and both
8 holds output value for 32 GPIOs. Due to a missing adjustment, the
9 current code always uses the first register while setting the
10 output value whereas it should use the second one for GPIOs > 31.
11
12 Add the missing armada_37xx_update_reg() call to adjust the register
13 according to the 'offset' parameter of the function to fix the issue.
14
15 Cc: stable@vger.kernel.org
16 Fixes: 6702abb3bf23 ("pinctrl: armada-37xx: Fix direction_output() callback behavior")
17 Signed-off-by: Imre Kaloz <kaloz@openwrt.org>
18 Reviewed-by: Andrew Lunn <andrew@lunn.ch>
19 Signed-off-by: Gabor Juhos <j4g8y7@gmail.com>
20 Link: https://lore.kernel.org/20250514-pinctrl-a37xx-fixes-v2-1-07e9ac1ab737@gmail.com
21 Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
22 ---
23 drivers/pinctrl/mvebu/pinctrl-armada-37xx.c | 3 +++
24 1 file changed, 3 insertions(+)
25
26 --- a/drivers/pinctrl/mvebu/pinctrl-armada-37xx.c
27 +++ b/drivers/pinctrl/mvebu/pinctrl-armada-37xx.c
28 @@ -417,6 +417,7 @@ static int armada_37xx_gpio_direction_ou
29 unsigned int offset, int value)
30 {
31 struct armada_37xx_pinctrl *info = gpiochip_get_data(chip);
32 + unsigned int val_offset = offset;
33 unsigned int reg = OUTPUT_EN;
34 unsigned int mask, val, ret;
35
36 @@ -429,6 +430,8 @@ static int armada_37xx_gpio_direction_ou
37 return ret;
38
39 reg = OUTPUT_VAL;
40 + armada_37xx_update_reg(&reg, &val_offset);
41 +
42 val = value ? mask : 0;
43 regmap_update_bits(info->regmap, reg, mask, val);
44