Hi Linus: On 10:44 Tue 18 Feb , Linus Walleij wrote: > On Fri, Feb 14, 2025 at 12:54 PM Yixun Lan <dlan@xxxxxxxxxx> 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@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. > can you check the v5 of the patch here [1]? which I just sent out yesterday it does 1) implement xlate() 2) instroduce custom add_pin_page() the gpio part works as I tested, the gpio irq probably need more testing > Yours, > Linus Walleij [1] https://lore.kernel.org/spacemit/20250217-03-k1-gpio-v5-0-2863ec3e7b67@xxxxxxxxxx/ -- Yixun Lan (dlan) Gentoo Linux Developer GPG Key ID AABEFD55