Jump to content

Armbian 5.15.26-sunxi64 kernel breaks GPIO on NanoPi NEO2


Maarten1

Recommended Posts

Armbian 5.15.26-sunxi64 kernel breaks GPIO on NanoPi NEO2

 

Armbian 5.15.26-sunxi64 (bullseye)

NanoHatOLED fails:

GPIO devices are missing;

- /proc/cpuinfo lacks Processor, Hardware info.

 

root@nanopineo2:~# uname -a
Linux nanopineo2 5.15.26-sunxi64 #trunk.0002 SMP Thu Mar 3 10:24:53 UTC 2022 aarch64 GNU/Linux

 

root@nanopineo2:~# gpio readall
piBoardRev: Unable to determine board revision from /proc/cpuinfo
 -> Is not NanoPi based board.
 ->  You may want to check:
 ->  http://www.lemaker.org/

 

root@nanopineo2:~# cat /tmp/nanohat-oled.log
open of gpio 0 returned -1: No such file or directory
error opening gpio sysfs entries

 

root@nanopineo2:~# cat /proc/cpuinfo
processor       : 0
BogoMIPS        : 48.00
Features        : fp asimd evtstrm aes pmull sha1 sha2 crc32 cpuid
CPU implementer : 0x41
CPU architecture: 8
CPU variant     : 0x0
CPU part        : 0xd03
CPU revision    : 4

processor       : 1
BogoMIPS        : 48.00
Features        : fp asimd evtstrm aes pmull sha1 sha2 crc32 cpuid
CPU implementer : 0x41
CPU architecture: 8
CPU variant     : 0x0
CPU part        : 0xd03
CPU revision    : 4

processor       : 2
BogoMIPS        : 48.00
Features        : fp asimd evtstrm aes pmull sha1 sha2 crc32 cpuid
CPU implementer : 0x41
CPU architecture: 8
CPU variant     : 0x0
CPU part        : 0xd03
CPU revision    : 4

processor       : 3
BogoMIPS        : 48.00
Features        : fp asimd evtstrm aes pmull sha1 sha2 crc32 cpuid
CPU implementer : 0x41
CPU architecture: 8
CPU variant     : 0x0
CPU part        : 0xd03
CPU revision    : 4

 

Armbian 5.10.60-sunxi64 (bullseye)

NanoHatOLED is running fine:

 

root@nanopineo2:~# ls -l /sys/class/gpio
total 0
--w--w---- 1 root dialout 4096 Mar 29 23:42 export
lrwxrwxrwx 1 root root       0 Mar 29 23:42 gpio0 -> ../../devices/platform/soc/1c20800.pinctrl/gpiochip1/gpio/gpio0
lrwxrwxrwx 1 root root       0 Mar 29 23:42 gpio2 -> ../../devices/platform/soc/1c20800.pinctrl/gpiochip1/gpio/gpio2
lrwxrwxrwx 1 root root       0 Mar 29 23:42 gpio3 -> ../../devices/platform/soc/1c20800.pinctrl/gpiochip1/gpio/gpio3
lrwxrwxrwx 1 root root       0 Jan  1  1970 gpiochip0 -> ../../devices/platform/soc/1c20800.pinctrl/gpio/gpiochip0
lrwxrwxrwx 1 root root       0 Jan  1  1970 gpiochip352 -> ../../devices/platform/soc/1f02c00.pinctrl/gpio/gpiochip352
--w--w---- 1 root dialout 4096 Mar 29 23:42 unexport

 

