diff options
author | Simon Guinot <sguinot@lacie.com> | 2009-06-22 15:45:01 -0400 |
---|---|---|
committer | Nicolas Pitre <nico@cam.org> | 2009-08-10 18:03:59 -0400 |
commit | 8f2208601f81b505710b0d13dbd80b687ccbca60 (patch) | |
tree | 5d02298edae2a97e130d01c74ed44796c2638c21 /arch/arm/mach-orion5x | |
parent | ed680c4ad478d0fee9740f7d029087f181346564 (diff) |
[ARM] orion5x: Add LaCie NAS d2Network support
This patch add support for the d2 Network and the Big Disk Network
LaCie boards.
Signed-off-by: Simon Guinot <sguinot@lacie.com>
Acked-by: Christopher Moore <moore@free.fr>
Signed-off-by: Nicolas Pitre <nico@marvell.com>
Diffstat (limited to 'arch/arm/mach-orion5x')
-rw-r--r-- | arch/arm/mach-orion5x/Kconfig | 14 | ||||
-rw-r--r-- | arch/arm/mach-orion5x/Makefile | 2 | ||||
-rw-r--r-- | arch/arm/mach-orion5x/d2net-setup.c | 365 |
3 files changed, 381 insertions, 0 deletions
diff --git a/arch/arm/mach-orion5x/Kconfig b/arch/arm/mach-orion5x/Kconfig index 2c7035d8dcbf..5062b05b76b7 100644 --- a/arch/arm/mach-orion5x/Kconfig +++ b/arch/arm/mach-orion5x/Kconfig | |||
@@ -89,6 +89,20 @@ config MACH_EDMINI_V2 | |||
89 | Say 'Y' here if you want your kernel to support the | 89 | Say 'Y' here if you want your kernel to support the |
90 | LaCie Ethernet Disk mini V2. | 90 | LaCie Ethernet Disk mini V2. |
91 | 91 | ||
92 | config MACH_D2NET | ||
93 | bool "LaCie d2 Network" | ||
94 | select I2C_BOARDINFO | ||
95 | help | ||
96 | Say 'Y' here if you want your kernel to support the | ||
97 | LaCie d2 Network NAS. | ||
98 | |||
99 | config MACH_BIGDISK | ||
100 | bool "LaCie Big Disk Network" | ||
101 | select I2C_BOARDINFO | ||
102 | help | ||
103 | Say 'Y' here if you want your kernel to support the | ||
104 | LaCie Big Disk Network NAS. | ||
105 | |||
92 | config MACH_MSS2 | 106 | config MACH_MSS2 |
93 | bool "Maxtor Shared Storage II" | 107 | bool "Maxtor Shared Storage II" |
94 | help | 108 | help |
diff --git a/arch/arm/mach-orion5x/Makefile b/arch/arm/mach-orion5x/Makefile index edc38e2c856f..1db8a3a2708a 100644 --- a/arch/arm/mach-orion5x/Makefile +++ b/arch/arm/mach-orion5x/Makefile | |||
@@ -12,6 +12,8 @@ obj-$(CONFIG_MACH_WRT350N_V2) += wrt350n-v2-setup.o | |||
12 | obj-$(CONFIG_MACH_TS78XX) += ts78xx-setup.o | 12 | obj-$(CONFIG_MACH_TS78XX) += ts78xx-setup.o |
13 | obj-$(CONFIG_MACH_MV2120) += mv2120-setup.o | 13 | obj-$(CONFIG_MACH_MV2120) += mv2120-setup.o |
14 | obj-$(CONFIG_MACH_EDMINI_V2) += edmini_v2-setup.o | 14 | obj-$(CONFIG_MACH_EDMINI_V2) += edmini_v2-setup.o |
15 | obj-$(CONFIG_MACH_D2NET) += d2net-setup.o | ||
16 | obj-$(CONFIG_MACH_BIGDISK) += d2net-setup.o | ||
15 | obj-$(CONFIG_MACH_MSS2) += mss2-setup.o | 17 | obj-$(CONFIG_MACH_MSS2) += mss2-setup.o |
16 | obj-$(CONFIG_MACH_WNR854T) += wnr854t-setup.o | 18 | obj-$(CONFIG_MACH_WNR854T) += wnr854t-setup.o |
17 | obj-$(CONFIG_MACH_RD88F5181L_GE) += rd88f5181l-ge-setup.o | 19 | obj-$(CONFIG_MACH_RD88F5181L_GE) += rd88f5181l-ge-setup.o |
diff --git a/arch/arm/mach-orion5x/d2net-setup.c b/arch/arm/mach-orion5x/d2net-setup.c new file mode 100644 index 000000000000..9d4bf763f25b --- /dev/null +++ b/arch/arm/mach-orion5x/d2net-setup.c | |||
@@ -0,0 +1,365 @@ | |||
1 | /* | ||
2 | * arch/arm/mach-orion5x/d2net-setup.c | ||
3 | * | ||
4 | * LaCie d2Network and Big Disk Network NAS setup | ||
5 | * | ||
6 | * Copyright (C) 2009 Simon Guinot <sguinot@lacie.com> | ||
7 | * | ||
8 | * This file is licensed under the terms of the GNU General Public | ||
9 | * License version 2. This program is licensed "as is" without any | ||
10 | * warranty of any kind, whether express or implied. | ||
11 | */ | ||
12 | |||
13 | #include <linux/kernel.h> | ||
14 | #include <linux/init.h> | ||
15 | #include <linux/platform_device.h> | ||
16 | #include <linux/pci.h> | ||
17 | #include <linux/irq.h> | ||
18 | #include <linux/mtd/physmap.h> | ||
19 | #include <linux/mv643xx_eth.h> | ||
20 | #include <linux/leds.h> | ||
21 | #include <linux/gpio_keys.h> | ||
22 | #include <linux/input.h> | ||
23 | #include <linux/i2c.h> | ||
24 | #include <linux/ata_platform.h> | ||
25 | #include <linux/gpio.h> | ||
26 | #include <asm/mach-types.h> | ||
27 | #include <asm/mach/arch.h> | ||
28 | #include <asm/mach/pci.h> | ||
29 | #include <mach/orion5x.h> | ||
30 | #include "common.h" | ||
31 | #include "mpp.h" | ||
32 | |||
33 | /***************************************************************************** | ||
34 | * LaCie d2 Network Info | ||
35 | ****************************************************************************/ | ||
36 | |||
37 | /* | ||
38 | * 512KB NOR flash Device bus boot chip select | ||
39 | */ | ||
40 | |||
41 | #define D2NET_NOR_BOOT_BASE 0xfff80000 | ||
42 | #define D2NET_NOR_BOOT_SIZE SZ_512K | ||
43 | |||
44 | /***************************************************************************** | ||
45 | * 512KB NOR Flash on Boot Device | ||
46 | ****************************************************************************/ | ||
47 | |||
48 | /* | ||
49 | * TODO: Check write support on flash MX29LV400CBTC-70G | ||
50 | */ | ||
51 | |||
52 | static struct mtd_partition d2net_partitions[] = { | ||
53 | { | ||
54 | .name = "Full512kb", | ||
55 | .size = MTDPART_SIZ_FULL, | ||
56 | .offset = 0, | ||
57 | .mask_flags = MTD_WRITEABLE, | ||
58 | }, | ||
59 | }; | ||
60 | |||
61 | static struct physmap_flash_data d2net_nor_flash_data = { | ||
62 | .width = 1, | ||
63 | .parts = d2net_partitions, | ||
64 | .nr_parts = ARRAY_SIZE(d2net_partitions), | ||
65 | }; | ||
66 | |||
67 | static struct resource d2net_nor_flash_resource = { | ||
68 | .flags = IORESOURCE_MEM, | ||
69 | .start = D2NET_NOR_BOOT_BASE, | ||
70 | .end = D2NET_NOR_BOOT_BASE | ||
71 | + D2NET_NOR_BOOT_SIZE - 1, | ||
72 | }; | ||
73 | |||
74 | static struct platform_device d2net_nor_flash = { | ||
75 | .name = "physmap-flash", | ||
76 | .id = 0, | ||
77 | .dev = { | ||
78 | .platform_data = &d2net_nor_flash_data, | ||
79 | }, | ||
80 | .num_resources = 1, | ||
81 | .resource = &d2net_nor_flash_resource, | ||
82 | }; | ||
83 | |||
84 | /***************************************************************************** | ||
85 | * Ethernet | ||
86 | ****************************************************************************/ | ||
87 | |||
88 | static struct mv643xx_eth_platform_data d2net_eth_data = { | ||
89 | .phy_addr = MV643XX_ETH_PHY_ADDR(8), | ||
90 | }; | ||
91 | |||
92 | /***************************************************************************** | ||
93 | * I2C devices | ||
94 | ****************************************************************************/ | ||
95 | |||
96 | /* | ||
97 | * i2c addr | chip | description | ||
98 | * 0x32 | Ricoh 5C372b | RTC | ||
99 | * 0x3e | GMT G762 | PWM fan controller | ||
100 | * 0x50 | HT24LC08 | eeprom (1kB) | ||
101 | * | ||
102 | * TODO: Add G762 support to the g760a driver. | ||
103 | */ | ||
104 | static struct i2c_board_info __initdata d2net_i2c_devices[] = { | ||
105 | { | ||
106 | I2C_BOARD_INFO("rs5c372b", 0x32), | ||
107 | }, { | ||
108 | I2C_BOARD_INFO("24c08", 0x50), | ||
109 | }, | ||
110 | }; | ||
111 | |||
112 | /***************************************************************************** | ||
113 | * SATA | ||
114 | ****************************************************************************/ | ||
115 | |||
116 | static struct mv_sata_platform_data d2net_sata_data = { | ||
117 | .n_ports = 2, | ||
118 | }; | ||
119 | |||
120 | #define D2NET_GPIO_SATA0_POWER 3 | ||
121 | #define D2NET_GPIO_SATA1_POWER 12 | ||
122 | |||
123 | static void __init d2net_sata_power_init(void) | ||
124 | { | ||
125 | int err; | ||
126 | |||
127 | err = gpio_request(D2NET_GPIO_SATA0_POWER, "SATA0 power"); | ||
128 | if (err == 0) { | ||
129 | err = gpio_direction_output(D2NET_GPIO_SATA0_POWER, 1); | ||
130 | if (err) | ||
131 | gpio_free(D2NET_GPIO_SATA0_POWER); | ||
132 | } | ||
133 | if (err) | ||
134 | pr_err("d2net: failed to configure SATA0 power GPIO\n"); | ||
135 | |||
136 | err = gpio_request(D2NET_GPIO_SATA1_POWER, "SATA1 power"); | ||
137 | if (err == 0) { | ||
138 | err = gpio_direction_output(D2NET_GPIO_SATA1_POWER, 1); | ||
139 | if (err) | ||
140 | gpio_free(D2NET_GPIO_SATA1_POWER); | ||
141 | } | ||
142 | if (err) | ||
143 | pr_err("d2net: failed to configure SATA1 power GPIO\n"); | ||
144 | } | ||
145 | |||
146 | /***************************************************************************** | ||
147 | * GPIO LED's | ||
148 | ****************************************************************************/ | ||
149 | |||
150 | /* | ||
151 | * The blue front LED is wired to the CPLD and can blink in relation with the | ||
152 | * SATA activity. This feature is disabled to make this LED compatible with | ||
153 | * the leds-gpio driver: MPP14 and MPP15 are configured to act like output | ||
154 | * GPIO's and have to stay in an active state. This is needed to set the blue | ||
155 | * LED in a "fix on" state regardless of the SATA activity. | ||
156 | * | ||
157 | * The following array detail the different LED registers and the combination | ||
158 | * of their possible values: | ||
159 | * | ||
160 | * led_off | blink_ctrl | SATA active | LED state | ||
161 | * | | | | ||
162 | * 1 | x | x | off | ||
163 | * 0 | 0 | 0 | off | ||
164 | * 0 | 1 | 0 | blink (rate 300ms) | ||
165 | * 0 | x | 1 | on | ||
166 | * | ||
167 | * Notes: The blue and the red front LED's can't be on at the same time. | ||
168 | * Red LED have priority. | ||
169 | */ | ||
170 | |||
171 | #define D2NET_GPIO_RED_LED 6 | ||
172 | #define D2NET_GPIO_BLUE_LED_BLINK_CTRL 16 | ||
173 | #define D2NET_GPIO_BLUE_LED_OFF 23 | ||
174 | #define D2NET_GPIO_SATA0_ACT 14 | ||
175 | #define D2NET_GPIO_SATA1_ACT 15 | ||
176 | |||
177 | static struct gpio_led d2net_leds[] = { | ||
178 | { | ||
179 | .name = "d2net:blue:power", | ||
180 | .gpio = D2NET_GPIO_BLUE_LED_OFF, | ||
181 | .active_low = 1, | ||
182 | }, | ||
183 | { | ||
184 | .name = "d2net:red:fail", | ||
185 | .gpio = D2NET_GPIO_RED_LED, | ||
186 | }, | ||
187 | }; | ||
188 | |||
189 | static struct gpio_led_platform_data d2net_led_data = { | ||
190 | .num_leds = ARRAY_SIZE(d2net_leds), | ||
191 | .leds = d2net_leds, | ||
192 | }; | ||
193 | |||
194 | static struct platform_device d2net_gpio_leds = { | ||
195 | .name = "leds-gpio", | ||
196 | .id = -1, | ||
197 | .dev = { | ||
198 | .platform_data = &d2net_led_data, | ||
199 | }, | ||
200 | }; | ||
201 | |||
202 | static void __init d2net_gpio_leds_init(void) | ||
203 | { | ||
204 | /* Configure GPIO over MPP max number. */ | ||
205 | orion_gpio_set_valid(D2NET_GPIO_BLUE_LED_OFF, 1); | ||
206 | |||
207 | if (gpio_request(D2NET_GPIO_SATA0_ACT, "LED SATA0 activity") != 0) | ||
208 | return; | ||
209 | if (gpio_direction_output(D2NET_GPIO_SATA0_ACT, 1) != 0) | ||
210 | goto err_free_1; | ||
211 | if (gpio_request(D2NET_GPIO_SATA1_ACT, "LED SATA1 activity") != 0) | ||
212 | goto err_free_1; | ||
213 | if (gpio_direction_output(D2NET_GPIO_SATA1_ACT, 1) != 0) | ||
214 | goto err_free_2; | ||
215 | platform_device_register(&d2net_gpio_leds); | ||
216 | return; | ||
217 | |||
218 | err_free_2: | ||
219 | gpio_free(D2NET_GPIO_SATA1_ACT); | ||
220 | err_free_1: | ||
221 | gpio_free(D2NET_GPIO_SATA0_ACT); | ||
222 | return; | ||
223 | } | ||
224 | |||
225 | /**************************************************************************** | ||
226 | * GPIO keys | ||
227 | ****************************************************************************/ | ||
228 | |||
229 | #define D2NET_GPIO_PUSH_BUTTON 18 | ||
230 | #define D2NET_GPIO_POWER_SWITCH_ON 8 | ||
231 | #define D2NET_GPIO_POWER_SWITCH_OFF 9 | ||
232 | |||
233 | #define D2NET_SWITCH_POWER_ON 0x1 | ||
234 | #define D2NET_SWITCH_POWER_OFF 0x2 | ||
235 | |||
236 | static struct gpio_keys_button d2net_buttons[] = { | ||
237 | { | ||
238 | .type = EV_SW, | ||
239 | .code = D2NET_SWITCH_POWER_OFF, | ||
240 | .gpio = D2NET_GPIO_POWER_SWITCH_OFF, | ||
241 | .desc = "Power rocker switch (auto|off)", | ||
242 | .active_low = 0, | ||
243 | }, | ||
244 | { | ||
245 | .type = EV_SW, | ||
246 | .code = D2NET_SWITCH_POWER_ON, | ||
247 | .gpio = D2NET_GPIO_POWER_SWITCH_ON, | ||
248 | .desc = "Power rocker switch (on|auto)", | ||
249 | .active_low = 0, | ||
250 | }, | ||
251 | { | ||
252 | .type = EV_KEY, | ||
253 | .code = KEY_POWER, | ||
254 | .gpio = D2NET_GPIO_PUSH_BUTTON, | ||
255 | .desc = "Front Push Button", | ||
256 | .active_low = 0, | ||
257 | }, | ||
258 | }; | ||
259 | |||
260 | static struct gpio_keys_platform_data d2net_button_data = { | ||
261 | .buttons = d2net_buttons, | ||
262 | .nbuttons = ARRAY_SIZE(d2net_buttons), | ||
263 | }; | ||
264 | |||
265 | static struct platform_device d2net_gpio_buttons = { | ||
266 | .name = "gpio-keys", | ||
267 | .id = -1, | ||
268 | .dev = { | ||
269 | .platform_data = &d2net_button_data, | ||
270 | }, | ||
271 | }; | ||
272 | |||
273 | /***************************************************************************** | ||
274 | * General Setup | ||
275 | ****************************************************************************/ | ||
276 | |||
277 | static struct orion5x_mpp_mode d2net_mpp_modes[] __initdata = { | ||
278 | { 0, MPP_GPIO }, /* Board ID (bit 0) */ | ||
279 | { 1, MPP_GPIO }, /* Board ID (bit 1) */ | ||
280 | { 2, MPP_GPIO }, /* Board ID (bit 2) */ | ||
281 | { 3, MPP_GPIO }, /* SATA 0 power */ | ||
282 | { 4, MPP_UNUSED }, | ||
283 | { 5, MPP_GPIO }, /* Fan fail detection */ | ||
284 | { 6, MPP_GPIO }, /* Red front LED */ | ||
285 | { 7, MPP_UNUSED }, | ||
286 | { 8, MPP_GPIO }, /* Rear power switch (on|auto) */ | ||
287 | { 9, MPP_GPIO }, /* Rear power switch (auto|off) */ | ||
288 | { 10, MPP_UNUSED }, | ||
289 | { 11, MPP_UNUSED }, | ||
290 | { 12, MPP_GPIO }, /* SATA 1 power */ | ||
291 | { 13, MPP_UNUSED }, | ||
292 | { 14, MPP_GPIO }, /* SATA 0 active */ | ||
293 | { 15, MPP_GPIO }, /* SATA 1 active */ | ||
294 | { 16, MPP_GPIO }, /* Blue front LED blink control */ | ||
295 | { 17, MPP_UNUSED }, | ||
296 | { 18, MPP_GPIO }, /* Front button (0 = Released, 1 = Pushed ) */ | ||
297 | { 19, MPP_UNUSED }, | ||
298 | { -1 } | ||
299 | /* 22: USB port 1 fuse (0 = Fail, 1 = Ok) */ | ||
300 | /* 23: Blue front LED off */ | ||
301 | /* 24: Inhibit board power off (0 = Disabled, 1 = Enabled) */ | ||
302 | }; | ||
303 | |||
304 | static void __init d2net_init(void) | ||
305 | { | ||
306 | /* | ||
307 | * Setup basic Orion functions. Need to be called early. | ||
308 | */ | ||
309 | orion5x_init(); | ||
310 | |||
311 | orion5x_mpp_conf(d2net_mpp_modes); | ||
312 | |||
313 | /* | ||
314 | * Configure peripherals. | ||
315 | */ | ||
316 | orion5x_ehci0_init(); | ||
317 | orion5x_eth_init(&d2net_eth_data); | ||
318 | orion5x_i2c_init(); | ||
319 | orion5x_uart0_init(); | ||
320 | |||
321 | d2net_sata_power_init(); | ||
322 | orion5x_sata_init(&d2net_sata_data); | ||
323 | |||
324 | orion5x_setup_dev_boot_win(D2NET_NOR_BOOT_BASE, | ||
325 | D2NET_NOR_BOOT_SIZE); | ||
326 | platform_device_register(&d2net_nor_flash); | ||
327 | |||
328 | platform_device_register(&d2net_gpio_buttons); | ||
329 | |||
330 | d2net_gpio_leds_init(); | ||
331 | |||
332 | pr_notice("d2net: Flash write are not yet supported.\n"); | ||
333 | |||
334 | i2c_register_board_info(0, d2net_i2c_devices, | ||
335 | ARRAY_SIZE(d2net_i2c_devices)); | ||
336 | } | ||
337 | |||
338 | /* Warning: LaCie use a wrong mach-type (0x20e=526) in their bootloader. */ | ||
339 | |||
340 | #ifdef CONFIG_MACH_D2NET | ||
341 | MACHINE_START(D2NET, "LaCie d2 Network") | ||
342 | .phys_io = ORION5X_REGS_PHYS_BASE, | ||
343 | .io_pg_offst = ((ORION5X_REGS_VIRT_BASE) >> 18) & 0xFFFC, | ||
344 | .boot_params = 0x00000100, | ||
345 | .init_machine = d2net_init, | ||
346 | .map_io = orion5x_map_io, | ||
347 | .init_irq = orion5x_init_irq, | ||
348 | .timer = &orion5x_timer, | ||
349 | .fixup = tag_fixup_mem32, | ||
350 | MACHINE_END | ||
351 | #endif | ||
352 | |||
353 | #ifdef CONFIG_MACH_BIGDISK | ||
354 | MACHINE_START(BIGDISK, "LaCie Big Disk Network") | ||
355 | .phys_io = ORION5X_REGS_PHYS_BASE, | ||
356 | .io_pg_offst = ((ORION5X_REGS_VIRT_BASE) >> 18) & 0xFFFC, | ||
357 | .boot_params = 0x00000100, | ||
358 | .init_machine = d2net_init, | ||
359 | .map_io = orion5x_map_io, | ||
360 | .init_irq = orion5x_init_irq, | ||
361 | .timer = &orion5x_timer, | ||
362 | .fixup = tag_fixup_mem32, | ||
363 | MACHINE_END | ||
364 | #endif | ||
365 | |||