ar71xx: move arch specific files to files-2.6.39
[openwrt/svn-archive/archive.git] / target / linux / ar71xx / files-2.6.39 / arch / mips / ar71xx / mach-aw-nr580.c
1 /*
2 * AzureWave AW-NR580 board support
3 *
4 * Copyright (C) 2008-2009 Gabor Juhos <juhosg@openwrt.org>
5 * Copyright (C) 2008 Imre Kaloz <kaloz@openwrt.org>
6 *
7 * This program is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License version 2 as published
9 * by the Free Software Foundation.
10 */
11
12 #include <asm/mips_machine.h>
13 #include <asm/mach-ar71xx/ar71xx.h>
14
15 #include "machtype.h"
16 #include "devices.h"
17 #include "dev-m25p80.h"
18 #include "dev-gpio-buttons.h"
19 #include "dev-pb42-pci.h"
20 #include "dev-leds-gpio.h"
21
22 #define AW_NR580_GPIO_LED_READY_RED 0
23 #define AW_NR580_GPIO_LED_WLAN 1
24 #define AW_NR580_GPIO_LED_READY_GREEN 2
25 #define AW_NR580_GPIO_LED_WPS_GREEN 4
26 #define AW_NR580_GPIO_LED_WPS_AMBER 5
27
28 #define AW_NR580_GPIO_BTN_WPS 3
29 #define AW_NR580_GPIO_BTN_RESET 11
30
31 #define AW_NR580_KEYS_POLL_INTERVAL 20 /* msecs */
32 #define AW_NR580_KEYS_DEBOUNCE_INTERVAL (3 * AW_NR580_KEYS_POLL_INTERVAL)
33
34 static struct gpio_led aw_nr580_leds_gpio[] __initdata = {
35 {
36 .name = "aw-nr580:red:ready",
37 .gpio = AW_NR580_GPIO_LED_READY_RED,
38 .active_low = 0,
39 }, {
40 .name = "aw-nr580:green:ready",
41 .gpio = AW_NR580_GPIO_LED_READY_GREEN,
42 .active_low = 0,
43 }, {
44 .name = "aw-nr580:green:wps",
45 .gpio = AW_NR580_GPIO_LED_WPS_GREEN,
46 .active_low = 0,
47 }, {
48 .name = "aw-nr580:amber:wps",
49 .gpio = AW_NR580_GPIO_LED_WPS_AMBER,
50 .active_low = 0,
51 }, {
52 .name = "aw-nr580:green:wlan",
53 .gpio = AW_NR580_GPIO_LED_WLAN,
54 .active_low = 0,
55 }
56 };
57
58 static struct gpio_keys_button aw_nr580_gpio_keys[] __initdata = {
59 {
60 .desc = "reset",
61 .type = EV_KEY,
62 .code = KEY_RESTART,
63 .debounce_interval = AW_NR580_KEYS_DEBOUNCE_INTERVAL,
64 .gpio = AW_NR580_GPIO_BTN_RESET,
65 .active_low = 1,
66 }, {
67 .desc = "wps",
68 .type = EV_KEY,
69 .code = KEY_WPS_BUTTON,
70 .debounce_interval = AW_NR580_KEYS_DEBOUNCE_INTERVAL,
71 .gpio = AW_NR580_GPIO_BTN_WPS,
72 .active_low = 1,
73 }
74 };
75
76 static const char *aw_nr580_part_probes[] = {
77 "RedBoot",
78 NULL,
79 };
80
81 static struct flash_platform_data aw_nr580_flash_data = {
82 .part_probes = aw_nr580_part_probes,
83 };
84
85 static void __init aw_nr580_setup(void)
86 {
87 ar71xx_add_device_mdio(0, 0x0);
88
89 ar71xx_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_MII;
90 ar71xx_eth0_data.speed = SPEED_100;
91 ar71xx_eth0_data.duplex = DUPLEX_FULL;
92
93 ar71xx_add_device_eth(0);
94
95 pb42_pci_init();
96
97 ar71xx_add_device_m25p80(&aw_nr580_flash_data);
98
99 ar71xx_add_device_leds_gpio(-1, ARRAY_SIZE(aw_nr580_leds_gpio),
100 aw_nr580_leds_gpio);
101
102 ar71xx_register_gpio_keys_polled(-1, AW_NR580_KEYS_POLL_INTERVAL,
103 ARRAY_SIZE(aw_nr580_gpio_keys),
104 aw_nr580_gpio_keys);
105 }
106
107 MIPS_MACHINE(AR71XX_MACH_AW_NR580, "AW-NR580", "AzureWave AW-NR580",
108 aw_nr580_setup);