diff options
author | Jamie Lentin <jm@lentin.co.uk> | 2012-04-18 06:06:40 -0400 |
---|---|---|
committer | Jason Cooper <jason@lakedaemon.net> | 2012-05-14 22:28:01 -0400 |
commit | 9007d1007317658d5b32bda9f59c797c59ce4d47 (patch) | |
tree | f3121c825eb848af75bf301369052147b55f98c2 /arch | |
parent | 36be50515fe2aef61533b516fa2576a2c7fe7664 (diff) |
ARM: kirkwood: Basic support for DNS-320 and DNS-325
Add support for the DNS-320 and DNS-325. Describe as much as currently possible
in the devicetree files, create a board-dnskw.c for everything else.
Changes since last submission (V3) [Addressing comments by]:-
* One MACH_DLINK_KIRKWOOD_DT for all dtb files [Grant Likely, Jason Cooper]
* Drop brain-dead select "select CONFIG_MTD_OF_PARTS" [Grant Likely]
* Don't add NAND support then throw it away immediately after [Grant Likely]
* Describe purpose of MPP 41, 42 & 49
Changes since last submission (V2):-
* Use IEEE-compliant "okay", rather than "ok" [Scott Wood]
Signed-off-by: Jamie Lentin <jm@lentin.co.uk>
Signed-off-by: Jason Cooper <jason@lakedaemon.net>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/arm/boot/dts/kirkwood-dns320.dts | 29 | ||||
-rw-r--r-- | arch/arm/boot/dts/kirkwood-dns325.dts | 24 | ||||
-rw-r--r-- | arch/arm/mach-kirkwood/Kconfig | 8 | ||||
-rw-r--r-- | arch/arm/mach-kirkwood/Makefile | 1 | ||||
-rw-r--r-- | arch/arm/mach-kirkwood/Makefile.boot | 2 | ||||
-rw-r--r-- | arch/arm/mach-kirkwood/board-dnskw.c | 275 | ||||
-rw-r--r-- | arch/arm/mach-kirkwood/board-dt.c | 5 | ||||
-rw-r--r-- | arch/arm/mach-kirkwood/common.h | 6 |
8 files changed, 350 insertions, 0 deletions
diff --git a/arch/arm/boot/dts/kirkwood-dns320.dts b/arch/arm/boot/dts/kirkwood-dns320.dts new file mode 100644 index 000000000000..78c834f6c57f --- /dev/null +++ b/arch/arm/boot/dts/kirkwood-dns320.dts | |||
@@ -0,0 +1,29 @@ | |||
1 | /dts-v1/; | ||
2 | |||
3 | /include/ "kirkwood.dtsi" | ||
4 | |||
5 | / { | ||
6 | model = "D-Link DNS-320 NAS (Rev A1)"; | ||
7 | compatible = "dlink,dns-320-a1", "dlink,dns-320", "dlink,dns-kirkwood", "mrvl,kirkwood-88f6281", "mrvl,kirkwood"; | ||
8 | |||
9 | memory { | ||
10 | device_type = "memory"; | ||
11 | reg = <0x00000000 0x8000000>; | ||
12 | }; | ||
13 | |||
14 | chosen { | ||
15 | bootargs = "console=ttyS0,115200n8 earlyprintk"; | ||
16 | }; | ||
17 | |||
18 | ocp@f1000000 { | ||
19 | serial@12000 { | ||
20 | clock-frequency = <166666667>; | ||
21 | status = "okay"; | ||
22 | }; | ||
23 | |||
24 | serial@12100 { | ||
25 | clock-frequency = <166666667>; | ||
26 | status = "okay"; | ||
27 | }; | ||
28 | }; | ||
29 | }; | ||
diff --git a/arch/arm/boot/dts/kirkwood-dns325.dts b/arch/arm/boot/dts/kirkwood-dns325.dts new file mode 100644 index 000000000000..23241abca1e7 --- /dev/null +++ b/arch/arm/boot/dts/kirkwood-dns325.dts | |||
@@ -0,0 +1,24 @@ | |||
1 | /dts-v1/; | ||
2 | |||
3 | /include/ "kirkwood.dtsi" | ||
4 | |||
5 | / { | ||
6 | model = "D-Link DNS-325 NAS (Rev A1)"; | ||
7 | compatible = "dlink,dns-325-a1", "dlink,dns-325", "dlink,dns-kirkwood", "mrvl,kirkwood-88f6281", "mrvl,kirkwood"; | ||
8 | |||
9 | memory { | ||
10 | device_type = "memory"; | ||
11 | reg = <0x00000000 0x10000000>; | ||
12 | }; | ||
13 | |||
14 | chosen { | ||
15 | bootargs = "console=ttyS0,115200n8 earlyprintk"; | ||
16 | }; | ||
17 | |||
18 | ocp@f1000000 { | ||
19 | serial@12000 { | ||
20 | clock-frequency = <200000000>; | ||
21 | status = "okay"; | ||
22 | }; | ||
23 | }; | ||
24 | }; | ||
diff --git a/arch/arm/mach-kirkwood/Kconfig b/arch/arm/mach-kirkwood/Kconfig index 90ceab761929..636778e7c526 100644 --- a/arch/arm/mach-kirkwood/Kconfig +++ b/arch/arm/mach-kirkwood/Kconfig | |||
@@ -58,6 +58,14 @@ config MACH_DREAMPLUG_DT | |||
58 | Say 'Y' here if you want your kernel to support the | 58 | Say 'Y' here if you want your kernel to support the |
59 | Marvell DreamPlug (Flattened Device Tree). | 59 | Marvell DreamPlug (Flattened Device Tree). |
60 | 60 | ||
61 | config MACH_DLINK_KIRKWOOD_DT | ||
62 | bool "D-Link Kirkwood-based NAS (Flattened Device Tree)" | ||
63 | select ARCH_KIRKWOOD_DT | ||
64 | help | ||
65 | Say 'Y' here if you want your kernel to support the | ||
66 | Kirkwood-based D-Link NASes such as DNS-320 & DNS-325, | ||
67 | using Flattened Device Tree. | ||
68 | |||
61 | config MACH_TS219 | 69 | config MACH_TS219 |
62 | bool "QNAP TS-110, TS-119, TS-119P+, TS-210, TS-219, TS-219P and TS-219P+ Turbo NAS" | 70 | bool "QNAP TS-110, TS-119, TS-119P+, TS-210, TS-219, TS-219P and TS-219P+ Turbo NAS" |
63 | help | 71 | help |
diff --git a/arch/arm/mach-kirkwood/Makefile b/arch/arm/mach-kirkwood/Makefile index e299a9576bf0..36781b318ebc 100644 --- a/arch/arm/mach-kirkwood/Makefile +++ b/arch/arm/mach-kirkwood/Makefile | |||
@@ -22,3 +22,4 @@ obj-$(CONFIG_MACH_T5325) += t5325-setup.o | |||
22 | obj-$(CONFIG_CPU_IDLE) += cpuidle.o | 22 | obj-$(CONFIG_CPU_IDLE) += cpuidle.o |
23 | obj-$(CONFIG_ARCH_KIRKWOOD_DT) += board-dt.o | 23 | obj-$(CONFIG_ARCH_KIRKWOOD_DT) += board-dt.o |
24 | obj-$(CONFIG_MACH_DREAMPLUG_DT) += board-dreamplug.o | 24 | obj-$(CONFIG_MACH_DREAMPLUG_DT) += board-dreamplug.o |
25 | obj-$(CONFIG_MACH_DLINK_KIRKWOOD_DT) += board-dnskw.o | ||
diff --git a/arch/arm/mach-kirkwood/Makefile.boot b/arch/arm/mach-kirkwood/Makefile.boot index 16f938522304..8bbffbe1d9ce 100644 --- a/arch/arm/mach-kirkwood/Makefile.boot +++ b/arch/arm/mach-kirkwood/Makefile.boot | |||
@@ -3,3 +3,5 @@ params_phys-y := 0x00000100 | |||
3 | initrd_phys-y := 0x00800000 | 3 | initrd_phys-y := 0x00800000 |
4 | 4 | ||
5 | dtb-$(CONFIG_MACH_DREAMPLUG_DT) += kirkwood-dreamplug.dtb | 5 | dtb-$(CONFIG_MACH_DREAMPLUG_DT) += kirkwood-dreamplug.dtb |
6 | dtb-$(CONFIG_MACH_DLINK_KIRKWOOD_DT) += kirkwood-dns320.dtb | ||
7 | dtb-$(CONFIG_MACH_DLINK_KIRKWOOD_DT) += kirkwood-dns325.dtb | ||
diff --git a/arch/arm/mach-kirkwood/board-dnskw.c b/arch/arm/mach-kirkwood/board-dnskw.c new file mode 100644 index 000000000000..58c2d68f9443 --- /dev/null +++ b/arch/arm/mach-kirkwood/board-dnskw.c | |||
@@ -0,0 +1,275 @@ | |||
1 | /* | ||
2 | * Copyright 2012 (C), Jamie Lentin <jm@lentin.co.uk> | ||
3 | * | ||
4 | * arch/arm/mach-kirkwood/board-dnskw.c | ||
5 | * | ||
6 | * D-link DNS-320 & DNS-325 NAS Init for drivers not converted to | ||
7 | * flattened device tree yet. | ||
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/i2c.h> | ||
18 | #include <linux/ata_platform.h> | ||
19 | #include <linux/mv643xx_eth.h> | ||
20 | #include <linux/of.h> | ||
21 | #include <linux/gpio.h> | ||
22 | #include <linux/input.h> | ||
23 | #include <linux/gpio_keys.h> | ||
24 | #include <linux/gpio-fan.h> | ||
25 | #include <linux/leds.h> | ||
26 | #include <asm/mach-types.h> | ||
27 | #include <asm/mach/arch.h> | ||
28 | #include <asm/mach/map.h> | ||
29 | #include <mach/kirkwood.h> | ||
30 | #include <mach/bridge-regs.h> | ||
31 | #include "common.h" | ||
32 | #include "mpp.h" | ||
33 | |||
34 | static struct mv643xx_eth_platform_data dnskw_ge00_data = { | ||
35 | .phy_addr = MV643XX_ETH_PHY_ADDR(8), | ||
36 | }; | ||
37 | |||
38 | static struct mv_sata_platform_data dnskw_sata_data = { | ||
39 | .n_ports = 2, | ||
40 | }; | ||
41 | |||
42 | static unsigned int dnskw_mpp_config[] __initdata = { | ||
43 | MPP13_UART1_TXD, /* Custom ... */ | ||
44 | MPP14_UART1_RXD, /* ... Controller (DNS-320 only) */ | ||
45 | MPP20_SATA1_ACTn, /* LED: White Right HDD */ | ||
46 | MPP21_SATA0_ACTn, /* LED: White Left HDD */ | ||
47 | MPP24_GPIO, | ||
48 | MPP25_GPIO, | ||
49 | MPP26_GPIO, /* LED: Power */ | ||
50 | MPP27_GPIO, /* LED: Red Right HDD */ | ||
51 | MPP28_GPIO, /* LED: Red Left HDD */ | ||
52 | MPP29_GPIO, /* LED: Red USB (DNS-325 only) */ | ||
53 | MPP30_GPIO, | ||
54 | MPP31_GPIO, | ||
55 | MPP32_GPIO, | ||
56 | MPP33_GPO, | ||
57 | MPP34_GPIO, /* Button: Front power */ | ||
58 | MPP35_GPIO, /* LED: Red USB (DNS-320 only) */ | ||
59 | MPP36_GPIO, /* Power: Turn off board */ | ||
60 | MPP37_GPIO, /* Power: Turn back on after power failure */ | ||
61 | MPP38_GPIO, | ||
62 | MPP39_GPIO, /* Power: SATA0 */ | ||
63 | MPP40_GPIO, /* Power: SATA1 */ | ||
64 | MPP41_GPIO, /* SATA0 present */ | ||
65 | MPP42_GPIO, /* SATA1 present */ | ||
66 | MPP43_GPIO, /* LED: White USB */ | ||
67 | MPP44_GPIO, /* Fan: Tachometer Pin */ | ||
68 | MPP45_GPIO, /* Fan: high speed */ | ||
69 | MPP46_GPIO, /* Fan: low speed */ | ||
70 | MPP47_GPIO, /* Button: Back unmount */ | ||
71 | MPP48_GPIO, /* Button: Back reset */ | ||
72 | MPP49_GPIO, /* Temp Alarm (DNS-325) Pin of U5 (DNS-320) */ | ||
73 | 0 | ||
74 | }; | ||
75 | |||
76 | static struct gpio_led dns325_led_pins[] = { | ||
77 | { | ||
78 | .name = "dns325:white:power", | ||
79 | .gpio = 26, | ||
80 | .active_low = 1, | ||
81 | .default_trigger = "default-on", | ||
82 | }, | ||
83 | { | ||
84 | .name = "dns325:white:usb", | ||
85 | .gpio = 43, | ||
86 | .active_low = 1, | ||
87 | }, | ||
88 | { | ||
89 | .name = "dns325:red:l_hdd", | ||
90 | .gpio = 28, | ||
91 | .active_low = 1, | ||
92 | }, | ||
93 | { | ||
94 | .name = "dns325:red:r_hdd", | ||
95 | .gpio = 27, | ||
96 | .active_low = 1, | ||
97 | }, | ||
98 | { | ||
99 | .name = "dns325:red:usb", | ||
100 | .gpio = 29, | ||
101 | .active_low = 1, | ||
102 | }, | ||
103 | }; | ||
104 | |||
105 | static struct gpio_led_platform_data dns325_led_data = { | ||
106 | .num_leds = ARRAY_SIZE(dns325_led_pins), | ||
107 | .leds = dns325_led_pins, | ||
108 | }; | ||
109 | |||
110 | static struct platform_device dns325_led_device = { | ||
111 | .name = "leds-gpio", | ||
112 | .id = -1, | ||
113 | .dev = { | ||
114 | .platform_data = &dns325_led_data, | ||
115 | }, | ||
116 | }; | ||
117 | |||
118 | static struct gpio_led dns320_led_pins[] = { | ||
119 | { | ||
120 | .name = "dns320:blue:power", | ||
121 | .gpio = 26, | ||
122 | .active_low = 1, | ||
123 | .default_trigger = "default-on", | ||
124 | }, | ||
125 | { | ||
126 | .name = "dns320:blue:usb", | ||
127 | .gpio = 43, | ||
128 | .active_low = 1, | ||
129 | }, | ||
130 | { | ||
131 | .name = "dns320:orange:l_hdd", | ||
132 | .gpio = 28, | ||
133 | .active_low = 1, | ||
134 | }, | ||
135 | { | ||
136 | .name = "dns320:orange:r_hdd", | ||
137 | .gpio = 27, | ||
138 | .active_low = 1, | ||
139 | }, | ||
140 | { | ||
141 | .name = "dns320:orange:usb", | ||
142 | .gpio = 35, | ||
143 | .active_low = 1, | ||
144 | }, | ||
145 | }; | ||
146 | |||
147 | static struct gpio_led_platform_data dns320_led_data = { | ||
148 | .num_leds = ARRAY_SIZE(dns320_led_pins), | ||
149 | .leds = dns320_led_pins, | ||
150 | }; | ||
151 | |||
152 | static struct platform_device dns320_led_device = { | ||
153 | .name = "leds-gpio", | ||
154 | .id = -1, | ||
155 | .dev = { | ||
156 | .platform_data = &dns320_led_data, | ||
157 | }, | ||
158 | }; | ||
159 | |||
160 | static struct i2c_board_info dns325_i2c_board_info[] __initdata = { | ||
161 | { | ||
162 | I2C_BOARD_INFO("lm75", 0x48), | ||
163 | }, | ||
164 | /* Something at 0x0c also */ | ||
165 | }; | ||
166 | |||
167 | static struct gpio_keys_button dnskw_button_pins[] = { | ||
168 | { | ||
169 | .code = KEY_POWER, | ||
170 | .gpio = 34, | ||
171 | .desc = "Power button", | ||
172 | .active_low = 1, | ||
173 | }, | ||
174 | { | ||
175 | .code = KEY_EJECTCD, | ||
176 | .gpio = 47, | ||
177 | .desc = "USB unmount button", | ||
178 | .active_low = 1, | ||
179 | }, | ||
180 | { | ||
181 | .code = KEY_RESTART, | ||
182 | .gpio = 48, | ||
183 | .desc = "Reset button", | ||
184 | .active_low = 1, | ||
185 | }, | ||
186 | }; | ||
187 | |||
188 | static struct gpio_keys_platform_data dnskw_button_data = { | ||
189 | .buttons = dnskw_button_pins, | ||
190 | .nbuttons = ARRAY_SIZE(dnskw_button_pins), | ||
191 | }; | ||
192 | |||
193 | static struct platform_device dnskw_button_device = { | ||
194 | .name = "gpio-keys", | ||
195 | .id = -1, | ||
196 | .num_resources = 0, | ||
197 | .dev = { | ||
198 | .platform_data = &dnskw_button_data, | ||
199 | } | ||
200 | }; | ||
201 | |||
202 | /* Fan: ADDA AD045HB-G73 40mm 6000rpm@5v */ | ||
203 | static struct gpio_fan_speed dnskw_fan_speed[] = { | ||
204 | { 0, 0 }, | ||
205 | { 3000, 1 }, | ||
206 | { 6000, 2 }, | ||
207 | }; | ||
208 | static unsigned dnskw_fan_pins[] = {46, 45}; | ||
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 void dnskw_power_off(void) | ||
226 | { | ||
227 | gpio_set_value(36, 1); | ||
228 | } | ||
229 | |||
230 | /* Register any GPIO for output and set the value */ | ||
231 | static void __init dnskw_gpio_register(unsigned gpio, char *name, int def) | ||
232 | { | ||
233 | if (gpio_request(gpio, name) == 0 && | ||
234 | gpio_direction_output(gpio, 0) == 0) { | ||
235 | gpio_set_value(gpio, def); | ||
236 | if (gpio_export(gpio, 0) != 0) | ||
237 | pr_err("dnskw: Failed to export GPIO %s\n", name); | ||
238 | } else | ||
239 | pr_err("dnskw: Failed to register %s\n", name); | ||
240 | } | ||
241 | |||
242 | void __init dnskw_init(void) | ||
243 | { | ||
244 | kirkwood_mpp_conf(dnskw_mpp_config); | ||
245 | |||
246 | kirkwood_ehci_init(); | ||
247 | kirkwood_ge00_init(&dnskw_ge00_data); | ||
248 | kirkwood_sata_init(&dnskw_sata_data); | ||
249 | kirkwood_i2c_init(); | ||
250 | |||
251 | platform_device_register(&dnskw_button_device); | ||
252 | platform_device_register(&dnskw_fan_device); | ||
253 | |||
254 | if (of_machine_is_compatible("dlink,dns-325")) { | ||
255 | i2c_register_board_info(0, dns325_i2c_board_info, | ||
256 | ARRAY_SIZE(dns325_i2c_board_info)); | ||
257 | platform_device_register(&dns325_led_device); | ||
258 | |||
259 | } else if (of_machine_is_compatible("dlink,dns-320")) | ||
260 | platform_device_register(&dns320_led_device); | ||
261 | |||
262 | /* Register power-off GPIO. */ | ||
263 | if (gpio_request(36, "dnskw:power:off") == 0 | ||
264 | && gpio_direction_output(36, 0) == 0) | ||
265 | pm_power_off = dnskw_power_off; | ||
266 | else | ||
267 | pr_err("dnskw: failed to configure power-off GPIO\n"); | ||
268 | |||
269 | /* Ensure power is supplied to both HDDs */ | ||
270 | dnskw_gpio_register(39, "dnskw:power:sata0", 1); | ||
271 | dnskw_gpio_register(40, "dnskw:power:sata1", 1); | ||
272 | |||
273 | /* Set NAS to turn back on after a power failure */ | ||
274 | dnskw_gpio_register(37, "dnskw:power:recover", 1); | ||
275 | } | ||
diff --git a/arch/arm/mach-kirkwood/board-dt.c b/arch/arm/mach-kirkwood/board-dt.c index f7fe1b9f3170..3ade0ec20c9f 100644 --- a/arch/arm/mach-kirkwood/board-dt.c +++ b/arch/arm/mach-kirkwood/board-dt.c | |||
@@ -56,11 +56,16 @@ static void __init kirkwood_dt_init(void) | |||
56 | if (of_machine_is_compatible("globalscale,dreamplug")) | 56 | if (of_machine_is_compatible("globalscale,dreamplug")) |
57 | dreamplug_init(); | 57 | dreamplug_init(); |
58 | 58 | ||
59 | if (of_machine_is_compatible("dlink,dns-kirkwood")) | ||
60 | dnskw_init(); | ||
61 | |||
59 | of_platform_populate(NULL, kirkwood_dt_match_table, NULL, NULL); | 62 | of_platform_populate(NULL, kirkwood_dt_match_table, NULL, NULL); |
60 | } | 63 | } |
61 | 64 | ||
62 | static const char *kirkwood_dt_board_compat[] = { | 65 | static const char *kirkwood_dt_board_compat[] = { |
63 | "globalscale,dreamplug", | 66 | "globalscale,dreamplug", |
67 | "dlink,dns-320", | ||
68 | "dlink,dns-325", | ||
64 | NULL | 69 | NULL |
65 | }; | 70 | }; |
66 | 71 | ||
diff --git a/arch/arm/mach-kirkwood/common.h b/arch/arm/mach-kirkwood/common.h index fa8e7689c436..6195a3770800 100644 --- a/arch/arm/mach-kirkwood/common.h +++ b/arch/arm/mach-kirkwood/common.h | |||
@@ -58,6 +58,12 @@ void dreamplug_init(void); | |||
58 | static inline void dreamplug_init(void) {}; | 58 | static inline void dreamplug_init(void) {}; |
59 | #endif | 59 | #endif |
60 | 60 | ||
61 | #ifdef CONFIG_MACH_DLINK_KIRKWOOD_DT | ||
62 | void dnskw_init(void); | ||
63 | #else | ||
64 | static inline void dnskw_init(void) {}; | ||
65 | #endif | ||
66 | |||
61 | /* early init functions not converted to fdt yet */ | 67 | /* early init functions not converted to fdt yet */ |
62 | char *kirkwood_id(void); | 68 | char *kirkwood_id(void); |
63 | void kirkwood_l2_init(void); | 69 | void kirkwood_l2_init(void); |