d94c9580492753b8cd9892213c8d285cb73712d4
[openwrt/svn-archive/archive.git] / target / linux / ifxmips / files / arch / mips / ifxmips / danube / mach-arv45xx.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 #include <linux/etherdevice.h>
11
12 #include <machine.h>
13 #include <ifxmips.h>
14 #include <ifxmips_prom.h>
15
16 #include "arcaydian.h"
17 #include "devices.h"
18
19 #define ARV45XX_BRN 0x3f0000
20 #define ARV45XX_BRN_MAC 0x3f0016
21
22 #define ARV45XX_EBU_GPIO_START 0x14000000
23 #define ARV45XX_EBU_GPIO_SIZE 0x00001000
24
25 #define ARV4520_LATCH_SWITCH (1 << 10)
26
27 #ifdef CONFIG_MTD_PARTITIONS
28 static struct mtd_partition arv45xx_partitions[] =
29 {
30 {
31 .name = "uboot",
32 .offset = 0x0,
33 .size = 0x20000,
34 },
35 {
36 .name = "uboot_env",
37 .offset = 0x20000,
38 .size = 0x0,
39 },
40 {
41 .name = "kernel",
42 .offset = 0x0,
43 .size = 0x0,
44 },
45 {
46 .name = "rootfs",
47 .offset = 0x0,
48 .size = 0x0,
49 },
50 {
51 .name = "board_config",
52 .offset = 0x3f0000,
53 .size = 0x10000,
54 },
55 {
56 .name = "openwrt",
57 .offset = 0x0,
58 .size = 0x0,
59 },
60 };
61 #endif
62
63 static struct physmap_flash_data arv45xx_flash_data = {
64 #ifdef CONFIG_MTD_PARTITIONS
65 .nr_parts = ARRAY_SIZE(arv45xx_partitions),
66 .parts = arv45xx_partitions,
67 #endif
68 };
69
70 static struct gpio_led
71 arv4518_leds_gpio[] __initdata = {
72 { .name = "ifx:blue:power", .gpio = 3, .active_low = 1, },
73 { .name = "ifx:blue:adsl", .gpio = 4, .active_low = 1, },
74 { .name = "ifx:blue:internet", .gpio = 5, .active_low = 1, },
75 { .name = "ifx:red:power", .gpio = 6, .active_low = 1, },
76 { .name = "ifx:yello:wps", .gpio = 7, .active_low = 1, },
77 { .name = "ifx:red:wps", .gpio = 9, .active_low = 1, },
78 { .name = "ifx:blue:voip", .gpio = 32, .active_low = 1, },
79 { .name = "ifx:blue:fxs1", .gpio = 33, .active_low = 1, },
80 { .name = "ifx:blue:fxs2", .gpio = 34, .active_low = 1, },
81 { .name = "ifx:blue:fxo", .gpio = 35, .active_low = 1, },
82 { .name = "ifx:blue:voice", .gpio = 36, .active_low = 1, },
83 { .name = "ifx:blue:usb", .gpio = 37, .active_low = 1, },
84 { .name = "ifx:blue:wlan", .gpio = 38, .active_low = 1, },
85 };
86
87 static struct gpio_led
88 arv4520_leds_gpio[] __initdata = {
89 { .name = "ifx:blue:power", .gpio = 3, .active_low = 1, },
90 { .name = "ifx:blue:adsl", .gpio = 4, .active_low = 1, },
91 { .name = "ifx:blue:internet", .gpio = 5, .active_low = 1, },
92 { .name = "ifx:red:power", .gpio = 6, .active_low = 1, },
93 { .name = "ifx:yello:wps", .gpio = 7, .active_low = 1, },
94 { .name = "ifx:red:wps", .gpio = 9, .active_low = 1, },
95 { .name = "ifx:blue:voip", .gpio = 32, .active_low = 1, },
96 { .name = "ifx:blue:fxs1", .gpio = 33, .active_low = 1, },
97 { .name = "ifx:blue:fxs2", .gpio = 34, .active_low = 1, },
98 { .name = "ifx:blue:fxo", .gpio = 35, .active_low = 1, },
99 { .name = "ifx:blue:voice", .gpio = 36, .active_low = 1, },
100 { .name = "ifx:blue:usb", .gpio = 37, .active_low = 1, },
101 { .name = "ifx:blue:wlan", .gpio = 38, .active_low = 1, },
102 };
103
104 static struct gpio_led arv4525_leds_gpio[] __initdata = {
105 { .name = "ifx:green:festnetz", .gpio = 4, .active_low = 1, },
106 { .name = "ifx:green:internet", .gpio = 5, .active_low = 1, },
107 { .name = "ifx:green:dsl", .gpio = 6, .active_low = 1, },
108 { .name = "ifx:green:wlan", .gpio = 8, .active_low = 1, },
109 { .name = "ifx:green:online", .gpio = 9, .active_low = 1, },
110 };
111
112 static struct resource arv45xx_ebu_resource =
113 {
114 .name = "ebu-gpio",
115 .start = ARV45XX_EBU_GPIO_START,
116 .end = ARV45XX_EBU_GPIO_START + ARV45XX_EBU_GPIO_SIZE - 1,
117 .flags = IORESOURCE_MEM,
118 };
119
120 static void __init
121 arv4518_init(void)
122 {
123 static unsigned char mac[6];
124 if(!ifxmix_detect_brn_block(ARV45XX_BRN))
125 ifxmips_find_brn_mac(ARV45XX_BRN_MAC, mac);
126 else
127 random_ether_addr(mac);
128 ifxmips_register_gpio();
129 danube_register_ebu_gpio(&arv45xx_ebu_resource, ARV4520_LATCH_SWITCH);
130 ifxmips_register_mtd(&arv45xx_flash_data);
131 danube_register_pci(PCI_CLOCK_EXT, 0);
132 ifxmips_register_wdt();
133 ifxmips_register_gpio_leds(arv4518_leds_gpio, ARRAY_SIZE(arv4518_leds_gpio));
134 danube_register_ethernet(mac, REV_MII_MODE);
135 danube_register_tapi();
136 }
137
138 MIPS_MACHINE(IFXMIPS_MACH_ARV4518,
139 "ARV4518",
140 "ARV4518 - SMC7908A-ISP",
141 arv4518_init);
142
143 static void __init
144 arv4520_init(void)
145 {
146 static unsigned char mac[6];
147 if(!ifxmix_detect_brn_block(ARV45XX_BRN))
148 ifxmips_find_brn_mac(ARV45XX_BRN_MAC, mac);
149 else
150 random_ether_addr(mac);
151 ifxmips_register_gpio();
152 danube_register_ebu_gpio(&arv45xx_ebu_resource, ARV4520_LATCH_SWITCH);
153 ifxmips_register_mtd(&arv45xx_flash_data);
154 danube_register_pci(PCI_CLOCK_EXT, 0);
155 ifxmips_register_wdt();
156 ifxmips_register_gpio_leds(arv4520_leds_gpio, ARRAY_SIZE(arv4520_leds_gpio));
157 danube_register_ethernet(mac, REV_MII_MODE);
158 danube_register_tapi();
159 }
160
161 MIPS_MACHINE(IFXMIPS_MACH_ARV4520,
162 "ARV452",
163 "ARV4520 - Airties WAV-281, Arcor A800",
164 arv4520_init);
165
166 static void __init
167 arv4525_init(void)
168 {
169 static unsigned char mac[6];
170 if(!ifxmix_detect_brn_block(ARV45XX_BRN))
171 ifxmips_find_brn_mac(ARV45XX_BRN_MAC, mac);
172 else
173 random_ether_addr(mac);
174 ifxmips_register_gpio();
175 ifxmips_register_mtd(&arv45xx_flash_data);
176 danube_register_pci(PCI_CLOCK_INT, 0);
177 ifxmips_register_wdt();
178 ifxmips_register_gpio_leds(arv4525_leds_gpio, ARRAY_SIZE(arv4525_leds_gpio));
179 danube_register_ethernet(mac, MII_MODE);
180 danube_register_tapi();
181 }
182
183 MIPS_MACHINE(IFXMIPS_MACH_ARV4525,
184 "ARV4525",
185 "ARV4525 - Speedport W502V",
186 arv4525_init);