brcm47xx: update board detection patches
Add patches like they are currently in the mainline mips tree and add some more pending patches for board detection. * Now the board name is shown under machine in /proc/cpuinfo. Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de> SVN-Revision: 38308
This commit is contained in:
parent
53a2c19c69
commit
ebf0778721
9 changed files with 227 additions and 241 deletions
|
@ -1,3 +1,21 @@
|
|||
commit 74370cf83baefceb83f5f4b7ff5c8e19e7056632
|
||||
Author: Hauke Mehrtens <hauke@hauke-m.de>
|
||||
Date: Wed Sep 18 13:29:57 2013 +0200
|
||||
|
||||
MIPS: BCM47XX: Add board detection
|
||||
|
||||
Detect on which board this code is running based on some nvram
|
||||
settings. This is needed to start board specific workarounds and
|
||||
configure the leds and buttons which are on different gpios on every board.
|
||||
|
||||
This patches add some boards we have seen, but there are many more.
|
||||
|
||||
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
|
||||
Cc: linux-mips@linux-mips.org
|
||||
Patchwork: https://patchwork.linux-mips.org/patch/5840
|
||||
Patchwork: https://patchwork.linux-mips.org/patch/5855/
|
||||
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
|
||||
|
||||
--- a/arch/mips/bcm47xx/Makefile
|
||||
+++ b/arch/mips/bcm47xx/Makefile
|
||||
@@ -4,4 +4,5 @@
|
||||
|
@ -8,7 +26,7 @@
|
|||
obj-$(CONFIG_BCM47XX_SSB) += wgt634u.o
|
||||
--- /dev/null
|
||||
+++ b/arch/mips/bcm47xx/board.c
|
||||
@@ -0,0 +1,296 @@
|
||||
@@ -0,0 +1,309 @@
|
||||
+#include <linux/export.h>
|
||||
+#include <linux/string.h>
|
||||
+#include <bcm47xx_board.h>
|
||||
|
@ -37,27 +55,36 @@
|
|||
+ const char *value3;
|
||||
+};
|
||||
+
|
||||
+struct bcm47xx_board_store {
|
||||
+ enum bcm47xx_board board;
|
||||
+ char name[BCM47XX_BOARD_MAX_NAME];
|
||||
+};
|
||||
+
|
||||
+/* model_name */
|
||||
+static const struct bcm47xx_board_type_list1 bcm47xx_board_list_model_name[] = {
|
||||
+static const
|
||||
+struct bcm47xx_board_type_list1 bcm47xx_board_list_model_name[] __initconst = {
|
||||
+ {{BCM47XX_BOARD_DLINK_DIR130, "D-Link DIR-130"}, "DIR-130"},
|
||||
+ {{BCM47XX_BOARD_DLINK_DIR330, "D-Link DIR-330"}, "DIR-330"},
|
||||
+ { {0}, 0},
|
||||
+};
|
||||
+
|
||||
+/* model_no */
|
||||
+static const struct bcm47xx_board_type_list1 bcm47xx_board_list_model_no[] = {
|
||||
+static const
|
||||
+struct bcm47xx_board_type_list1 bcm47xx_board_list_model_no[] __initconst = {
|
||||
+ {{BCM47XX_BOARD_ASUS_WL700GE, "Asus WL700"}, "WL700"},
|
||||
+ { {0}, 0},
|
||||
+};
|
||||
+
|
||||
+/* machine_name */
|
||||
+static const struct bcm47xx_board_type_list1 bcm47xx_board_list_machine_name[] = {
|
||||
+static const
|
||||
+struct bcm47xx_board_type_list1 bcm47xx_board_list_machine_name[] __initconst = {
|
||||
+ {{BCM47XX_BOARD_LINKSYS_WRTSL54GS, "Linksys WRTSL54GS"}, "WRTSL54GS"},
|
||||
+ { {0}, 0},
|
||||
+};
|
||||
+
|
||||
+/* hardware_version */
|
||||
+static const struct bcm47xx_board_type_list1 bcm47xx_board_list_hardware_version[] = {
|
||||
+static const
|
||||
+struct bcm47xx_board_type_list1 bcm47xx_board_list_hardware_version[] __initconst = {
|
||||
+ {{BCM47XX_BOARD_ASUS_RTN16, "Asus RT-N16"}, "RT-N16-"},
|
||||
+ {{BCM47XX_BOARD_ASUS_WL320GE, "Asus WL320GE"}, "WL320G-"},
|
||||
+ {{BCM47XX_BOARD_ASUS_WL330GE, "Asus WL330GE"}, "WL330GE-"},
|
||||
|
@ -72,7 +99,8 @@
|
|||
+};
|
||||
+
|
||||
+/* productid */
|
||||
+static const struct bcm47xx_board_type_list1 bcm47xx_board_list_productid[] = {
|
||||
+static const
|
||||
+struct bcm47xx_board_type_list1 bcm47xx_board_list_productid[] __initconst = {
|
||||
+ {{BCM47XX_BOARD_ASUS_RTAC66U, "Asus RT-AC66U"}, "RT-AC66U"},
|
||||
+ {{BCM47XX_BOARD_ASUS_RTN10, "Asus RT-N10"}, "RT-N10"},
|
||||
+ {{BCM47XX_BOARD_ASUS_RTN10D, "Asus RT-N10D"}, "RT-N10D"},
|
||||
|
@ -92,7 +120,8 @@
|
|||
+};
|
||||
+
|
||||
+/* ModelId */
|
||||
+static const struct bcm47xx_board_type_list1 bcm47xx_board_list_ModelId[] = {
|
||||
+static const
|
||||
+struct bcm47xx_board_type_list1 bcm47xx_board_list_ModelId[] __initconst = {
|
||||
+ {{BCM47XX_BOARD_DELL_TM2300, "Dell WX-5565"}, "WX-5565"},
|
||||
+ {{BCM47XX_BOARD_MOTOROLA_WE800G, "Motorola WE800G"}, "WE800G"},
|
||||
+ {{BCM47XX_BOARD_MOTOROLA_WR850GP, "Motorola WR850GP"}, "WR850GP"},
|
||||
|
@ -101,7 +130,8 @@
|
|||
+};
|
||||
+
|
||||
+/* melco_id or buf1falo_id */
|
||||
+static const struct bcm47xx_board_type_list1 bcm47xx_board_list_melco_id[] = {
|
||||
+static const
|
||||
+struct bcm47xx_board_type_list1 bcm47xx_board_list_melco_id[] __initconst = {
|
||||
+ {{BCM47XX_BOARD_BUFFALO_WBR2_G54, "Buffalo WBR2-G54"}, "29bb0332"},
|
||||
+ {{BCM47XX_BOARD_BUFFALO_WHR2_A54G54, "Buffalo WHR2-A54G54"}, "290441dd"},
|
||||
+ {{BCM47XX_BOARD_BUFFALO_WHR_G125, "Buffalo WHR-G125"}, "32093"},
|
||||
|
@ -115,7 +145,8 @@
|
|||
+};
|
||||
+
|
||||
+/* boot_hw_model, boot_hw_ver */
|
||||
+static const struct bcm47xx_board_type_list2 bcm47xx_board_list_boot_hw[] = {
|
||||
+static const
|
||||
+struct bcm47xx_board_type_list2 bcm47xx_board_list_boot_hw[] __initconst = {
|
||||
+ /* like WRT160N v3.0 */
|
||||
+ {{BCM47XX_BOARD_CISCO_M10V1, "Cisco M10"}, "M10", "1.0"},
|
||||
+ /* like WRT310N v2.0 */
|
||||
|
@ -145,7 +176,8 @@
|
|||
+};
|
||||
+
|
||||
+/* board_id */
|
||||
+static const struct bcm47xx_board_type_list1 bcm47xx_board_list_board_id[] = {
|
||||
+static const
|
||||
+struct bcm47xx_board_type_list1 bcm47xx_board_list_board_id[] __initconst = {
|
||||
+ {{BCM47XX_BOARD_NETGEAR_WGR614V8, "Netgear WGR614 V8"}, "U12H072T00_NETGEAR"},
|
||||
+ {{BCM47XX_BOARD_NETGEAR_WGR614V9, "Netgear WGR614 V9"}, "U12H094T00_NETGEAR"},
|
||||
+ {{BCM47XX_BOARD_NETGEAR_WNDR3300, "Netgear WNDR3300"}, "U12H093T00_NETGEAR"},
|
||||
|
@ -166,24 +198,22 @@
|
|||
+};
|
||||
+
|
||||
+/* boardtype, boardnum, boardrev */
|
||||
+static const struct bcm47xx_board_type_list3 bcm47xx_board_list_board[] = {
|
||||
+static const
|
||||
+struct bcm47xx_board_type_list3 bcm47xx_board_list_board[] __initconst = {
|
||||
+ {{BCM47XX_BOARD_HUAWEI_E970, "Huawei E970"}, "0x048e", "0x5347", "0x11"},
|
||||
+ {{BCM47XX_BOARD_PHICOMM_M1, "Phicomm M1"}, "0x0590", "80", "0x1104"},
|
||||
+ {{BCM47XX_BOARD_ZTE_H218N, "ZTE H218N"}, "0x053d", "1234", "0x1305"},
|
||||
+ { {0}, 0},
|
||||
+};
|
||||
+
|
||||
+static const struct bcm47xx_board_type bcm47xx_board_unknown[] = {
|
||||
+static const
|
||||
+struct bcm47xx_board_type bcm47xx_board_unknown[] __initconst = {
|
||||
+ {BCM47XX_BOARD_UNKNOWN, "Unknown Board"},
|
||||
+};
|
||||
+
|
||||
+static const struct bcm47xx_board_type bcm47xx_board_no[] = {
|
||||
+ {BCM47XX_BOARD_NO, "No Board"},
|
||||
+};
|
||||
+static struct bcm47xx_board_store bcm47xx_board = {BCM47XX_BOARD_NO, "Unknown Board"};
|
||||
+
|
||||
+static const struct bcm47xx_board_type *bcm47xx_board = bcm47xx_board_no;
|
||||
+
|
||||
+static const struct bcm47xx_board_type *bcm47xx_board_get_nvram(void)
|
||||
+static __init const struct bcm47xx_board_type *bcm47xx_board_get_nvram(void)
|
||||
+{
|
||||
+ char buf1[30];
|
||||
+ char buf2[30];
|
||||
|
@ -272,12 +302,13 @@
|
|||
+ return bcm47xx_board_unknown;
|
||||
+}
|
||||
+
|
||||
+static void bcm47xx_board_detect(void)
|
||||
+void __init bcm47xx_board_detect(void)
|
||||
+{
|
||||
+ int err;
|
||||
+ char buf[10];
|
||||
+ const struct bcm47xx_board_type *board_detected;
|
||||
+
|
||||
+ if (bcm47xx_board != bcm47xx_board_no)
|
||||
+ if (bcm47xx_board.board != BCM47XX_BOARD_NO)
|
||||
+ return;
|
||||
+
|
||||
+ /* check if the nvram is available */
|
||||
|
@ -288,26 +319,44 @@
|
|||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ bcm47xx_board = bcm47xx_board_get_nvram();
|
||||
+ pr_debug("Found board: \"%s\"\n", bcm47xx_board->name);
|
||||
+ board_detected = bcm47xx_board_get_nvram();
|
||||
+ bcm47xx_board.board = board_detected->board;
|
||||
+ strlcpy(bcm47xx_board.name, board_detected->name,
|
||||
+ BCM47XX_BOARD_MAX_NAME);
|
||||
+}
|
||||
+
|
||||
+enum bcm47xx_board bcm47xx_board_get(void)
|
||||
+{
|
||||
+ bcm47xx_board_detect();
|
||||
+ return bcm47xx_board->board;
|
||||
+ return bcm47xx_board.board;
|
||||
+}
|
||||
+EXPORT_SYMBOL(bcm47xx_board_get);
|
||||
+
|
||||
+const char *bcm47xx_board_get_name(void)
|
||||
+{
|
||||
+ bcm47xx_board_detect();
|
||||
+ return bcm47xx_board->name;
|
||||
+ return bcm47xx_board.name;
|
||||
+}
|
||||
+EXPORT_SYMBOL(bcm47xx_board_get_name);
|
||||
--- a/arch/mips/bcm47xx/setup.c
|
||||
+++ b/arch/mips/bcm47xx/setup.c
|
||||
@@ -36,6 +36,7 @@
|
||||
#include <asm/time.h>
|
||||
#include <bcm47xx.h>
|
||||
#include <bcm47xx_nvram.h>
|
||||
+#include <bcm47xx_board.h>
|
||||
|
||||
union bcm47xx_bus bcm47xx_bus;
|
||||
EXPORT_SYMBOL(bcm47xx_bus);
|
||||
@@ -221,6 +222,7 @@ void __init plat_mem_setup(void)
|
||||
_machine_restart = bcm47xx_machine_restart;
|
||||
_machine_halt = bcm47xx_machine_halt;
|
||||
pm_power_off = bcm47xx_machine_halt;
|
||||
+ bcm47xx_board_detect();
|
||||
}
|
||||
|
||||
static int __init bcm47xx_register_bus_complete(void)
|
||||
--- /dev/null
|
||||
+++ b/arch/mips/include/asm/mach-bcm47xx/bcm47xx_board.h
|
||||
@@ -0,0 +1,107 @@
|
||||
@@ -0,0 +1,110 @@
|
||||
+#ifndef __BCM47XX_BOARD_H
|
||||
+#define __BCM47XX_BOARD_H
|
||||
+
|
||||
|
@ -411,6 +460,9 @@
|
|||
+ BCM47XX_BOARD_NO,
|
||||
+};
|
||||
+
|
||||
+#define BCM47XX_BOARD_MAX_NAME 30
|
||||
+
|
||||
+void bcm47xx_board_detect(void);
|
||||
+enum bcm47xx_board bcm47xx_board_get(void);
|
||||
+const char *bcm47xx_board_get_name(void);
|
||||
+
|
|
@ -1,12 +1,28 @@
|
|||
commit 7ad3b82f9d80ef8919dcfdfe7561e1a83e09c6bd
|
||||
Author: Hauke Mehrtens <hauke@hauke-m.de>
|
||||
Date: Wed Sep 18 13:29:58 2013 +0200
|
||||
|
||||
MIPS: BCM47XX: Print board name in /proc/cpuinfo
|
||||
|
||||
Do not print the constant system type "Broadcom BCM47XX" but print the
|
||||
name of the actual SoC in use and the detected board.
|
||||
|
||||
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
|
||||
Cc: linux-mips@linux-mips.org
|
||||
Patchwork: https://patchwork.linux-mips.org/patch/5839/
|
||||
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
|
||||
|
||||
--- a/arch/mips/bcm47xx/prom.c
|
||||
+++ b/arch/mips/bcm47xx/prom.c
|
||||
@@ -32,10 +32,35 @@
|
||||
@@ -32,12 +32,37 @@
|
||||
#include <asm/bootinfo.h>
|
||||
#include <asm/fw/cfe/cfe_api.h>
|
||||
#include <asm/fw/cfe/cfe_error.h>
|
||||
+#include <bcm47xx.h>
|
||||
+#include <bcm47xx_board.h>
|
||||
+
|
||||
|
||||
static int cfe_cons_handle;
|
||||
|
||||
+static u16 get_chip_id(void)
|
||||
+{
|
||||
+ switch (bcm47xx_bus_type) {
|
||||
|
@ -21,7 +37,7 @@
|
|||
+ }
|
||||
+ return 0;
|
||||
+}
|
||||
|
||||
+
|
||||
const char *get_system_type(void)
|
||||
{
|
||||
- return "Broadcom BCM47XX";
|
||||
|
@ -36,4 +52,4 @@
|
|||
+ return buf;
|
||||
}
|
||||
|
||||
static __init int prom_init_cfe(void)
|
||||
void prom_putchar(char c)
|
|
@ -0,0 +1,83 @@
|
|||
commit 88aaea30099c1562c4b4015d965c22df29034a74
|
||||
Author: Hauke Mehrtens <hauke@hauke-m.de>
|
||||
Date: Thu Sep 19 22:01:53 2013 +0200
|
||||
|
||||
MIPS: BCM47XX: only print SoC name in system type in cpuinfo
|
||||
|
||||
Recently the output of "system type" in /proc/cpuinfo was changed to
|
||||
Broadcom BCM4730 (Some sample board), but it is better to just print
|
||||
the SoC name in the "system type" entry. The board name will be added
|
||||
in the machine entry later.
|
||||
|
||||
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
|
||||
|
||||
--- a/arch/mips/bcm47xx/prom.c
|
||||
+++ b/arch/mips/bcm47xx/prom.c
|
||||
@@ -37,32 +37,19 @@
|
||||
|
||||
static int cfe_cons_handle;
|
||||
|
||||
-static u16 get_chip_id(void)
|
||||
-{
|
||||
- switch (bcm47xx_bus_type) {
|
||||
-#ifdef CONFIG_BCM47XX_SSB
|
||||
- case BCM47XX_BUS_TYPE_SSB:
|
||||
- return bcm47xx_bus.ssb.chip_id;
|
||||
-#endif
|
||||
-#ifdef CONFIG_BCM47XX_BCMA
|
||||
- case BCM47XX_BUS_TYPE_BCMA:
|
||||
- return bcm47xx_bus.bcma.bus.chipinfo.id;
|
||||
-#endif
|
||||
- }
|
||||
- return 0;
|
||||
-}
|
||||
+static char bcm47xx_system_type[20] = "Broadcom BCM47XX";
|
||||
|
||||
const char *get_system_type(void)
|
||||
{
|
||||
- static char buf[50];
|
||||
- u16 chip_id = get_chip_id();
|
||||
-
|
||||
- snprintf(buf, sizeof(buf),
|
||||
- (chip_id > 0x9999) ? "Broadcom BCM%d (%s)" :
|
||||
- "Broadcom BCM%04X (%s)",
|
||||
- chip_id, bcm47xx_board_get_name());
|
||||
+ return bcm47xx_system_type;
|
||||
+}
|
||||
|
||||
- return buf;
|
||||
+__init void bcm47xx_set_system_type(u16 chip_id)
|
||||
+{
|
||||
+ snprintf(bcm47xx_system_type, sizeof(bcm47xx_system_type),
|
||||
+ (chip_id > 0x9999) ? "Broadcom BCM%d" :
|
||||
+ "Broadcom BCM%04X",
|
||||
+ chip_id);
|
||||
}
|
||||
|
||||
void prom_putchar(char c)
|
||||
--- a/arch/mips/bcm47xx/setup.c
|
||||
+++ b/arch/mips/bcm47xx/setup.c
|
||||
@@ -210,12 +210,14 @@ void __init plat_mem_setup(void)
|
||||
#ifdef CONFIG_BCM47XX_BCMA
|
||||
bcm47xx_bus_type = BCM47XX_BUS_TYPE_BCMA;
|
||||
bcm47xx_register_bcma();
|
||||
+ bcm47xx_set_system_type(bcm47xx_bus.bcma.bus.chipinfo.id);
|
||||
#endif
|
||||
} else {
|
||||
printk(KERN_INFO "bcm47xx: using ssb bus\n");
|
||||
#ifdef CONFIG_BCM47XX_SSB
|
||||
bcm47xx_bus_type = BCM47XX_BUS_TYPE_SSB;
|
||||
bcm47xx_register_ssb();
|
||||
+ bcm47xx_set_system_type(bcm47xx_bus.ssb.chip_id);
|
||||
#endif
|
||||
}
|
||||
|
||||
--- a/arch/mips/include/asm/mach-bcm47xx/bcm47xx.h
|
||||
+++ b/arch/mips/include/asm/mach-bcm47xx/bcm47xx.h
|
||||
@@ -56,4 +56,6 @@ void bcm47xx_fill_bcma_boardinfo(struct
|
||||
const char *prefix);
|
||||
#endif
|
||||
|
||||
+void bcm47xx_set_system_type(u16 chip_id);
|
||||
+
|
||||
#endif /* __ASM_BCM47XX_H */
|
|
@ -0,0 +1,28 @@
|
|||
commit 86bd812676d1e99968f395ad82ccaa2db7965748
|
||||
Author: Hauke Mehrtens <hauke@hauke-m.de>
|
||||
Date: Thu Sep 19 22:04:04 2013 +0200
|
||||
|
||||
MIPS: BCM47XX: print board name in machine entry in cpuinfo
|
||||
|
||||
This will add the board name to the machine entry in /proc/cpuinfo.
|
||||
|
||||
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
|
||||
|
||||
--- a/arch/mips/bcm47xx/setup.c
|
||||
+++ b/arch/mips/bcm47xx/setup.c
|
||||
@@ -32,6 +32,7 @@
|
||||
#include <linux/ssb/ssb_embedded.h>
|
||||
#include <linux/bcma/bcma_soc.h>
|
||||
#include <asm/bootinfo.h>
|
||||
+#include <asm/prom.h>
|
||||
#include <asm/reboot.h>
|
||||
#include <asm/time.h>
|
||||
#include <bcm47xx.h>
|
||||
@@ -225,6 +226,7 @@ void __init plat_mem_setup(void)
|
||||
_machine_halt = bcm47xx_machine_halt;
|
||||
pm_power_off = bcm47xx_machine_halt;
|
||||
bcm47xx_board_detect();
|
||||
+ mips_set_machine_name(bcm47xx_board_get_name());
|
||||
}
|
||||
|
||||
static int __init bcm47xx_register_bus_complete(void)
|
|
@ -22,9 +22,9 @@ Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
|
|||
+#include <linux/serial.h>
|
||||
+#include <linux/serial_8250.h>
|
||||
#include <asm/bootinfo.h>
|
||||
#include <asm/prom.h>
|
||||
#include <asm/reboot.h>
|
||||
#include <asm/time.h>
|
||||
@@ -121,6 +123,31 @@ static int bcm47xx_get_invariants(struct
|
||||
@@ -123,6 +125,31 @@ static int bcm47xx_get_invariants(struct
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -56,7 +56,7 @@ Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
|
|||
static void __init bcm47xx_register_ssb(void)
|
||||
{
|
||||
int err;
|
||||
@@ -150,6 +177,10 @@ static void __init bcm47xx_register_ssb(
|
||||
@@ -152,6 +179,10 @@ static void __init bcm47xx_register_ssb(
|
||||
memcpy(&mcore->serial_ports[1], &port, sizeof(port));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -26,15 +26,17 @@ Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
|
|||
|
||||
--- a/arch/mips/bcm47xx/prom.c
|
||||
+++ b/arch/mips/bcm47xx/prom.c
|
||||
@@ -33,96 +33,28 @@
|
||||
#include <asm/fw/cfe/cfe_api.h>
|
||||
#include <asm/fw/cfe/cfe_error.h>
|
||||
@@ -35,8 +35,6 @@
|
||||
#include <bcm47xx.h>
|
||||
#include <bcm47xx_board.h>
|
||||
|
||||
-static int cfe_cons_handle;
|
||||
-
|
||||
static char bcm47xx_system_type[20] = "Broadcom BCM47XX";
|
||||
|
||||
const char *get_system_type(void)
|
||||
{
|
||||
return "Broadcom BCM47XX";
|
||||
@@ -52,89 +50,23 @@ __init void bcm47xx_set_system_type(u16
|
||||
chip_id);
|
||||
}
|
||||
|
||||
-void prom_putchar(char c)
|
||||
|
@ -130,7 +132,7 @@ Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
|
|||
}
|
||||
|
||||
static __init void prom_init_mem(void)
|
||||
@@ -173,8 +105,6 @@ static __init void prom_init_mem(void)
|
||||
@@ -185,8 +117,6 @@ static __init void prom_init_mem(void)
|
||||
void __init prom_init(void)
|
||||
{
|
||||
prom_init_cfe();
|
||||
|
|
|
@ -1,189 +0,0 @@
|
|||
--- a/arch/mips/bcm47xx/board.c
|
||||
+++ b/arch/mips/bcm47xx/board.c
|
||||
@@ -26,27 +26,36 @@ struct bcm47xx_board_type_list3 {
|
||||
const char *value3;
|
||||
};
|
||||
|
||||
+struct bcm47xx_board_store {
|
||||
+ enum bcm47xx_board board;
|
||||
+ char name[BCM47XX_BOARD_MAX_NAME];
|
||||
+};
|
||||
+
|
||||
/* model_name */
|
||||
-static const struct bcm47xx_board_type_list1 bcm47xx_board_list_model_name[] = {
|
||||
+static const
|
||||
+struct bcm47xx_board_type_list1 bcm47xx_board_list_model_name[] __initconst = {
|
||||
{{BCM47XX_BOARD_DLINK_DIR130, "D-Link DIR-130"}, "DIR-130"},
|
||||
{{BCM47XX_BOARD_DLINK_DIR330, "D-Link DIR-330"}, "DIR-330"},
|
||||
{ {0}, 0},
|
||||
};
|
||||
|
||||
/* model_no */
|
||||
-static const struct bcm47xx_board_type_list1 bcm47xx_board_list_model_no[] = {
|
||||
+static const
|
||||
+struct bcm47xx_board_type_list1 bcm47xx_board_list_model_no[] __initconst = {
|
||||
{{BCM47XX_BOARD_ASUS_WL700GE, "Asus WL700"}, "WL700"},
|
||||
{ {0}, 0},
|
||||
};
|
||||
|
||||
/* machine_name */
|
||||
-static const struct bcm47xx_board_type_list1 bcm47xx_board_list_machine_name[] = {
|
||||
+static const
|
||||
+struct bcm47xx_board_type_list1 bcm47xx_board_list_machine_name[] __initconst = {
|
||||
{{BCM47XX_BOARD_LINKSYS_WRTSL54GS, "Linksys WRTSL54GS"}, "WRTSL54GS"},
|
||||
{ {0}, 0},
|
||||
};
|
||||
|
||||
/* hardware_version */
|
||||
-static const struct bcm47xx_board_type_list1 bcm47xx_board_list_hardware_version[] = {
|
||||
+static const
|
||||
+struct bcm47xx_board_type_list1 bcm47xx_board_list_hardware_version[] __initconst = {
|
||||
{{BCM47XX_BOARD_ASUS_RTN16, "Asus RT-N16"}, "RT-N16-"},
|
||||
{{BCM47XX_BOARD_ASUS_WL320GE, "Asus WL320GE"}, "WL320G-"},
|
||||
{{BCM47XX_BOARD_ASUS_WL330GE, "Asus WL330GE"}, "WL330GE-"},
|
||||
@@ -61,7 +70,8 @@ static const struct bcm47xx_board_type_l
|
||||
};
|
||||
|
||||
/* productid */
|
||||
-static const struct bcm47xx_board_type_list1 bcm47xx_board_list_productid[] = {
|
||||
+static const
|
||||
+struct bcm47xx_board_type_list1 bcm47xx_board_list_productid[] __initconst = {
|
||||
{{BCM47XX_BOARD_ASUS_RTAC66U, "Asus RT-AC66U"}, "RT-AC66U"},
|
||||
{{BCM47XX_BOARD_ASUS_RTN10, "Asus RT-N10"}, "RT-N10"},
|
||||
{{BCM47XX_BOARD_ASUS_RTN10D, "Asus RT-N10D"}, "RT-N10D"},
|
||||
@@ -81,7 +91,8 @@ static const struct bcm47xx_board_type_l
|
||||
};
|
||||
|
||||
/* ModelId */
|
||||
-static const struct bcm47xx_board_type_list1 bcm47xx_board_list_ModelId[] = {
|
||||
+static const
|
||||
+struct bcm47xx_board_type_list1 bcm47xx_board_list_ModelId[] __initconst = {
|
||||
{{BCM47XX_BOARD_DELL_TM2300, "Dell WX-5565"}, "WX-5565"},
|
||||
{{BCM47XX_BOARD_MOTOROLA_WE800G, "Motorola WE800G"}, "WE800G"},
|
||||
{{BCM47XX_BOARD_MOTOROLA_WR850GP, "Motorola WR850GP"}, "WR850GP"},
|
||||
@@ -90,7 +101,8 @@ static const struct bcm47xx_board_type_l
|
||||
};
|
||||
|
||||
/* melco_id or buf1falo_id */
|
||||
-static const struct bcm47xx_board_type_list1 bcm47xx_board_list_melco_id[] = {
|
||||
+static const
|
||||
+struct bcm47xx_board_type_list1 bcm47xx_board_list_melco_id[] __initconst = {
|
||||
{{BCM47XX_BOARD_BUFFALO_WBR2_G54, "Buffalo WBR2-G54"}, "29bb0332"},
|
||||
{{BCM47XX_BOARD_BUFFALO_WHR2_A54G54, "Buffalo WHR2-A54G54"}, "290441dd"},
|
||||
{{BCM47XX_BOARD_BUFFALO_WHR_G125, "Buffalo WHR-G125"}, "32093"},
|
||||
@@ -104,7 +116,8 @@ static const struct bcm47xx_board_type_l
|
||||
};
|
||||
|
||||
/* boot_hw_model, boot_hw_ver */
|
||||
-static const struct bcm47xx_board_type_list2 bcm47xx_board_list_boot_hw[] = {
|
||||
+static const
|
||||
+struct bcm47xx_board_type_list2 bcm47xx_board_list_boot_hw[] __initconst = {
|
||||
/* like WRT160N v3.0 */
|
||||
{{BCM47XX_BOARD_CISCO_M10V1, "Cisco M10"}, "M10", "1.0"},
|
||||
/* like WRT310N v2.0 */
|
||||
@@ -134,7 +147,8 @@ static const struct bcm47xx_board_type_l
|
||||
};
|
||||
|
||||
/* board_id */
|
||||
-static const struct bcm47xx_board_type_list1 bcm47xx_board_list_board_id[] = {
|
||||
+static const
|
||||
+struct bcm47xx_board_type_list1 bcm47xx_board_list_board_id[] __initconst = {
|
||||
{{BCM47XX_BOARD_NETGEAR_WGR614V8, "Netgear WGR614 V8"}, "U12H072T00_NETGEAR"},
|
||||
{{BCM47XX_BOARD_NETGEAR_WGR614V9, "Netgear WGR614 V9"}, "U12H094T00_NETGEAR"},
|
||||
{{BCM47XX_BOARD_NETGEAR_WNDR3300, "Netgear WNDR3300"}, "U12H093T00_NETGEAR"},
|
||||
@@ -155,24 +169,22 @@ static const struct bcm47xx_board_type_l
|
||||
};
|
||||
|
||||
/* boardtype, boardnum, boardrev */
|
||||
-static const struct bcm47xx_board_type_list3 bcm47xx_board_list_board[] = {
|
||||
+static const
|
||||
+struct bcm47xx_board_type_list3 bcm47xx_board_list_board[] __initconst = {
|
||||
{{BCM47XX_BOARD_HUAWEI_E970, "Huawei E970"}, "0x048e", "0x5347", "0x11"},
|
||||
{{BCM47XX_BOARD_PHICOMM_M1, "Phicomm M1"}, "0x0590", "80", "0x1104"},
|
||||
{{BCM47XX_BOARD_ZTE_H218N, "ZTE H218N"}, "0x053d", "1234", "0x1305"},
|
||||
{ {0}, 0},
|
||||
};
|
||||
|
||||
-static const struct bcm47xx_board_type bcm47xx_board_unknown[] = {
|
||||
+static const
|
||||
+struct bcm47xx_board_type bcm47xx_board_unknown[] __initconst = {
|
||||
{BCM47XX_BOARD_UNKNOWN, "Unknown Board"},
|
||||
};
|
||||
|
||||
-static const struct bcm47xx_board_type bcm47xx_board_no[] = {
|
||||
- {BCM47XX_BOARD_NO, "No Board"},
|
||||
-};
|
||||
-
|
||||
-static const struct bcm47xx_board_type *bcm47xx_board = bcm47xx_board_no;
|
||||
+static struct bcm47xx_board_store bcm47xx_board = {BCM47XX_BOARD_NO, "Unknown Board"};
|
||||
|
||||
-static const struct bcm47xx_board_type *bcm47xx_board_get_nvram(void)
|
||||
+static __init const struct bcm47xx_board_type *bcm47xx_board_get_nvram(void)
|
||||
{
|
||||
char buf1[30];
|
||||
char buf2[30];
|
||||
@@ -261,12 +273,13 @@ static const struct bcm47xx_board_type *
|
||||
return bcm47xx_board_unknown;
|
||||
}
|
||||
|
||||
-static void bcm47xx_board_detect(void)
|
||||
+void __init bcm47xx_board_detect(void)
|
||||
{
|
||||
int err;
|
||||
char buf[10];
|
||||
+ const struct bcm47xx_board_type *board_detected;
|
||||
|
||||
- if (bcm47xx_board != bcm47xx_board_no)
|
||||
+ if (bcm47xx_board.board != BCM47XX_BOARD_NO)
|
||||
return;
|
||||
|
||||
/* check if the nvram is available */
|
||||
@@ -277,20 +290,20 @@ static void bcm47xx_board_detect(void)
|
||||
return;
|
||||
}
|
||||
|
||||
- bcm47xx_board = bcm47xx_board_get_nvram();
|
||||
- pr_debug("Found board: \"%s\"\n", bcm47xx_board->name);
|
||||
+ board_detected = bcm47xx_board_get_nvram();
|
||||
+ bcm47xx_board.board = board_detected->board;
|
||||
+ strncpy(bcm47xx_board.name, board_detected->name, BCM47XX_BOARD_MAX_NAME);
|
||||
+ bcm47xx_board.name[BCM47XX_BOARD_MAX_NAME - 1] = 0;
|
||||
}
|
||||
|
||||
enum bcm47xx_board bcm47xx_board_get(void)
|
||||
{
|
||||
- bcm47xx_board_detect();
|
||||
- return bcm47xx_board->board;
|
||||
+ return bcm47xx_board.board;
|
||||
}
|
||||
EXPORT_SYMBOL(bcm47xx_board_get);
|
||||
|
||||
const char *bcm47xx_board_get_name(void)
|
||||
{
|
||||
- bcm47xx_board_detect();
|
||||
- return bcm47xx_board->name;
|
||||
+ return bcm47xx_board.name;
|
||||
}
|
||||
EXPORT_SYMBOL(bcm47xx_board_get_name);
|
||||
--- a/arch/mips/bcm47xx/setup.c
|
||||
+++ b/arch/mips/bcm47xx/setup.c
|
||||
@@ -252,6 +252,7 @@ void __init plat_mem_setup(void)
|
||||
_machine_restart = bcm47xx_machine_restart;
|
||||
_machine_halt = bcm47xx_machine_halt;
|
||||
pm_power_off = bcm47xx_machine_halt;
|
||||
+ bcm47xx_board_detect();
|
||||
}
|
||||
|
||||
static int __init bcm47xx_register_bus_complete(void)
|
||||
--- a/arch/mips/include/asm/mach-bcm47xx/bcm47xx_board.h
|
||||
+++ b/arch/mips/include/asm/mach-bcm47xx/bcm47xx_board.h
|
||||
@@ -101,6 +101,9 @@ enum bcm47xx_board {
|
||||
BCM47XX_BOARD_NO,
|
||||
};
|
||||
|
||||
+#define BCM47XX_BOARD_MAX_NAME 30
|
||||
+
|
||||
+void bcm47xx_board_detect(void);
|
||||
enum bcm47xx_board bcm47xx_board_get(void);
|
||||
const char *bcm47xx_board_get_name(void);
|
||||
|
|
@ -1,21 +1,15 @@
|
|||
--- a/arch/mips/bcm47xx/setup.c
|
||||
+++ b/arch/mips/bcm47xx/setup.c
|
||||
@@ -33,11 +33,13 @@
|
||||
@@ -33,6 +33,7 @@
|
||||
#include <linux/bcma/bcma_soc.h>
|
||||
#include <linux/serial.h>
|
||||
#include <linux/serial_8250.h>
|
||||
+#include <linux/gpio_wdt.h>
|
||||
#include <asm/bootinfo.h>
|
||||
#include <asm/prom.h>
|
||||
#include <asm/reboot.h>
|
||||
#include <asm/time.h>
|
||||
#include <bcm47xx.h>
|
||||
#include <bcm47xx_nvram.h>
|
||||
+#include <bcm47xx_board.h>
|
||||
|
||||
union bcm47xx_bus bcm47xx_bus;
|
||||
EXPORT_SYMBOL(bcm47xx_bus);
|
||||
@@ -255,6 +257,33 @@ void __init plat_mem_setup(void)
|
||||
bcm47xx_board_detect();
|
||||
@@ -260,6 +261,33 @@ void __init plat_mem_setup(void)
|
||||
mips_set_machine_name(bcm47xx_board_get_name());
|
||||
}
|
||||
|
||||
+static struct gpio_wdt_platform_data gpio_wdt_data;
|
||||
|
@ -48,7 +42,7 @@
|
|||
static int __init bcm47xx_register_bus_complete(void)
|
||||
{
|
||||
switch (bcm47xx_bus_type) {
|
||||
@@ -269,6 +298,8 @@ static int __init bcm47xx_register_bus_c
|
||||
@@ -274,6 +302,8 @@ static int __init bcm47xx_register_bus_c
|
||||
break;
|
||||
#endif
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
--- a/arch/mips/bcm47xx/setup.c
|
||||
+++ b/arch/mips/bcm47xx/setup.c
|
||||
@@ -122,6 +122,10 @@ static int bcm47xx_get_invariants(struct
|
||||
@@ -123,6 +123,10 @@ static int bcm47xx_get_invariants(struct
|
||||
if (bcm47xx_nvram_getenv("cardbus", buf, sizeof(buf)) >= 0)
|
||||
iv->has_cardbus_slot = !!simple_strtoul(buf, NULL, 10);
|
||||
|
||||
|
|
Loading…
Reference in a new issue