On Tue, May 30, 2017 at 3:59 PM, Yves Lefloch <YvesMarie_Lefloch@xxxxxxxxxxxxxxxx> wrote: > I've put together a draft to try and solve this problem using approach (A). > Each IP node gets a GPIO child node, since this is what the hardware looks like, > and they are all tied together using phandles to a central pin controller node. I like the looks of this! > The draft only demonstrates the solution for the pins dedicated to GPIO, > namely `gpio_sys', and for the smartcard pins, namely `gpio_smcard'. It is elegant and it will scale. > As before, bindings are not yet commented. > > BTW, I'm sure there is a far better way than this `all_pins' array, let me know > if you have feedback on that. So that is this: > +static const unsigned int all_pins[] = { > + 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, > + 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, > + 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, > + 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, > + 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, > + 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, > + 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, > + 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, > + 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, > + 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, > +}; That looks a bit like what we usually put in pin descriptors. (...) This: > + struct pinctrl_gpio_range *prange; > + (...) > + prange->name = group->label; > + prange->id = group->base; > + prange->base = group->base; > + prange->pin_base = group->base; > + prange->npins = group->ngpio; > + prange->gc = gchip; > + pinctrl_add_gpio_range(pindev, prange); Can't you just add that to the device tree using the gpio-ranges property? It is handled in the core and should "just work". The documentation for that is a bit terse in Documentation/devicetree/bindings/gpio/gpio.txt but if you just grep for gpio-ranges you will get the hang of it. It is handled from the gpiochip side which is advisible, even if you hardcode it in the driver. Yours, Linus Walleij -- To unsubscribe from this list: send the line "unsubscribe linux-gpio" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html