aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux/ath25/patches-5.4/210-reset_button.patch
diff options
context:
space:
mode:
authorAdrian Schmutzler <freifunk@adrianschmutzler.de>2020-09-06 13:57:27 +0200
committerAdrian Schmutzler <freifunk@adrianschmutzler.de>2020-09-06 19:49:05 +0200
commit081e944be6684bf5c4ee7c9fa2683d568d5be288 (patch)
tree9f1942be74e4faef66c1fd8dee9b15dcc2b33d87 /target/linux/ath25/patches-5.4/210-reset_button.patch
parent8938711223842facfd9a2a36ca4c589665c2c0ca (diff)
downloadupstream-081e944be6684bf5c4ee7c9fa2683d568d5be288.tar.gz
upstream-081e944be6684bf5c4ee7c9fa2683d568d5be288.tar.bz2
upstream-081e944be6684bf5c4ee7c9fa2683d568d5be288.zip
ath25: add back target support
Discussion on the mailing list reveals that this target has active users. As we are finally able to upgrade this target to kernel 5.4, add it back to master. This reverts commit 7d29a5571403 ("ath25: drop target") and immediately moves the relevant files to 5.4, without touching the content. Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
Diffstat (limited to 'target/linux/ath25/patches-5.4/210-reset_button.patch')
-rw-r--r--target/linux/ath25/patches-5.4/210-reset_button.patch71
1 files changed, 71 insertions, 0 deletions
diff --git a/target/linux/ath25/patches-5.4/210-reset_button.patch b/target/linux/ath25/patches-5.4/210-reset_button.patch
new file mode 100644
index 0000000000..b3f7a14cda
--- /dev/null
+++ b/target/linux/ath25/patches-5.4/210-reset_button.patch
@@ -0,0 +1,71 @@
+--- a/arch/mips/ath25/Makefile
++++ b/arch/mips/ath25/Makefile
+@@ -8,7 +8,7 @@
+ # Copyright (C) 2006-2009 Felix Fietkau <nbd@openwrt.org>
+ #
+
+-obj-y += board.o prom.o devices.o
++obj-y += board.o prom.o devices.o reset.o
+
+ obj-$(CONFIG_EARLY_PRINTK) += early_printk.o
+
+--- /dev/null
++++ b/arch/mips/ath25/reset.c
+@@ -0,0 +1,57 @@
++#include <linux/init.h>
++#include <linux/slab.h>
++#include <linux/platform_device.h>
++#include <linux/gpio_keys.h>
++#include <linux/input.h>
++#include <ath25_platform.h>
++#include "devices.h"
++
++static int __init
++ar231x_init_reset(void)
++{
++ struct platform_device *pdev;
++ struct gpio_keys_platform_data pdata;
++ struct gpio_keys_button *p;
++ int err;
++
++ if (ath25_board.config->reset_config_gpio == 0xffff)
++ return -ENODEV;
++
++ p = kzalloc(sizeof(*p), GFP_KERNEL);
++ if (!p)
++ goto err;
++
++ p->desc = "reset";
++ p->type = EV_KEY;
++ p->code = KEY_RESTART;
++ p->debounce_interval = 60;
++ p->gpio = ath25_board.config->reset_config_gpio;
++
++ memset(&pdata, 0, sizeof(pdata));
++ pdata.poll_interval = 20;
++ pdata.buttons = p;
++ pdata.nbuttons = 1;
++
++ pdev = platform_device_alloc("gpio-keys-polled", 0);
++ if (!pdev)
++ goto err_free;
++
++ err = platform_device_add_data(pdev, &pdata, sizeof(pdata));
++ if (err)
++ goto err_put_pdev;
++
++ err = platform_device_add(pdev);
++ if (err)
++ goto err_put_pdev;
++
++ return 0;
++
++err_put_pdev:
++ platform_device_put(pdev);
++err_free:
++ kfree(p);
++err:
++ return -ENOMEM;
++}
++
++device_initcall(ar231x_init_reset);