Patch is based on http://patchwork.openwrt.org/patch/5273/.
I extended the TL-WR703n as Hartmut Knaack suggested and made some other LEDs 
and config fixes.

Signed-off-by: Álvaro Fernández Rojas <nolt...@gmail.com>
Signed-off-by: Michel Stempin <michel.stem...@wanadoo.fr>
Signed-off-by: Mark Janssen <m...@sig-io.nl>
Signed-off-by: alzhao <alz...@gmail.com>
---
diff --git a/target/linux/ar71xx/files/arch/mips/ath79/mach-tl-wr703n.c 
b/target/linux/ar71xx/files/arch/mips/ath79/mach-tl-wr703n.c
index 1d8d01c..6f61e0a 100644
--- a/target/linux/ar71xx/files/arch/mips/ath79/mach-tl-wr703n.c
+++ b/target/linux/ar71xx/files/arch/mips/ath79/mach-tl-wr703n.c
@@ -21,6 +21,9 @@
 #include "dev-wmac.h"
 #include "machtypes.h"
 
+#define GL_INET_GPIO_LED_WLAN          0
+#define GL_INET_GPIO_LED_LAN           13
+
 #define TL_WR703N_GPIO_LED_SYSTEM      27
 #define TL_WR703N_GPIO_BTN_RESET       11
 
@@ -40,6 +43,19 @@ static struct flash_platform_data tl_wr703n_flash_data = {
        .part_probes    = tl_wr703n_part_probes,
 };
 
