[RFC PATCH 6/9] pinctrl: sunxi: add support for set/clear regs
Linus Walleij
linus.walleij at linaro.org
Thu Aug 21 05:35:10 PDT 2025
Hi Andre,
thanks for your patch!
On Thu, Aug 21, 2025 at 2:45 AM Andre Przywara <andre.przywara at arm.com> wrote:
> - raw_spin_unlock_irqrestore(&pctl->lock, flags);
> + if (pctl->flags & SUNXI_PINCTRL_HAS_SET_CLEAR_REGS) {
> + if (value)
> + writel(mask, pctl->membase + reg + DATA_SET_OFFSET);
> + else
> + writel(mask, pctl->membase + reg + DATA_CLR_OFFSET);
> + } else {
> + raw_spin_lock_irqsave(&pctl->lock, flags);
> + val = readl(pctl->membase + reg);
> + if (value)
> + val |= mask;
> + else
> + val &= ~mask;
> + writel(val, pctl->membase + reg);
> + raw_spin_unlock_irqrestore(&pctl->lock, flags);
> + }
This is now starting to re-implement the generic MMIO GPIO chip,
which I'm not so happy about, this is simply the difference between
passing just a single data register to the generic config or
passing a set and clear register.
ret = bgpio_init(&g->gc, dev, 4,
g->base + GPIO_DATA_IN,
g->base + GPIO_DATA_SET,
g->base + GPIO_DATA_CLR,
g->base + GPIO_DIR,
NULL,
0);
...
I also notice:
pctl->chip->of_gpio_n_cells = 3;
Is Allwinner one of those drivers that could actually start using
select GPIO_GENERIC nowadays?
Please look at
commit bd3ce71078bde4ecbfc60d49c96d1c55de0635cc
"gpiolib: of: Handle threecell GPIO chips"
And the example user:
drivers/gpio/gpio-spacemit-k1.c
esp how it uses spacemit_of_node_instance_match().
If it's possible to switch over to GPIO_GENERIC this hopeless
maintainer would love if that could be done first so the picture
gets more clear.
Yours,
Linus Walleij
Yours,
Linus Walleij
More information about the linux-arm-kernel
mailing list