X-Git-Url: https://git.rohieb.name/openwrt.git/blobdiff_plain/fca1e2883934a6d918878c05ddbea9aadb91b2a5..e87fb5ee5a75b03e8b2e128b611a72e08eab3196:/package/broadcom-diag/src/diag.c diff --git a/package/broadcom-diag/src/diag.c b/package/broadcom-diag/src/diag.c index 4dcc0bf15..7866b9f79 100644 --- a/package/broadcom-diag/src/diag.c +++ b/package/broadcom-diag/src/diag.c @@ -62,6 +62,7 @@ enum { WL500G, WL500GD, WL500GP, + WL500W, ASUS_4702, WL700GE, @@ -100,9 +101,12 @@ enum { /* Trendware */ TEW411BRPP, + + /* SimpleTech */ + STI_NAS, }; -static void __init wl700ge_init(void) { +static void __init bcm4780_init(void) { int pin = 1 << 3; /* Enables GPIO 3 that controls HDD and led power on ASUS WL-700gE */ @@ -250,6 +254,16 @@ static struct platform_t __initdata platforms[] = { { .name = "power", .gpio = 1 << 1, .polarity = REVERSE }, }, }, + [WL500W] = { + .name = "ASUS WL-500W", + .buttons = { + { .name = "reset", .gpio = 1 << 6 }, + { .name = "ses", .gpio = 1 << 7 }, + }, + .leds = { + { .name = "power", .gpio = 1 << 5, .polarity = REVERSE }, + }, + }, [ASUS_4702] = { .name = "ASUS (unknown, BCM4702)", .buttons = { @@ -276,7 +290,7 @@ static struct platform_t __initdata platforms[] = { #endif { .name = "diag", .gpio = 1 << 1, .polarity = REVERSE }, // actual name ready }, - .platform_init = wl700ge_init, + .platform_init = bcm4780_init, }, /* Buffalo */ [WHR_G54S] = { @@ -489,7 +503,7 @@ static struct platform_t __initdata platforms[] = { { .name = "reset", .gpio = 1 << 2 }, }, .leds = { - { .name = "power", .gpio = 1 << 3, .polarity = REVERSE }, + { .name = "power", .gpio = 1 << 3, .polarity = NORMAL }, }, }, /* Trendware */ @@ -504,6 +518,18 @@ static struct platform_t __initdata platforms[] = { { .name = "bridge", .gpio = 1 << 6, .polarity = NORMAL }, }, }, + /* SimpleTech */ + [STI_NAS] = { + .name = "SimpleTech SimpleShare NAS", + .buttons = { + { .name = "reset", .gpio = 1 << 7 }, // on back, hardwired, always resets device regardless OS state + { .name = "power", .gpio = 1 << 0 }, // on back + }, + .leds = { + { .name = "diag", .gpio = 1 << 1, .polarity = REVERSE }, // actual name ready + }, + .platform_init = bcm4780_init, + }, }; static struct platform_t __init *platform_detect(void) @@ -513,8 +539,11 @@ static struct platform_t __init *platform_detect(void) boardnum = getvar("boardnum"); boardtype = getvar("boardtype"); - if (strncmp(getvar("model_no"), "WL700",5) == 0) { - return &platforms[WL700GE]; } + if (strcmp(getvar("nvram_type"), "cfe") == 0) + return &platforms[WGT634U]; + + if (strncmp(getvar("model_no"), "WL700",5) == 0) + return &platforms[WL700GE]; if (strncmp(getvar("pmon_ver"), "CFE", 3) == 0) { /* CFE based - newer hardware */ @@ -535,6 +564,8 @@ static struct platform_t __init *platform_detect(void) if (!strcmp(boardnum, "45")) { /* ASUS */ if (!strcmp(boardtype,"0x042f")) return &platforms[WL500GP]; + else if (!strcmp(boardtype,"0x0472")) + return &platforms[WL500W]; else return &platforms[WL500GD]; } @@ -614,6 +645,9 @@ static struct platform_t __init *platform_detect(void) return &platforms[TEW411BRPP]; } + if (!strncmp(boardnum, "04FN52", 6)) /* SimpleTech SimpleShare */ + return &platforms[STI_NAS]; + /* not found */ return NULL; } @@ -641,8 +675,14 @@ static void unregister_buttons(struct button_t *b) gpio_set_irqenable(0, button_handler); } +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20) +static void hotplug_button(struct work_struct *work) +{ + struct event_t *event = container_of(work, struct event_t, wq); +#else static void hotplug_button(struct event_t *event) { +#endif #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) call_usermodehelper (event->argv[0], event->argv, event->envp, 1); #else @@ -690,7 +730,11 @@ static irqreturn_t button_handler(int irq, void *dev_id, struct pt_regs *regs) scratch += sprintf (scratch, "SEEN=%ld", (jiffies - b->seen)/HZ) + 1; event->envp[i] = 0; +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20) + INIT_WORK(&event->wq, (void *)(void *)hotplug_button); +#else INIT_WORK(&event->wq, (void *)(void *)hotplug_button, (void *)event); +#endif schedule_work(&event->wq); }