2e406c90ae99dba93e63b7e612d70b14744e4a10
[openwrt/openwrt.git] / target / linux / ifxmips / files-2.6.33 / arch / mips / ifxmips / danube / mach-arv452.c
1 #include <linux/init.h>
2 #include <linux/platform_device.h>
3 #include <linux/leds.h>
4 #include <linux/gpio.h>
5 #include <linux/gpio_buttons.h>
6 #include <linux/mtd/mtd.h>
7 #include <linux/mtd/partitions.h>
8 #include <linux/mtd/physmap.h>
9 #include <linux/input.h>
10
11 #include <machine.h>
12 #include <ifxmips_prom.h>
13
14 #include "arcaydian.h"
15 #include "devices.h"
16
17 #define ARV452_EBU_GPIO_START 0x14000000
18 #define ARV452_EBU_GPIO_SIZE 0x00001000
19
20 #define ARV452_GPIO_BUTTON_RESET 14
21 #define ARV452_BUTTONS_POLL_INTERVAL 20
22
23 #define ARV452_LATCH_SWITCH (1 << 10)
24
25 #ifdef CONFIG_MTD_PARTITIONS
26 static struct mtd_partition arv452_partitions[] =
27 {
28 {
29 .name = "uboot",
30 .offset = 0x0,
31 .size = 0x20000,
32 },
33 {
34 .name = "uboot_env",
35 .offset = 0x20000,
36 .size = 0x0,
37 },
38 {
39 .name = "kernel",
40 .offset = 0x0,
41 .size = 0x0,
42 },
43 {
44 .name = "rootfs",
45 .offset = 0x0,
46 .size = 0x0,
47 },
48 {
49 .name = "board_config",
50 .offset = 0x3f0000,
51 .size = 0x10000,
52 },
53 {
54 .name = "openwrt",
55 .offset = 0x0,
56 .size = 0x0,
57 },
58 };
59 #endif
60
61 static struct physmap_flash_data arv452_flash_data = {
62 #ifdef CONFIG_MTD_PARTITIONS
63 .nr_parts = ARRAY_SIZE(arv452_partitions),
64 .parts = arv452_partitions,
65 #endif
66 };
67
68 static struct gpio_led
69 arv452_leds_gpio[] __initdata = {
70 /*
71 { .name = "ifx0", .gpio = 0, .active_low = 1, },
72 { .name = "ifx1", .gpio = 1, .active_low = 1, },
73 { .name = "ifx2", .gpio = 2, .active_low = 1, },
74 */
75 { .name = "ifx:blue:power", .gpio = 3, .active_low = 1, },
76 { .name = "ifx:blue:adsl", .gpio = 4, .active_low = 1, },
77 { .name = "ifx:blue:internet", .gpio = 5, .active_low = 1, },
78 { .name = "ifx:red:power", .gpio = 6, .active_low = 1, },
79 { .name = "ifx:yello:wps", .gpio = 7, .active_low = 1, },
80 { .name = "ifx:red:wps", .gpio = 9, .active_low = 1, },
81 /*
82 { .name = "ifx10", .gpio = 10, .active_low = 1, },
83 { .name = "ifx11", .gpio = 11, .active_low = 1, },
84 { .name = "ifx12", .gpio = 12, .active_low = 1, },
85 { .name = "ifx13", .gpio = 13, .active_low = 1, },
86 { .name = "ifx14", .gpio = 14, .active_low = 1, },
87 { .name = "ifx15", .gpio = 15, .active_low = 1, },
88 { .name = "ifx16", .gpio = 16, .active_low = 1, },
89 { .name = "ifx17", .gpio = 17, .active_low = 1, },
90 { .name = "ifx18", .gpio = 18, .active_low = 1, },
91 { .name = "ifx19", .gpio = 19, .active_low = 1, },
92 { .name = "ifx20", .gpio = 20, .active_low = 1, },
93 { .name = "ifx21", .gpio = 21, .active_low = 1, },
94 { .name = "ifx22", .gpio = 22, .active_low = 1, },
95 { .name = "ifx23", .gpio = 23, .active_low = 1, },
96 { .name = "ifx24", .gpio = 24, .active_low = 1, },
97 { .name = "ifx25", .gpio = 25, .active_low = 1, },
98 { .name = "ifx26", .gpio = 26, .active_low = 1, },
99 { .name = "ifx27", .gpio = 27, .active_low = 1, },
100 { .name = "ifx28", .gpio = 28, .active_low = 1, },
101 { .name = "ifx29", .gpio = 29, .active_low = 1, },
102 { .name = "ifx30", .gpio = 30, .active_low = 1, },
103 { .name = "ifx31", .gpio = 31, .active_low = 1, },
104 */
105 { .name = "ifx:blue:voip", .gpio = 32, .active_low = 1, },
106 { .name = "ifx:blue:fxs1", .gpio = 33, .active_low = 1, },
107 { .name = "ifx:blue:fxs2", .gpio = 34, .active_low = 1, },
108 { .name = "ifx:blue:fxo", .gpio = 35, .active_low = 1, },
109 { .name = "ifx:blue:voice", .gpio = 36, .active_low = 1, },
110 { .name = "ifx:blue:usb", .gpio = 37, .active_low = 1, },
111 { .name = "ifx:blue:wlan", .gpio = 38, .active_low = 1, },
112 /* { .name = "ifx39", .gpio = 39, .active_low = 1, },
113 { .name = "ifx40", .gpio = 40, .active_low = 1, },
114 { .name = "ifx41", .gpio = 41, .active_low = 1, },
115 { .name = "ifx42", .gpio = 42, .active_low = 1, },
116 { .name = "ifx43", .gpio = 43, .active_low = 1, },
117 { .name = "ifx44", .gpio = 44, .active_low = 1, },
118 { .name = "ifx45", .gpio = 45, .active_low = 1, },
119 { .name = "ifx46", .gpio = 46, .active_low = 1, },
120 { .name = "ifx47", .gpio = 47, .active_low = 1, },
121 */
122 };
123
124 static struct gpio_button
125 arv452_gpio_buttons[] __initdata = {
126 {
127 .desc = "reset",
128 .type = EV_KEY,
129 .code = BTN_0,
130 .threshold = 3,
131 .gpio = ARV452_GPIO_BUTTON_RESET,
132 .active_low = 1,
133 }
134 };
135
136 static struct resource arv452_ebu_resource =
137 {
138 .name = "ebu-gpio",
139 .start = ARV452_EBU_GPIO_START,
140 .end = ARV452_EBU_GPIO_START + ARV452_EBU_GPIO_SIZE - 1,
141 .flags = IORESOURCE_MEM,
142 };
143
144 static void __init
145 arv452_init(void)
146 {
147 unsigned char mac[6] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff};
148 ifxmips_find_brn_mac(mac);
149
150 ifxmips_register_gpio();
151
152 danube_register_ebu_gpio(&arv452_ebu_resource, ARV452_LATCH_SWITCH);
153
154 ifxmips_register_mtd(&arv452_flash_data);
155
156 danube_register_pci(PCI_CLOCK_EXT, 0);
157
158 ifxmips_register_wdt();
159
160 ifxmips_register_gpio_leds(arv452_leds_gpio, ARRAY_SIZE(arv452_leds_gpio));
161
162 danube_register_ethernet(mac);
163
164 danube_register_usb();
165 }
166
167 MIPS_MACHINE(IFXMIPS_MACH_ARV452,
168 "ARV452",
169 "Airties WAV-281, Arcor A800",
170 arv452_init);