Skip to content

Missing GPIO line names for newer Raspberry Pi models #2760

Open

Description

@nikonthethird

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 731b26a introduced the line names.

The problem with the missing line names is that the gpioinfo utility prints this for a Raspberry Pi B:

gpiochip0 - 54 lines:
    line   0:       "SDA0"       unused   input  active-high
    line   1:       "SCL0"       unused   input  active-high
    line   2:       "SDA1"       unused   input  active-high
    line   3:       "SCL1"       unused   input  active-high
    line   4:  "GPIO_GCLK"       unused   input  active-high
    line   5:  "CAM_GPIO1"       unused   input  active-high
    line   6:    "LAN_RUN"       unused   input  active-high
    line   7:  "SPI_CE1_N"       unused   input  active-high
...

but this for a Raspberry Pi 3 B, which makes it hard to figure out which line is what:

gpiochip0 - 54 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
...

Activity

  1. pelwell commented on Nov 20, 2018

    @pelwell
    Contributor

    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.

  2. nikonthethird commented on Nov 20, 2018

    @nikonthethird
    Author

    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.

  3. pelwell commented on Nov 20, 2018

    @pelwell
    Contributor

    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.

  4. nikonthethird commented on Nov 20, 2018

    @nikonthethird
    Author

    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.

  5. seamusdemora commented on Feb 18, 2022

    @seamusdemora
  6. pelwell commented on Feb 18, 2022

    @pelwell
    Contributor

    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.

  7. pelwell commented on Feb 18, 2022

    @pelwell
    Contributor

    Another question wrt to the pinctrl mechanism: What are the implications of that if the names are added to the 3B+ dts?

    None. AFAIK.

  8. pelwell commented on Feb 18, 2022

    @pelwell
    Contributor

    Note that the line-names property can be copied from the upstream file bcm2837-rpi-3-b-plus.dts.

  9. maxpolzin commented on Feb 18, 2022

    @maxpolzin

    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.

  10. pelwell commented on Feb 18, 2022

    @pelwell
    Contributor

    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.

  11. pelwell commented on Feb 20, 2022

    @pelwell
    Contributor

    The line names are added by commit ac66b3f (until the next rebase, which the hash will change).

  12. seamusdemora commented on Feb 21, 2022

    @seamusdemora
  13. 44 remaining items

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions