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