Changeset 38036


Ignore:
Timestamp:
2013-09-18T16:33:54+02:00 (4 years ago)
Author:
hauke
Message:

brcm47xx: update board detection patches

This is now the version which was send for mainline Linux kernel
inclusion. The data needed to detection a board is now stored in init
data.

Signed-off-by: Hauke Mehrtens <hauke@…>

Location:
trunk
Files:
1 added
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/package/kernel/broadcom-diag/src/diag.c

    r38008 r38036  
    13451345        board = bcm47xx_board_get(); 
    13461346        board_name = bcm47xx_board_get_name(); 
    1347         if (board != BCM47XX_BOARD_UNKNOWN && board != BCM47XX_BOARD_NON) 
     1347        if (board != BCM47XX_BOARD_UNKNOWN && board != BCM47XX_BOARD_NO) 
    13481348                printk(MODULE_NAME ": kernel found a \"%s\"\n", board_name); 
    13491349 
     
    14481448                return &platforms[WNDR3700V3]; 
    14491449        case BCM47XX_BOARD_UNKNOWN: 
    1450         case BCM47XX_BOARD_NON: 
     1450        case BCM47XX_BOARD_NO: 
    14511451                printk(MODULE_NAME ": unknown board found, try legacy detect\n"); 
    14521452                printk(MODULE_NAME ": please open a ticket at https://dev.openwrt.org and attach the complete nvram\n"); 
  • trunk/target/linux/brcm47xx/patches-3.10/260-MIPS-BCM47XX-add-board-detection.patch

    r38035 r38036  
    99--- /dev/null 
    1010+++ b/arch/mips/bcm47xx/board.c 
    11 @@ -0,0 +1,289 @@ 
     11@@ -0,0 +1,296 @@ 
    1212+#include <linux/export.h> 
    1313+#include <linux/string.h> 
     
    3737+       const char *value3; 
    3838+}; 
    39 + 
    40 +static const struct bcm47xx_board_type *bcm47xx_board = NULL; 
    4139+ 
    4240+/* model_name */ 
     
    119117+/* boot_hw_model, boot_hw_ver */ 
    120118+static const struct bcm47xx_board_type_list2 bcm47xx_board_list_boot_hw[] = { 
    121 +       {{BCM47XX_BOARD_CISCO_M10V1, "Cisco M10"}, "M10", "1.0"}, /* like WRT160N v3.0 */ 
    122 +       {{BCM47XX_BOARD_CISCO_M20V1, "Cisco M20"}, "M20", "1.0"}, /* like WRT310N v2.0 */ 
     119+       /* like WRT160N v3.0 */ 
     120+       {{BCM47XX_BOARD_CISCO_M10V1, "Cisco M10"}, "M10", "1.0"}, 
     121+       /* like WRT310N v2.0 */ 
     122+       {{BCM47XX_BOARD_CISCO_M20V1, "Cisco M20"}, "M20", "1.0"}, 
    123123+       {{BCM47XX_BOARD_LINKSYS_E900V1, "Linksys E900 V1"}, "E900", "1.0"}, 
    124 +       {{BCM47XX_BOARD_LINKSYS_E1000V1, "Linksys E1000 V1"}, "E100", "1.0"},  /* like WRT160N v3.0 */ 
     124+       /* like WRT160N v3.0 */ 
     125+       {{BCM47XX_BOARD_LINKSYS_E1000V1, "Linksys E1000 V1"}, "E100", "1.0"}, 
    125126+       {{BCM47XX_BOARD_LINKSYS_E1000V2, "Linksys E1000 V2"}, "E1000", "2.0"}, 
    126127+       {{BCM47XX_BOARD_LINKSYS_E1000V21, "Linksys E1000 V2.1"}, "E1000", "2.1"}, 
    127128+       {{BCM47XX_BOARD_LINKSYS_E1200V2, "Linksys E1200 V2"}, "E1200", "2.0"}, 
    128129+       {{BCM47XX_BOARD_LINKSYS_E2000V1, "Linksys E2000 V1"}, "Linksys E2000", "1.0"}, 
    129 +       {{BCM47XX_BOARD_LINKSYS_E3000V1, "Linksys E3000 V1"}, "E300", "1.0"}, /* like WRT610N v2.0 */ 
     130+       /* like WRT610N v2.0 */ 
     131+       {{BCM47XX_BOARD_LINKSYS_E3000V1, "Linksys E3000 V1"}, "E300", "1.0"}, 
    130132+       {{BCM47XX_BOARD_LINKSYS_E3200V1, "Linksys E3200 V1"}, "E3200", "1.0"}, 
    131133+       {{BCM47XX_BOARD_LINKSYS_E4200V1, "Linksys E4200 V1"}, "E4200", "1.0"}, 
     
    166168+/* boardtype, boardnum, boardrev */ 
    167169+static const struct bcm47xx_board_type_list3 bcm47xx_board_list_board[] = { 
    168 +       {{BCM47XX_BOARD_ZTE_H218N, "ZTE H218N"}, "0x053d", "1234", "0x1305"}, 
    169170+       {{BCM47XX_BOARD_HUAWEI_E970, "Huawei E970"}, "0x048e", "0x5347", "0x11"}, 
    170171+       {{BCM47XX_BOARD_PHICOMM_M1, "Phicomm M1"}, "0x0590", "80", "0x1104"}, 
     172+       {{BCM47XX_BOARD_ZTE_H218N, "ZTE H218N"}, "0x053d", "1234", "0x1305"}, 
    171173+       { {0}, 0}, 
    172174+}; 
     
    176178+}; 
    177179+ 
    178 +static inline int startswith(char *source, char *cmp) 
    179 +{ 
    180 +       return !strncmp(source, cmp, strlen(cmp)); 
    181 +} 
     180+static const struct bcm47xx_board_type bcm47xx_board_no[] = { 
     181+       {BCM47XX_BOARD_NO, "No Board"}, 
     182+}; 
     183+ 
     184+static const struct bcm47xx_board_type *bcm47xx_board = bcm47xx_board_no; 
    182185+ 
    183186+static const struct bcm47xx_board_type *bcm47xx_board_get_nvram(void) 
     
    272275+static void bcm47xx_board_detect(void) 
    273276+{ 
    274 +       char buf[15]; 
    275 + 
    276 +       if (bcm47xx_board != NULL) 
     277+       int err; 
     278+       char buf[10]; 
     279+ 
     280+       if (bcm47xx_board != bcm47xx_board_no) 
    277281+               return; 
     282+ 
    278283+       /* check if the nvram is available */ 
    279 +       if (bcm47xx_nvram_getenv("boardtype", buf, sizeof(buf)) == -ENXIO) { 
    280 +               bcm47xx_board = bcm47xx_board_unknown; 
     284+       err = bcm47xx_nvram_getenv("boardtype", buf, sizeof(buf)); 
     285+ 
     286+       /* init of nvram failed, probably too early now */ 
     287+       if (err == -ENXIO) { 
    281288+               return; 
    282289+       } 
    283290+ 
    284291+       bcm47xx_board = bcm47xx_board_get_nvram(); 
    285 +       pr_info("Found board: \"%s\"\n", bcm47xx_board->name); 
     292+       pr_debug("Found board: \"%s\"\n", bcm47xx_board->name); 
    286293+} 
    287294+ 
     
    301308--- /dev/null 
    302309+++ b/arch/mips/include/asm/mach-bcm47xx/bcm47xx_board.h 
    303 @@ -0,0 +1,108 @@ 
     310@@ -0,0 +1,107 @@ 
    304311+#ifndef __BCM47XX_BOARD_H 
    305312+#define __BCM47XX_BOARD_H 
     
    397404+       BCM47XX_BOARD_PHICOMM_M1, 
    398405+ 
    399 +       /* TODO */ 
    400406+       BCM47XX_BOARD_SIMPLETECH_SIMPLESHARE, 
    401407+ 
     
    403409+ 
    404410+       BCM47XX_BOARD_UNKNOWN, 
    405 +       BCM47XX_BOARD_NON, 
    406 +}; 
    407 + 
    408 +extern enum bcm47xx_board bcm47xx_board_get(void); 
    409 +extern const char *bcm47xx_board_get_name(void); 
     411+       BCM47XX_BOARD_NO, 
     412+}; 
     413+ 
     414+enum bcm47xx_board bcm47xx_board_get(void); 
     415+const char *bcm47xx_board_get_name(void); 
    410416+ 
    411417+#endif /* __BCM47XX_BOARD_H */ 
  • trunk/target/linux/brcm47xx/patches-3.10/261-MIPS-BCM47XX-print-board-name-in-proc-cpuinfo.patch

    r37287 r38036  
    2626 { 
    2727-       return "Broadcom BCM47XX"; 
    28 +       static char buf[128]; 
     28+       static char buf[50]; 
    2929+       u16 chip_id = get_chip_id(); 
    3030+ 
  • trunk/target/linux/brcm47xx/patches-3.10/830-huawei_e970_support.patch

    r38011 r38036  
    1515 union bcm47xx_bus bcm47xx_bus; 
    1616 EXPORT_SYMBOL(bcm47xx_bus); 
    17 @@ -254,6 +256,33 @@ void __init plat_mem_setup(void) 
    18         pm_power_off = bcm47xx_machine_halt; 
     17@@ -255,6 +257,33 @@ void __init plat_mem_setup(void) 
     18        bcm47xx_board_detect(); 
    1919 } 
    2020  
     
    4949 { 
    5050        switch (bcm47xx_bus_type) { 
    51 @@ -268,6 +297,8 @@ static int __init bcm47xx_register_bus_c 
     51@@ -269,6 +298,8 @@ static int __init bcm47xx_register_bus_c 
    5252                break; 
    5353 #endif 
Note: See TracChangeset for help on using the changeset viewer.