Resetbutton not working ath79 8Devices Lima

Hello everyone,
I'm currently trying to build an OpenWRT on the most recent master for my 8Devices Lima module. The build is running perfecly. But when i install the image i can't use the reset button. Here are a few outputs.

cat /proc/interrupts

root@OpenWrt:/# cat /proc/interrupts
               CPU0
  3:          0                MIPS   3  ehci_hcd:usb1
  4:          0                MIPS   4  19000000.eth
  5:          1215          MIPS   5  1a000000.eth
  7:          106996      MIPS   7  timer
  9:          360            MISC   3  ttyS0
 13:         0                INTC   0  ath9k
ERR:      0

cat /sys/kernel/debug/gpio

gpiochip0: GPIOs 0-31, parent: platform/18040000.gpio, 18040000.gpio:

ls /sys/firmware/devicetree/base/keys/reset

gpios label linux-code name

qca9531_8dev_lima.dts

/ {
	compatible = "8dev,lima", "qca,qca9531";
	model = "8devices Lima";

	keys {
		compatible = "gpio-keys";

		reset {
			label = "reset";
			linux-code = "KEY_RESTART";
			gpios = <&gpio 16 GPIO_ACTIVE_LOW>;
		};
	};
};

If i run this script i can see that the input is doing something

#!/bin/sh
GPIOBASE=`cat /sys/class/gpio/gpiochip*/base | head -n1`
GPIOmin=`expr $1 + $GPIOBASE`
GPIOmax=`expr $2 + $GPIOBASE`
 
cd /sys/class/gpio
for i in `seq $GPIOmin $GPIOmax`; do
echo $i > export; echo in >gpio$i/direction
done
nums=`seq $GPIOmin $GPIOmax`
while true; do
  for i in $nums; do
     echo read gpio$i 
     cat /sys/class/gpio/gpio$i/value
 done
  sleep 1
done
read gpio16
0
read gpio16
1

But it does not trigger any hotplug.d or rc.button actions

This is my first build with the ath79 Device Tree. Hopefully i am just doing something wrong. The Image is running on the 8Devices Lima Evalboard. I checked the voltage level on the board and this is working great.

Thank you so much in advance

Does official snapshot build work for you?

This should not be a string, but an integer defined as a preprocessor macro:

linux,code = <KEY_RESTART>;

1 Like

Official Snapshot from Tue Nov 10 04:42:55 2020 has exactly the same behavior.

I am building a new Version with
linux,code = <KEY_RESTART>;

I did this before with
linux-code = <KEY_RESTART>;
I missed the comma

I will let you know as soon as the build is finished

Okay that is working great.
Thank you very much for the fast support.
Is there something behind that 8Devices did it that way or would it make sense that I do a pull request?

That's actually a bug, please send a patch.

Here is the patch

diff --git a/target/linux/ath79/dts/qca9531_8dev_lima.dts b/target/linux/ath79/dts/qca9531_8dev_lima.dts
index 266807b837..d13ae66a1c 100644
--- a/target/linux/ath79/dts/qca9531_8dev_lima.dts
+++ b/target/linux/ath79/dts/qca9531_8dev_lima.dts
@@ -14,7 +14,7 @@
 
 		reset {
 			label = "reset";
-			linux-code = "KEY_RESTART";
+			linux,code = <KEY_RESTART>;
 			gpios = <&gpio 16 GPIO_ACTIVE_LOW>;
 		};
 	};

@reeett @s_2
Fix included in my staging tree, thanks!

2 Likes

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.