ar71xx: add preliminary support for the Atheros AR933x SoCs
[openwrt/svn-archive/archive.git] / target / linux / ar71xx / files / 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 <linux/mtd/mtd.h>
13 #include <linux/mtd/partitions.h>
14
15 #include <asm/mips_machine.h>
16 #include <asm/mach-ar71xx/ar71xx.h>
17
18 #include "machtype.h"
19 #include "devices.h"
20 #include "dev-m25p80.h"
21 #include "dev-gpio-buttons.h"
22 #include "dev-pb42-pci.h"
23 #include "dev-leds-gpio.h"
24
25 #define AW_NR580_GPIO_LED_READY_RED 0
26 #define AW_NR580_GPIO_LED_WLAN 1
27 #define AW_NR580_GPIO_LED_READY_GREEN 2
28 #define AW_NR580_GPIO_LED_WPS_GREEN 4
29 #define AW_NR580_GPIO_LED_WPS_AMBER 5
30
31 #define AW_NR580_GPIO_BTN_WPS 3
32 #define AW_NR580_GPIO_BTN_RESET 11
33
34 #define AW_NR580_KEYS_POLL_INTERVAL 20 /* msecs */
35 #define AW_NR580_KEYS_DEBOUNCE_INTERVAL (3 * AW_NR580_KEYS_POLL_INTERVAL)
36
37 static struct gpio_led aw_nr580_leds_gpio[] __initdata = {
38 {
39 .name = "aw-nr580:red:ready",
40 .gpio = AW_NR580_GPIO_LED_READY_RED,
41 .active_low = 0,
42 }, {
43 .name = "aw-nr580:green:ready",
44 .gpio = AW_NR580_GPIO_LED_READY_GREEN,
45 .active_low = 0,
46 }, {
47 .name = "aw-nr580:green:wps",
48 .gpio = AW_NR580_GPIO_LED_WPS_GREEN,
49 .active_low = 0,
50 }, {
51 .name = "aw-nr580:amber:wps",
52 .gpio = AW_NR580_GPIO_LED_WPS_AMBER,
53 .active_low = 0,
54 }, {
55 .name = "aw-nr580:green:wlan",
56 .gpio = AW_NR580_GPIO_LED_WLAN,
57 .active_low = 0,
58 }
59 };
60
61 static struct gpio_keys_button aw_nr580_gpio_keys[] __initdata = {
62 {
63 .desc = "reset",
64 .type = EV_KEY,
65 .code = KEY_RESTART,
66 .debounce_interval = AW_NR580_KEYS_DEBOUNCE_INTERVAL,
67 .gpio = AW_NR580_GPIO_BTN_RESET,
68 .active_low = 1,
69 }, {
70 .desc = "wps",
71 .type = EV_KEY,
72 .code = KEY_WPS_BUTTON,
73 .debounce_interval = AW_NR580_KEYS_DEBOUNCE_INTERVAL,
74 .gpio = AW_NR580_GPIO_BTN_WPS,
75 .active_low = 1,
76 }
77 };
78
79 static void __init aw_nr580_setup(void)
80 {
81 ar71xx_add_device_mdio(0x0);
82
83 ar71xx_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_MII;
84 ar71xx_eth0_data.speed = SPEED_100;
85 ar71xx_eth0_data.duplex = DUPLEX_FULL;
86
87 ar71xx_add_device_eth(0);
88
89 pb42_pci_init();
90
91 ar71xx_add_device_m25p80(NULL);
92
93 ar71xx_add_device_leds_gpio(-1, ARRAY_SIZE(aw_nr580_leds_gpio),
94 aw_nr580_leds_gpio);
95
96 ar71xx_register_gpio_keys_polled(-1, AW_NR580_KEYS_POLL_INTERVAL,
97 ARRAY_SIZE(aw_nr580_gpio_keys),
98 aw_nr580_gpio_keys);
99 }
100
101 MIPS_MACHINE(AR71XX_MACH_AW_NR580, "AW-NR580", "AzureWave AW-NR580",
102 aw_nr580_setup);