5a48dffa4d1d7c6e0ca6c239fe99cd9367164730
[openwrt/svn-archive/archive.git] / target / linux / ar71xx / files / arch / mips / ar71xx / mach-ap81.c
1 /*
2 * Atheros AP81 board support
3 *
4 * Copyright (C) 2009 Gabor Juhos <juhosg@openwrt.org>
5 * Copyright (C) 2009 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/input.h>
13
14 #include <asm/mips_machine.h>
15 #include <asm/mach-ar71xx/ar71xx.h>
16
17 #include "devices.h"
18
19 #define AP81_GPIO_BTN_SW4 12
20 #define AP81_GPIO_BTN_SW1 21
21
22 #define AP81_BUTTONS_POLL_INTERVAL 20
23
24 static struct gpio_button ap81_gpio_buttons[] __initdata = {
25 {
26 .desc = "sw1",
27 .type = EV_KEY,
28 .code = BTN_0,
29 .threshold = 5,
30 .gpio = AP81_GPIO_BTN_SW1,
31 .active_low = 1,
32 } , {
33 .desc = "sw4",
34 .type = EV_KEY,
35 .code = BTN_1,
36 .threshold = 5,
37 .gpio = AP81_GPIO_BTN_SW4,
38 .active_low = 1,
39 }
40 };
41
42 static void __init ap81_setup(void)
43 {
44 ar71xx_add_device_mdio(0x0);
45
46 ar71xx_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_RMII;
47 ar71xx_eth0_data.phy_mask = 0xf;
48 ar71xx_eth0_data.speed = SPEED_100;
49 ar71xx_eth0_data.duplex = DUPLEX_FULL;
50 ar71xx_eth0_data.has_ar8216 = 1;
51
52 ar71xx_eth1_data.phy_if_mode = PHY_INTERFACE_MODE_RMII;
53 ar71xx_eth1_data.phy_mask = 0x10;
54
55 ar71xx_add_device_eth(0);
56 ar71xx_add_device_eth(1);
57
58 ar71xx_add_device_usb();
59
60 ar71xx_add_device_gpio_buttons(-1, AP81_BUTTONS_POLL_INTERVAL,
61 ARRAY_SIZE(ap81_gpio_buttons),
62 ap81_gpio_buttons);
63
64 ar91xx_add_device_wmac();
65 }
66
67 MIPS_MACHINE(AR71XX_MACH_AP81, "Atheros AP81", ap81_setup);