+static struct gpio_led gl_inet_leds_gpio[] __initdata = {
+       {
+               .name           = "gl-connect:red:wlan",
+               .gpio           = GL_INET_GPIO_LED_WLAN,
+               .active_low     = 0,
+       },
+       {
+               .name           = "gl-connect:green:lan",
+               .gpio           = GL_INET_GPIO_LED_LAN,
+               .active_low     = 0,
+       },
+};
+
 static struct gpio_led tl_wr703n_leds_gpio[] __initdata = {
        {
                .name           = "tp-link:blue:system",
@@ -59,7 +75,7 @@ static struct gpio_keys_button tl_wr703n_gpio_keys[] 
__initdata = {
        }
 };
 
-static void __init common_setup(unsigned usb_power_gpio, bool sec_ethernet)
+static void __init common_setup(bool sec_ethernet)
 {
        u8 *mac = (u8 *) KSEG1ADDR(0x1f01fc00);
        u8 *ee = (u8 *) KSEG1ADDR(0x1fff1000);
@@ -68,15 +84,10 @@ static void __init common_setup(unsigned usb_power_gpio, 
bool sec_ethernet)
        ath79_setup_ar933x_phy4_switch(false, false);
 
        ath79_register_m25p80(&tl_wr703n_flash_data);
-       ath79_register_leds_gpio(-1, ARRAY_SIZE(tl_wr703n_leds_gpio),
-                                tl_wr703n_leds_gpio);
        ath79_register_gpio_keys_polled(-1, TL_WR703N_KEYS_POLL_INTERVAL,
                                        ARRAY_SIZE(tl_wr703n_gpio_keys),
                                        tl_wr703n_gpio_keys);
 
-       gpio_request_one(usb_power_gpio,
-                        GPIOF_OUT_INIT_HIGH | GPIOF_EXPORT_DIR_FIXED,
-                        "USB power");
        ath79_register_usb();
 
        ath79_init_mac(ath79_eth0_data.mac_addr, mac, 0);
@@ -93,9 +104,26 @@ static void __init common_setup(unsigned usb_power_gpio, 
bool sec_ethernet)
        ath79_register_wmac(ee, mac);
 }
 
+static void __init gl_inet_setup(void)
+{
+       common_setup(true);
+
+       ath79_register_leds_gpio(-1, ARRAY_SIZE(gl_inet_leds_gpio),
+                                gl_inet_leds_gpio);
+}
+
+MIPS_MACHINE(ATH79_MACH_GL_INET, "GL-INET", "GL-CONNECT INET v1",
+            gl_inet_setup);
+
 static void __init tl_mr10u_setup(void)
 {
-       common_setup(TL_MR10U_GPIO_USB_POWER, false);
+       common_setup(false);
+
+       ath79_register_leds_gpio(-1, ARRAY_SIZE(tl_wr703n_leds_gpio),
+                                tl_wr703n_leds_gpio);
+       gpio_request_one(TL_MR10U_GPIO_USB_POWER,
+                        GPIOF_OUT_INIT_HIGH | GPIOF_EXPORT_DIR_FIXED,
+                        "USB power");
 }
 
 MIPS_MACHINE(ATH79_MACH_TL_MR10U, "TL-MR10U", "TP-LINK TL-MR10U",
@@ -103,7 +131,13 @@ MIPS_MACHINE(ATH79_MACH_TL_MR10U, "TL-MR10U", "TP-LINK 
TL-MR10U",
 
 static void __init tl_wr703n_setup(void)
 {
-       common_setup(TL_WR703N_GPIO_USB_POWER, false);
+       common_setup(false);
+
+       ath79_register_leds_gpio(-1, ARRAY_SIZE(tl_wr703n_leds_gpio),
+                                tl_wr703n_leds_gpio);
+       gpio_request_one(TL_WR703N_GPIO_USB_POWER,
+                        GPIOF_OUT_INIT_HIGH | GPIOF_EXPORT_DIR_FIXED,
+                        "USB power");
 }
 
 MIPS_MACHINE(ATH79_MACH_TL_WR703N, "TL-WR703N", "TP-LINK TL-WR703N v1",
@@ -111,7 +145,13 @@ MIPS_MACHINE(ATH79_MACH_TL_WR703N, "TL-WR703N", "TP-LINK 
TL-WR703N v1",
 
 static void __init tl_wr710n_setup(void)
 {
-       common_setup(TL_WR703N_GPIO_USB_POWER, true);
+       common_setup(true);
+
+       ath79_register_leds_gpio(-1, ARRAY_SIZE(tl_wr703n_leds_gpio),
+                                tl_wr703n_leds_gpio);
+       gpio_request_one(TL_WR703N_GPIO_USB_POWER,
+                        GPIOF_OUT_INIT_HIGH | GPIOF_EXPORT_DIR_FIXED,
+                        "USB power");
 }
 
 MIPS_MACHINE(ATH79_MACH_TL_WR710N, "TL-WR710N", "TP-LINK TL-WR710N v1",
diff --git a/target/linux/ar71xx/patches-3.10/712-MIPS-ath79-add-GL-INET.patch 
b/target/linux/ar71xx/patches-3.10/712-MIPS-ath79-add-GL-INET.patch
new file mode 100644
index 0000000..c1247a2
--- /dev/null
+++ b/target/linux/ar71xx/patches-3.10/712-MIPS-ath79-add-GL-INET.patch
@@ -0,0 +1,10 @@
+--- a/arch/mips/ath79/machtypes.h
++++ b/arch/mips/ath79/machtypes.h
+@@ -50,6 +50,7 @@ enum ath79_mach_type {
+       ATH79_MACH_EW_DORIN,            /* embedded wireless Dorin Platform */
+       ATH79_MACH_EW_DORIN_ROUTER,     /* embedded wireless Dorin Router 
Platform */
+       ATH79_MACH_EAP7660D,            /* Senao EAP7660D */
++      ATH79_MACH_GL_INET,             /* GL-CONNECT GL-INET */
+       ATH79_MACH_GS_OOLITE,           /* GS OOLITE V1.0 */
+       ATH79_MACH_HIWIFI_HC6361,       /* HiWiFi HC6361 */
+       ATH79_MACH_JA76PF,              /* jjPlus JA76PF */
_______________________________________________
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel

Reply via email to