AnsweredAssumed Answered

LS1021A GPIO numbering in Linux

Question asked by Tarek El-Sherbiny on Sep 13, 2016
Latest reply on Sep 13, 2016 by Pavel Chubakov

I'm using a commercial board based on the LS1021A SoC which is running Linux.

I would like to test the GPIO's functionality by configuring it as output and probing the signal.

 

From userspace Linux I would like to export a gpio port and use the sysfs gpio files to manipulate the port. But to do that I need to know what each gpio<number> represents.

 

This is the port mapping as provided by debugfs:

 

~ cat /sys/kernel/debug/gpio
GPIOs 358-359, i2c/0-0060, gpio-pca9532, can sleep:
gpio-358 ( |backlight ) out lo

GPIOs 360-367, platform/stmpe-gpio, stmpe, can sleep:
gpio-360 ((none) ) in lo edge-inactive
gpio-361 ((none) ) in lo edge-inactive
gpio-362 ((none) ) in lo edge-inactive
gpio-363 ((none) ) in lo edge-inactive
gpio-364 ((none) ) in lo edge-inactive
gpio-365 ((none) ) in lo edge-inactive
gpio-366 ((none) ) in lo edge-inactive
gpio-367 ((none) ) in lo edge-inactive

GPIOs 368-375, i2c/0-0021, pca9554, can sleep:

GPIOs 376-383, i2c/0-0020, pca9554, can sleep:

GPIOs 384-415, /soc/gpio@2330000:

GPIOs 416-447, /soc/gpio@2320000:

GPIOs 448-479, /soc/gpio@2310000:

GPIOs 480-511, /soc/gpio@2300000:

 

According to this mapping GPIO1 is assigned the numbers from 480 to 511.

Is GPIO1_13 == 480 , GPIO1_14 == 481 ....and so on?

Same question for the rest of the ports

GPIO2_4 == 448 , GPIO2_5 == 449

GPIO3_0 == 416, GPIO3_1 == 417

 

 

Can you please confirm that this mapping is correct?

 

Thanks

Outcomes