| 1 | /* |
|---|
| 2 | * This program is free software; you can redistribute it and/or modify it |
|---|
| 3 | * under the terms of the GNU General Public License version 2 as published |
|---|
| 4 | * by the Free Software Foundation. |
|---|
| 5 | * |
|---|
| 6 | * Copyright (C) 2010 John Crispin <blogic@openwrt.org> |
|---|
| 7 | */ |
|---|
| 8 | |
|---|
| 9 | #include <linux/init.h> |
|---|
| 10 | #include <linux/platform_device.h> |
|---|
| 11 | #include <linux/leds.h> |
|---|
| 12 | #include <linux/gpio.h> |
|---|
| 13 | #include <linux/gpio_buttons.h> |
|---|
| 14 | #include <linux/mtd/mtd.h> |
|---|
| 15 | #include <linux/mtd/partitions.h> |
|---|
| 16 | #include <linux/mtd/physmap.h> |
|---|
| 17 | #include <linux/input.h> |
|---|
| 18 | #include <linux/etherdevice.h> |
|---|
| 19 | #include <linux/ath5k_platform.h> |
|---|
| 20 | #include <linux/pci.h> |
|---|
| 21 | |
|---|
| 22 | #include <lantiq_soc.h> |
|---|
| 23 | #include <lantiq_platform.h> |
|---|
| 24 | #include <dev-gpio-leds.h> |
|---|
| 25 | #include <dev-gpio-buttons.h> |
|---|
| 26 | |
|---|
| 27 | #include "../machtypes.h" |
|---|
| 28 | //#include "dev-wifi-rt2x00.h" |
|---|
| 29 | #include "dev-wifi-ath5k.h" |
|---|
| 30 | #include "devices.h" |
|---|
| 31 | #include "dev-dwc_otg.h" |
|---|
| 32 | |
|---|
| 33 | static struct mtd_partition arv4510_partitions[] = |
|---|
| 34 | { |
|---|
| 35 | { |
|---|
| 36 | .name = "uboot", |
|---|
| 37 | .offset = 0x0, |
|---|
| 38 | .size = 0x20000, |
|---|
| 39 | }, |
|---|
| 40 | { |
|---|
| 41 | .name = "uboot_env", |
|---|
| 42 | .offset = 0x20000, |
|---|
| 43 | .size = 0x120000, |
|---|
| 44 | }, |
|---|
| 45 | { |
|---|
| 46 | .name = "linux", |
|---|
| 47 | .offset = 0x40000, |
|---|
| 48 | .size = 0xfa0000, |
|---|
| 49 | }, |
|---|
| 50 | { |
|---|
| 51 | .name = "board_config", |
|---|
| 52 | .offset = 0xfe0000, |
|---|
| 53 | .size = 0x20000, |
|---|
| 54 | }, |
|---|
| 55 | }; |
|---|
| 56 | |
|---|
| 57 | static struct mtd_partition arv45xx_partitions[] = |
|---|
| 58 | { |
|---|
| 59 | { |
|---|
| 60 | .name = "uboot", |
|---|
| 61 | .offset = 0x0, |
|---|
| 62 | .size = 0x20000, |
|---|
| 63 | }, |
|---|
| 64 | { |
|---|
| 65 | .name = "uboot_env", |
|---|
| 66 | .offset = 0x20000, |
|---|
| 67 | .size = 0x10000, |
|---|
| 68 | }, |
|---|
| 69 | { |
|---|
| 70 | .name = "linux", |
|---|
| 71 | .offset = 0x30000, |
|---|
| 72 | .size = 0x3c0000, |
|---|
| 73 | }, |
|---|
| 74 | { |
|---|
| 75 | .name = "board_config", |
|---|
| 76 | .offset = 0x3f0000, |
|---|
| 77 | .size = 0x10000, |
|---|
| 78 | }, |
|---|
| 79 | }; |
|---|
| 80 | |
|---|
| 81 | static struct mtd_partition arv7525_partitions[] = |
|---|
| 82 | { |
|---|
| 83 | { |
|---|
| 84 | .name = "uboot", |
|---|
| 85 | .offset = 0x0, |
|---|
| 86 | .size = 0x10000, |
|---|
| 87 | }, |
|---|
| 88 | { |
|---|
| 89 | .name = "uboot_env", |
|---|
| 90 | .offset = 0x10000, |
|---|
| 91 | .size = 0x10000, |
|---|
| 92 | }, |
|---|
| 93 | { |
|---|
| 94 | .name = "linux", |
|---|
| 95 | .offset = 0x20000, |
|---|
| 96 | .size = 0x3d0000, |
|---|
| 97 | }, |
|---|
| 98 | { |
|---|
| 99 | .name = "board_config", |
|---|
| 100 | .offset = 0x3f0000, |
|---|
| 101 | .size = 0x10000, |
|---|
| 102 | }, |
|---|
| 103 | }; |
|---|
| 104 | |
|---|
| 105 | static struct mtd_partition arv75xx_partitions[] = |
|---|
| 106 | { |
|---|
| 107 | { |
|---|
| 108 | .name = "uboot", |
|---|
| 109 | .offset = 0x0, |
|---|
| 110 | .size = 0x10000, |
|---|
| 111 | }, |
|---|
| 112 | { |
|---|
| 113 | .name = "uboot_env", |
|---|
| 114 | .offset = 0x10000, |
|---|
| 115 | .size = 0x10000, |
|---|
| 116 | }, |
|---|
| 117 | { |
|---|
| 118 | .name = "linux", |
|---|
| 119 | .offset = 0x20000, |
|---|
| 120 | .size = 0x7d0000, |
|---|
| 121 | }, |
|---|
| 122 | { |
|---|
| 123 | .name = "board_config", |
|---|
| 124 | .offset = 0x7f0000, |
|---|
| 125 | .size = 0x10000, |
|---|
| 126 | }, |
|---|
| 127 | }; |
|---|
| 128 | |
|---|
| 129 | static struct physmap_flash_data arv4510_flash_data = { |
|---|
| 130 | .nr_parts = ARRAY_SIZE(arv4510_partitions), |
|---|
| 131 | .parts = arv4510_partitions, |
|---|
| 132 | }; |
|---|
| 133 | |
|---|
| 134 | static struct physmap_flash_data arv45xx_flash_data = { |
|---|
| 135 | .nr_parts = ARRAY_SIZE(arv45xx_partitions), |
|---|
| 136 | .parts = arv45xx_partitions, |
|---|
| 137 | }; |
|---|
| 138 | |
|---|
| 139 | static struct physmap_flash_data arv7525_flash_data = { |
|---|
| 140 | .nr_parts = ARRAY_SIZE(arv7525_partitions), |
|---|
| 141 | .parts = arv7525_partitions, |
|---|
| 142 | }; |
|---|
| 143 | |
|---|
| 144 | static struct physmap_flash_data arv75xx_flash_data = { |
|---|
| 145 | .nr_parts = ARRAY_SIZE(arv75xx_partitions), |
|---|
| 146 | .parts = arv75xx_partitions, |
|---|
| 147 | }; |
|---|
| 148 | |
|---|
| 149 | static struct ltq_pci_data ltq_pci_data = { |
|---|
| 150 | .clock = PCI_CLOCK_EXT, |
|---|
| 151 | .gpio = PCI_GNT1 | PCI_REQ1, |
|---|
| 152 | .irq = { |
|---|
| 153 | [14] = INT_NUM_IM0_IRL0 + 22, |
|---|
| 154 | }, |
|---|
| 155 | }; |
|---|
| 156 | |
|---|
| 157 | static struct ltq_eth_data ltq_eth_data = { |
|---|
| 158 | .mii_mode = PHY_INTERFACE_MODE_RMII, |
|---|
| 159 | }; |
|---|
| 160 | |
|---|
| 161 | static struct gpio_led |
|---|
| 162 | arv4510pw_gpio_leds[] __initdata = { |
|---|
| 163 | { .name = "soc:green:foo", .gpio = 4, .active_low = 1, }, |
|---|
| 164 | }; |
|---|
| 165 | |
|---|
| 166 | static struct gpio_led |
|---|
| 167 | arv4518pw_gpio_leds[] __initdata = { |
|---|
| 168 | { .name = "soc:green:power", .gpio = 3, .active_low = 1, .default_trigger = "default-on" }, |
|---|
| 169 | { .name = "soc:green:adsl", .gpio = 4, .active_low = 1, .default_trigger = "default-on" }, |
|---|
| 170 | { .name = "soc:green:internet", .gpio = 5, .active_low = 1, .default_trigger = "default-on" }, |
|---|
| 171 | { .name = "soc:green:wifi", .gpio = 6, .active_low = 1, .default_trigger = "default-on" }, |
|---|
| 172 | { .name = "soc:yellow:wps", .gpio = 7, .active_low = 1, .default_trigger = "default-on" }, |
|---|
| 173 | { .name = "soc:red:fail", .gpio = 8, .active_low = 1, .default_trigger = "default-on" }, |
|---|
| 174 | { .name = "soc:green:usb", .gpio = 19, .active_low = 1, .default_trigger = "default-on" }, |
|---|
| 175 | { .name = "soc:green:voip", .gpio = 100, .active_low = 1, .default_trigger = "default-on" }, |
|---|
| 176 | { .name = "soc:green:fxs1", .gpio = 101, .active_low = 1, .default_trigger = "default-on" }, |
|---|
| 177 | { .name = "soc:green:fxs2", .gpio = 102, .active_low = 1, .default_trigger = "default-on" }, |
|---|
| 178 | { .name = "soc:green:fxo", .gpio = 103, .active_low = 1, .default_trigger = "default-on" }, |
|---|
| 179 | }; |
|---|
| 180 | |
|---|
| 181 | static struct gpio_keys_button |
|---|
| 182 | arv4518pw_gpio_keys[] __initdata = { |
|---|
| 183 | { |
|---|
| 184 | .desc = "wifi", |
|---|
| 185 | .type = EV_KEY, |
|---|
| 186 | .code = BTN_0, |
|---|
| 187 | .debounce_interval = LTQ_KEYS_DEBOUNCE_INTERVAL, |
|---|
| 188 | .gpio = 28, |
|---|
| 189 | .active_low = 1, |
|---|
| 190 | }, |
|---|
| 191 | { |
|---|
| 192 | .desc = "reset", |
|---|
| 193 | .type = EV_KEY, |
|---|
| 194 | .code = BTN_1, |
|---|
| 195 | .debounce_interval = LTQ_KEYS_DEBOUNCE_INTERVAL, |
|---|
| 196 | .gpio = 30, |
|---|
| 197 | .active_low = 1, |
|---|
| 198 | }, |
|---|
| 199 | { |
|---|
| 200 | .desc = "wps", |
|---|
| 201 | .type = EV_KEY, |
|---|
| 202 | .code = BTN_2, |
|---|
| 203 | .debounce_interval = LTQ_KEYS_DEBOUNCE_INTERVAL, |
|---|
| 204 | .gpio = 29, |
|---|
| 205 | .active_low = 1, |
|---|
| 206 | }, |
|---|
| 207 | }; |
|---|
| 208 | |
|---|
| 209 | static struct gpio_led |
|---|
| 210 | arv4520pw_gpio_leds[] __initdata = { |
|---|
| 211 | { .name = "soc:blue:power", .gpio = 3, .active_low = 1, }, |
|---|
| 212 | { .name = "soc:blue:adsl", .gpio = 4, .active_low = 1, }, |
|---|
| 213 | { .name = "soc:blue:internet", .gpio = 5, .active_low = 1, }, |
|---|
| 214 | { .name = "soc:red:power", .gpio = 6, .active_low = 1, }, |
|---|
| 215 | { .name = "soc:yellow:wps", .gpio = 7, .active_low = 1, }, |
|---|
| 216 | { .name = "soc:red:wps", .gpio = 9, .active_low = 1, }, |
|---|
| 217 | { .name = "soc:blue:voip", .gpio = 100, .active_low = 1, }, |
|---|
| 218 | { .name = "soc:blue:fxs1", .gpio = 101, .active_low = 1, }, |
|---|
| 219 | { .name = "soc:blue:fxs2", .gpio = 102, .active_low = 1, }, |
|---|
| 220 | { .name = "soc:blue:fxo", .gpio = 103, .active_low = 1, }, |
|---|
| 221 | { .name = "soc:blue:voice", .gpio = 104, .active_low = 1, }, |
|---|
| 222 | { .name = "soc:blue:usb", .gpio = 105, .active_low = 1, }, |
|---|
| 223 | { .name = "soc:blue:wifi", .gpio = 106, .active_low = 1, }, |
|---|
| 224 | }; |
|---|
| 225 | |
|---|
| 226 | static struct gpio_led |
|---|
| 227 | arv452cpw_gpio_leds[] __initdata = { |
|---|
| 228 | { .name = "soc:blue:power", .gpio = 3, .active_low = 1, .default_trigger = "default-on" }, |
|---|
| 229 | { .name = "soc:blue:adsl", .gpio = 4, .active_low = 1, .default_trigger = "default-on" }, |
|---|
| 230 | { .name = "soc:blue:isdn", .gpio = 5, .active_low = 1, .default_trigger = "default-on" }, |
|---|
| 231 | { .name = "soc:red:power", .gpio = 6, .active_low = 1, .default_trigger = "default-on" }, |
|---|
| 232 | { .name = "soc:yellow:wps", .gpio = 7, .active_low = 1, .default_trigger = "default-on" }, |
|---|
| 233 | { .name = "soc:red:wps", .gpio = 9, .active_low = 1, .default_trigger = "default-on" }, |
|---|
| 234 | { .name = "soc:blue:fxs1", .gpio = 100, .active_low = 1, .default_trigger = "default-on" }, |
|---|
| 235 | { .name = "soc:blue:fxs2", .gpio = 101, .active_low = 1, .default_trigger = "default-on" }, |
|---|
| 236 | { .name = "soc:blue:wps", .gpio = 102, .active_low = 1, .default_trigger = "default-on" }, |
|---|
| 237 | { .name = "soc:blue:fxo", .gpio = 103, .active_low = 1, .default_trigger = "default-on" }, |
|---|
| 238 | { .name = "soc:blue:voice", .gpio = 104, .active_low = 1, .default_trigger = "default-on" }, |
|---|
| 239 | { .name = "soc:blue:usb", .gpio = 105, .active_low = 1, .default_trigger = "default-on" }, |
|---|
| 240 | { .name = "soc:blue:wifi", .gpio = 106, .active_low = 1, .default_trigger = "default-on" }, |
|---|
| 241 | { .name = "soc:blue:internet", .gpio = 108, .active_low = 1, .default_trigger = "default-on" }, |
|---|
| 242 | { .name = "soc:red:internet", .gpio = 109, .active_low = 1, .default_trigger = "default-on" }, |
|---|
| 243 | }; |
|---|
| 244 | |
|---|
| 245 | static struct gpio_led |
|---|
| 246 | arv4525pw_gpio_leds[] __initdata = { |
|---|
| 247 | { .name = "soc:green:fxs1", .gpio = 4, .active_low = 1, .default_trigger = "default-on" }, |
|---|
| 248 | { .name = "soc:green:fxs2", .gpio = 5, .active_low = 1, .default_trigger = "default-on" }, |
|---|
| 249 | { .name = "soc:red:dsl", .gpio = 6, .active_low = 1, .default_trigger = "default-on" }, |
|---|
| 250 | { .name = "soc:green:wifi", .gpio = 8, .active_low = 1, .default_trigger = "default-on" }, |
|---|
| 251 | { .name = "soc:green:online", .gpio = 9, .active_low = 1, .default_trigger = "default-on" }, |
|---|
| 252 | }; |
|---|
| 253 | |
|---|
| 254 | static struct gpio_led |
|---|
| 255 | arv752dpw22_gpio_leds[] __initdata = { |
|---|
| 256 | { .name = "soc:blue:power", .gpio = 3, .active_low = 1, .default_trigger = "default-on" }, |
|---|
| 257 | { .name = "soc:red:internet", .gpio = 5, .active_low = 1, .default_trigger = "default-on" }, |
|---|
| 258 | { .name = "soc:red:power", .gpio = 6, .active_low = 1, .default_trigger = "default-on" }, |
|---|
| 259 | { .name = "soc:red:wps", .gpio = 8, .active_low = 1, .default_trigger = "default-on" }, |
|---|
| 260 | { .name = "soc:red:fxo", .gpio = 103, .active_low = 1, .default_trigger = "default-on" }, |
|---|
| 261 | { .name = "soc:red:voice", .gpio = 104, .active_low = 1, .default_trigger = "default-on" }, |
|---|
| 262 | { .name = "soc:green:usb", .gpio = 105, .active_low = 1, .default_trigger = "default-on" }, |
|---|
| 263 | { .name = "soc:green:wifi", .gpio = 106, .active_low = 1, .default_trigger = "default-on" }, |
|---|
| 264 | { .name = "soc:green:wifi1", .gpio = 107, .active_low = 1, .default_trigger = "default-on" }, |
|---|
| 265 | { .name = "soc:blue:wifi", .gpio = 108, .active_low = 1, .default_trigger = "default-on" }, |
|---|
| 266 | { .name = "soc:blue:wifi1", .gpio = 109, .active_low = 1, .default_trigger = "default-on" }, |
|---|
| 267 | { .name = "soc:green:eth1", .gpio = 111, .active_low = 1, .default_trigger = "default-on" }, |
|---|
| 268 | { .name = "soc:green:eth2", .gpio = 112, .active_low = 1, .default_trigger = "default-on" }, |
|---|
| 269 | { .name = "soc:green:eth3", .gpio = 113, .active_low = 1, .default_trigger = "default-on" }, |
|---|
| 270 | { .name = "soc:green:eth4", .gpio = 114, .active_low = 1, .default_trigger = "default-on", }, |
|---|
| 271 | }; |
|---|
| 272 | |
|---|
| 273 | static struct gpio_keys_button |
|---|
| 274 | arv752dpw22_gpio_keys[] __initdata = { |
|---|
| 275 | { |
|---|
| 276 | .desc = "btn0", |
|---|
| 277 | .type = EV_KEY, |
|---|
| 278 | .code = BTN_0, |
|---|
| 279 | .debounce_interval = LTQ_KEYS_DEBOUNCE_INTERVAL, |
|---|
| 280 | .gpio = 12, |
|---|
| 281 | .active_low = 1, |
|---|
| 282 | }, |
|---|
| 283 | { |
|---|
| 284 | .desc = "btn1", |
|---|
| 285 | .type = EV_KEY, |
|---|
| 286 | .code = BTN_1, |
|---|
| 287 | .debounce_interval = LTQ_KEYS_DEBOUNCE_INTERVAL, |
|---|
| 288 | .gpio = 13, |
|---|
| 289 | .active_low = 1, |
|---|
| 290 | }, |
|---|
| 291 | { |
|---|
| 292 | .desc = "btn2", |
|---|
| 293 | .type = EV_KEY, |
|---|
| 294 | .code = BTN_2, |
|---|
| 295 | .debounce_interval = LTQ_KEYS_DEBOUNCE_INTERVAL, |
|---|
| 296 | .gpio = 28, |
|---|
| 297 | .active_low = 1, |
|---|
| 298 | }, |
|---|
| 299 | }; |
|---|
| 300 | |
|---|
| 301 | static struct gpio_led |
|---|
| 302 | arv7518pw_gpio_leds[] __initdata = { |
|---|
| 303 | { .name = "soc:green:power", .gpio = 2, .active_low = 1, }, |
|---|
| 304 | { .name = "soc:green:adsl", .gpio = 4, .active_low = 1, }, |
|---|
| 305 | { .name = "soc:green:internet", .gpio = 5, .active_low = 1, }, |
|---|
| 306 | { .name = "soc:green:wifi", .gpio = 6, .active_low = 1, }, |
|---|
| 307 | { .name = "soc:red:internet", .gpio = 8, .active_low = 1, }, |
|---|
| 308 | { .name = "soc:green:usb", .gpio = 19, .active_low = 1, }, |
|---|
| 309 | }; |
|---|
| 310 | |
|---|
| 311 | static struct gpio_keys_button |
|---|
| 312 | arv7518pw_gpio_keys[] __initdata = { |
|---|
| 313 | { |
|---|
| 314 | .desc = "reset", |
|---|
| 315 | .type = EV_KEY, |
|---|
| 316 | .code = BTN_0, |
|---|
| 317 | .debounce_interval = LTQ_KEYS_DEBOUNCE_INTERVAL, |
|---|
| 318 | .gpio = 23, |
|---|
| 319 | .active_low = 1, |
|---|
| 320 | }, |
|---|
| 321 | { |
|---|
| 322 | .desc = "wifi", |
|---|
| 323 | .type = EV_KEY, |
|---|
| 324 | .code = BTN_1, |
|---|
| 325 | .debounce_interval = LTQ_KEYS_DEBOUNCE_INTERVAL, |
|---|
| 326 | .gpio = 25, |
|---|
| 327 | .active_low = 1, |
|---|
| 328 | }, |
|---|
| 329 | }; |
|---|
| 330 | |
|---|
| 331 | static struct gpio_keys_button |
|---|
| 332 | arv7525pw_gpio_keys[] __initdata = { |
|---|
| 333 | { |
|---|
| 334 | .desc = "restart", |
|---|
| 335 | .type = EV_KEY, |
|---|
| 336 | .code = BTN_0, |
|---|
| 337 | .debounce_interval = LTQ_KEYS_DEBOUNCE_INTERVAL, |
|---|
| 338 | .gpio = 29, |
|---|
| 339 | .active_low = 1, |
|---|
| 340 | }, |
|---|
| 341 | }; |
|---|
| 342 | |
|---|
| 343 | static void |
|---|
| 344 | arv45xx_register_ethernet(void) |
|---|
| 345 | { |
|---|
| 346 | #define ARV45XX_BRN_MAC 0x3f0016 |
|---|
| 347 | memcpy_fromio(<q_eth_data.mac.sa_data, |
|---|
| 348 | (void *)KSEG1ADDR(LTQ_FLASH_START + ARV45XX_BRN_MAC), 6); |
|---|
| 349 | ltq_register_etop(<q_eth_data); |
|---|
| 350 | } |
|---|
| 351 | |
|---|
| 352 | static void |
|---|
| 353 | arv75xx_register_ethernet(void) |
|---|
| 354 | { |
|---|
| 355 | #define ARV75XX_BRN_MAC 0x7f0016 |
|---|
| 356 | memcpy_fromio(<q_eth_data.mac.sa_data, |
|---|
| 357 | (void *)KSEG1ADDR(LTQ_FLASH_START + ARV75XX_BRN_MAC), 6); |
|---|
| 358 | ltq_register_etop(<q_eth_data); |
|---|
| 359 | } |
|---|
| 360 | |
|---|
| 361 | static void |
|---|
| 362 | bewan_register_ethernet(void) |
|---|
| 363 | { |
|---|
| 364 | #define BEWAN_BRN_MAC 0x3f0014 |
|---|
| 365 | memcpy_fromio(<q_eth_data.mac.sa_data, |
|---|
| 366 | (void *)KSEG1ADDR(LTQ_FLASH_START + BEWAN_BRN_MAC), 6); |
|---|
| 367 | ltq_register_etop(<q_eth_data); |
|---|
| 368 | } |
|---|
| 369 | |
|---|
| 370 | static u16 arv45xx_ath5k_eeprom_data[ATH5K_PLAT_EEP_MAX_WORDS]; |
|---|
| 371 | static u8 arv45xx_ath5k_eeprom_mac[6]; |
|---|
| 372 | |
|---|
| 373 | void __init |
|---|
| 374 | arv45xx_register_ath5k(void) |
|---|
| 375 | { |
|---|
| 376 | #define ARV45XX_BRN_ATH 0x3f0478 |
|---|
| 377 | int i; |
|---|
| 378 | static u16 eeprom_data[ATH5K_PLAT_EEP_MAX_WORDS]; |
|---|
| 379 | u32 *p = (u32*)arv45xx_ath5k_eeprom_data; |
|---|
| 380 | |
|---|
| 381 | memcpy_fromio(arv45xx_ath5k_eeprom_mac, |
|---|
| 382 | (void *)KSEG1ADDR(LTQ_FLASH_START + ARV45XX_BRN_MAC), 6); |
|---|
| 383 | arv45xx_ath5k_eeprom_mac[5]++; |
|---|
| 384 | memcpy_fromio(arv45xx_ath5k_eeprom_data, |
|---|
| 385 | (void *)KSEG1ADDR(LTQ_FLASH_START + ARV45XX_BRN_ATH), ATH5K_PLAT_EEP_MAX_WORDS); |
|---|
| 386 | // swap eeprom bytes |
|---|
| 387 | for (i = 0; i < ATH5K_PLAT_EEP_MAX_WORDS>>1; i++){ |
|---|
| 388 | //arv4518_ath5k_eeprom_data[i] = ((eeprom_data[i]&0xff)<<8)|((eeprom_data[i]&0xff00)>>8); |
|---|
| 389 | p[i] = ((eeprom_data[(i<<1)+1]&0xff)<<24)|((eeprom_data[(i<<1)+1]&0xff00)<<8)|((eeprom_data[i<<1]&0xff)<<8)|((eeprom_data[i<<1]&0xff00)>>8); |
|---|
| 390 | if (i == 0xbf>>1){ |
|---|
| 391 | // printk ("regdomain: 0x%x --> 0x%x\n", p[i], (p[i] & 0xffff0000)|0x67); |
|---|
| 392 | /* regdomain is invalid?? how did original fw convert |
|---|
| 393 | * value to 0x82d4 ?? |
|---|
| 394 | * for now, force to 0x67 */ |
|---|
| 395 | p[i] &= 0xffff0000; |
|---|
| 396 | p[i] |= 0x67; |
|---|
| 397 | } |
|---|
| 398 | } |
|---|
| 399 | } |
|---|
| 400 | |
|---|
| 401 | static void __init |
|---|
| 402 | arv3527p_init(void) |
|---|
| 403 | { |
|---|
| 404 | ltq_register_gpio_stp(); |
|---|
| 405 | //ltq_add_device_gpio_leds(arv3527p_gpio_leds, ARRAY_SIZE(arv3527p_gpio_leds)); |
|---|
| 406 | ltq_register_nor(&arv45xx_flash_data); |
|---|
| 407 | arv45xx_register_ethernet(); |
|---|
| 408 | } |
|---|
| 409 | |
|---|
| 410 | MIPS_MACHINE(LANTIQ_MACH_ARV3527P, |
|---|
| 411 | "ARV3527P", |
|---|
| 412 | "ARV3527P - Arcor Easybox 401", |
|---|
| 413 | arv3527p_init); |
|---|
| 414 | |
|---|
| 415 | static void __init |
|---|
| 416 | arv4510pw_init(void) |
|---|
| 417 | { |
|---|
| 418 | ltq_register_gpio_stp(); |
|---|
| 419 | ltq_add_device_gpio_leds(-1, ARRAY_SIZE(arv4510pw_gpio_leds), arv4510pw_gpio_leds); |
|---|
| 420 | ltq_register_nor(&arv4510_flash_data); |
|---|
| 421 | ltq_pci_data.irq[12] = (INT_NUM_IM2_IRL0 + 31); |
|---|
| 422 | ltq_pci_data.irq[15] = (INT_NUM_IM0_IRL0 + 26); |
|---|
| 423 | ltq_pci_data.gpio |= PCI_EXIN2 | PCI_REQ2; |
|---|
| 424 | ltq_register_pci(<q_pci_data); |
|---|
| 425 | bewan_register_ethernet(); |
|---|
| 426 | } |
|---|
| 427 | |
|---|
| 428 | MIPS_MACHINE(LANTIQ_MACH_ARV4510PW, |
|---|
| 429 | "ARV4510PW", |
|---|
| 430 | "ARV4510PW - Wippies Homebox", |
|---|
| 431 | arv4510pw_init); |
|---|
| 432 | |
|---|
| 433 | static void __init |
|---|
| 434 | arv4518pw_init(void) |
|---|
| 435 | { |
|---|
| 436 | #define ARV4518PW_EBU 0 |
|---|
| 437 | #define ARV4518PW_USB 14 |
|---|
| 438 | #define ARV4518PW_SWITCH_RESET 13 |
|---|
| 439 | #define ARV4518PW_MADWIFI_ADDR 0xb07f0400 |
|---|
| 440 | |
|---|
| 441 | ltq_register_gpio_ebu(ARV4518PW_EBU); |
|---|
| 442 | ltq_add_device_gpio_leds(-1, ARRAY_SIZE(arv4518pw_gpio_leds), arv4518pw_gpio_leds); |
|---|
| 443 | ltq_register_gpio_keys_polled(-1, LTQ_KEYS_POLL_INTERVAL, |
|---|
| 444 | ARRAY_SIZE(arv4518pw_gpio_keys), arv4518pw_gpio_keys); |
|---|
| 445 | ltq_register_nor(&arv45xx_flash_data); |
|---|
| 446 | ltq_pci_data.gpio = PCI_GNT2 | PCI_REQ2; |
|---|
| 447 | ltq_register_pci(<q_pci_data); |
|---|
| 448 | ltq_register_madwifi_eep((void*)ARV4518PW_MADWIFI_ADDR); |
|---|
| 449 | ltq_register_ath5k(arv45xx_ath5k_eeprom_data, arv45xx_ath5k_eeprom_mac); |
|---|
| 450 | xway_register_dwc(ARV4518PW_USB); |
|---|
| 451 | arv45xx_register_ethernet(); |
|---|
| 452 | |
|---|
| 453 | gpio_request(ARV4518PW_SWITCH_RESET, "switch"); |
|---|
| 454 | gpio_direction_output(ARV4518PW_SWITCH_RESET, 1); |
|---|
| 455 | gpio_export(ARV4518PW_SWITCH_RESET, 0); |
|---|
| 456 | } |
|---|
| 457 | |
|---|
| 458 | MIPS_MACHINE(LANTIQ_MACH_ARV4518PW, |
|---|
| 459 | "ARV4518PW", |
|---|
| 460 | "ARV4518PW - SMC7908A-ISP, Airties WAV-221", |
|---|
| 461 | arv4518pw_init); |
|---|
| 462 | |
|---|
| 463 | static void __init |
|---|
| 464 | arv4520pw_init(void) |
|---|
| 465 | { |
|---|
| 466 | #define ARV4520PW_EBU 0x400 |
|---|
| 467 | #define ARV4520PW_USB 28 |
|---|
| 468 | #define ARV4520PW_SWITCH_RESET 110 |
|---|
| 469 | |
|---|
| 470 | ltq_register_gpio_ebu(ARV4520PW_EBU); |
|---|
| 471 | ltq_add_device_gpio_leds(-1, ARRAY_SIZE(arv4520pw_gpio_leds), arv4520pw_gpio_leds); |
|---|
| 472 | ltq_register_nor(&arv45xx_flash_data); |
|---|
| 473 | ltq_register_pci(<q_pci_data); |
|---|
| 474 | ltq_register_tapi(); |
|---|
| 475 | arv45xx_register_ethernet(); |
|---|
| 476 | xway_register_dwc(ARV4520PW_USB); |
|---|
| 477 | |
|---|
| 478 | gpio_request(ARV4520PW_SWITCH_RESET, "switch"); |
|---|
| 479 | gpio_set_value(ARV4520PW_SWITCH_RESET, 1); |
|---|
| 480 | } |
|---|
| 481 | |
|---|
| 482 | MIPS_MACHINE(LANTIQ_MACH_ARV4520PW, |
|---|
| 483 | "ARV4520PW", |
|---|
| 484 | "ARV4520PW - Airties WAV-281, Arcor A800", |
|---|
| 485 | arv4520pw_init); |
|---|
| 486 | |
|---|
| 487 | static void __init |
|---|
| 488 | arv452Cpw_init(void) |
|---|
| 489 | { |
|---|
| 490 | #define ARV452CPW_EBU 0x77f |
|---|
| 491 | #define ARV452CPW_USB 28 |
|---|
| 492 | #define ARV452CPW_RELAY1 31 |
|---|
| 493 | #define ARV452CPW_RELAY2 107 |
|---|
| 494 | #define ARV452CPW_SWITCH_RESET 110 |
|---|
| 495 | #define ARV452CPW_MADWIFI_ADDR 0xb07f0400 |
|---|
| 496 | |
|---|
| 497 | ltq_register_gpio_ebu(ARV452CPW_EBU); |
|---|
| 498 | ltq_add_device_gpio_leds(-1, ARRAY_SIZE(arv452cpw_gpio_leds), arv452cpw_gpio_leds); |
|---|
| 499 | ltq_register_nor(&arv45xx_flash_data); |
|---|
| 500 | ltq_register_pci(<q_pci_data); |
|---|
| 501 | ltq_register_madwifi_eep((void*)ARV452CPW_MADWIFI_ADDR); |
|---|
| 502 | xway_register_dwc(ARV452CPW_USB); |
|---|
| 503 | arv45xx_register_ethernet(); |
|---|
| 504 | arv45xx_register_ath5k(); |
|---|
| 505 | |
|---|
| 506 | gpio_request(ARV452CPW_SWITCH_RESET, "switch"); |
|---|
| 507 | gpio_set_value(ARV452CPW_SWITCH_RESET, 1); |
|---|
| 508 | gpio_export(ARV452CPW_SWITCH_RESET, 0); |
|---|
| 509 | |
|---|
| 510 | gpio_request(ARV452CPW_RELAY1, "relay1"); |
|---|
| 511 | gpio_direction_output(ARV452CPW_RELAY1, 1); |
|---|
| 512 | gpio_export(ARV452CPW_RELAY1, 0); |
|---|
| 513 | |
|---|
| 514 | gpio_request(ARV452CPW_RELAY2, "relay2"); |
|---|
| 515 | gpio_set_value(ARV452CPW_RELAY2, 1); |
|---|
| 516 | gpio_export(ARV452CPW_RELAY2, 0); |
|---|
| 517 | } |
|---|
| 518 | |
|---|
| 519 | MIPS_MACHINE(LANTIQ_MACH_ARV452CPW, |
|---|
| 520 | "ARV452CPW", |
|---|
| 521 | "ARV452CPW - Arcor A801", |
|---|
| 522 | arv452Cpw_init); |
|---|
| 523 | |
|---|
| 524 | |
|---|
| 525 | static void __init |
|---|
| 526 | arv4525pw_init(void) |
|---|
| 527 | { |
|---|
| 528 | #define ARV4525PW_MADWIFI_ADDR 0xb07f0400 |
|---|
| 529 | ltq_add_device_gpio_leds(-1, ARRAY_SIZE(arv4525pw_gpio_leds), arv4525pw_gpio_leds); |
|---|
| 530 | ltq_register_nor(&arv45xx_flash_data); |
|---|
| 531 | ltq_pci_data.clock = PCI_CLOCK_INT; |
|---|
| 532 | ltq_register_pci(<q_pci_data); |
|---|
| 533 | ltq_register_madwifi_eep((void*)ARV4525PW_MADWIFI_ADDR); |
|---|
| 534 | ltq_eth_data.mii_mode = PHY_INTERFACE_MODE_MII; |
|---|
| 535 | arv45xx_register_ethernet(); |
|---|
| 536 | } |
|---|
| 537 | |
|---|
| 538 | MIPS_MACHINE(LANTIQ_MACH_ARV4525PW, |
|---|
| 539 | "ARV4525PW", |
|---|
| 540 | "ARV4525PW - Speedport W502V", |
|---|
| 541 | arv4525pw_init); |
|---|
| 542 | |
|---|
| 543 | static void __init |
|---|
| 544 | arv7525pw_init(void) |
|---|
| 545 | { |
|---|
| 546 | ltq_add_device_gpio_leds(-1, ARRAY_SIZE(arv4525pw_gpio_leds), arv4525pw_gpio_leds); |
|---|
| 547 | ltq_register_nor(&arv7525_flash_data); |
|---|
| 548 | ltq_register_gpio_keys_polled(-1, LTQ_KEYS_POLL_INTERVAL, |
|---|
| 549 | ARRAY_SIZE(arv7525pw_gpio_keys), arv7525pw_gpio_keys); |
|---|
| 550 | ltq_pci_data.clock = PCI_CLOCK_INT; |
|---|
| 551 | ltq_pci_data.gpio = PCI_GNT1 | PCI_EXIN1; |
|---|
| 552 | ltq_pci_data.irq[14] = (INT_NUM_IM3_IRL0 + 31); |
|---|
| 553 | ltq_register_pci(<q_pci_data); |
|---|
| 554 | ltq_eth_data.mii_mode = PHY_INTERFACE_MODE_MII; |
|---|
| 555 | // ltq_register_rt2x00("RT2860.eeprom"); |
|---|
| 556 | ltq_register_tapi(); |
|---|
| 557 | arv45xx_register_ethernet(); |
|---|
| 558 | } |
|---|
| 559 | |
|---|
| 560 | MIPS_MACHINE(LANTIQ_MACH_ARV7525PW, |
|---|
| 561 | "ARV7525PW", |
|---|
| 562 | "ARV7525PW - Speedport W303V", |
|---|
| 563 | arv7525pw_init); |
|---|
| 564 | |
|---|
| 565 | static void __init |
|---|
| 566 | arv7518pw_init(void) |
|---|
| 567 | { |
|---|
| 568 | #define ARV7518PW_EBU 0x2 |
|---|
| 569 | #define ARV7518PW_USB 14 |
|---|
| 570 | |
|---|
| 571 | ltq_register_gpio_ebu(ARV7518PW_EBU); |
|---|
| 572 | ltq_add_device_gpio_leds(-1, ARRAY_SIZE(arv7518pw_gpio_leds), arv7518pw_gpio_leds); |
|---|
| 573 | ltq_register_gpio_keys_polled(-1, LTQ_KEYS_POLL_INTERVAL, |
|---|
| 574 | ARRAY_SIZE(arv7518pw_gpio_keys), arv7518pw_gpio_keys); |
|---|
| 575 | ltq_register_nor(&arv75xx_flash_data); |
|---|
| 576 | ltq_register_pci(<q_pci_data); |
|---|
| 577 | ltq_register_tapi(); |
|---|
| 578 | xway_register_dwc(ARV7518PW_USB); |
|---|
| 579 | arv75xx_register_ethernet(); |
|---|
| 580 | //arv7518_register_ath9k(mac); |
|---|
| 581 | } |
|---|
| 582 | |
|---|
| 583 | MIPS_MACHINE(LANTIQ_MACH_ARV7518PW, |
|---|
| 584 | "ARV7518PW", |
|---|
| 585 | "ARV7518PW - ASTORIA", |
|---|
| 586 | arv7518pw_init); |
|---|
| 587 | |
|---|
| 588 | static void __init |
|---|
| 589 | arv752dpw22_init(void) |
|---|
| 590 | { |
|---|
| 591 | #define ARV752DPW22_EBU 0x2 |
|---|
| 592 | #define ARV752DPW22_USB 100 |
|---|
| 593 | #define ARV752DPW22_RELAY 101 |
|---|
| 594 | |
|---|
| 595 | ltq_register_gpio_ebu(ARV752DPW22_EBU); |
|---|
| 596 | ltq_add_device_gpio_leds(-1, ARRAY_SIZE(arv752dpw22_gpio_leds), arv752dpw22_gpio_leds); |
|---|
| 597 | ltq_register_gpio_keys_polled(-1, LTQ_KEYS_POLL_INTERVAL, |
|---|
| 598 | ARRAY_SIZE(arv752dpw22_gpio_keys), arv752dpw22_gpio_keys); |
|---|
| 599 | ltq_register_nor(&arv75xx_flash_data); |
|---|
| 600 | ltq_pci_data.irq[15] = (INT_NUM_IM3_IRL0 + 31); |
|---|
| 601 | ltq_pci_data.gpio |= PCI_EXIN1 | PCI_REQ2; |
|---|
| 602 | ltq_register_pci(<q_pci_data); |
|---|
| 603 | xway_register_dwc(ARV752DPW22_USB); |
|---|
| 604 | arv75xx_register_ethernet(); |
|---|
| 605 | |
|---|
| 606 | gpio_request(ARV752DPW22_RELAY, "relay"); |
|---|
| 607 | gpio_set_value(ARV752DPW22_RELAY, 1); |
|---|
| 608 | gpio_export(ARV752DPW22_RELAY, 0); |
|---|
| 609 | } |
|---|
| 610 | |
|---|
| 611 | MIPS_MACHINE(LANTIQ_MACH_ARV752DPW22, |
|---|
| 612 | "ARV752DPW22", |
|---|
| 613 | "ARV752DPW22 - Arcor A803", |
|---|
| 614 | arv752dpw22_init); |
|---|