brcm47xx: improve detection of Linksys WRTSL54GS
authorHauke Mehrtens <hauke@hauke-m.de>
Thu, 1 Aug 2013 19:33:59 +0000 (19:33 +0000)
committerHauke Mehrtens <hauke@hauke-m.de>
Thu, 1 Aug 2013 19:33:59 +0000 (19:33 +0000)
This closes #13319

Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
SVN-Revision: 37647

package/kernel/broadcom-diag/src/diag.c
target/linux/brcm47xx/patches-3.10/260-MIPS-BCM47XX-add-board-detection.patch
target/linux/brcm47xx/patches-3.8/260-MIPS-BCM47XX-add-board-detection.patch

index c87ca97458e793ea7d3d32a61a14e24a442d37ce..f5c834617fe9b85e911241237b8ace3508309cbd 100644 (file)
@@ -1145,9 +1145,6 @@ static struct platform_t __init *platform_detect_legacy(void)
                        if (!strcmp(boardtype, "0x0101") && !strcmp(getvar("boot_ver"), "v3.6"))
                                return &platforms[WRT54G3G];
 
-                       if (!strcmp(getvar("et1phyaddr"),"5") && !strcmp(getvar("et1mdcport"), "1"))
-                               return &platforms[WRTSL54GS];
-
                        /* default to WRT54G */
                        return &platforms[WRT54G];
                }
@@ -1347,6 +1344,8 @@ static struct platform_t __init *platform_detect(void)
                return &platforms[WRT610N];
        case BCM47XX_BOARD_LINKSYS_WRT610NV2:
                return &platforms[WRT610NV2];
+       case BCM47XX_BOARD_LINKSYS_WRTSL54GS:
+               return &platforms[WRTSL54GS];
        case BCM47XX_BOARD_MOTOROLA_WE800G:
                return &platforms[WE800G];
        case BCM47XX_BOARD_MOTOROLA_WR850GP:
index cef3d527edab2a8fbbdd7928c191f4bf1a119588..ebc179ab1af82de055c2adfd92e776fd0c5ebb45 100644 (file)
@@ -8,7 +8,7 @@
  obj-$(CONFIG_BCM47XX_SSB)     += wgt634u.o
 --- /dev/null
 +++ b/arch/mips/bcm47xx/board.c
-@@ -0,0 +1,223 @@
+@@ -0,0 +1,235 @@
 +#include <linux/export.h>
 +#include <linux/string.h>
 +#include <bcm47xx_board.h>
 +      { {0}, 0},
 +};
 +
++static const struct bcm47xx_board_type_list bcm47xx_board_list_machine_name[] = {
++      {{BCM47XX_BOARD_LINKSYS_WRTSL54GS, "Linksys WRTSL54GS"}, "WRTSL54GS",},
++      { {0}, 0},
++};
++
 +static const struct bcm47xx_board_type_list bcm47xx_board_list_hardware_version[] = {
 +      {{BCM47XX_BOARD_ASUS_RTN16, "Asus RT-N16"}, "RT-N16-",},
 +      {{BCM47XX_BOARD_ASUS_WL330GE, "Asus WL330GE"}, "WL330GE-",},
 +              }
 +      }
 +
++      if (bcm47xx_nvram_getenv("machine_name", buf1, sizeof(buf1)) >= 0) {
++              for (e = bcm47xx_board_list_machine_name; e->value1; e++) {
++                      if (strstarts(buf1, e->value1))
++                              return &e->board;
++              }
++      }
++
 +      if (bcm47xx_nvram_getenv("hardware_version", buf1, sizeof(buf1)) >= 0) {
 +              for (e = bcm47xx_board_list_hardware_version; e->value1; e++) {
 +                      if (strstarts(buf1, e->value1))
 +EXPORT_SYMBOL(bcm47xx_board_get_name);
 --- /dev/null
 +++ b/arch/mips/include/asm/mach-bcm47xx/bcm47xx_board.h
-@@ -0,0 +1,91 @@
+@@ -0,0 +1,92 @@
 +#ifndef __BCM47XX_BOARD_H
 +#define __BCM47XX_BOARD_H
 +
 +      BCM47XX_BOARD_LINKSYS_WRT54G3GV2,
 +      BCM47XX_BOARD_LINKSYS_WRT610NV1,
 +      BCM47XX_BOARD_LINKSYS_WRT610NV2,
++      BCM47XX_BOARD_LINKSYS_WRTSL54GS,
 +
 +      BCM47XX_BOARD_MOTOROLA_WE800G,
 +      BCM47XX_BOARD_MOTOROLA_WR850GP,
index 3149855bf4ecd267de99291c6e562b0444add267..74cd182b72547b6f939d9085c27d0af03d155916 100644 (file)
@@ -8,7 +8,7 @@
  obj-$(CONFIG_BCM47XX_SSB)     += wgt634u.o
 --- /dev/null
 +++ b/arch/mips/bcm47xx/board.c
-@@ -0,0 +1,223 @@
+@@ -0,0 +1,235 @@
 +#include <linux/export.h>
 +#include <linux/string.h>
 +#include <bcm47xx_board.h>
 +      { {0}, 0},
 +};
 +
++static const struct bcm47xx_board_type_list bcm47xx_board_list_machine_name[] = {
++      {{BCM47XX_BOARD_LINKSYS_WRTSL54GS, "Linksys WRTSL54GS"}, "WRTSL54GS",},
++      { {0}, 0},
++};
++
 +static const struct bcm47xx_board_type_list bcm47xx_board_list_hardware_version[] = {
 +      {{BCM47XX_BOARD_ASUS_RTN16, "Asus RT-N16"}, "RT-N16-",},
 +      {{BCM47XX_BOARD_ASUS_WL330GE, "Asus WL330GE"}, "WL330GE-",},
 +              }
 +      }
 +
++      if (bcm47xx_nvram_getenv("machine_name", buf1, sizeof(buf1)) >= 0) {
++              for (e = bcm47xx_board_list_machine_name; e->value1; e++) {
++                      if (strstarts(buf1, e->value1))
++                              return &e->board;
++              }
++      }
++
 +      if (bcm47xx_nvram_getenv("hardware_version", buf1, sizeof(buf1)) >= 0) {
 +              for (e = bcm47xx_board_list_hardware_version; e->value1; e++) {
 +                      if (strstarts(buf1, e->value1))
 +EXPORT_SYMBOL(bcm47xx_board_get_name);
 --- /dev/null
 +++ b/arch/mips/include/asm/mach-bcm47xx/bcm47xx_board.h
-@@ -0,0 +1,91 @@
+@@ -0,0 +1,92 @@
 +#ifndef __BCM47XX_BOARD_H
 +#define __BCM47XX_BOARD_H
 +
 +      BCM47XX_BOARD_LINKSYS_WRT54G3GV2,
 +      BCM47XX_BOARD_LINKSYS_WRT610NV1,
 +      BCM47XX_BOARD_LINKSYS_WRT610NV2,
++      BCM47XX_BOARD_LINKSYS_WRTSL54GS,
 +
 +      BCM47XX_BOARD_MOTOROLA_WE800G,
 +      BCM47XX_BOARD_MOTOROLA_WR850GP,