[package] fix detection of motorola wr850g, thanks to Vinicius Fonseca, (#4710)
[openwrt/svn-archive/archive.git] / package / broadcom-diag / src / diag.c
index cde681a0f2e3744fbe22a7d113f50ad895322a7e..c8c0e34abebed486fc8bd6c0ccb897f0ee06557e 100644 (file)
@@ -19,7 +19,6 @@
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
  *
- * $Id$
  */
 #include <linux/module.h>
 #include <linux/pci.h>
@@ -67,6 +66,8 @@ enum {
        /* ASUS */
        WLHDD,
        WL300G,
+       WL320GE,
+       WL330GE,
        WL500G,
        WL500GD,
        WL500GP,
@@ -295,6 +296,26 @@ static struct platform_t __initdata platforms[] = {
                        { .name = "power",      .gpio = 1 << 0, .polarity = REVERSE },
                },
        },
+       [WL320GE] = {
+               .name           = "ASUS WL-320gE/WL-320gP",
+               .buttons        = {
+                       { .name = "reset",      .gpio = 1 << 6 },
+               },
+               .leds           = {
+                       { .name = "wlan",       .gpio = 1 << 0, .polarity = REVERSE },
+                       { .name = "power",      .gpio = 1 << 2, .polarity = REVERSE },
+                       { .name = "link",       .gpio = 1 << 11, .polarity = REVERSE },
+               },
+       },
+       [WL330GE] = {
+               .name           = "ASUS WL-330gE",
+               .buttons        = {
+                       { .name = "reset",      .gpio = 1 << 2 },
+               },
+               .leds           = {
+                       { .name = "power",      .gpio = 1 << 0, .polarity = REVERSE },
+               },
+       },
        [WL500G] = {
                .name           = "ASUS WL-500g",
                .buttons        = {
@@ -752,12 +773,16 @@ static struct platform_t __init *platform_detect(void)
                        return &platforms[WL520GC];
                if (startswith(buf,"WL520GU-")) /* WL520GU-* */
                        return &platforms[WL520GU];
+               if (startswith(buf,"WL330GE-")) /* WL330GE-* */
+                       return &platforms[WL330GE];
        }
 
        /* Based on "ModelId" */
        if ((buf = nvram_get("ModelId"))) {
                if (!strcmp(buf, "WR850GP"))
                        return &platforms[WR850GP];
+               if (!strcmp(buf, "WR850G"))
+                       return &platforms[WR850GV2V3];
                if (!strcmp(buf, "WX-5565") && !strcmp(getvar("boardtype"),"bcm94710ap"))
                        return &platforms[TM2300]; /* Dell TrueMobile 2300 */
                if (startswith(buf,"WE800G")) /* WE800G* */
@@ -825,6 +850,8 @@ static struct platform_t __init *platform_detect(void)
                                return &platforms[WL500GP];
                        else if (!strcmp(boardtype,"0x0472"))
                                return &platforms[WL500W];
+                       else if (!strcmp(boardtype,"0x467"))
+                               return &platforms[WL320GE];
                        else
                                return &platforms[WL500GD];
                }
@@ -905,14 +932,14 @@ static void register_buttons(struct button_t *b)
        gpio_control(platform.button_mask, 0);
        platform.button_polarity = gpio_in() & platform.button_mask;
        gpio_intpolarity(platform.button_mask, platform.button_polarity);
-       gpio_intmask(platform.button_mask, platform.button_mask);
+       gpio_setintmask(platform.button_mask, platform.button_mask);
 
        gpio_set_irqenable(1, button_handler);
 }
 
 static void unregister_buttons(struct button_t *b)
 {
-       gpio_intmask(platform.button_mask, 0);
+       gpio_setintmask(platform.button_mask, 0);
 
        gpio_set_irqenable(0, button_handler);
 }
@@ -1087,7 +1114,7 @@ static void register_leds(struct led_t *l)
        gpio_outen(mask, oe_mask);
        gpio_control(mask, 0);
        gpio_out(mask, val);
-       gpio_intmask(mask, 0);
+       gpio_setintmask(mask, 0);
 }
 
 static void unregister_leds(struct led_t *l)