Commit d8f3ad52 authored by Thomas Blocher's avatar Thomas Blocher Committed by Wen Zhiwei
Browse files

pinctrl: at91: make it work with current gpiolib

stable inclusion
from stable-v6.6.53
commit af08f4506114422eb21e8440a2fc6efe4ce6c5ec
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/IAZ0GM

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=af08f4506114422eb21e8440a2fc6efe4ce6c5ec



--------------------------------

[ Upstream commit 752f387faaae0ae2e84d3f496922524785e77d60 ]

pinctrl-at91 currently does not support the gpio-groups devicetree
property and has no pin-range.
Because of this at91 gpios stopped working since patch
commit 2ab73c6d ("gpio: Support GPIO controllers without pin-ranges")
This was discussed in the patches
commit fc328a7d ("gpio: Revert regression in sysfs-gpio (gpiolib.c)")
commit 56e337f2 ("Revert "gpio: Revert regression in sysfs-gpio (gpiolib.c)"")

As a workaround manually set pin-range via gpiochip_add_pin_range() until
a) pinctrl-at91 is reworked to support devicetree gpio-groups
b) another solution as mentioned in
commit 56e337f2 ("Revert "gpio: Revert regression in sysfs-gpio (gpiolib.c)"")
is found

Signed-off-by: default avatarThomas Blocher <thomas.blocher@ek-dev.de>
Link: https://lore.kernel.org/5b992862-355d-f0de-cd3d-ff99e67a4ff1@ek-dev.de


Signed-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
Signed-off-by: default avatarWen Zhiwei <wenzhiwei@kylinos.cn>
parent 9bd043fb
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -1410,8 +1410,11 @@ static int at91_pinctrl_probe(struct platform_device *pdev)

	/* We will handle a range of GPIO pins */
	for (i = 0; i < gpio_banks; i++)
		if (gpio_chips[i])
		if (gpio_chips[i]) {
			pinctrl_add_gpio_range(info->pctl, &gpio_chips[i]->range);
			gpiochip_add_pin_range(&gpio_chips[i]->chip, dev_name(info->pctl->dev), 0,
				gpio_chips[i]->range.pin_base, gpio_chips[i]->range.npins);
		}

	dev_info(dev, "initialized AT91 pinctrl driver\n");