[PATCH v4 1/4] dt-bindings: gpio: spacemit: add support for K1 SoC

Linus Walleij linus.walleij at linaro.org
Tue Feb 18 01:44:59 PST 2025


On Fri, Feb 14, 2025 at 12:54 PM Yixun Lan <dlan at gentoo.org> wrote:

> thanks for this very detail prototype! it works mostly, with one problem:
>
> how to map gpio correctly to the pin from pinctrl subsystem?
>
> for example, I specify gpio-ranges in dts, then
>                 gpio0: gpio at d4019000 {
>                         compatible = "spacemit,k1-gpio";
>                         reg = <0x0 0xd4019000 0x0 0x100>;
>                         ...
>                         gpio-ranges = <&pinctrl 0 0 96>;
>                 };
>
>                 foo-gpios = <&gpio0 2 28 GPIO_ACTIVE_LOW>;
>
> It should get GPIO_92 ( 92 = 2 * 32 + 28), but turns out GPIO_28
>
> Probably there is something I missed...

No it's just me missing the complexity!

> to make the gpio part work, we need additional custom gpio-ranges parser,
> which should similar to of_gpiochip_add_pin_range() in gpiolib-of.c
> (at least gpio core need to adjust to call custom this function)

Let me send a patch set to bring threecell into the core instead,
and see if it works for you!

I will post it real soon.

Yours,
Linus Walleij



More information about the linux-riscv mailing list