Add multiple default gateways patch. No need to change the kernel configuration....
[openwrt.git] / target / linux / package / diag / diag_led.c
index cc2bc8a..6ad7ff1 100644 (file)
@@ -28,6 +28,7 @@
  * 2005/03/14 asus wl-500g deluxe and buffalo v2 support added
  * 2005/04/13 added licensing informations
  * 2005/04/18 base reset polarity off initial readings
+ * 2006/02/07 motorola wa840g/we800g support added
  */
 
 #include <linux/module.h>
@@ -36,6 +37,7 @@
 #include <linux/sysctl.h>
 #include <asm/io.h>
 #include <typedefs.h>
+#include <osl.h>
 #include <bcmdevs.h>
 #include <sbutils.h>
 
@@ -47,9 +49,9 @@ static void *sbh;
 #define DMZ_GPIO  (1<<7)
 
 static void set_gpio(uint32 mask, uint32 value) {
-       sb_gpiocontrol(sbh,mask,0);
-       sb_gpioouten(sbh,mask,mask);
-       sb_gpioout(sbh,mask,value);
+       sb_gpiocontrol(sbh,mask, 0, GPIO_DRV_PRIORITY);
+       sb_gpioouten(sbh,mask,mask,GPIO_DRV_PRIORITY);
+       sb_gpioout(sbh,mask,value,GPIO_DRV_PRIORITY);
 }
 
 static void v2_set_diag(u8 state) {
@@ -78,6 +80,13 @@ static void v1_set_dmz(u8 state) {
        }
 }
 
+static void wap1_set_diag(u8 state) {
+       set_gpio(1<<3,state);
+}
+static void wap1_set_dmz(u8 state) {
+       set_gpio(1<<4,state);
+}
+
 // - - - - -
 static void ignore(u8 ignored) {};
 
@@ -122,8 +131,8 @@ static int proc_reset(ctl_table *table, int write, struct file *filp,
 {
 
        if (reset_gpio) {
-               sb_gpiocontrol(sbh,reset_gpio,reset_gpio);
-               sb_gpioouten(sbh,reset_gpio,0);
+               sb_gpiocontrol(sbh,reset_gpio,reset_gpio,GPIO_DRV_PRIORITY);
+               sb_gpioouten(sbh,reset_gpio,0,GPIO_DRV_PRIORITY);
                reset=!(sb_gpioin(sbh)&reset_gpio);
 
                if (reset_polarity) reset=!reset;
@@ -170,10 +179,10 @@ static int __init diag_init()
        set_diag=ignore;
        set_dmz=ignore;
        
-       buf=nvram_get("boardrev");
-       if (((board_type & 0xf00) == 0x400) && strcmp(buf,"0x10")) {
+       buf=nvram_get("pmon_ver") ?: "";
+       if (((board_type & 0xf00) == 0x400) && (strncmp(buf, "CFE", 3) != 0)) {
                buf=nvram_get("boardtype")?:"";
-               if (!strcmp(buf,"bcm94710dev")) {
+               if (!strncmp(buf,"bcm94710dev",11)) {
                        buf=nvram_get("boardnum")?:"";
                        if (!strcmp(buf,"42")) {
                                // wrt54g v1.x
@@ -181,10 +190,24 @@ static int __init diag_init()
                                set_dmz=v1_set_dmz;
                                reset_gpio=(1<<6);
                        }
+                       if (simple_strtoul(buf, NULL, 0) == 2) {
+                               // wap54g v1.0
+                               // do not use strcmp as PMON v5.3.22 has some built-in nvram 
+                               // defaults with trailing \r
+                               set_diag=wap1_set_diag;
+                               // no dmz led on wap54g, used green led 
+                               // labeled "WLAN Link" instead
+                               set_dmz=wap1_set_dmz;
+                               reset_gpio=(1<<0);
+                       }
                        if (!strcmp(buf,"asusX")) {
                                //asus wl-500g
                                reset_gpio=(1<<6);
                        }
+                       if (!strcmp(buf,"2")) {
+                               //wa840g v1 / we800g v1
+                               reset_gpio=(1<<0);
+                       }
                }
                if (!strcmp(buf,"bcm94710ap")) {
                        buf=nvram_get("boardnum")?:"";
@@ -222,8 +245,8 @@ static int __init diag_init()
        }
 
        
-       sb_gpiocontrol(sbh,reset_gpio,reset_gpio);
-       sb_gpioouten(sbh,reset_gpio,0);
+       sb_gpiocontrol(sbh,reset_gpio,reset_gpio,GPIO_DRV_PRIORITY);
+       sb_gpioouten(sbh,reset_gpio,0,GPIO_DRV_PRIORITY);
        reset_polarity=!(sb_gpioin(sbh)&reset_gpio);
 
        diag_sysctl_header = register_sysctl_table(sys_diag, 0);
This page took 0.023991 seconds and 4 git commands to generate.