generic gpio-syscon

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi all, Hi Linus,

Linus, I've especially added you because you've expressed some concerns about using bits and offsets in the device-tree [1].

I'd like to disuss adding a generic gpio-syscon (eg. compatible = "gpio-syscon"). At the moment, if you have a board which could use the gpio-syscon out-of-the-box, you still have to submit a patch to add support to the gpio-syscon driver. Wouldn't it be easier to let the user/board manufacturer configure the parameters through the dtb? I understand your reasoning to have the information in two different places, but isn't that alwas the case for any non trivial device tree binding? On the other hand, if you'd have a generic gpio-syscon and the actual hardware is compatible with it, all you have to do is to add the devicetree fragment. You don't have to wait until your patch is approved by the kernel maintainers, you don't have to wait until the kernel with your patch actually makes it into the distributions, etc.

I have thought about something like:
   gpio0 {
       compatible = "gpio-syscon";
       syscon = <&syscon>;
       gpio-controller;
flags = <GPIO_SYSCON_FEAT_IN | GPIO_SYSCON_FEAT_OUT | GPIO_SYSCON_FEAT_DIR>;
       offsets = <0 0 1>;
       io-width = <4>;
       mask = <0x0000ffff>;
   };

Where offsets is a tuple of (input register offset, output register offset, direction register offset) and the driver would expose 16 GPIOs.

For the flags there might be something like:

#define GPIO_SYSCON_GPIO (GPIO_SYSCON_FEAT_IN | GPIO_SYSCON_FEAT_OUT | GPIO_SYSCON_FEAT_DIR)
#define GPIO_SYSCON_GPI  (GPIO_SYSCON_FEAT_IN)
#define GPIO_SYSCON_GPO  (GPIO_SYSCON_FEAT_OUT)


TBH, I'm a newbie at what should be in the dts and what should be in the driver, but I've seen the syscon-poweroff driver which can be used for most use cases out-of-the-box.

-michael

[1] https://www.mail-archive.com/linux-gpio@xxxxxxxxxxxxxxx/msg01660.html



[Index of Archives]     [Linux SPI]     [Linux Kernel]     [Linux ARM (vger)]     [Linux ARM MSM]     [Linux Omap]     [Linux Arm]     [Linux Tegra]     [Fedora ARM]     [Linux for Samsung SOC]     [eCos]     [Linux Fastboot]     [Gcc Help]     [Git]     [DCCP]     [IETF Announce]     [Security]     [Linux MIPS]     [Yosemite Campsites]

  Powered by Linux