[Arm-netbook] Testing: GPIO

Richard Wilbur richard.wilbur at gmail.com
Tue May 15 21:14:09 BST 2018


On May 14, 2018, at 12:24, Luke Kenneth Casson Leighton <lkcl at lkcl.net> wrote:
> Look up sunxi-tools fex2bin bin2fex and wiki sunxi fex.

I did look up and read some about those topics--and I will read more!

What I'm wondering is what does the script.bin configure presently at
boot?  Then I can figure out whether we need to change it in order to
be able to test the GPIO pins.  With sunxi 3.4 kernel it looks like
whatever we have configured in script.bin is what we have to work with
on that load of the gpio-sunxi kernel module so I'm interested in
making sure the GPIO pins we want to test are configured into the
/sys/class/gpio namespace, and at what names they appear.

I read in the sunxi GPIO wiki page[1] that script.bin can specify the
mapping between the GPIO number NNN and PORT:BIT that determines the
sysfs name /sys/class/gpio/gpioNNN_PORTBIT brought about by
sudo echo NNN >/sys/class/gpio/export
# A request to export control over gpio mapping NNN (as defined in
script.bin) from kernel space to user space.

So, to track down the pins we want, we need to know the mapping that
is currently in script.bin (or specify it ourselves).

There is a scheme outlined in the sunxi GPIO wiki page[1] for
associating the numbers NNN with PORT:BIT that is followed on the
A20/PIO page[2] and seems useful as it is consistent and reversible.
So if we haven't already created a version of script.bin (for the
sunxi-gpio module) that maps the A20's Programmable Input/Output pins
for the DS113 card, I'd recommend we follow that scheme.

NNN := (PORT - 'A') * 32 + BIT

PORT:BIT  NNN  sysfs
PI11  267  gpio267_pi11
PI10  266  gpio266_pi10
PI13  269  gpio269_pi13
PI12  268  gpio268_pi12
PI3  259  gpio259_pi3
PB4   36  gpio36_pb4
PH0  224  gpio224_ph0
PB3   35  gpio35_pb3

References:

[1]  https://linux-sunxi.org/GPIO
[2]  https://linux-sunxi.org/A20/PIO



More information about the arm-netbook mailing list