Open nikonthethird opened 5 years ago
The gpio-line-names feature is currently only present in the upstream DTS files (those named bcm28*
), and even then only for a subset of models (A, A+, B, B+, Zero and ZeroW).
If it's any help, all Pis with the 40-pin header have exactly the same pin functions available on GPIOs 0-27. But beware - although pin functions are easily modified using DT overlays, the pinctrl mechanism for drivers and other utilities such as raspi-gpio
, that list of GPIO names is completely static.
Thank you, that does help.
I was just wondering, since the sysfs interface for GPIOs will be removed in 2020, then the only available interface for GPIOs will be the character device one, if the pin numbers will be the same.
So echo 26 > export
is basically the same as exporting line offset 26 of gpio chip 0? Looking at the schematic, that seems to be the case.
Yes, thank goodness - each gpiochip has a fixed numbering scheme (the Broadcom numbers for the on-board GPIOs), and the main gpiochip always seems to start at offset 0 in the global space.
N.B. gpiochip0 is named that way because it manages the global GPIO space starting at 0, so your statement above is trivially true, but it is also true that the onboard GPIO controller is always gpiochip0.
That solves everything for me then. 👍
Feel free to close the issue since it seems to me now that the actual line names are not that important anyways.
@pelwell ,
The gpio-line-names feature is currently only present in the upstream DTS files (those named
bcm28*
), and even then only for a subset of models (A, A+, B, B+, Zero and ZeroW).If it's any help, all Pis with the 40-pin header have exactly the same pin functions available on GPIOs 0-27. But beware - although pin functions are easily modified using DT overlays, the pinctrl mechanism for drivers and other utilities such as
raspi-gpio
, that list of GPIO names is completely static.
I'm just beginning to explore the GPIO character device API. and discovered that gpioinfo
provides only unnamed
on my 3B+ (bullseye), but provides useful names on my 4B (buster). If I understand your input correctly, it seems that this is due to the fact that the pin names are absent from the dts file supplied for the 3B+... is that correct?
If so, can you point me to any documentation that explains where to find the applicable dts file for 3B+, and how to make these changes?
Another question wrt to the pinctrl
mechanism: What are the implications of that if the names are added to the 3B+ dts?
Thanks!
If so, can you point me to any documentation that explains where to find the applicable dts file for 3B+, and how to make these changes?
The dts file for the 3B+ is called bcm2710-rpi-3-b-plus.dts (the current version is here: https://github.com/raspberrypi/linux/blob/rpi-5.15.y/arch/arm/boot/dts/bcm2710-rpi-3-b-plus.dts). How to build dtb files is covered in https://www.raspberrypi.com/documentation/computers/configuration.html#device-trees-overlays-and-parameters and https://www.raspberrypi.com/documentation/computers/linux_kernel.html#building (make ARCH=arm bcm2709_defconfig
, and make ARCH=arm dtbs
should suffice), and the way to make the changes is to add the gpio-line-names property to the above .dts file and rebuild the .dtb file.
Another question wrt to the pinctrl mechanism: What are the implications of that if the names are added to the 3B+ dts?
None. AFAIK.
Note that the line-names property can be copied from the upstream file bcm2837-rpi-3-b-plus.dts.
I am encountering the same problem. Names available on pi4, no names on pi3 b+. I am on kernel 5.10, raspian buster. Does that make a difference or can I simply download and replace my dts file with the upstream version to get the pin names.
can I simply download and replace my dts file with the upstream version to get the pin names.
No - you will lose a number of features at least. The correct solution is to add the necessary GPIO names to the remaining models.
The line names are added by commit ac66b3f757a3a6c84c6641356fb81c9fce3e89e9 (until the next rebase, which the hash will change).
@pelwell 👍 Thanks for this! I guess the procedure is to d/l the appropriate file you've updated, and then follow the procedure you outline previously to build it?
The dts file for the 3B+ is called bcm2710-rpi-3-b-plus.dts (the current version is here: https://github.com/raspberrypi/linux/blob/rpi-5.15.y/arch/arm/boot/dts/bcm2710-rpi-3-b-plus.dts). How to build dtb files is covered in https://www.raspberrypi.com/documentation/computers/configuration.html#device-trees-overlays-and-parameters and https://www.raspberrypi.com/documentation/computers/linux_kernel.html#building (
make ARCH=arm bcm2709_defconfig
, andmake ARCH=arm dtbs
should suffice), and the way to make the changes is to add the gpio-line-names property to the above .dts file and rebuild the .dtb file.
Or wait for the next firmware release.
@pelwell 👍
Or wait for the next firmware release
That sounds a wee bit simpler :) AIUI, firmware (incl .dtb files) for all models except the 4B is updated via the apt update & upgrade process, no?
I see the following in /boot
on my 3B+:
-rwxr-xr-x 1 root root 31266 Jan 22 21:11 bcm2710-rpi-3-b-plus.dtb
And status of firmware may be tracked from the firmware/boot repo?
The update is in latest rpi-update kernel. It will appear in apt at a later date.
I try to upstream some of the fixes: https://marc.info/?l=linux-arm-kernel&m=164970745528178&w=2
The device tree (DTS) files for newer Raspberry Pi models (e.g. Raspberry Pi 3 B) are missing the GPIO line name definitions.
For instance, here are the line names for the Raspberry Pi B.
But in the corresponding file for the Raspberry Pi 3 B, there are no line names.
For reference, commit 731b26a6ac17f24057c559361c6d0cb7cb79baed introduced the line names.
The problem with the missing line names is that the
gpioinfo
utility prints this for a Raspberry Pi B:but this for a Raspberry Pi 3 B, which makes it hard to figure out which line is what: