For the WNDR3700 platform, this patch:

(1) provides the proper userspace setup for wired and wireless LEDs,
(2) adds a config file option to use the green LED (instead of orange) for the 
WAN port, and
(3) fixes an incorrect parity setting for the GPIO buttons.

I am just an enabler for these features. Forum user "ase" did all of the heavy 
lifting to figure out the proper WLAN GPIO and create the switch interface--I 
just put it together in a pretty package.

The patch leverages juhosg's recent wndr3700_quirk work to use a different GPIO 
pin only when run on the WNDR3700 platform.

Two caveats:

(1) I don't know if it's kosher to place comments in UCI configuration files. 
If not, feel free to strip them (although I think they add value).

(2) I'm also unsure if it's proper to include UCI configs other than "network" 
in the target/linux/PLATFORM/base-files/etc/defconfig/BOARD/ directory. I added 
a "system" config file there for the wndr3700 platform to adjust the WAN LED 
color, but based on my limited testing, this file seems to be get clobbered by 
the default /etc/config/system configuration file upon doing the initial flash. 
Surely, it would be better to append a board-specific "system" config to the 
main system config, right?

Signed-off-by: Scott Dudley <spms...@hotmail.com>


                                          
_________________________________________________________________
Hotmail: Powerful Free email with security by Microsoft.
http://clk.atdmt.com/GBL/go/201469230/direct/01/
--- target/linux/ar71xx/files/arch/mips/ar71xx/mach-wndr3700.c  (revision 19631)
+++ target/linux/ar71xx/files/arch/mips/ar71xx/mach-wndr3700.c  (working copy)
@@ -29,6 +29,7 @@
 #define WNDR3700_GPIO_LED_POWER_ORANGE 1
 #define WNDR3700_GPIO_LED_POWER_GREEN  2
 #define WNDR3700_GPIO_LED_WPS_GREEN    4
+#define WNDR3700_GPIO_LED_WAN_GREEN    6
 
 #define WNDR3700_GPIO_BTN_WPS          3
 #define WNDR3700_GPIO_BTN_RESET                8
@@ -118,6 +119,10 @@
                .name           = "wndr3700:orange:wps",
                .gpio           = WNDR3700_GPIO_LED_WPS_ORANGE,
                .active_low     = 1,
+       }, {
+               .name           = "wndr3700:green:wan",
+               .gpio           = WNDR3700_GPIO_LED_WAN_GREEN,
+               .active_low     = 1,
        }
 };
 
@@ -128,18 +133,21 @@
                .code           = BTN_0,
                .threshold      = 3,
                .gpio           = WNDR3700_GPIO_BTN_RESET,
+               .active_low     = 1,
        }, {
                .desc           = "wps",
                .type           = EV_KEY,
                .code           = BTN_1,
                .threshold      = 3,
                .gpio           = WNDR3700_GPIO_BTN_WPS,
+               .active_low     = 1,
        } , {
                .desc           = "wifi",
                .type           = EV_KEY,
                .code           = BTN_2,
                .threshold      = 3,
                .gpio           = WNDR3700_GPIO_BTN_WIFI,
+               .active_low     = 1,
        }
 };
 
--- target/linux/ar71xx/base-files/etc/defconfig/wndr3700/system        
(revision 0)
+++ target/linux/ar71xx/base-files/etc/defconfig/wndr3700/system        
(revision 0)
@@ -0,0 +1,11 @@
+config 'led'
+        # Setting the default to '1' below uses a GPIO to force the
+        # WAN LED to be green rather than orange. Currently, this must
+        # be statically configured. A further improvement would be
+        # to dynamically adjust this based on the negotiated   
+        # Ethernet speed.                   
+                                            
+        option sysfs    'wndr3700:green:wan'
+        option name     'WAN LED (green)'
+        option default  '0'
+
--- target/linux/ar71xx/base-files/etc/defconfig/wndr3700/network       
(revision 19631)
+++ target/linux/ar71xx/base-files/etc/defconfig/wndr3700/network       
(working copy)
@@ -19,8 +19,53 @@
        option name     rtl8366s
        option reset    1
        option enable_vlan 1
+       # Blinkrate: 0=43ms; 1=84ms; 2=120ms; 3=170ms; 4=340ms; 5=670ms
+       option blinkrate        2
 
 config switch_vlan
        option device   rtl8366s
        option vlan     0
        option ports    "0 1 2 3 5"
+
+config switch_port
+       # Port 1 controls the GREEN configuration of LEDs for
+       # the switch and the section does not correspond to a real
+       # switch port.
+       #
+       # 0=LED off; 1=Collision/FDX; 2=Link/activity; 3-1000MB/s
+       # 4=100 MB/s; 5=10 MB/s; 6=1000 MB/s+activity; 7=100 MB/s+activity
+       # 8=10 MB/s+activity; 9=10/100 Mb/s+activity; 10: Fiber;
+       # 11: Fault; 12: Link/activity(tx); 13: Link/activity(rx);
+       # 14: Link (master); 15: separate register
+       
+       option device           rtl8366s
+       option port             1
+       option led              2
+       
+config switch_port
+       # Port 2 controls the ORANGE configuration of LEDs for
+       # the switch and the section does not correspond to a real
+       # switch port.
+       #
+       # See the key above for switch port 1 for the meaning of the
+       # 'led' setting below.
+       
+       option device           rtl8366s
+       option port             2
+       option led              6
+
+
+config switch_port                                              
+       # Port 5 controls the configuration of the WAN LED and the
+       # section does not correspond to a real switch port.
+       #
+       # To toggle the use of green or orange LEDs for the WAN port,
+       # see the LED setting for wndr3700:green:wan in /etc/config/system.
+       #
+       # See the key above for switch port 1 for the meaning of the
+       # 'led' setting below.
+
+       option device           rtl8366s
+       option port             5
+       option led              6
+
--- package/mac80211/patches/580-wndr3700-led-pin.patch (revision 0)
+++ package/mac80211/patches/580-wndr3700-led-pin.patch (revision 0)
@@ -0,0 +1,23 @@
+--- a/drivers/net/wireless/ath/ath9k/gpio.c    2010-01-18 14:11:59.943782130 
-0200
++++ b/drivers/net/wireless/ath/ath9k/gpio.c    2010-01-18 14:12:59.015805947 
-0200
+@@ -138,7 +138,9 @@
+       if (AR_SREV_9100(sc->sc_ah))
+               return;
+ 
+-      if (AR_SREV_9287(sc->sc_ah))
++      if (sc->quirk_wndr3700)
++              sc->sc_ah->led_pin = ATH_LED_PIN_WNDR_3700;
++      else if (AR_SREV_9287(sc->sc_ah))
+               sc->sc_ah->led_pin = ATH_LED_PIN_9287;
+       else
+               sc->sc_ah->led_pin = ATH_LED_PIN_DEF;
+--- a/drivers/net/wireless/ath/ath9k/ath9k.h   2010-02-03 23:54:38.587384701 
-0200
++++ b/drivers/net/wireless/ath/ath9k/ath9k.h   2010-02-03 23:55:02.856200079 
-0200
+@@ -378,6 +378,7 @@
+ 
+ #define ATH_LED_PIN_DEF               1
+ #define ATH_LED_PIN_9287              8
++#define ATH_LED_PIN_WNDR_3700         5
+ #define ATH_LED_ON_DURATION_IDLE      350     /* in msecs */
+ #define ATH_LED_OFF_DURATION_IDLE     250     /* in msecs */
+ 
_______________________________________________
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel

Reply via email to