Re: [PATCH] arm: dts: am33xx-l4: add gpio-line-names to gpio controllers
From: Drew Fustini
Date: Wed Apr 29 2020 - 08:56:56 EST
On Tue, Apr 28, 2020 at 10:37:43AM +0300, Grygorii Strashko wrote:
>
>
> On 28/04/2020 02:31, Drew Fustini wrote:
> > Add gpio-line-names properties to the gpio controller nodes. The names
> > correspond to the AM335x pin names which are also the muxmode 0 signal
> > names. Refer to "Table 4-2. Pin Attributes" in the TI AM335x Sitara
> > Processors datasheet:
> This misuse GPIO DT bindings:
> "
> Optionally, a GPIO controller may have a "gpio-line-names" property. This is
> an array of strings defining the names of the GPIO lines going out of the
> GPIO controller. This name should be the most meaningful producer name
> for the system, such as a rail name indicating the usage. Package names
> such as pin name are discouraged: such lines have opaque names (since they
> are by definition generic purpose) and such names are usually not very
> helpful. For example "MMC-CD", "Red LED Vdd" and "ethernet reset" are
> reasonable line names as they describe what the line is used for. "GPIO0"
> is not a good name to give to a GPIO line. Placeholders are discouraged:
> rather use the "" (blank string) if the use of the GPIO line is undefined
> in your design. The names are assigned starting from line offset 0 from
> left to right from the passed array. An incomplete array (where the number
> of passed named are less than ngpios) will still be used up until the last
> provided valid line index.
> "
Thank you for pointing out that "Package names such as pin name are
discouraged". That is what I was doing in that patch which I now
realize is incorrect.
The goal to adding the gpio-line-names was to have gpioinfo provide
helpful information to a user on the BeagleBone. Currently this is all
that appears when booting 5.7-rc2 on a BegaleBone:
debian@beaglebone:~$ gpioinfo
gpiochip0 - 32 lines:
line 0: unnamed unused input active-high
line 1: unnamed unused input active-high
line 2: unnamed unused input active-high
line 3: unnamed unused input active-high
line 4: unnamed unused input active-high
line 5: unnamed unused input active-high
line 6: unnamed "cd" input active-low [used]
line 7: unnamed unused input active-high
line 8: unnamed unused input active-high
line 9: unnamed unused input active-high
line 10: unnamed unused input active-high
line 11: unnamed unused input active-high
line 12: unnamed unused input active-high
line 13: unnamed unused input active-high
line 14: unnamed unused input active-high
line 15: unnamed unused input active-high
line 16: unnamed unused input active-high
line 17: unnamed unused input active-high
line 18: unnamed unused input active-high
line 19: unnamed unused input active-high
line 20: unnamed unused input active-high
line 21: unnamed unused input active-high
line 22: unnamed unused input active-high
line 23: unnamed unused input active-high
line 24: unnamed unused input active-high
line 25: unnamed unused input active-high
line 26: unnamed unused input active-high
line 27: unnamed unused input active-high
line 28: unnamed unused input active-high
line 29: unnamed unused input active-high
line 30: unnamed unused input active-high
line 31: unnamed unused input active-high
gpiochip1 - 32 lines:
line 0: unnamed unused input active-high
line 1: unnamed unused input active-high
line 2: unnamed unused input active-high
line 3: unnamed unused input active-high
line 4: unnamed unused input active-high
line 5: unnamed unused input active-high
line 6: unnamed unused input active-high
line 7: unnamed unused input active-high
line 8: unnamed unused input active-high
line 9: unnamed unused input active-high
line 10: unnamed unused input active-high
line 11: unnamed unused input active-high
line 12: unnamed unused input active-high
line 13: unnamed unused input active-high
line 14: unnamed unused input active-high
line 15: unnamed unused input active-high
line 16: unnamed unused input active-high
line 17: unnamed unused input active-high
line 18: unnamed unused input active-high
line 19: unnamed unused input active-high
line 20: unnamed unused input active-high
line 21: unnamed "beaglebone:green:usr0" output active-high [used]
line 22: unnamed "beaglebone:green:usr1" output active-high [used]
line 23: unnamed "beaglebone:green:usr2" output active-high [used]
line 24: unnamed "beaglebone:green:usr3" output active-high [used]
line 25: unnamed unused input active-high
line 26: unnamed unused input active-high
line 27: unnamed unused input active-high
line 28: unnamed unused input active-high
line 29: unnamed unused input active-high
line 30: unnamed unused input active-high
line 31: unnamed unused input active-high
gpiochip2 - 32 lines:
line 0: unnamed unused input active-high
line 1: unnamed unused input active-high
line 2: unnamed unused input active-high
line 3: unnamed unused input active-high
line 4: unnamed unused input active-high
line 5: unnamed unused input active-high
line 6: unnamed unused input active-high
line 7: unnamed unused input active-high
line 8: unnamed unused input active-high
line 9: unnamed unused input active-high
line 10: unnamed unused input active-high
line 11: unnamed unused input active-high
line 12: unnamed unused input active-high
line 13: unnamed unused input active-high
line 14: unnamed unused input active-high
line 15: unnamed unused input active-high
line 16: unnamed unused input active-high
line 17: unnamed unused input active-high
line 18: unnamed unused input active-high
line 19: unnamed unused input active-high
line 20: unnamed unused input active-high
line 21: unnamed unused input active-high
line 22: unnamed unused input active-high
line 23: unnamed unused input active-high
line 24: unnamed unused input active-high
line 25: unnamed unused input active-high
line 26: unnamed unused input active-high
line 27: unnamed unused input active-high
line 28: unnamed unused input active-high
line 29: unnamed unused input active-high
line 30: unnamed unused input active-high
line 31: unnamed unused input active-high
gpiochip3 - 32 lines:
line 0: unnamed unused input active-high
line 1: unnamed unused input active-high
line 2: unnamed unused input active-high
line 3: unnamed unused input active-high
line 4: unnamed unused input active-high
line 5: unnamed unused input active-high
line 6: unnamed unused input active-high
line 7: unnamed unused input active-high
line 8: unnamed unused input active-high
line 9: unnamed unused input active-high
line 10: unnamed unused input active-high
line 11: unnamed unused input active-high
line 12: unnamed unused input active-high
line 13: unnamed unused input active-high
line 14: unnamed unused input active-high
line 15: unnamed unused input active-high
line 16: unnamed unused input active-high
line 17: unnamed unused input active-high
line 18: unnamed unused input active-high
line 19: unnamed unused input active-high
line 20: unnamed unused input active-high
line 21: unnamed unused input active-high
line 22: unnamed unused input active-high
line 23: unnamed unused input active-high
line 24: unnamed unused input active-high
line 25: unnamed unused input active-high
line 26: unnamed unused input active-high
line 27: unnamed unused input active-high
line 28: unnamed unused input active-high
line 29: unnamed unused input active-high
line 30: unnamed unused input active-high
line 31: unnamed unused input active-high
I discussed it with Robert Nelson and Jason Kridner and the idea came up
that using the beagle pin header labels would be more useful than the
AM3358 pin names.
> Additional note. On other TI SoCs like am437x the same gpio line can be routed to more
> than one pin (but only one pin can be used).
> gpio0_0 GPIO IO -> A17, D16
Thank you for that insights.
Instead of am33xx-l4.dtsi, I am thinking of adding a gpio-line-names
property in: source/arch/arm/boot/dts/am335x-bone-common.dtsi
For gpiochip0, line 0 and line 1 would be "" as they are not connected
to P8/P9 header. line 2 would be labeled "P9_22", line 3 would be
"P9_21", etc. I'll post a complete patch for am335x-bone-common.dtsi
and the gpioinfo output to demonstrate the usefulness.
thanks,
drew