d56656d50301a78cd2cbdf054027da8d55a97be4
[openwrt.git] / target / linux / adm5120 / files / arch / mips / adm5120 / compex / wp54.c
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 #ifdef CONFIG_MTD_PARTITIONS
15 static struct mtd_partition wp54g_wrt_partitions[] = {
16 {
17 .name = "cfe",
18 .offset = 0,
19 .size = 0x050000,
20 .mask_flags = MTD_WRITEABLE,
21 } , {
22 .name = "trx",
23 .offset = MTDPART_OFS_APPEND,
24 .size = 0x3A0000,
25 } , {
26 .name = "nvram",
27 .offset = MTDPART_OFS_APPEND,
28 .size = 0x010000,
29 }
30 };
31 #endif /* CONFIG_MTD_PARTITIONS */
32
33 static struct adm5120_pci_irq wp54_pci_irqs[] __initdata = {
34 PCIIRQ(2, 0, 1, ADM5120_IRQ_PCI0),
35 };
36
37 static struct gpio_button wp54_gpio_buttons[] __initdata = {
38 {
39 .desc = "reset_button",
40 .type = EV_KEY,
41 .code = BTN_0,
42 .threshold = 5,
43 .gpio = ADM5120_GPIO_PIN4,
44 }
45 };
46
47 static struct gpio_led wp54_gpio_leds[] __initdata = {
48 GPIO_LED_INV(ADM5120_GPIO_PIN2, "diag", NULL),
49 GPIO_LED_INV(ADM5120_GPIO_PIN6, "wlan", NULL),
50 GPIO_LED_INV(ADM5120_GPIO_PIN7, "wan", NULL),
51 GPIO_LED_INV(ADM5120_GPIO_P0L0, "lan1", NULL),
52 GPIO_LED_INV(ADM5120_GPIO_P1L0, "lan2", NULL),
53 };
54
55 static u8 wp54_vlans[6] __initdata = {
56 0x41, 0x42, 0x00, 0x00, 0x00, 0x00
57 };
58
59 static void wp54_reset(void)
60 {
61 gpio_set_value(ADM5120_GPIO_PIN3, 0);
62 }
63
64 static void __init wp54_setup(void)
65 {
66 compex_generic_setup();
67
68 /* setup reset line */
69 gpio_request(ADM5120_GPIO_PIN3, NULL);
70 gpio_direction_output(ADM5120_GPIO_PIN3, 1);
71 adm5120_board_reset = wp54_reset;
72
73 adm5120_add_device_switch(2, wp54_vlans);
74 adm5120_add_device_gpio_buttons(ARRAY_SIZE(wp54_gpio_buttons),
75 wp54_gpio_buttons);
76 adm5120_add_device_gpio_leds(ARRAY_SIZE(wp54_gpio_leds),
77 wp54_gpio_leds);
78
79 adm5120_pci_set_irq_map(ARRAY_SIZE(wp54_pci_irqs), wp54_pci_irqs);
80 }
81
82 MIPS_MACHINE(MACH_ADM5120_WP54, "Compex WP54 family", wp54_setup);
83
84 static void __init wp54_wrt_setup(void)
85 {
86 #ifdef CONFIG_MTD_PARTITIONS
87 adm5120_flash0_data.nr_parts = ARRAY_SIZE(wp54g_wrt_partitions);
88 adm5120_flash0_data.parts = wp54g_wrt_partitions;
89 #endif
90
91 wp54_setup();
92 }
93
94 MIPS_MACHINE(MACH_ADM5120_WP54G_WRT, "Compex WP54G-WRT", wp54_wrt_setup);
This page took 0.040599 seconds and 3 git commands to generate.