-};
-
-extern void *sbh;
-extern spinlock_t sbh_lock;
-extern char *nvram_get(char *str);
-
-static struct proc_dir_entry *diag, *leds;
-static struct platform_t platform;
-static void led_flash(unsigned long dummy);
-
-#define getvar(str) (nvram_get(str)?:"")
-
-static void set_led_extif(struct led_t *led)
-{
- volatile u8 *addr = (volatile u8 *) KSEG1ADDR(EXTIF_UART) + (led->gpio & ~GPIO_TYPE_MASK);
- if (led->state)
- *addr = 0xFF;
- else
- *addr;
-}
-
-static struct platform_t __init *platform_detect(void)
-{
- char *boardnum, *boardtype, *buf;
-
- boardnum = getvar("boardnum");
- boardtype = getvar("boardtype");
- if (strncmp(getvar("pmon_ver"), "CFE", 3) == 0) {
- /* CFE based - newer hardware */
- if (!strcmp(boardnum, "42")) { /* Linksys */
- if (!strcmp(boardtype, "0x0101"))
- return &platforms[WRT54G3G];
-
- if (!strcmp(getvar("et1phyaddr"),"5") && !strcmp(getvar("et1mdcport"), "1"))
- return &platforms[WRTSL54GS];
-
- /* default to WRT54G */
- return &platforms[WRT54G];
- }
-
- if (!strcmp(boardnum, "45")) { /* ASUS */
- if (!strcmp(boardtype,"0x042f"))
- return &platforms[WL500GP];
- else
- return &platforms[WL500GD];
- }
-
- if (!strcmp(boardnum, "10496"))
- return &platforms[USR5461];
- } else { /* PMON based - old stuff */
- if (!strncmp(boardtype, "bcm94710dev", 11)) {
- if (!strcmp(boardnum, "42"))
- return &platforms[WRT54GV1];
- if (simple_strtoul(boardnum, NULL, 9) == 2)
- return &platforms[WAP54GV1];
- }
- if (!strncmp(getvar("hardware_version"), "WL500-", 6))
- return &platforms[WL500G];
- if (!strncmp(getvar("hardware_version"), "WL300-", 6)) {
- /* Either WL-300g or WL-HDD, do more extensive checks */
- if ((simple_strtoul(getvar("et0phyaddr"), NULL, 0) == 0) &&
- (simple_strtoul(getvar("et1phyaddr"), NULL, 9) == 1))
- return &platforms[WLHDD];
- if ((simple_strtoul(getvar("et0phyaddr"), NULL, 0) == 0) &&
- (simple_strtoul(getvar("et1phyaddr"), NULL, 9) == 10))
- return &platforms[WL300G];
- }
-
- /* unknown asus stuff, probably bcm4702 */
- if (!strncmp(boardnum, "asusX", 5))
- return &platforms[ASUS_4702];
-
- if ((simple_strtoul(getvar("GemtekPmonVer"), NULL, 0) == 9) &&
- (simple_strtoul(getvar("et0phyaddr"), NULL, 0) == 30)) {
- if (!strncmp(getvar("ModelId"),"WE800G", 6))
- return &platforms[WE800G];
- else
- return &platforms[WR850GV1];
- }
- }
+ /* Netgear */
+ [WGT634U] = {
+ .name = "Netgear WGT634U",
+ .buttons = {
+ { .name = "reset", .gpio = 1 << 2 },
+ },
+ .leds = {
+ { .name = "power", .gpio = 1 << 3, .polarity = NORMAL },
+ },
+ },
+ /* Netgear */
+ [WNR834BV1] = {
+ .name = "Netgear WNR834B V1",
+ .buttons = { /* TODO: add reset button and confirm LEDs - GPIO from dd-wrt */ },
+ .leds = {
+ { .name = "power", .gpio = 1 << 4, .polarity = REVERSE },
+ { .name = "diag", .gpio = 1 << 5, .polarity = REVERSE },
+ { .name = "wlan", .gpio = 1 << 6, .polarity = REVERSE },
+ },
+ },
+ /* Netgear */
+ [WNR834BV2] = {
+ .name = "Netgear WNR834B V2",
+ .buttons = {
+ { .name = "reset", .gpio = 1 << 6 },
+ },
+ .leds = {
+ { .name = "power", .gpio = 1 << 2, .polarity = NORMAL },
+ { .name = "diag", .gpio = 1 << 3, .polarity = NORMAL },
+ { .name = "connected", .gpio = 1 << 7, .polarity = NORMAL },
+ },
+ },
+ /* Trendware */
+ [TEW411BRPP] = {
+ .name = "Trendware TEW411BRP+",
+ .buttons = {
+ { /* No usable buttons */ },
+ },
+ .leds = {
+ { .name = "power", .gpio = 1 << 7, .polarity = NORMAL },
+ { .name = "wlan", .gpio = 1 << 1, .polarity = NORMAL },
+ { .name = "bridge", .gpio = 1 << 6, .polarity = NORMAL },
+ },
+ },
+ /* SimpleTech */
+ [STI_NAS] = {
+ .name = "SimpleTech SimpleShare NAS",
+ .buttons = {
+ { .name = "reset", .gpio = 1 << 0 }, // Power button on back, named reset to enable failsafe.
+ },
+ .leds = {
+ { .name = "diag", .gpio = 1 << 1, .polarity = REVERSE }, // actual name ready
+ },
+ .platform_init = bcm4780_init,
+ },
+ /* D-Link */
+ [DIR130] = {
+ .name = "D-Link DIR-130",
+ .buttons = {
+ { .name = "reset", .gpio = 1 << 3},
+ { .name = "reserved", .gpio = 1 << 7},
+ },
+ .leds = {
+ { .name = "diag", .gpio = 1 << 0},
+ { .name = "blue", .gpio = 1 << 6},
+ },
+ },
+ [DIR320] = {
+ .name = "D-Link DIR-320",
+ .buttons = {
+ { .name = "reserved", .gpio = 1 << 6},
+ { .name = "reset", .gpio = 1 << 7},
+ },
+ .leds = {
+ { .name = "wlan", .gpio = 1 << 0, .polarity = NORMAL },
+ { .name = "diag", .gpio = 1 << 1, .polarity = NORMAL }, /* "status led */
+ { .name = "red", .gpio = 1 << 3, .polarity = REVERSE },
+ { .name = "blue", .gpio = 1 << 4, .polarity = REVERSE },
+ { .name = "usb", .gpio = 1 << 5, .polarity = NORMAL },
+ },
+ },
+ [DIR330] = {
+ .name = "D-Link DIR-330",
+ .buttons = {
+ { .name = "reset", .gpio = 1 << 3},
+ { .name = "reserved", .gpio = 1 << 7},
+ },
+ .leds = {
+ { .name = "diag", .gpio = 1 << 0},
+ { .name = "usb", .gpio = 1 << 4},
+ { .name = "blue", .gpio = 1 << 6},
+ },
+ },
+ [DWL3150] = {
+ .name = "D-Link DWL-3150",
+ .buttons = {
+ { .name = "reset", .gpio = 1 << 7},
+ },
+ .leds = {
+ { .name = "diag", .gpio = 1 << 2},
+ { .name = "status", .gpio = 1 << 1},
+ },
+ },
+ /* Double check */
+ [WL105B] = {
+ .name = "Sitecom WL-105b",
+ .buttons = {
+ { .name = "reset", .gpio = 1 << 10},
+ },
+ .leds = {
+ { .name = "wlan", .gpio = 1 << 4},
+ { .name = "power", .gpio = 1 << 3},
+ },
+ },
+ /* Western Digital Net Center */
+ [WDNetCenter] = {
+ .name = "Western Digital NetCenter",
+ .buttons = {
+ { .name = "power", .gpio = 1 << 0},
+ { .name = "reset", .gpio = 1 << 7},
+ },
+ .platform_init = NetCenter_init,
+ },
+ /* Askey (and clones) */
+ [RT210W] = {
+ .name = "Askey RT210W",
+ .buttons = {
+ /* Power button is hard-wired to hardware reset */
+ /* but is also connected to GPIO 7 (probably for bootloader recovery) */
+ { .name = "power", .gpio = 1 << 7},
+ },
+ .leds = {
+ /* These were verified and named based on Belkin F5D4230-4 v1112 */
+ { .name = "connected", .gpio = 1 << 0, .polarity = REVERSE },
+ { .name = "wlan", .gpio = 1 << 3, .polarity = REVERSE },
+ { .name = "power", .gpio = 1 << 5, .polarity = REVERSE },
+ },
+ },
+ [WL1600GL] = {
+ .name = "OvisLink WL-1600GL",
+ .buttons = {
+ { .name = "reset", .gpio = 1 << 3 },
+ { .name = "ses", .gpio = 1 << 4 },
+ },
+ .leds = {
+ { .name = "power", .gpio = 1 << 5, .polarity = REVERSE },
+ { .name = "wps", .gpio = 1 << 2, .polarity = REVERSE },
+ { .name = "wlan", .gpio = 1 << 1, .polarity = REVERSE },
+ { .name = "connected", .gpio = 1 << 0, .polarity = REVERSE },
+ },
+ },
+ /* Microsoft */
+ [MN700] = {
+ .name = "Microsoft MN-700",
+ .buttons = {
+ { .name = "reset", .gpio = 1 << 7 },
+ },
+ .leds = {
+ { .name = "power", .gpio = 1 << 6, .polarity = NORMAL },
+ },
+ },
+ /* Edimax */
+ [PS1208MFG] = {
+ .name = "Edimax PS-1208MFG",
+ .buttons = {
+ { .name = "reset", .gpio = 1 << 4 },
+ },
+ .leds = {
+ { .name = "status", .gpio = 1 << 1, .polarity = NORMAL },
+ { .name = "wlan", .gpio = 1 << 0, .polarity = NORMAL },
+ },
+ },
+};
+
+static struct platform_t __init *platform_detect(void)
+{
+ char *boardnum, *boardtype, *buf;
+
+ if (strcmp(getvar("nvram_type"), "cfe") == 0)
+ return &platforms[WGT634U];
+
+ /* Look for a model identifier */
+
+ /* Based on "model_name" */
+ if ((buf = nvram_get("model_name"))) {
+ if (!strcmp(buf, "DIR-130"))
+ return &platforms[DIR130];
+ if (!strcmp(buf, "DIR-330"))
+ return &platforms[DIR330];
+ }