1 --- linux-3.1.arch-orig/arch/arm/mach-kirkwood/dns320l-setup.c 1970-01-01 01:00:00.000000000 +0100 |
|
2 +++ linux-3.1/arch/arm/mach-kirkwood/dns320l-setup.c 2013-09-02 23:49:04.481512328 +0200 |
|
3 @@ -0,0 +1,295 @@ |
|
4 +/* |
|
5 + * arch/arm/mach-kirkwood/dns320l-setup.c |
|
6 + * |
|
7 + * D-Link DNS-320L Setup File |
|
8 + * |
|
9 + * This file is licensed under the terms of the GNU General Public |
|
10 + * License version 2. This program is licensed "as is" without any |
|
11 + * warranty of any kind, whether express or implied. |
|
12 + */ |
|
13 + |
|
14 +#include <linux/kernel.h> |
|
15 +#include <linux/init.h> |
|
16 +#include <linux/platform_device.h> |
|
17 +#include <linux/ata_platform.h> |
|
18 +#include <linux/mtd/partitions.h> |
|
19 +#include <linux/mv643xx_eth.h> |
|
20 +#include <linux/gpio.h> |
|
21 +#include <linux/leds.h> |
|
22 +#include <asm/mach-types.h> |
|
23 +#include <asm/mach/arch.h> |
|
24 +#include <mach/kirkwood.h> |
|
25 +#include "common.h" |
|
26 +#include "mpp.h" |
|
27 +#include <linux/sysfs.h> |
|
28 +#include <linux/kobject.h> |
|
29 +#include <linux/mtd/nand.h> |
|
30 +#include <linux/i2c.h> |
|
31 +#include <linux/gpio_keys.h> |
|
32 +#include <linux/gpio-fan.h> |
|
33 +#include <linux/input.h> |
|
34 + |
|
35 +#define DNSKW_GPIO_LED_POWER 26 |
|
36 +#define DNSKW_GPIO_LED_RED_R 27 |
|
37 +#define DNSKW_GPIO_LED_RED_L 28 |
|
38 +#define DNS325_GPIO_LED_RED_USB 29 |
|
39 +#define DNS320_GPIO_LED_RED_USB 35 |
|
40 +#define DNSKW_GPIO_LED_WHITE_R 20 |
|
41 +#define DNSKW_GPIO_LED_WHITE_L 21 |
|
42 +#define DNSKW_GPIO_LED_WHITE_USB 43 |
|
43 +#define DNSKW_GPIO_FAN_ALARM 44 |
|
44 +#define DNSKW_GPIO_FAN_HIGH 45 |
|
45 +#define DNSKW_GPIO_FAN_LOW 46 |
|
46 +#define DNSKW_GPIO_BTN_POWER 34 |
|
47 +#define DNSKW_GPIO_BTN_UNMOUNT 47 |
|
48 +#define DNSKW_GPIO_BTN_RESET 48 |
|
49 +#define DNSKW_GPIO_POWER 36 |
|
50 +#define DNSKW_GPIO_POWER_RECOVER 37 |
|
51 +#define DNSKW_GPIO_POWER_SATA0 39 |
|
52 +#define DNSKW_GPIO_POWER_SATA1 40 |
|
53 + |
|
54 +static struct mtd_partition dns320l_nand_parts[] = { |
|
55 + { |
|
56 + .name = "u-boot", |
|
57 + .offset = 0, |
|
58 + .size = SZ_1M |
|
59 + }, { |
|
60 + .name = "uImage", |
|
61 + .offset = MTDPART_OFS_NXTBLK, |
|
62 + .size = 5 * SZ_1M |
|
63 + }, { |
|
64 + .name = "ramdisk", |
|
65 + .offset = MTDPART_OFS_NXTBLK, |
|
66 + .size = 5 * SZ_1M |
|
67 + }, { |
|
68 + .name = "image", |
|
69 + .offset = MTDPART_OFS_NXTBLK, |
|
70 + .size = 100 * SZ_1M |
|
71 + }, { |
|
72 + .name = "rescue firmware", |
|
73 + .offset = MTDPART_OFS_NXTBLK, |
|
74 + .size = 10 * SZ_1M |
|
75 + }, { |
|
76 + .name = "config", |
|
77 + .offset = MTDPART_OFS_NXTBLK, |
|
78 + .size = 5 * SZ_1M |
|
79 + }, { |
|
80 + .name = "my-dlink", |
|
81 + .offset = MTDPART_OFS_NXTBLK, |
|
82 + .size = 2 * SZ_1M |
|
83 + }, |
|
84 +}; |
|
85 + |
|
86 + |
|
87 +static struct mv643xx_eth_platform_data dns320l_ge00_data = { |
|
88 + .phy_addr = MV643XX_ETH_PHY_ADDR(0), |
|
89 +}; |
|
90 + |
|
91 +static struct mv_sata_platform_data dns320l_sata_data = { |
|
92 + .n_ports = 2, |
|
93 +}; |
|
94 + |
|
95 +static void __init dnskw_gpio_register(unsigned gpio, char *name, int def) |
|
96 +{ |
|
97 + if (gpio_request(gpio, name) == 0 && |
|
98 + gpio_direction_output(gpio, 0) == 0) { |
|
99 + gpio_set_value(gpio, def); |
|
100 + if (gpio_export(gpio, 0) != 0) |
|
101 + pr_err("dnskw: Failed to export GPIO %s\n", name); |
|
102 + } else |
|
103 + pr_err("dnskw: Failed to register %s\n", name); |
|
104 +} |
|
105 + |
|
106 +/***************************************************************************** |
|
107 + * Buttons |
|
108 + ****************************************************************************/ |
|
109 + |
|
110 +static struct gpio_keys_button dnskw_button_pins[] = { |
|
111 + { |
|
112 + .code = KEY_POWER, |
|
113 + .gpio = DNSKW_GPIO_BTN_POWER, |
|
114 + .desc = "Power button", |
|
115 + .active_low = 1, |
|
116 + }, |
|
117 + { |
|
118 + .code = KEY_EJECTCD, |
|
119 + .gpio = DNSKW_GPIO_BTN_UNMOUNT, |
|
120 + .desc = "USB unmount button", |
|
121 + .active_low = 1, |
|
122 + }, |
|
123 + { |
|
124 + .code = KEY_RESTART, |
|
125 + .gpio = DNSKW_GPIO_BTN_RESET, |
|
126 + .desc = "Reset button", |
|
127 + .active_low = 1, |
|
128 + }, |
|
129 +}; |
|
130 + |
|
131 +static struct gpio_keys_platform_data dnskw_button_data = { |
|
132 + .buttons = dnskw_button_pins, |
|
133 + .nbuttons = ARRAY_SIZE(dnskw_button_pins), |
|
134 +}; |
|
135 + |
|
136 +static struct platform_device dnskw_button_device = { |
|
137 + .name = "gpio-keys", |
|
138 + .id = -1, |
|
139 + .num_resources = 0, |
|
140 + .dev = { |
|
141 + .platform_data = &dnskw_button_data, |
|
142 + } |
|
143 +}; |
|
144 + |
|
145 +/***************************************************************************** |
|
146 + * LEDs |
|
147 + ****************************************************************************/ |
|
148 + |
|
149 + |
|
150 +#ifdef CONFIG_MACH_DNS320L |
|
151 +static struct gpio_led dns320_led_pins[] = { |
|
152 + { |
|
153 + .name = "dns320:blue:power", |
|
154 + .gpio = DNSKW_GPIO_LED_POWER, |
|
155 + .active_low = 1, |
|
156 + .default_trigger = "default-on", |
|
157 + }, |
|
158 + { |
|
159 + .name = "dns320:blue:usb", |
|
160 + .gpio = DNSKW_GPIO_LED_WHITE_USB, |
|
161 + .active_low = 1, |
|
162 + }, |
|
163 + { |
|
164 + .name = "dns320:orange:l_hdd", |
|
165 + .gpio = DNSKW_GPIO_LED_RED_L, |
|
166 + .active_low = 1, |
|
167 + }, |
|
168 + { |
|
169 + .name = "dns320:orange:r_hdd", |
|
170 + .gpio = DNSKW_GPIO_LED_RED_R, |
|
171 + .active_low = 1, |
|
172 + }, |
|
173 + { |
|
174 + .name = "dns320:orange:usb", |
|
175 + .gpio = DNS320_GPIO_LED_RED_USB, |
|
176 + .active_low = 1, |
|
177 + }, |
|
178 +}; |
|
179 + |
|
180 +static struct gpio_led_platform_data dns320_led_data = { |
|
181 + .num_leds = ARRAY_SIZE(dns320_led_pins), |
|
182 + .leds = dns320_led_pins, |
|
183 +}; |
|
184 + |
|
185 +static struct platform_device dns320_led_device = { |
|
186 + .name = "leds-gpio", |
|
187 + .id = -1, |
|
188 + .dev = { |
|
189 + .platform_data = &dns320_led_data, |
|
190 + }, |
|
191 +}; |
|
192 +#endif |
|
193 + |
|
194 +/***************************************************************************** |
|
195 + * Fan |
|
196 + ****************************************************************************/ |
|
197 + |
|
198 +/* Fan: ADDA AD045HB-G73 40mm 6000rpm <at> 5v */ |
|
199 +static struct gpio_fan_speed dnskw_fan_speed[] = { |
|
200 + { 0, 0 }, |
|
201 + { 3000, 1 }, |
|
202 + { 6000, 2 }, |
|
203 +}; |
|
204 + |
|
205 +static unsigned dnskw_fan_pins[] = { |
|
206 + DNSKW_GPIO_FAN_LOW, |
|
207 + DNSKW_GPIO_FAN_HIGH, |
|
208 +}; |
|
209 + |
|
210 +static struct gpio_fan_platform_data dnskw_fan_data = { |
|
211 + .num_ctrl = ARRAY_SIZE(dnskw_fan_pins), |
|
212 + .ctrl = dnskw_fan_pins, |
|
213 + .num_speed = ARRAY_SIZE(dnskw_fan_speed), |
|
214 + .speed = dnskw_fan_speed, |
|
215 +}; |
|
216 + |
|
217 +static struct platform_device dnskw_fan_device = { |
|
218 + .name = "gpio-fan", |
|
219 + .id = -1, |
|
220 + .dev = { |
|
221 + .platform_data = &dnskw_fan_data, |
|
222 + }, |
|
223 +}; |
|
224 + |
|
225 +static unsigned int dns320l_mpp_config[] __initdata = { |
|
226 + MPP13_UART1_TXD, /* Custom ... */ |
|
227 + MPP14_UART1_RXD, /* ... Controller (DNS-320 only) */ |
|
228 + MPP20_SATA1_ACTn, /* LED: White Right HDD */ |
|
229 + MPP21_SATA0_ACTn, /* LED: White Left HDD */ |
|
230 + MPP24_GPIO, |
|
231 + MPP25_GPIO, |
|
232 + MPP26_GPIO, /* LED: Power */ |
|
233 + MPP27_GPIO, /* LED: Red Right HDD */ |
|
234 + MPP28_GPIO, /* LED: Red Left HDD */ |
|
235 + MPP29_GPIO, /* LED: Red USB (DNS-325 only) */ |
|
236 + MPP30_GPIO, |
|
237 + MPP31_GPIO, |
|
238 + MPP32_GPIO, |
|
239 + MPP33_GPO, |
|
240 + MPP34_GPIO, /* Button: Front power */ |
|
241 + MPP35_GPIO, /* LED: Red USB (DNS-320 only) */ |
|
242 + MPP36_GPIO, /* Power: MV88F6281_DEV_ID Board */ |
|
243 + MPP37_GPIO, /* Power: Boot when power applied */ |
|
244 + MPP38_GPIO, |
|
245 + MPP39_GPIO, /* Power: SATA0 */ |
|
246 + MPP40_GPIO, /* Power: SATA1 */ |
|
247 + MPP41_GPIO, |
|
248 + MPP42_GPIO, |
|
249 + MPP43_GPIO, /* LED: White USB */ |
|
250 + MPP44_GPIO, /* Fan: Tachometer Pin */ |
|
251 + MPP45_GPIO, /* Fan: high speed */ |
|
252 + MPP46_GPIO, /* Fan: low speed */ |
|
253 + MPP47_GPIO, /* Button: Back unmount */ |
|
254 + MPP48_GPIO, /* Button: Back reset */ |
|
255 + MPP49_GPIO, /* Pin of unused U5 (DNS-320 only) */ |
|
256 + 0 |
|
257 +}; |
|
258 + |
|
259 +static void dnskw_power_off(void) |
|
260 +{ |
|
261 + gpio_set_value(DNSKW_GPIO_POWER, 1); |
|
262 +} |
|
263 + |
|
264 +static void __init dns320l_init(void) |
|
265 +{ |
|
266 + /* |
|
267 + * Basic setup. Needs to be called early. |
|
268 + */ |
|
269 + kirkwood_init(); |
|
270 + /* setup gpio pin select */ |
|
271 + kirkwood_mpp_conf(dns320l_mpp_config); |
|
272 + kirkwood_uart0_init(); |
|
273 + kirkwood_uart1_init(); |
|
274 + kirkwood_nand_init(ARRAY_AND_SIZE(dns320l_nand_parts), 60); |
|
275 + |
|
276 + kirkwood_ehci_init(); |
|
277 + kirkwood_i2c_init(); |
|
278 + kirkwood_ge00_init(&dns320l_ge00_data); |
|
279 + platform_device_register(&dns320_led_device); |
|
280 + dnskw_gpio_register(DNSKW_GPIO_POWER_SATA0, "dnskw:power:sata0", 1); |
|
281 + dnskw_gpio_register(DNSKW_GPIO_POWER_SATA1, "dnskw:power:sata1", 1); |
|
282 + kirkwood_sata_init(&dns320l_sata_data); |
|
283 + |
|
284 + platform_device_register(&dnskw_button_device); |
|
285 + platform_device_register(&dnskw_fan_device); |
|
286 + |
|
287 +} |
|
288 + |
|
289 +MACHINE_START(DNS320L, "DNS-320L") |
|
290 + /* Maintainer: Andreas Boehler <andreas@aboehler.at> */ |
|
291 + .boot_params = 0x00000100, |
|
292 + .init_machine = dns320l_init, |
|
293 + .map_io = kirkwood_map_io, |
|
294 + .init_early = kirkwood_init_early, |
|
295 + .init_irq = kirkwood_init_irq, |
|
296 + .timer = &kirkwood_timer, |
|
297 +MACHINE_END |
|
298 + |
|
299 --- linux-3.1.arch-orig/arch/arm/mach-kirkwood/Kconfig 2013-08-31 01:01:15.248534683 +0200 |
1 --- linux-3.1.arch-orig/arch/arm/mach-kirkwood/Kconfig 2013-08-31 01:01:15.248534683 +0200 |
300 +++ linux-3.1/arch/arm/mach-kirkwood/Kconfig 2013-09-02 18:54:10.319145257 +0200 |
2 +++ linux-3.1/arch/arm/mach-kirkwood/Kconfig 2013-09-02 18:54:10.319145257 +0200 |
301 @@ -196,6 +196,11 @@ config MACH_NSA320 |
3 @@ -196,6 +196,11 @@ config MACH_NSA320 |
302 Say 'Y' here if you want your kernel to support the |
4 Say 'Y' here if you want your kernel to support the |
303 ZyXEL NSA320. |
5 ZyXEL NSA320. |