ar71xx: remove more unnecessary includes
[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/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 "devices.h"
19 #include "dev-m25p80.h"
20 #include "dev-ar913x-wmac.h"
21 #include "dev-gpio-buttons.h"
22 #include "dev-leds-gpio.h"
23
24 #define AP81_GPIO_LED_STATUS 1
25 #define AP81_GPIO_LED_AOSS 3
26 #define AP81_GPIO_LED_WLAN 6
27 #define AP81_GPIO_LED_POWER 14
28
29 #define AP81_GPIO_BTN_SW4 12
30 #define AP81_GPIO_BTN_SW1 21
31
32 #define AP81_BUTTONS_POLL_INTERVAL 20
33
34 #ifdef CONFIG_MTD_PARTITIONS
35 static struct mtd_partition ap81_partitions[] = {
36 {
37 .name = "u-boot",
38 .offset = 0,
39 .size = 0x040000,
40 .mask_flags = MTD_WRITEABLE,
41 } , {
42 .name = "u-boot-env",
43 .offset = 0x040000,
44 .size = 0x010000,
45 } , {
46 .name = "rootfs",
47 .offset = 0x050000,
48 .size = 0x500000,
49 } , {
50 .name = "uImage",
51 .offset = 0x550000,
52 .size = 0x100000,
53 } , {
54 .name = "ART",
55 .offset = 0x650000,
56 .size = 0x1b0000,
57 .mask_flags = MTD_WRITEABLE,
58 }
59 };
60 #endif /* CONFIG_MTD_PARTITIONS */
61
62 static struct flash_platform_data ap81_flash_data = {
63 #ifdef CONFIG_MTD_PARTITIONS
64 .parts = ap81_partitions,
65 .nr_parts = ARRAY_SIZE(ap81_partitions),
66 #endif
67 };
68
69 static struct gpio_led ap81_leds_gpio[] __initdata = {
70 {
71 .name = "ap81:green:status",
72 .gpio = AP81_GPIO_LED_STATUS,
73 .active_low = 1,
74 }, {
75 .name = "ap81:amber:aoss",
76 .gpio = AP81_GPIO_LED_AOSS,
77 .active_low = 1,
78 }, {
79 .name = "ap81:green:wlan",
80 .gpio = AP81_GPIO_LED_WLAN,
81 .active_low = 1,
82 }, {
83 .name = "ap81:green:power",
84 .gpio = AP81_GPIO_LED_POWER,
85 .active_low = 1,
86 }
87 };
88
89 static struct gpio_button ap81_gpio_buttons[] __initdata = {
90 {
91 .desc = "sw1",
92 .type = EV_KEY,
93 .code = BTN_0,
94 .threshold = 5,
95 .gpio = AP81_GPIO_BTN_SW1,
96 .active_low = 1,
97 } , {
98 .desc = "sw4",
99 .type = EV_KEY,
100 .code = BTN_1,
101 .threshold = 5,
102 .gpio = AP81_GPIO_BTN_SW4,
103 .active_low = 1,
104 }
105 };
106
107 static void __init ap81_setup(void)
108 {
109 u8 *mac = (u8 *) KSEG1ADDR(0x1fff1000);
110
111 ar71xx_set_mac_base(mac);
112 ar71xx_add_device_mdio(0x0);
113
114 ar71xx_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_RMII;
115 ar71xx_eth0_data.phy_mask = 0xf;
116 ar71xx_eth0_data.speed = SPEED_100;
117 ar71xx_eth0_data.duplex = DUPLEX_FULL;
118 ar71xx_eth0_data.has_ar8216 = 1;
119
120 ar71xx_eth1_data.phy_if_mode = PHY_INTERFACE_MODE_RMII;
121 ar71xx_eth1_data.phy_mask = 0x10;
122
123 ar71xx_add_device_eth(0);
124 ar71xx_add_device_eth(1);
125
126 ar71xx_add_device_usb();
127
128 ar71xx_add_device_m25p80(&ap81_flash_data);
129
130 ar71xx_add_device_leds_gpio(-1, ARRAY_SIZE(ap81_leds_gpio),
131 ap81_leds_gpio);
132
133 ar71xx_add_device_gpio_buttons(-1, AP81_BUTTONS_POLL_INTERVAL,
134 ARRAY_SIZE(ap81_gpio_buttons),
135 ap81_gpio_buttons);
136
137 ar913x_add_device_wmac();
138 }
139
140 MIPS_MACHINE(AR71XX_MACH_AP81, "Atheros AP81", ap81_setup);