69c92e641eed602ef97509e1f4eb32894c6f2668
[openwrt/svn-archive/archive.git] / target / linux / ifxmips / files-2.6.33 / arch / mips / ifxmips / danube / mach-arv4525.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.h>
13 #include <ifxmips_prom.h>
14
15 #include "arcaydian.h"
16 #include "devices.h"
17
18 #define ARV452_EBU_GPIO_START 0x14000000
19 #define ARV452_EBU_GPIO_SIZE 0x00001000
20
21 #define ARV452_GPIO_BUTTON_RESET 14
22 #define ARV452_BUTTONS_POLL_INTERVAL 20
23
24 #define ARV452_LATCH_SWITCH (1 << 10)
25
26 #ifdef CONFIG_MTD_PARTITIONS
27 static struct mtd_partition arv4525_partitions[] =
28 {
29 {
30 .name = "uboot",
31 .offset = 0x0,
32 .size = 0x20000,
33 },
34 {
35 .name = "uboot_env",
36 .offset = 0x20000,
37 .size = 0x0,
38 },
39 {
40 .name = "kernel",
41 .offset = 0x0,
42 .size = 0x0,
43 },
44 {
45 .name = "rootfs",
46 .offset = 0x0,
47 .size = 0x0,
48 },
49 {
50 .name = "board_config",
51 .offset = 0x3f0000,
52 .size = 0x10000,
53 },
54 {
55 .name = "openwrt",
56 .offset = 0x0,
57 .size = 0x0,
58 },
59 };
60 #endif
61
62 static struct physmap_flash_data arv4525_flash_data = {
63 #ifdef CONFIG_MTD_PARTITIONS
64 .nr_parts = ARRAY_SIZE(arv4525_partitions),
65 .parts = arv4525_partitions,
66 #endif
67 };
68
69 static struct gpio_led
70 arv4525_leds_gpio[] __initdata = {
71 { .name = "ifx:blue:power", .gpio = 3, .active_low = 1, },
72 { .name = "ifx:blue:adsl", .gpio = 4, .active_low = 1, },
73 { .name = "ifx:blue:internet", .gpio = 5, .active_low = 1, },
74 { .name = "ifx:red:power", .gpio = 6, .active_low = 1, },
75 { .name = "ifx:yello:wps", .gpio = 7, .active_low = 1, },
76 { .name = "ifx:red:wps", .gpio = 9, .active_low = 1, },
77 { .name = "ifx:blue:voip", .gpio = 32, .active_low = 1, },
78 { .name = "ifx:blue:fxs1", .gpio = 33, .active_low = 1, },
79 { .name = "ifx:blue:fxs2", .gpio = 34, .active_low = 1, },
80 { .name = "ifx:blue:fxo", .gpio = 35, .active_low = 1, },
81 { .name = "ifx:blue:voice", .gpio = 36, .active_low = 1, },
82 { .name = "ifx:blue:usb", .gpio = 37, .active_low = 1, },
83 { .name = "ifx:blue:wlan", .gpio = 38, .active_low = 1, },
84 };
85
86 static struct gpio_button
87 arv4525_gpio_buttons[] __initdata = {
88 {
89 .desc = "reset",
90 .type = EV_KEY,
91 .code = BTN_0,
92 .threshold = 3,
93 .gpio = ARV452_GPIO_BUTTON_RESET,
94 .active_low = 1,
95 }
96 };
97
98 static struct resource arv4525_ebu_resource =
99 {
100 .name = "ebu-gpio",
101 .start = ARV452_EBU_GPIO_START,
102 .end = ARV452_EBU_GPIO_START + ARV452_EBU_GPIO_SIZE - 1,
103 .flags = IORESOURCE_MEM,
104 };
105
106 static void __init
107 arv4525_init(void)
108 {
109 unsigned char mac[6] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff};
110
111 ifxmix_detect_brn_block();
112
113 ifxmips_find_brn_mac(mac);
114
115 ifxmips_register_gpio();
116
117 danube_register_ebu_gpio(&arv4525_ebu_resource, ARV452_LATCH_SWITCH);
118
119 ifxmips_register_mtd(&arv4525_flash_data);
120
121 danube_register_pci(PCI_CLOCK_INT, 0);
122
123 ifxmips_register_wdt();
124
125 ifxmips_register_gpio_leds(arv4525_leds_gpio, ARRAY_SIZE(arv4525_leds_gpio));
126
127 danube_register_ethernet(mac, MII_MODE);
128
129 danube_register_usb();
130 }
131
132 MIPS_MACHINE(IFXMIPS_MACH_ARV4525,
133 "ARV4525",
134 "Speedport W502V",
135 arv4525_init);