aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorHauke Mehrtens <hauke@hauke-m.de>2014-07-28 18:12:09 -0400
committerRalf Baechle <ralf@linux-mips.org>2014-07-30 13:27:06 -0400
commit250dc03727b9cce91bd86091f05bf2443e2be9ec (patch)
tree33c2586eabe1b50774162cd852eea2b7d8841aa9 /arch
parent103c0bf3ff46486466bc9138d70c25133d516003 (diff)
MIPS: BCM47XX: add Microsoft MN-700 and Asus WL500G
This patch adds detection for the Microsoft MN-700 and the Asus WL500G router. This is based on some old code from OpenWrt. Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de> Cc: zajec5@gmail.com Cc: linux-mips@linux-mips.org Patchwork: https://patchwork.linux-mips.org/patch/7490/ Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Diffstat (limited to 'arch')
-rw-r--r--arch/mips/bcm47xx/board.c17
-rw-r--r--arch/mips/bcm47xx/buttons.c19
-rw-r--r--arch/mips/bcm47xx/leds.c19
-rw-r--r--arch/mips/include/asm/mach-bcm47xx/bcm47xx_board.h3
4 files changed, 58 insertions, 0 deletions
diff --git a/arch/mips/bcm47xx/board.c b/arch/mips/bcm47xx/board.c
index 44ab1be68c3c..7d4ac39ed14c 100644
--- a/arch/mips/bcm47xx/board.c
+++ b/arch/mips/bcm47xx/board.c
@@ -80,6 +80,14 @@ struct bcm47xx_board_type_list1 bcm47xx_board_list_hardware_version[] __initcons
80 { {0}, NULL}, 80 { {0}, NULL},
81}; 81};
82 82
83/* hardware_version, boardnum */
84static const
85struct bcm47xx_board_type_list2 bcm47xx_board_list_hw_version_num[] __initconst = {
86 {{BCM47XX_BOARD_MICROSOFT_MN700, "Microsoft MN-700"}, "WL500-", "mn700"},
87 {{BCM47XX_BOARD_ASUS_WL500G, "Asus WL500G"}, "WL500-", "asusX"},
88 { {0}, NULL},
89};
90
83/* productid */ 91/* productid */
84static const 92static const
85struct bcm47xx_board_type_list1 bcm47xx_board_list_productid[] __initconst = { 93struct bcm47xx_board_type_list1 bcm47xx_board_list_productid[] __initconst = {
@@ -237,6 +245,15 @@ static __init const struct bcm47xx_board_type *bcm47xx_board_get_nvram(void)
237 } 245 }
238 } 246 }
239 247
248 if (bcm47xx_nvram_getenv("hardware_version", buf1, sizeof(buf1)) >= 0 &&
249 bcm47xx_nvram_getenv("boardtype", buf2, sizeof(buf2)) >= 0) {
250 for (e2 = bcm47xx_board_list_boot_hw; e2->value1; e2++) {
251 if (!strstarts(buf1, e2->value1) &&
252 !strcmp(buf2, e2->value2))
253 return &e2->board;
254 }
255 }
256
240 if (bcm47xx_nvram_getenv("productid", buf1, sizeof(buf1)) >= 0) { 257 if (bcm47xx_nvram_getenv("productid", buf1, sizeof(buf1)) >= 0) {
241 for (e1 = bcm47xx_board_list_productid; e1->value1; e1++) { 258 for (e1 = bcm47xx_board_list_productid; e1->value1; e1++) {
242 if (!strcmp(buf1, e1->value1)) 259 if (!strcmp(buf1, e1->value1))
diff --git a/arch/mips/bcm47xx/buttons.c b/arch/mips/bcm47xx/buttons.c
index 49a1ce06844b..82dbbbbe800c 100644
--- a/arch/mips/bcm47xx/buttons.c
+++ b/arch/mips/bcm47xx/buttons.c
@@ -56,6 +56,11 @@ bcm47xx_buttons_asus_wl330ge[] __initconst = {
56}; 56};
57 57
58static const struct gpio_keys_button 58static const struct gpio_keys_button
59bcm47xx_buttons_asus_wl500g[] __initconst = {
60 BCM47XX_GPIO_KEY(6, KEY_RESTART),
61};
62
63static const struct gpio_keys_button
59bcm47xx_buttons_asus_wl500gd[] __initconst = { 64bcm47xx_buttons_asus_wl500gd[] __initconst = {
60 BCM47XX_GPIO_KEY(6, KEY_RESTART), 65 BCM47XX_GPIO_KEY(6, KEY_RESTART),
61}; 66};
@@ -288,6 +293,13 @@ bcm47xx_buttons_linksys_wrtsl54gs[] __initconst = {
288 BCM47XX_GPIO_KEY(6, KEY_RESTART), 293 BCM47XX_GPIO_KEY(6, KEY_RESTART),
289}; 294};
290 295
296/* Microsoft */
297
298static const struct gpio_keys_button
299bcm47xx_buttons_microsoft_nm700[] __initconst = {
300 BCM47XX_GPIO_KEY(7, KEY_RESTART),
301};
302
291/* Motorola */ 303/* Motorola */
292 304
293static const struct gpio_keys_button 305static const struct gpio_keys_button
@@ -395,6 +407,9 @@ int __init bcm47xx_buttons_register(void)
395 case BCM47XX_BOARD_ASUS_WL330GE: 407 case BCM47XX_BOARD_ASUS_WL330GE:
396 err = bcm47xx_copy_bdata(bcm47xx_buttons_asus_wl330ge); 408 err = bcm47xx_copy_bdata(bcm47xx_buttons_asus_wl330ge);
397 break; 409 break;
410 case BCM47XX_BOARD_ASUS_WL500G:
411 err = bcm47xx_copy_bdata(bcm47xx_buttons_asus_wl500g);
412 break;
398 case BCM47XX_BOARD_ASUS_WL500GD: 413 case BCM47XX_BOARD_ASUS_WL500GD:
399 err = bcm47xx_copy_bdata(bcm47xx_buttons_asus_wl500gd); 414 err = bcm47xx_copy_bdata(bcm47xx_buttons_asus_wl500gd);
400 break; 415 break;
@@ -517,6 +532,10 @@ int __init bcm47xx_buttons_register(void)
517 err = bcm47xx_copy_bdata(bcm47xx_buttons_linksys_wrtsl54gs); 532 err = bcm47xx_copy_bdata(bcm47xx_buttons_linksys_wrtsl54gs);
518 break; 533 break;
519 534
535 case BCM47XX_BOARD_MICROSOFT_MN700:
536 err = bcm47xx_copy_bdata(bcm47xx_buttons_microsoft_nm700);
537 break;
538
520 case BCM47XX_BOARD_MOTOROLA_WE800G: 539 case BCM47XX_BOARD_MOTOROLA_WE800G:
521 err = bcm47xx_copy_bdata(bcm47xx_buttons_motorola_we800g); 540 err = bcm47xx_copy_bdata(bcm47xx_buttons_motorola_we800g);
522 break; 541 break;
diff --git a/arch/mips/bcm47xx/leds.c b/arch/mips/bcm47xx/leds.c
index adcb547a91c3..1e256a91e330 100644
--- a/arch/mips/bcm47xx/leds.c
+++ b/arch/mips/bcm47xx/leds.c
@@ -64,6 +64,11 @@ bcm47xx_leds_asus_wl330ge[] __initconst = {
64}; 64};
65 65
66static const struct gpio_led 66static const struct gpio_led
67bcm47xx_leds_asus_wl500g[] __initconst = {
68 BCM47XX_GPIO_LED(0, "unk", "power", 1, LEDS_GPIO_DEFSTATE_ON),
69};
70
71static const struct gpio_led
67bcm47xx_leds_asus_wl500gd[] __initconst = { 72bcm47xx_leds_asus_wl500gd[] __initconst = {
68 BCM47XX_GPIO_LED(0, "unk", "power", 1, LEDS_GPIO_DEFSTATE_ON), 73 BCM47XX_GPIO_LED(0, "unk", "power", 1, LEDS_GPIO_DEFSTATE_ON),
69}; 74};
@@ -332,6 +337,13 @@ bcm47xx_leds_linksys_wrtsl54gs[] __initconst = {
332 BCM47XX_GPIO_LED(7, "unk", "dmz", 1, LEDS_GPIO_DEFSTATE_OFF), 337 BCM47XX_GPIO_LED(7, "unk", "dmz", 1, LEDS_GPIO_DEFSTATE_OFF),
333}; 338};
334 339
340/* Microsoft */
341
342static const struct gpio_led
343bcm47xx_leds_microsoft_nm700[] __initconst = {
344 BCM47XX_GPIO_LED(6, "unk", "power", 0, LEDS_GPIO_DEFSTATE_ON),
345};
346
335/* Motorola */ 347/* Motorola */
336 348
337static const struct gpio_led 349static const struct gpio_led
@@ -432,6 +444,9 @@ void __init bcm47xx_leds_register(void)
432 case BCM47XX_BOARD_ASUS_WL330GE: 444 case BCM47XX_BOARD_ASUS_WL330GE:
433 bcm47xx_set_pdata(bcm47xx_leds_asus_wl330ge); 445 bcm47xx_set_pdata(bcm47xx_leds_asus_wl330ge);
434 break; 446 break;
447 case BCM47XX_BOARD_ASUS_WL500G:
448 bcm47xx_set_pdata(bcm47xx_leds_asus_wl500g);
449 break;
435 case BCM47XX_BOARD_ASUS_WL500GD: 450 case BCM47XX_BOARD_ASUS_WL500GD:
436 bcm47xx_set_pdata(bcm47xx_leds_asus_wl500gd); 451 bcm47xx_set_pdata(bcm47xx_leds_asus_wl500gd);
437 break; 452 break;
@@ -554,6 +569,10 @@ void __init bcm47xx_leds_register(void)
554 bcm47xx_set_pdata(bcm47xx_leds_linksys_wrtsl54gs); 569 bcm47xx_set_pdata(bcm47xx_leds_linksys_wrtsl54gs);
555 break; 570 break;
556 571
572 case BCM47XX_BOARD_MICROSOFT_MN700:
573 bcm47xx_set_pdata(bcm47xx_leds_microsoft_nm700);
574 break;
575
557 case BCM47XX_BOARD_MOTOROLA_WE800G: 576 case BCM47XX_BOARD_MOTOROLA_WE800G:
558 bcm47xx_set_pdata(bcm47xx_leds_motorola_we800g); 577 bcm47xx_set_pdata(bcm47xx_leds_motorola_we800g);
559 break; 578 break;
diff --git a/arch/mips/include/asm/mach-bcm47xx/bcm47xx_board.h b/arch/mips/include/asm/mach-bcm47xx/bcm47xx_board.h
index bba7399a49a3..0c3c8993567d 100644
--- a/arch/mips/include/asm/mach-bcm47xx/bcm47xx_board.h
+++ b/arch/mips/include/asm/mach-bcm47xx/bcm47xx_board.h
@@ -18,6 +18,7 @@ enum bcm47xx_board {
18 BCM47XX_BOARD_ASUS_WL300G, 18 BCM47XX_BOARD_ASUS_WL300G,
19 BCM47XX_BOARD_ASUS_WL320GE, 19 BCM47XX_BOARD_ASUS_WL320GE,
20 BCM47XX_BOARD_ASUS_WL330GE, 20 BCM47XX_BOARD_ASUS_WL330GE,
21 BCM47XX_BOARD_ASUS_WL500G,
21 BCM47XX_BOARD_ASUS_WL500GD, 22 BCM47XX_BOARD_ASUS_WL500GD,
22 BCM47XX_BOARD_ASUS_WL500GPV1, 23 BCM47XX_BOARD_ASUS_WL500GPV1,
23 BCM47XX_BOARD_ASUS_WL500GPV2, 24 BCM47XX_BOARD_ASUS_WL500GPV2,
@@ -75,6 +76,8 @@ enum bcm47xx_board {
75 BCM47XX_BOARD_LINKSYS_WRT610NV2, 76 BCM47XX_BOARD_LINKSYS_WRT610NV2,
76 BCM47XX_BOARD_LINKSYS_WRTSL54GS, 77 BCM47XX_BOARD_LINKSYS_WRTSL54GS,
77 78
79 BCM47XX_BOARD_MICROSOFT_MN700,
80
78 BCM47XX_BOARD_MOTOROLA_WE800G, 81 BCM47XX_BOARD_MOTOROLA_WE800G,
79 BCM47XX_BOARD_MOTOROLA_WR850GP, 82 BCM47XX_BOARD_MOTOROLA_WR850GP,
80 BCM47XX_BOARD_MOTOROLA_WR850GV2V3, 83 BCM47XX_BOARD_MOTOROLA_WR850GV2V3,