| 1 | /* |
| 2 | * Compex WP54 board support |
| 3 | * |
| 4 | * Copyright (C) 2007-2008 Gabor Juhos <juhosg@openwrt.org> |
| 5 | * |
| 6 | * This program is free software; you can redistribute it and/or modify it |
| 7 | * under the terms of the GNU General Public License version 2 as published |
| 8 | * by the Free Software Foundation. |
| 9 | * |
| 10 | */ |
| 11 | |
| 12 | #include "compex.h" |
| 13 | |
| 14 | #define WP54_KEYS_POLL_INTERVAL 20 |
| 15 | #define WP54_KEYS_DEBOUNCE_INTERVAL (3 * WP54_KEYS_POLL_INTERVAL) |
| 16 | |
| 17 | static struct mtd_partition wp54g_wrt_partitions[] = { |
| 18 | { |
| 19 | .name = "cfe", |
| 20 | .offset = 0, |
| 21 | .size = 0x050000, |
| 22 | .mask_flags = MTD_WRITEABLE, |
| 23 | } , { |
| 24 | .name = "trx", |
| 25 | .offset = MTDPART_OFS_APPEND, |
| 26 | .size = 0x3A0000, |
| 27 | } , { |
| 28 | .name = "nvram", |
| 29 | .offset = MTDPART_OFS_APPEND, |
| 30 | .size = 0x010000, |
| 31 | } |
| 32 | }; |
| 33 | |
| 34 | static struct adm5120_pci_irq wp54_pci_irqs[] __initdata = { |
| 35 | PCIIRQ(2, 0, 1, ADM5120_IRQ_PCI0), |
| 36 | }; |
| 37 | |
| 38 | static struct gpio_keys_button wp54_gpio_buttons[] __initdata = { |
| 39 | { |
| 40 | .desc = "reset_button", |
| 41 | .type = EV_KEY, |
| 42 | .code = KEY_RESTART, |
| 43 | .debounce_interval = WP54_KEYS_DEBOUNCE_INTERVAL, |
| 44 | .gpio = ADM5120_GPIO_PIN4, |
| 45 | } |
| 46 | }; |
| 47 | |
| 48 | static struct gpio_led wp54_gpio_leds[] __initdata = { |
| 49 | GPIO_LED_INV(ADM5120_GPIO_PIN2, "diag", NULL), |
| 50 | GPIO_LED_INV(ADM5120_GPIO_PIN6, "wlan", NULL), |
| 51 | GPIO_LED_INV(ADM5120_GPIO_PIN7, "wan", NULL), |
| 52 | GPIO_LED_INV(ADM5120_GPIO_P0L0, "lan1", NULL), |
| 53 | GPIO_LED_INV(ADM5120_GPIO_P1L0, "lan2", NULL), |
| 54 | }; |
| 55 | |
| 56 | static u8 wp54_vlans[6] __initdata = { |
| 57 | 0x41, 0x42, 0x00, 0x00, 0x00, 0x00 |
| 58 | }; |
| 59 | |
| 60 | static void wp54_reset(void) |
| 61 | { |
| 62 | gpio_set_value(ADM5120_GPIO_PIN3, 0); |
| 63 | } |
| 64 | |
| 65 | static void __init wp54_setup(void) |
| 66 | { |
| 67 | compex_generic_setup(); |
| 68 | |
| 69 | /* setup reset line */ |
| 70 | gpio_request(ADM5120_GPIO_PIN3, NULL); |
| 71 | gpio_direction_output(ADM5120_GPIO_PIN3, 1); |
| 72 | adm5120_board_reset = wp54_reset; |
| 73 | |
| 74 | adm5120_add_device_switch(2, wp54_vlans); |
| 75 | adm5120_register_gpio_buttons(-1, WP54_KEYS_POLL_INTERVAL, |
| 76 | ARRAY_SIZE(wp54_gpio_buttons), |
| 77 | wp54_gpio_buttons); |
| 78 | adm5120_add_device_gpio_leds(ARRAY_SIZE(wp54_gpio_leds), |
| 79 | wp54_gpio_leds); |
| 80 | |
| 81 | adm5120_pci_set_irq_map(ARRAY_SIZE(wp54_pci_irqs), wp54_pci_irqs); |
| 82 | } |
| 83 | |
| 84 | MIPS_MACHINE(MACH_ADM5120_WP54, "WP54", "Compex WP54 family", wp54_setup); |
| 85 | |
| 86 | static void __init wp54_wrt_setup(void) |
| 87 | { |
| 88 | adm5120_flash0_data.nr_parts = ARRAY_SIZE(wp54g_wrt_partitions); |
| 89 | adm5120_flash0_data.parts = wp54g_wrt_partitions; |
| 90 | |
| 91 | wp54_setup(); |
| 92 | } |
| 93 | |
| 94 | MIPS_MACHINE(MACH_ADM5120_WP54G_WRT, "WP54G-WRT", "Compex WP54G-WRT", |
| 95 | wp54_wrt_setup); |
| 96 | |