This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

AM4378: Certain gpio's are missing in sys/class/gpio in kernel 5.4

Part Number: AM4378

We are working on a custom board based on Sitara AM4378, using Timesys factory2021 (with kernel 4.14) and Timesys factory2022 (with kernel 5.4 and TI-SDK patches).

While trying to toggle certain gpios (e.g. 144 and 148), we are able to do so on factory2021 (kernel 4.14), but we are not able to export the gpio's in factory2022 (kernel 5.4). It is seen from the below logs that the folder 'gpiochip128' is missing in kernel 5.4. The 'ngpio' value of this in kernel 5.4 is 32, which possibly means the missing gpio's 144 anf 148 fall within the range of gpiochip128 (128 + 32 = 160).

Below are logs from kernel 5.4:

# uname -a Linux am437x_evm 5.4.106-ts-armv7l #1 PREEMPT Mon Apr 4 19:51:10 IST 2022 armv7l GNU/Linux

# ls

export gpiochip32 gpiochip64 unexport gpiochip0 gpiochip510 gpiochip96

# echo 144 > export

[ 112.615118] export_store: invalid GPIO 144 sh: write error: Invalid argument

# echo 148 > export

[ 142.842765] export_store: invalid GPIO 148 sh: write error: Invalid argument

# cat gpiochip64/ngpio

32

# cat gpiochip32/ngpio

32

# cat gpiochip0/ngpio

32

# cat gpiochip96/ngpio

32

# cat gpiochip510/ngpio

--------------------------------------------------------------------------

The above errors are not seen in kernel 4.14, as seen in below logs:

# uname -a
Linux gcs_hub_controller 4.14.79-ts-armv7l #2 PREEMPT Sat Apr 2 16:44:18 IST 2022 armv7l GNU/Linux
#

# pwd
/sys/class/gpio
# ls
export gpiochip0 gpiochip128 gpiochip32 gpiochip64 gpiochip96 unexport
# echo 144 > export
# ls
export gpiochip0 gpiochip32 gpiochip96
gpio144 gpiochip128 gpiochip64 unexport
#
# echo 148 > export
# ls
export gpio148 gpiochip128 gpiochip64 unexport
gpio144 gpiochip0 gpiochip32 gpiochip96
#
#
# cd gpiochip64
# cat ngpio
32
# cd ..
# cat gpiochip96/ngpio
32
# cat gpiochip128/ngpio
32

  • Hi,

    I don't have such issue in AM437x Processor SDK v7.3 which uses kernel 5.4. Please see the log below on AM437x GPEVM:

    root@am437x-evm:~# cd /sys/class/gpio                                           
    root@am437x-evm:/sys/class/gpio# echo 144 > export                              
    root@am437x-evm:/sys/class/gpio# cd gpio144                                     
    root@am437x-evm:/sys/class/gpio/gpio144# ls                                     
    active_low  device  direction  edge  power  subsystem  uevent  value            
    root@am437x-evm:/sys/class/gpio/gpio144# cd ../                                 
    root@am437x-evm:/sys/class/gpio# echo 148 > export                              
    root@am437x-evm:/sys/class/gpio# ls gpio148                                     
    active_low  device  direction  edge  power  subsystem  uevent  value            
    root@am437x-evm:/sys/class/gpio# uname -a                                       
    Linux am437x-evm 5.4.106-g023faefa70 #1 PREEMPT Thu Jun 17 12:19:21 UTC 2021 armv7l armv7l armv7l GNU/Linux
    

  • Thanks, it turned out to be an issue with the device tree. Thank you for your investigation.