2 * Compex WP54 board support
4 * Copyright (C) 2007-2008 Gabor Juhos <juhosg@openwrt.org>
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.
14 #define WP54_KEYS_POLL_INTERVAL 20
15 #define WP54_KEYS_DEBOUNCE_INTERVAL (3 * WP54_KEYS_POLL_INTERVAL)
17 static struct mtd_partition wp54g_wrt_partitions[] = {
22 .mask_flags = MTD_WRITEABLE,
25 .offset = MTDPART_OFS_APPEND,
29 .offset = MTDPART_OFS_APPEND,
34 static struct adm5120_pci_irq wp54_pci_irqs[] __initdata = {
35 PCIIRQ(2, 0, 1, ADM5120_IRQ_PCI0),
38 static struct gpio_keys_button wp54_gpio_buttons[] __initdata = {
40 .desc = "reset_button",
43 .debounce_interval = WP54_KEYS_DEBOUNCE_INTERVAL,
44 .gpio = ADM5120_GPIO_PIN4,
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),
56 static u8 wp54_vlans[6] __initdata = {
57 0x41, 0x42, 0x00, 0x00, 0x00, 0x00
60 static void wp54_reset(void)
62 gpio_set_value(ADM5120_GPIO_PIN3, 0);
65 static void __init wp54_setup(void)
67 compex_generic_setup();
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;
74 adm5120_add_device_switch(2, wp54_vlans);
75 adm5120_register_gpio_buttons(-1, WP54_KEYS_POLL_INTERVAL,
76 ARRAY_SIZE(wp54_gpio_buttons),
78 adm5120_add_device_gpio_leds(ARRAY_SIZE(wp54_gpio_leds),
81 adm5120_pci_set_irq_map(ARRAY_SIZE(wp54_pci_irqs), wp54_pci_irqs);
84 MIPS_MACHINE(MACH_ADM5120_WP54, "WP54", "Compex WP54 family", wp54_setup);
86 static void __init wp54_wrt_setup(void)
88 adm5120_flash0_data.nr_parts = ARRAY_SIZE(wp54g_wrt_partitions);
89 adm5120_flash0_data.parts = wp54g_wrt_partitions;
94 MIPS_MACHINE(MACH_ADM5120_WP54G_WRT, "WP54G-WRT", "Compex WP54G-WRT",