Add Siemens SE505v2 detection to diag (#3416)
[openwrt/svn-archive/archive.git] / package / broadcom-diag / src / diag.c
index df28cab297b687767eacb9ee6540001b64049157..a4bad4d00c39475d78c3a1f44cdf0b4bf95dfdee 100644 (file)
@@ -70,6 +70,7 @@ enum {
        WL500GP,
        WL500GPV2,
        WL500W,
+       WL520GC,
        WL520GU,
        ASUS_4702,
        WL700GE,
@@ -305,6 +306,17 @@ static struct platform_t __initdata platforms[] = {
                        { .name = "power",      .gpio = 1 << 5, .polarity = REVERSE },
                },
        },
+       [WL520GC] = {
+               .name           = "ASUS WL-520GC",
+               .buttons        = {
+                       { .name = "reset",      .gpio = 1 << 2 },
+                       { .name = "ses",        .gpio = 1 << 3 },
+               },
+               .leds           = {
+               { .name = "power",      .gpio = 1 << 0, .polarity = REVERSE },
+                       { .name = "wlan",       .gpio = 1 << 1, .polarity = REVERSE },
+               },
+       },
        [WL520GU] = {
                .name           = "ASUS WL-520gU",
                .buttons        = {
@@ -479,7 +491,8 @@ static struct platform_t __initdata platforms[] = {
                        /* No usable buttons */
                },
                .leds           = {
-                       { .name = "dmz",        .gpio = 1 << 4, .polarity = REVERSE },
+//                     { .name = "power",      .gpio = 1 << 0  .polarity = REVERSE },  // Usable when retrofitting D26 (?)
+                       { .name = "dmz",        .gpio = 1 << 4, .polarity = REVERSE },  // actual name WWW
                        { .name = "wlan",       .gpio = 1 << 3, .polarity = REVERSE },
                },
        },
@@ -490,7 +503,7 @@ static struct platform_t __initdata platforms[] = {
                },
                .leds           = {
                        { .name = "power",      .gpio = 1 << 5, .polarity = REVERSE },
-                       { .name = "dmz",        .gpio = 1 << 0, .polarity = REVERSE },
+                       { .name = "dmz",        .gpio = 1 << 0, .polarity = REVERSE },  // actual name WWW
                        { .name = "wlan",       .gpio = 1 << 3, .polarity = REVERSE },
                },
        },
@@ -670,7 +683,7 @@ static struct platform_t __init *platform_detect(void)
        /* Look for a model identifier */
 
        /* Based on "model_name" */
-       if (buf = nvram_get("model_name")) {
+       if ((buf = nvram_get("model_name"))) {
                if (!strcmp(buf, "DIR-130"))
                        return &platforms[DIR130];
                if (!strcmp(buf, "DIR-330"))
@@ -678,21 +691,23 @@ static struct platform_t __init *platform_detect(void)
        }
 
        /* Based on "model_no" */
-       if (buf = nvram_get("model_no")) {
+       if ((buf = nvram_get("model_no"))) {
                if (startswith(buf,"WL700")) /* WL700* */
                        return &platforms[WL700GE];
        }
 
        /* Based on "hardware_version" */
-       if (buf = nvram_get("hardware_version")) {
+       if ((buf = nvram_get("hardware_version"))) {
                if (startswith(buf,"WL500GPV2-")) /* WL500GPV2-* */
                        return &platforms[WL500GPV2];
+               if (startswith(buf,"WL520GC-")) /* WL520GU-* */
+                       return &platforms[WL520GC];
                if (startswith(buf,"WL520GU-")) /* WL520GU-* */
                        return &platforms[WL520GU];
        }
 
        /* Based on "ModelId" */
-       if (buf = nvram_get("ModelId")) {
+       if ((buf = nvram_get("ModelId"))) {
                if (!strcmp(buf, "WR850GP"))
                        return &platforms[WR850GP];
                if (!strcmp(buf,"WX-5565"))
@@ -756,6 +771,9 @@ static struct platform_t __init *platform_detect(void)
                if (!strcmp(boardnum, "10496"))
                        return &platforms[USR5461];
 
+               if (!strcmp(getvar("boardtype"), "0x0101") && !strcmp(getvar("boardrev"), "0x10")) /* SE505V2 With Modified CFE */
+                       return &platforms[SE505V2];
+               
        } else { /* PMON based - old stuff */
                if ((simple_strtoul(getvar("GemtekPmonVer"), NULL, 0) == 9) &&
                        (simple_strtoul(getvar("et0phyaddr"), NULL, 0) == 30)) {