root@nanopineo2:~# gpio readall
 +-----+-----+----------+------+---+-NanoPi-NEO2--+------+----------+-----+-----+
 | BCM | wPi |   Name   | Mode | V | Physical | V | Mode | Name     | wPi | BCM |
 +-----+-----+----------+------+---+----++----+---+------+----------+-----+-----+
 |     |     |     3.3V |      |   |  1 || 2  |   |      | 5V       |     |     |
 |  12 |   8 |  GPIOA12 | ALT5 | 0 |  3 || 4  |   |      | 5V       |     |     |
 |  11 |   9 |  GPIOA11 | ALT5 | 0 |  5 || 6  |   |      | 0v       |     |     |
 | 203 |   7 |  GPIOG11 |  OFF | 0 |  7 || 8  | 0 |  OFF | GPIOG6   | 15  | 198 |
 |     |     |       0v |      |   |  9 || 10 | 0 |  OFF | GPIOG7   | 16  | 199 |
 |   0 |   0 |   GPIOA0 | ALT2 | 0 | 11 || 12 | 0 |  OFF | GPIOA6   | 1   | 6   |
 |   2 |   2 |   GPIOA2 | ALT2 | 0 | 13 || 14 |   |      | 0v       |     |     |
 |   3 |   3 |   GPIOA3 | ALT2 | 0 | 15 || 16 | 0 |  OFF | GPIOG8   | 4   | 200 |
 |     |     |     3.3v |      |   | 17 || 18 | 0 |  OFF | GPIOG9   | 5   | 201 |
 |  64 |  12 |   GPIOC0 |  OFF | 0 | 19 || 20 |   |      | 0v       |     |     |
 |  65 |  13 |   GPIOC1 |  OFF | 0 | 21 || 22 | 0 |  OFF | GPIOA1   | 6   | 1   |
 |  66 |  14 |   GPIOC2 |  OFF | 0 | 23 || 24 | 0 |  OFF | GPIOC3   | 10  | 67  |
 +-----+-----+----------+------+---+----++----+---+------+----------+-----+-----+
 | BCM | wPi |   Name   | Mode | V | Physical | V | Mode | Name     | wPi | BCM |
 +-----+-----+----------+------+---+-NanoPi-NEO2--+------+----------+-----+-----+

 +-----+----NanoPi-NEO2 USB/Audio-+----+
 | BCM | wPi |   Name   | Mode | V | Ph |
 +-----+-----+----------+------+---+----+
 |     |     |       5V |      |   | 25 |
 |     |     |  USB-DP1 |      |   | 26 |
 |     |     |  USB-DM1 |      |   | 27 |
 |     |     |  USB-DP2 |      |   | 28 |
 |     |     |  USB-DM2 |      |   | 29 |
 |     |     |    IR-RX |      |   | 30 |
 |  17 |  19 |  GPIOA17 |  OFF | 0 | 31 |
 |     |     |  PCM/I2C |      |   | 32 |
 |     |     |  PCM/I2C |      |   | 33 |
 |     |     |  PCM/I2C |      |   | 34 |
 |     |     |  PCM/I2C |      |   | 35 |
 |     |     |       0V |      |   | 36 |
 +-----+-----+----------+------+---+----+

 +-----+----NanoPi-NEO2 Debug UART-+----+
 | BCM | wPi |   Name   | Mode | V | Ph |
 +-----+-----+----------+------+---+----+
 |   4 |  17 |   GPIOA4 | ALT5 | 0 | 37 |
 |   5 |  18 |   GPIOA5 | ALT5 | 0 | 38 |
 +-----+-----+----------+------+---+----+

 

root@nanopineo2:~# ls -l /sys/class/gpio
total 0
--w--w---- 1 root dialout 4096 Mar 29 23:42 export
lrwxrwxrwx 1 root root       0 Mar 29 23:42 gpio0 -> ../../devices/platform/soc/1c20800.pinctrl/gpiochip1/gpio/gpio0
lrwxrwxrwx 1 root root       0 Mar 29 23:42 gpio2 -> ../../devices/platform/soc/1c20800.pinctrl/gpiochip1/gpio/gpio2
lrwxrwxrwx 1 root root       0 Mar 29 23:42 gpio3 -> ../../devices/platform/soc/1c20800.pinctrl/gpiochip1/gpio/gpio3
lrwxrwxrwx 1 root root       0 Jan  1  1970 gpiochip0 -> ../../devices/platform/soc/1c20800.pinctrl/gpio/gpiochip0
lrwxrwxrwx 1 root root       0 Jan  1  1970 gpiochip352 -> ../../devices/platform/soc/1f02c00.pinctrl/gpio/gpiochip352
--w--w---- 1 root dialout 4096 Mar 29 23:42 unexport

 

Link to comment
Share on other sites

  • Maarten1 changed the title to Armbian 5.15.26-sunxi64 kernel breaks GPIO on NanoPi NEO2

Now found: 

 

So it is an upstream deprecation, but schwar3kat is looking into a way to restore the sysfs API. But generally, software (like NanoHatOLED) needs to move to recent libraries, like libgpiod then, to make use of GPIO in a future-prove way.

Link to comment
Share on other sites

On 4/3/2022 at 2:17 AM, MichaIng said:

Found a kernel config which sounds like it restores /sys/class/gpio, applied a while back on a different kernel: https://github.com/armbian/build/commit/cfc79c1

This is indeed missing for sunxi64 kernel: https://github.com/armbian/build/blob/master/config/kernel/linux-sunxi64-current.config

 

CONFIG_GPIO_SYSFS=y

 

Hello @Igor, does the answer by @MichaIng makes sense?

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...

Important Information

Terms of Use - Privacy Policy - Guidelines