mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2025-01-18 03:44:27 +08:00
pinctrl: bcm2835: implement hook for missing gpio-ranges
[ Upstream commitd2b67744fd
] The commitc8013355ea
("ARM: dts: gpio-ranges property is now required") fixed the GPIO probing issues caused by "pinctrl: bcm2835: Change init order for gpio hogs". This changed only the kernel DTS files. Unfortunately it isn't guaranteed that these files are shipped to all users. So implement the necessary backward compatibility for BCM2835 and BCM2711 platform. Fixes:266423e60e
("pinctrl: bcm2835: Change init order for gpio hogs") Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com> Reviewed-by: Florian Fainelli <f.fainelli@gmail.com> Tested-by: Florian Fainelli <f.fainelli@gmail.com> Link: https://lore.kernel.org/r/20220409095129.45786-3-stefan.wahren@i2se.com Signed-off-by: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
parent
20340be216
commit
2b9f355ad8
@ -351,6 +351,22 @@ static int bcm2835_gpio_direction_output(struct gpio_chip *chip,
|
|||||||
return pinctrl_gpio_direction_output(chip->base + offset);
|
return pinctrl_gpio_direction_output(chip->base + offset);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int bcm2835_of_gpio_ranges_fallback(struct gpio_chip *gc,
|
||||||
|
struct device_node *np)
|
||||||
|
{
|
||||||
|
struct pinctrl_dev *pctldev = of_pinctrl_get(np);
|
||||||
|
|
||||||
|
of_node_put(np);
|
||||||
|
|
||||||
|
if (!pctldev)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
gpiochip_add_pin_range(gc, pinctrl_dev_get_devname(pctldev), 0, 0,
|
||||||
|
gc->ngpio);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
static const struct gpio_chip bcm2835_gpio_chip = {
|
static const struct gpio_chip bcm2835_gpio_chip = {
|
||||||
.label = MODULE_NAME,
|
.label = MODULE_NAME,
|
||||||
.owner = THIS_MODULE,
|
.owner = THIS_MODULE,
|
||||||
@ -365,6 +381,7 @@ static const struct gpio_chip bcm2835_gpio_chip = {
|
|||||||
.base = -1,
|
.base = -1,
|
||||||
.ngpio = BCM2835_NUM_GPIOS,
|
.ngpio = BCM2835_NUM_GPIOS,
|
||||||
.can_sleep = false,
|
.can_sleep = false,
|
||||||
|
.of_gpio_ranges_fallback = bcm2835_of_gpio_ranges_fallback,
|
||||||
};
|
};
|
||||||
|
|
||||||
static const struct gpio_chip bcm2711_gpio_chip = {
|
static const struct gpio_chip bcm2711_gpio_chip = {
|
||||||
@ -381,6 +398,7 @@ static const struct gpio_chip bcm2711_gpio_chip = {
|
|||||||
.base = -1,
|
.base = -1,
|
||||||
.ngpio = BCM2711_NUM_GPIOS,
|
.ngpio = BCM2711_NUM_GPIOS,
|
||||||
.can_sleep = false,
|
.can_sleep = false,
|
||||||
|
.of_gpio_ranges_fallback = bcm2835_of_gpio_ranges_fallback,
|
||||||
};
|
};
|
||||||
|
|
||||||
static void bcm2835_gpio_irq_handle_bank(struct bcm2835_pinctrl *pc,
|
static void bcm2835_gpio_irq_handle_bank(struct bcm2835_pinctrl *pc,
|
||||||
|
Loading…
Reference in New Issue
Block a user