Commit 250dc037 authored by Hauke Mehrtens's avatar Hauke Mehrtens Committed by Ralf Baechle

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: default avatarHauke 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: default avatarRalf Baechle <ralf@linux-mips.org>
parent 103c0bf3
...@@ -80,6 +80,14 @@ struct bcm47xx_board_type_list1 bcm47xx_board_list_hardware_version[] __initcons ...@@ -80,6 +80,14 @@ struct bcm47xx_board_type_list1 bcm47xx_board_list_hardware_version[] __initcons
{ {0}, NULL}, { {0}, NULL},
}; };
/* hardware_version, boardnum */
static const
struct bcm47xx_board_type_list2 bcm47xx_board_list_hw_version_num[] __initconst = {
{{BCM47XX_BOARD_MICROSOFT_MN700, "Microsoft MN-700"}, "WL500-", "mn700"},
{{BCM47XX_BOARD_ASUS_WL500G, "Asus WL500G"}, "WL500-", "asusX"},
{ {0}, NULL},
};
/* productid */ /* productid */
static const static const
struct bcm47xx_board_type_list1 bcm47xx_board_list_productid[] __initconst = { 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) ...@@ -237,6 +245,15 @@ static __init const struct bcm47xx_board_type *bcm47xx_board_get_nvram(void)
} }
} }
if (bcm47xx_nvram_getenv("hardware_version", buf1, sizeof(buf1)) >= 0 &&
bcm47xx_nvram_getenv("boardtype", buf2, sizeof(buf2)) >= 0) {
for (e2 = bcm47xx_board_list_boot_hw; e2->value1; e2++) {
if (!strstarts(buf1, e2->value1) &&
!strcmp(buf2, e2->value2))
return &e2->board;
}
}
if (bcm47xx_nvram_getenv("productid", buf1, sizeof(buf1)) >= 0) { if (bcm47xx_nvram_getenv("productid", buf1, sizeof(buf1)) >= 0) {
for (e1 = bcm47xx_board_list_productid; e1->value1; e1++) { for (e1 = bcm47xx_board_list_productid; e1->value1; e1++) {
if (!strcmp(buf1, e1->value1)) if (!strcmp(buf1, e1->value1))
......
...@@ -55,6 +55,11 @@ bcm47xx_buttons_asus_wl330ge[] __initconst = { ...@@ -55,6 +55,11 @@ bcm47xx_buttons_asus_wl330ge[] __initconst = {
BCM47XX_GPIO_KEY(2, KEY_RESTART), BCM47XX_GPIO_KEY(2, KEY_RESTART),
}; };
static const struct gpio_keys_button
bcm47xx_buttons_asus_wl500g[] __initconst = {
BCM47XX_GPIO_KEY(6, KEY_RESTART),
};
static const struct gpio_keys_button static const struct gpio_keys_button
bcm47xx_buttons_asus_wl500gd[] __initconst = { bcm47xx_buttons_asus_wl500gd[] __initconst = {
BCM47XX_GPIO_KEY(6, KEY_RESTART), BCM47XX_GPIO_KEY(6, KEY_RESTART),
...@@ -288,6 +293,13 @@ bcm47xx_buttons_linksys_wrtsl54gs[] __initconst = { ...@@ -288,6 +293,13 @@ bcm47xx_buttons_linksys_wrtsl54gs[] __initconst = {
BCM47XX_GPIO_KEY(6, KEY_RESTART), BCM47XX_GPIO_KEY(6, KEY_RESTART),
}; };
/* Microsoft */
static const struct gpio_keys_button
bcm47xx_buttons_microsoft_nm700[] __initconst = {
BCM47XX_GPIO_KEY(7, KEY_RESTART),
};
/* Motorola */ /* Motorola */
static const struct gpio_keys_button static const struct gpio_keys_button
...@@ -395,6 +407,9 @@ int __init bcm47xx_buttons_register(void) ...@@ -395,6 +407,9 @@ int __init bcm47xx_buttons_register(void)
case BCM47XX_BOARD_ASUS_WL330GE: case BCM47XX_BOARD_ASUS_WL330GE:
err = bcm47xx_copy_bdata(bcm47xx_buttons_asus_wl330ge); err = bcm47xx_copy_bdata(bcm47xx_buttons_asus_wl330ge);
break; break;
case BCM47XX_BOARD_ASUS_WL500G:
err = bcm47xx_copy_bdata(bcm47xx_buttons_asus_wl500g);
break;
case BCM47XX_BOARD_ASUS_WL500GD: case BCM47XX_BOARD_ASUS_WL500GD:
err = bcm47xx_copy_bdata(bcm47xx_buttons_asus_wl500gd); err = bcm47xx_copy_bdata(bcm47xx_buttons_asus_wl500gd);
break; break;
...@@ -517,6 +532,10 @@ int __init bcm47xx_buttons_register(void) ...@@ -517,6 +532,10 @@ int __init bcm47xx_buttons_register(void)
err = bcm47xx_copy_bdata(bcm47xx_buttons_linksys_wrtsl54gs); err = bcm47xx_copy_bdata(bcm47xx_buttons_linksys_wrtsl54gs);
break; break;
case BCM47XX_BOARD_MICROSOFT_MN700:
err = bcm47xx_copy_bdata(bcm47xx_buttons_microsoft_nm700);
break;
case BCM47XX_BOARD_MOTOROLA_WE800G: case BCM47XX_BOARD_MOTOROLA_WE800G:
err = bcm47xx_copy_bdata(bcm47xx_buttons_motorola_we800g); err = bcm47xx_copy_bdata(bcm47xx_buttons_motorola_we800g);
break; break;
......
...@@ -63,6 +63,11 @@ bcm47xx_leds_asus_wl330ge[] __initconst = { ...@@ -63,6 +63,11 @@ bcm47xx_leds_asus_wl330ge[] __initconst = {
BCM47XX_GPIO_LED(0, "unk", "power", 1, LEDS_GPIO_DEFSTATE_ON), BCM47XX_GPIO_LED(0, "unk", "power", 1, LEDS_GPIO_DEFSTATE_ON),
}; };
static const struct gpio_led
bcm47xx_leds_asus_wl500g[] __initconst = {
BCM47XX_GPIO_LED(0, "unk", "power", 1, LEDS_GPIO_DEFSTATE_ON),
};
static const struct gpio_led static const struct gpio_led
bcm47xx_leds_asus_wl500gd[] __initconst = { bcm47xx_leds_asus_wl500gd[] __initconst = {
BCM47XX_GPIO_LED(0, "unk", "power", 1, LEDS_GPIO_DEFSTATE_ON), BCM47XX_GPIO_LED(0, "unk", "power", 1, LEDS_GPIO_DEFSTATE_ON),
...@@ -332,6 +337,13 @@ bcm47xx_leds_linksys_wrtsl54gs[] __initconst = { ...@@ -332,6 +337,13 @@ bcm47xx_leds_linksys_wrtsl54gs[] __initconst = {
BCM47XX_GPIO_LED(7, "unk", "dmz", 1, LEDS_GPIO_DEFSTATE_OFF), BCM47XX_GPIO_LED(7, "unk", "dmz", 1, LEDS_GPIO_DEFSTATE_OFF),
}; };
/* Microsoft */
static const struct gpio_led
bcm47xx_leds_microsoft_nm700[] __initconst = {
BCM47XX_GPIO_LED(6, "unk", "power", 0, LEDS_GPIO_DEFSTATE_ON),
};
/* Motorola */ /* Motorola */
static const struct gpio_led static const struct gpio_led
...@@ -432,6 +444,9 @@ void __init bcm47xx_leds_register(void) ...@@ -432,6 +444,9 @@ void __init bcm47xx_leds_register(void)
case BCM47XX_BOARD_ASUS_WL330GE: case BCM47XX_BOARD_ASUS_WL330GE:
bcm47xx_set_pdata(bcm47xx_leds_asus_wl330ge); bcm47xx_set_pdata(bcm47xx_leds_asus_wl330ge);
break; break;
case BCM47XX_BOARD_ASUS_WL500G:
bcm47xx_set_pdata(bcm47xx_leds_asus_wl500g);
break;
case BCM47XX_BOARD_ASUS_WL500GD: case BCM47XX_BOARD_ASUS_WL500GD:
bcm47xx_set_pdata(bcm47xx_leds_asus_wl500gd); bcm47xx_set_pdata(bcm47xx_leds_asus_wl500gd);
break; break;
...@@ -554,6 +569,10 @@ void __init bcm47xx_leds_register(void) ...@@ -554,6 +569,10 @@ void __init bcm47xx_leds_register(void)
bcm47xx_set_pdata(bcm47xx_leds_linksys_wrtsl54gs); bcm47xx_set_pdata(bcm47xx_leds_linksys_wrtsl54gs);
break; break;
case BCM47XX_BOARD_MICROSOFT_MN700:
bcm47xx_set_pdata(bcm47xx_leds_microsoft_nm700);
break;
case BCM47XX_BOARD_MOTOROLA_WE800G: case BCM47XX_BOARD_MOTOROLA_WE800G:
bcm47xx_set_pdata(bcm47xx_leds_motorola_we800g); bcm47xx_set_pdata(bcm47xx_leds_motorola_we800g);
break; break;
......
...@@ -18,6 +18,7 @@ enum bcm47xx_board { ...@@ -18,6 +18,7 @@ enum bcm47xx_board {
BCM47XX_BOARD_ASUS_WL300G, BCM47XX_BOARD_ASUS_WL300G,
BCM47XX_BOARD_ASUS_WL320GE, BCM47XX_BOARD_ASUS_WL320GE,
BCM47XX_BOARD_ASUS_WL330GE, BCM47XX_BOARD_ASUS_WL330GE,
BCM47XX_BOARD_ASUS_WL500G,
BCM47XX_BOARD_ASUS_WL500GD, BCM47XX_BOARD_ASUS_WL500GD,
BCM47XX_BOARD_ASUS_WL500GPV1, BCM47XX_BOARD_ASUS_WL500GPV1,
BCM47XX_BOARD_ASUS_WL500GPV2, BCM47XX_BOARD_ASUS_WL500GPV2,
...@@ -75,6 +76,8 @@ enum bcm47xx_board { ...@@ -75,6 +76,8 @@ enum bcm47xx_board {
BCM47XX_BOARD_LINKSYS_WRT610NV2, BCM47XX_BOARD_LINKSYS_WRT610NV2,
BCM47XX_BOARD_LINKSYS_WRTSL54GS, BCM47XX_BOARD_LINKSYS_WRTSL54GS,
BCM47XX_BOARD_MICROSOFT_MN700,
BCM47XX_BOARD_MOTOROLA_WE800G, BCM47XX_BOARD_MOTOROLA_WE800G,
BCM47XX_BOARD_MOTOROLA_WR850GP, BCM47XX_BOARD_MOTOROLA_WR850GP,
BCM47XX_BOARD_MOTOROLA_WR850GV2V3, BCM47XX_BOARD_MOTOROLA_WR850GV2V3,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment