Skip to content

Commit 250dc03

Browse files
haukeralfbaechle
authored andcommitted
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>
1 parent 103c0bf commit 250dc03

4 files changed

Lines changed: 58 additions & 0 deletions

File tree

‎arch/mips/bcm47xx/board.c‎

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,14 @@ struct bcm47xx_board_type_list1 bcm47xx_board_list_hardware_version[] __initcons
8080
{ {0}, NULL},
8181
};
8282

83+
/* hardware_version, boardnum */
84+
static const
85+
struct 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+
8391
/* productid */
8492
static const
8593
struct 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)
237245
}
238246
}
239247

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+
240257
if (bcm47xx_nvram_getenv("productid", buf1, sizeof(buf1)) >= 0) {
241258
for (e1 = bcm47xx_board_list_productid; e1->value1; e1++) {
242259
if (!strcmp(buf1, e1->value1))

‎arch/mips/bcm47xx/buttons.c‎

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,11 @@ bcm47xx_buttons_asus_wl330ge[] __initconst = {
5555
BCM47XX_GPIO_KEY(2, KEY_RESTART),
5656
};
5757

58+
static const struct gpio_keys_button
59+
bcm47xx_buttons_asus_wl500g[] __initconst = {
60+
BCM47XX_GPIO_KEY(6, KEY_RESTART),
61+
};
62+
5863
static const struct gpio_keys_button
5964
bcm47xx_buttons_asus_wl500gd[] __initconst = {
6065
BCM47XX_GPIO_KEY(6, KEY_RESTART),
@@ -288,6 +293,13 @@ bcm47xx_buttons_linksys_wrtsl54gs[] __initconst = {
288293
BCM47XX_GPIO_KEY(6, KEY_RESTART),
289294
};
290295

296+
/* Microsoft */
297+
298+
static const struct gpio_keys_button
299+
bcm47xx_buttons_microsoft_nm700[] __initconst = {
300+
BCM47XX_GPIO_KEY(7, KEY_RESTART),
301+
};
302+
291303
/* Motorola */
292304

293305
static const struct gpio_keys_button
@@ -395,6 +407,9 @@ int __init bcm47xx_buttons_register(void)
395407
case BCM47XX_BOARD_ASUS_WL330GE:
396408
err = bcm47xx_copy_bdata(bcm47xx_buttons_asus_wl330ge);
397409
break;
410+
case BCM47XX_BOARD_ASUS_WL500G:
411+
err = bcm47xx_copy_bdata(bcm47xx_buttons_asus_wl500g);
412+
break;
398413
case BCM47XX_BOARD_ASUS_WL500GD:
399414
err = bcm47xx_copy_bdata(bcm47xx_buttons_asus_wl500gd);
400415
break;
@@ -517,6 +532,10 @@ int __init bcm47xx_buttons_register(void)
517532
err = bcm47xx_copy_bdata(bcm47xx_buttons_linksys_wrtsl54gs);
518533
break;
519534

535+
case BCM47XX_BOARD_MICROSOFT_MN700:
536+
err = bcm47xx_copy_bdata(bcm47xx_buttons_microsoft_nm700);
537+
break;
538+
520539
case BCM47XX_BOARD_MOTOROLA_WE800G:
521540
err = bcm47xx_copy_bdata(bcm47xx_buttons_motorola_we800g);
522541
break;

‎arch/mips/bcm47xx/leds.c‎

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,11 @@ bcm47xx_leds_asus_wl330ge[] __initconst = {
6363
BCM47XX_GPIO_LED(0, "unk", "power", 1, LEDS_GPIO_DEFSTATE_ON),
6464
};
6565

66+
static const struct gpio_led
67+
bcm47xx_leds_asus_wl500g[] __initconst = {
68+
BCM47XX_GPIO_LED(0, "unk", "power", 1, LEDS_GPIO_DEFSTATE_ON),
69+
};
70+
6671
static const struct gpio_led
6772
bcm47xx_leds_asus_wl500gd[] __initconst = {
6873
BCM47XX_GPIO_LED(0, "unk", "power", 1, LEDS_GPIO_DEFSTATE_ON),
@@ -332,6 +337,13 @@ bcm47xx_leds_linksys_wrtsl54gs[] __initconst = {
332337
BCM47XX_GPIO_LED(7, "unk", "dmz", 1, LEDS_GPIO_DEFSTATE_OFF),
333338
};
334339

340+
/* Microsoft */
341+
342+
static const struct gpio_led
343+
bcm47xx_leds_microsoft_nm700[] __initconst = {
344+
BCM47XX_GPIO_LED(6, "unk", "power", 0, LEDS_GPIO_DEFSTATE_ON),
345+
};
346+
335347
/* Motorola */
336348

337349
static const struct gpio_led
@@ -432,6 +444,9 @@ void __init bcm47xx_leds_register(void)
432444
case BCM47XX_BOARD_ASUS_WL330GE:
433445
bcm47xx_set_pdata(bcm47xx_leds_asus_wl330ge);
434446
break;
447+
case BCM47XX_BOARD_ASUS_WL500G:
448+
bcm47xx_set_pdata(bcm47xx_leds_asus_wl500g);
449+
break;
435450
case BCM47XX_BOARD_ASUS_WL500GD:
436451
bcm47xx_set_pdata(bcm47xx_leds_asus_wl500gd);
437452
break;
@@ -554,6 +569,10 @@ void __init bcm47xx_leds_register(void)
554569
bcm47xx_set_pdata(bcm47xx_leds_linksys_wrtsl54gs);
555570
break;
556571

572+
case BCM47XX_BOARD_MICROSOFT_MN700:
573+
bcm47xx_set_pdata(bcm47xx_leds_microsoft_nm700);
574+
break;
575+
557576
case BCM47XX_BOARD_MOTOROLA_WE800G:
558577
bcm47xx_set_pdata(bcm47xx_leds_motorola_we800g);
559578
break;

‎arch/mips/include/asm/mach-bcm47xx/bcm47xx_board.h‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ enum bcm47xx_board {
1818
BCM47XX_BOARD_ASUS_WL300G,
1919
BCM47XX_BOARD_ASUS_WL320GE,
2020
BCM47XX_BOARD_ASUS_WL330GE,
21+
BCM47XX_BOARD_ASUS_WL500G,
2122
BCM47XX_BOARD_ASUS_WL500GD,
2223
BCM47XX_BOARD_ASUS_WL500GPV1,
2324
BCM47XX_BOARD_ASUS_WL500GPV2,
@@ -75,6 +76,8 @@ enum bcm47xx_board {
7576
BCM47XX_BOARD_LINKSYS_WRT610NV2,
7677
BCM47XX_BOARD_LINKSYS_WRTSL54GS,
7778

79+
BCM47XX_BOARD_MICROSOFT_MN700,
80+
7881
BCM47XX_BOARD_MOTOROLA_WE800G,
7982
BCM47XX_BOARD_MOTOROLA_WR850GP,
8083
BCM47XX_BOARD_MOTOROLA_WR850GV2V3,

0 commit comments

Comments
 (0)