aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux/ath25/patches-5.4/330-board_leds.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/330-board_leds.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/330-board_leds.patch')
-rw-r--r--target/linux/ath25/patches-5.4/330-board_leds.patch116
1 files changed, 116 insertions, 0 deletions
diff --git a/target/linux/ath25/patches-5.4/330-board_leds.patch b/target/linux/ath25/patches-5.4/330-board_leds.patch
new file mode 100644
index 0000000000..e357fc6a64
--- /dev/null
+++ b/target/linux/ath25/patches-5.4/330-board_leds.patch
@@ -0,0 +1,116 @@
+--- a/arch/mips/ath25/ar2315.c
++++ b/arch/mips/ath25/ar2315.c
+@@ -23,6 +23,7 @@
+ #include <linux/reboot.h>
+ #include <linux/delay.h>
+ #include <linux/gpio.h>
++#include <linux/leds.h>
+ #include <asm/bootinfo.h>
+ #include <asm/reboot.h>
+ #include <asm/time.h>
+@@ -260,6 +261,50 @@ static struct platform_device ar2315_spi
+ .num_resources = ARRAY_SIZE(ar2315_spiflash_res)
+ };
+
++#ifdef CONFIG_LEDS_GPIO
++static struct gpio_led ar2315_leds[6];
++static struct gpio_led_platform_data ar2315_led_data = {
++ .leds = (void *)ar2315_leds,
++};
++
++static struct platform_device ar2315_gpio_leds = {
++ .name = "leds-gpio",
++ .id = -1,
++ .dev = {
++ .platform_data = (void *)&ar2315_led_data,
++ }
++};
++
++static void __init ar2315_init_gpio_leds(void)
++{
++ static char led_names[6][6];
++ int i, led = 0;
++
++ ar2315_led_data.num_leds = 0;
++ for (i = 1; i < 8; i++) {
++ if ((i == AR2315_RESET_GPIO) ||
++ (i == ath25_board.config->reset_config_gpio))
++ continue;
++
++ if (i == ath25_board.config->sys_led_gpio)
++ strcpy(led_names[led], "wlan");
++ else
++ sprintf(led_names[led], "gpio%d", i);
++
++ ar2315_leds[led].name = led_names[led];
++ ar2315_leds[led].gpio = i;
++ ar2315_leds[led].active_low = 0;
++ led++;
++ }
++ ar2315_led_data.num_leds = led;
++ platform_device_register(&ar2315_gpio_leds);
++}
++#else
++static inline void ar2315_init_gpio_leds(void)
++{
++}
++#endif
++
+ void __init ar2315_init_devices(void)
+ {
+ /* Find board configuration */
+@@ -270,6 +315,8 @@ void __init ar2315_init_devices(void)
+ ar2315_gpio_res[1].end = ar2315_gpio_res[1].start;
+ platform_device_register(&ar2315_gpio);
+
++ ar2315_init_gpio_leds();
++
+ ar2315_wdt_res[1].start = irq_create_mapping(ar2315_misc_irq_domain,
+ AR2315_MISC_IRQ_WATCHDOG);
+ ar2315_wdt_res[1].end = ar2315_wdt_res[1].start;
+--- a/arch/mips/ath25/ar5312.c
++++ b/arch/mips/ath25/ar5312.c
+@@ -23,6 +23,7 @@
+ #include <linux/mtd/physmap.h>
+ #include <linux/reboot.h>
+ #include <linux/gpio.h>
++#include <linux/leds.h>
+ #include <asm/bootinfo.h>
+ #include <asm/reboot.h>
+ #include <asm/time.h>
+@@ -231,6 +232,23 @@ static struct platform_device ar5312_gpi
+ .num_resources = ARRAY_SIZE(ar5312_gpio_res),
+ };
+
++#ifdef CONFIG_LEDS_GPIO
++static struct gpio_led ar5312_leds[] = {
++ { .name = "wlan", .gpio = 0, .active_low = 1, },
++};
++
++static const struct gpio_led_platform_data ar5312_led_data = {
++ .num_leds = ARRAY_SIZE(ar5312_leds),
++ .leds = (void *)ar5312_leds,
++};
++
++static struct platform_device ar5312_gpio_leds = {
++ .name = "leds-gpio",
++ .id = -1,
++ .dev.platform_data = (void *)&ar5312_led_data,
++};
++#endif
++
+ static void __init ar5312_flash_init(void)
+ {
+ void __iomem *flashctl_base;
+@@ -301,6 +319,11 @@ void __init ar5312_init_devices(void)
+
+ platform_device_register(&ar5312_gpio);
+
++#ifdef CONFIG_LEDS_GPIO
++ ar5312_leds[0].gpio = config->sys_led_gpio;
++ platform_device_register(&ar5312_gpio_leds);
++#endif
++
+ /* Fix up MAC addresses if necessary */
+ if (is_broadcast_ether_addr(config->enet0_mac))
+ ether_addr_copy(config->enet0_mac, config->enet1_mac);