[tools] autoconf: another relocatability fix for autom4te, substitute hardcoded prefi...
[openwrt.git] / target / linux / ar71xx / patches-3.2 / 603-MIPS-ath79-ap121-fixes.patch
1 --- a/arch/mips/ath79/mach-ap121.c
2 +++ b/arch/mips/ath79/mach-ap121.c
3 @@ -1,19 +1,23 @@
4 /*
5 * Atheros AP121 board support
6 *
7 - * Copyright (C) 2011 Gabor Juhos <juhosg@openwrt.org>
8 + * Copyright (C) 2011-2012 Gabor Juhos <juhosg@openwrt.org>
9 *
10 * This program is free software; you can redistribute it and/or modify it
11 * under the terms of the GNU General Public License version 2 as published
12 * by the Free Software Foundation.
13 */
14 +#include <linux/mtd/mtd.h>
15 +#include <linux/mtd/partitions.h>
16
17 -#include "machtypes.h"
18 +#include "dev-eth.h"
19 #include "dev-gpio-buttons.h"
20 #include "dev-leds-gpio.h"
21 +#include "dev-m25p80.h"
22 #include "dev-spi.h"
23 #include "dev-usb.h"
24 #include "dev-wmac.h"
25 +#include "machtypes.h"
26
27 #define AP121_GPIO_LED_WLAN 0
28 #define AP121_GPIO_LED_USB 1
29 @@ -24,7 +28,82 @@
30 #define AP121_KEYS_POLL_INTERVAL 20 /* msecs */
31 #define AP121_KEYS_DEBOUNCE_INTERVAL (3 * AP121_KEYS_POLL_INTERVAL)
32
33 -#define AP121_CAL_DATA_ADDR 0x1fff1000
34 +#define AP121_MAC0_OFFSET 0x0000
35 +#define AP121_MAC1_OFFSET 0x0006
36 +#define AP121_CALDATA_OFFSET 0x1000
37 +#define AP121_WMAC_MAC_OFFSET 0x1002
38 +
39 +#define AP121_MINI_GPIO_LED_WLAN 0
40 +#define AP121_MINI_GPIO_BTN_JUMPSTART 12
41 +#define AP121_MINI_GPIO_BTN_RESET 11
42 +
43 +static struct mtd_partition ap121_parts[] = {
44 + {
45 + .name = "u-boot",
46 + .offset = 0,
47 + .size = 0x010000,
48 + .mask_flags = MTD_WRITEABLE,
49 + },
50 + {
51 + .name = "rootfs",
52 + .offset = 0x010000,
53 + .size = 0x130000,
54 + },
55 + {
56 + .name = "uImage",
57 + .offset = 0x140000,
58 + .size = 0x0a0000,
59 + },
60 + {
61 + .name = "NVRAM",
62 + .offset = 0x1e0000,
63 + .size = 0x010000,
64 + },
65 + {
66 + .name = "ART",
67 + .offset = 0x1f0000,
68 + .size = 0x010000,
69 + .mask_flags = MTD_WRITEABLE,
70 + },
71 +};
72 +
73 +static struct mtd_partition ap121_mini_parts[] = {
74 + {
75 + .name = "u-boot",
76 + .offset = 0,
77 + .size = 0x040000,
78 + .mask_flags = MTD_WRITEABLE,
79 + },
80 + {
81 + .name = "u-boot-env",
82 + .offset = 0x040000,
83 + .size = 0x010000,
84 + .mask_flags = MTD_WRITEABLE,
85 + },
86 + {
87 + .name = "rootfs",
88 + .offset = 0x050000,
89 + .size = 0x2b0000,
90 + },
91 + {
92 + .name = "uImage",
93 + .offset = 0x300000,
94 + .size = 0x0e0000,
95 + },
96 + {
97 + .name = "NVRAM",
98 + .offset = 0x3e0000,
99 + .size = 0x010000,
100 + },
101 + {
102 + .name = "ART",
103 + .offset = 0x3f0000,
104 + .size = 0x010000,
105 + .mask_flags = MTD_WRITEABLE,
106 + },
107 +};
108 +
109 +static struct flash_platform_data ap121_flash_data;
110
111 static struct gpio_led ap121_leds_gpio[] __initdata = {
112 {
113 @@ -58,41 +137,84 @@ static struct gpio_keys_button ap121_gpi
114 }
115 };
116
117 -static struct ath79_spi_controller_data ap121_spi0_data = {
118 - .cs_type = ATH79_SPI_CS_TYPE_INTERNAL,
119 - .cs_line = 0,
120 +static struct gpio_led ap121_mini_leds_gpio[] __initdata = {
121 + {
122 + .name = "ap121:green:wlan",
123 + .gpio = AP121_MINI_GPIO_LED_WLAN,
124 + .active_low = 0,
125 + },
126 };
127
128 -static struct spi_board_info ap121_spi_info[] = {
129 - {
130 - .bus_num = 0,
131 - .chip_select = 0,
132 - .max_speed_hz = 25000000,
133 - .modalias = "mx25l1606e",
134 - .controller_data = &ap121_spi0_data,
135 +static struct gpio_keys_button ap121_mini_gpio_keys[] __initdata = {
136 + {
137 + .desc = "jumpstart button",
138 + .type = EV_KEY,
139 + .code = KEY_WPS_BUTTON,
140 + .debounce_interval = AP121_KEYS_DEBOUNCE_INTERVAL,
141 + .gpio = AP121_MINI_GPIO_BTN_JUMPSTART,
142 + .active_low = 1,
143 + },
144 + {
145 + .desc = "reset button",
146 + .type = EV_KEY,
147 + .code = KEY_RESTART,
148 + .debounce_interval = AP121_KEYS_DEBOUNCE_INTERVAL,
149 + .gpio = AP121_MINI_GPIO_BTN_RESET,
150 + .active_low = 1,
151 }
152 };
153
154 -static struct ath79_spi_platform_data ap121_spi_data = {
155 - .bus_num = 0,
156 - .num_chipselect = 1,
157 -};
158 +static void __init ap121_common_setup(void)
159 +{
160 + u8 *art = (u8 *) KSEG1ADDR(0x1fff0000);
161 +
162 + ath79_register_m25p80(&ap121_flash_data);
163 + ath79_register_wmac(art + AP121_CALDATA_OFFSET,
164 + art + AP121_WMAC_MAC_OFFSET);
165 +
166 + ath79_init_mac(ath79_eth0_data.mac_addr, art + AP121_MAC0_OFFSET, 0);
167 + ath79_init_mac(ath79_eth1_data.mac_addr, art + AP121_MAC1_OFFSET, 0);
168 +
169 + ath79_register_mdio(0, 0x0);
170 +
171 + /* LAN ports */
172 + ath79_register_eth(1);
173 +
174 + /* WAN port */
175 + ath79_register_eth(0);
176 +}
177
178 static void __init ap121_setup(void)
179 {
180 - u8 *cal_data = (u8 *) KSEG1ADDR(AP121_CAL_DATA_ADDR);
181 + ap121_flash_data.parts = ap121_parts;
182 + ap121_flash_data.nr_parts = ARRAY_SIZE(ap121_parts);
183 +
184 + ap121_common_setup();
185
186 ath79_register_leds_gpio(-1, ARRAY_SIZE(ap121_leds_gpio),
187 ap121_leds_gpio);
188 ath79_register_gpio_keys_polled(-1, AP121_KEYS_POLL_INTERVAL,
189 ARRAY_SIZE(ap121_gpio_keys),
190 ap121_gpio_keys);
191 -
192 - ath79_register_spi(&ap121_spi_data, ap121_spi_info,
193 - ARRAY_SIZE(ap121_spi_info));
194 ath79_register_usb();
195 - ath79_register_wmac(cal_data, NULL);
196 }
197
198 MIPS_MACHINE(ATH79_MACH_AP121, "AP121", "Atheros AP121 reference board",
199 ap121_setup);
200 +
201 +static void __init ap121_mini_setup(void)
202 +{
203 + ap121_flash_data.parts = ap121_mini_parts;
204 + ap121_flash_data.nr_parts = ARRAY_SIZE(ap121_mini_parts);
205 +
206 + ap121_common_setup();
207 +
208 + ath79_register_leds_gpio(-1, ARRAY_SIZE(ap121_mini_leds_gpio),
209 + ap121_mini_leds_gpio);
210 + ath79_register_gpio_keys_polled(-1, AP121_KEYS_POLL_INTERVAL,
211 + ARRAY_SIZE(ap121_mini_gpio_keys),
212 + ap121_mini_gpio_keys);
213 +}
214 +
215 +MIPS_MACHINE(ATH79_MACH_AP121_MINI, "AP121-MINI", "Atheros AP121-MINI",
216 + ap121_mini_setup);
217 --- a/arch/mips/ath79/Kconfig
218 +++ b/arch/mips/ath79/Kconfig
219 @@ -5,9 +5,10 @@ menu "Atheros AR71XX/AR724X/AR913X machi
220 config ATH79_MACH_AP121
221 bool "Atheros AP121 reference board"
222 select SOC_AR933X
223 + select ATH79_DEV_ETH
224 select ATH79_DEV_GPIO_BUTTONS
225 select ATH79_DEV_LEDS_GPIO
226 - select ATH79_DEV_SPI
227 + select ATH79_DEV_M25P80
228 select ATH79_DEV_USB
229 select ATH79_DEV_WMAC
230 help
231 --- a/arch/mips/ath79/machtypes.h
232 +++ b/arch/mips/ath79/machtypes.h
233 @@ -17,6 +17,7 @@
234 enum ath79_mach_type {
235 ATH79_MACH_GENERIC = 0,
236 ATH79_MACH_AP121, /* Atheros AP121 reference board */
237 + ATH79_MACH_AP121_MINI, /* Atheros AP121-MINI reference board */
238 ATH79_MACH_AP81, /* Atheros AP81 reference board */
239 ATH79_MACH_DB120, /* Atheros DB120 reference board */
240 ATH79_MACH_PB44, /* Atheros PB44 reference board */
This page took 0.052445 seconds and 5 git commands to generate.