Maarten1 Posted March 29, 2022 Posted March 29, 2022 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
MichaIng Posted March 31, 2022 Posted March 31, 2022 Is P2P the right place for a general issue (completely lost GPIO interface) with an officially supported SBC? 🤔 I hope Igor, listed as maintainer for NEO2, reads posts here.
Maarten1 Posted March 31, 2022 Author Posted March 31, 2022 Why is it moved to P2P since NanoPi NEO2 is officially supported and this bug affects others as well? I do not understand.
MichaIng Posted April 3, 2022 Posted April 3, 2022 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.
MichaIng Posted April 3, 2022 Posted April 3, 2022 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
Maarten1 Posted April 5, 2022 Author Posted April 5, 2022 Hi MichaIng, Thanks, does this mean we have to wait if in the next kernel update it will be corrected?
Maarten1 Posted April 5, 2022 Author Posted April 5, 2022 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?
MichaIng Posted April 5, 2022 Posted April 5, 2022 The related pull request is up already: https://github.com/armbian/build/pull/3635 This should re-enable the sysfs GPIO interface for all Allwinner 64-bit SBCs, including NanoPi NEO2.
MichaIng Posted May 30, 2022 Posted May 30, 2022 Issue solved with latest kernel release, many thanks guys!
Hayotbek Xasanboyev Posted June 2, 2022 Posted June 2, 2022 Can you confirm that, on Openwrt GPIO breaked to? I can't get to work GPIO pins for USB. It's depends linux kernel?
MichaIng Posted June 2, 2022 Posted June 2, 2022 At least Linux v5.15 by default has the old sysfs API disabled, so if anything depends on it (has not been migrated to use libgpiod) and it hasn't been explicitly enabled for the build like Armbian did now, then yes.
Recommended Posts