aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-orion5x
diff options
context:
space:
mode:
authorAndrea Bastoni <bastoni@cs.unc.edu>2010-05-30 19:16:45 -0400
committerAndrea Bastoni <bastoni@cs.unc.edu>2010-05-30 19:16:45 -0400
commitada47b5fe13d89735805b566185f4885f5a3f750 (patch)
tree644b88f8a71896307d71438e9b3af49126ffb22b /arch/arm/mach-orion5x
parent43e98717ad40a4ae64545b5ba047c7b86aa44f4f (diff)
parent3280f21d43ee541f97f8cda5792150d2dbec20d5 (diff)
Merge branch 'wip-2.6.34' into old-private-masterarchived-private-master
Diffstat (limited to 'arch/arm/mach-orion5x')
-rw-r--r--arch/arm/mach-orion5x/Kconfig7
-rw-r--r--arch/arm/mach-orion5x/Makefile1
-rw-r--r--arch/arm/mach-orion5x/common.c4
-rw-r--r--arch/arm/mach-orion5x/d2net-setup.c45
-rw-r--r--arch/arm/mach-orion5x/dns323-setup.c67
-rw-r--r--arch/arm/mach-orion5x/include/mach/debug-macro.S2
-rw-r--r--arch/arm/mach-orion5x/include/mach/vmalloc.h2
-rw-r--r--arch/arm/mach-orion5x/ls_hgl-setup.c276
-rw-r--r--arch/arm/mach-orion5x/lsmini-setup.c8
-rw-r--r--arch/arm/mach-orion5x/pci.c3
-rw-r--r--arch/arm/mach-orion5x/wrt350n-v2-setup.c79
11 files changed, 453 insertions, 41 deletions
diff --git a/arch/arm/mach-orion5x/Kconfig b/arch/arm/mach-orion5x/Kconfig
index c3d513cad5ac..905719a677ae 100644
--- a/arch/arm/mach-orion5x/Kconfig
+++ b/arch/arm/mach-orion5x/Kconfig
@@ -57,6 +57,13 @@ config MACH_LINKSTATION_MINI
57 Say 'Y' here if you want your kernel to support the 57 Say 'Y' here if you want your kernel to support the
58 Buffalo Linkstation Mini platform. 58 Buffalo Linkstation Mini platform.
59 59
60config MACH_LINKSTATION_LS_HGL
61 bool "Buffalo Linkstation LS-HGL"
62 select I2C_BOARDINFO
63 help
64 Say 'Y' here if you want your kernel to support the
65 Buffalo Linkstation LS-HGL platform.
66
60config MACH_TS409 67config MACH_TS409
61 bool "QNAP TS-409" 68 bool "QNAP TS-409"
62 help 69 help
diff --git a/arch/arm/mach-orion5x/Makefile b/arch/arm/mach-orion5x/Makefile
index 89772fcd65c7..eb6eabcb41e4 100644
--- a/arch/arm/mach-orion5x/Makefile
+++ b/arch/arm/mach-orion5x/Makefile
@@ -5,6 +5,7 @@ obj-$(CONFIG_MACH_KUROBOX_PRO) += kurobox_pro-setup.o
5obj-$(CONFIG_MACH_TERASTATION_PRO2) += terastation_pro2-setup.o 5obj-$(CONFIG_MACH_TERASTATION_PRO2) += terastation_pro2-setup.o
6obj-$(CONFIG_MACH_LINKSTATION_PRO) += kurobox_pro-setup.o 6obj-$(CONFIG_MACH_LINKSTATION_PRO) += kurobox_pro-setup.o
7obj-$(CONFIG_MACH_LINKSTATION_MINI) += lsmini-setup.o 7obj-$(CONFIG_MACH_LINKSTATION_MINI) += lsmini-setup.o
8obj-$(CONFIG_MACH_LINKSTATION_LS_HGL) += ls_hgl-setup.o
8obj-$(CONFIG_MACH_DNS323) += dns323-setup.o 9obj-$(CONFIG_MACH_DNS323) += dns323-setup.o
9obj-$(CONFIG_MACH_TS209) += ts209-setup.o tsx09-common.o 10obj-$(CONFIG_MACH_TS209) += ts209-setup.o tsx09-common.o
10obj-$(CONFIG_MACH_TS409) += ts409-setup.o tsx09-common.o 11obj-$(CONFIG_MACH_TS409) += ts409-setup.o tsx09-common.o
diff --git a/arch/arm/mach-orion5x/common.c b/arch/arm/mach-orion5x/common.c
index f87fa1253803..8dc2c76d2260 100644
--- a/arch/arm/mach-orion5x/common.c
+++ b/arch/arm/mach-orion5x/common.c
@@ -488,7 +488,7 @@ static struct platform_device orion5x_xor0_channel = {
488 .dev = { 488 .dev = {
489 .dma_mask = &orion5x_xor_dmamask, 489 .dma_mask = &orion5x_xor_dmamask,
490 .coherent_dma_mask = DMA_BIT_MASK(64), 490 .coherent_dma_mask = DMA_BIT_MASK(64),
491 .platform_data = (void *)&orion5x_xor0_data, 491 .platform_data = &orion5x_xor0_data,
492 }, 492 },
493}; 493};
494 494
@@ -514,7 +514,7 @@ static struct platform_device orion5x_xor1_channel = {
514 .dev = { 514 .dev = {
515 .dma_mask = &orion5x_xor_dmamask, 515 .dma_mask = &orion5x_xor_dmamask,
516 .coherent_dma_mask = DMA_BIT_MASK(64), 516 .coherent_dma_mask = DMA_BIT_MASK(64),
517 .platform_data = (void *)&orion5x_xor1_data, 517 .platform_data = &orion5x_xor1_data,
518 }, 518 },
519}; 519};
520 520
diff --git a/arch/arm/mach-orion5x/d2net-setup.c b/arch/arm/mach-orion5x/d2net-setup.c
index 9d4bf763f25b..7130904ad999 100644
--- a/arch/arm/mach-orion5x/d2net-setup.c
+++ b/arch/arm/mach-orion5x/d2net-setup.c
@@ -149,10 +149,7 @@ static void __init d2net_sata_power_init(void)
149 149
150/* 150/*
151 * The blue front LED is wired to the CPLD and can blink in relation with the 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 152 * SATA activity.
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 * 153 *
157 * The following array detail the different LED registers and the combination 154 * The following array detail the different LED registers and the combination
158 * of their possible values: 155 * of their possible values:
@@ -171,12 +168,11 @@ static void __init d2net_sata_power_init(void)
171#define D2NET_GPIO_RED_LED 6 168#define D2NET_GPIO_RED_LED 6
172#define D2NET_GPIO_BLUE_LED_BLINK_CTRL 16 169#define D2NET_GPIO_BLUE_LED_BLINK_CTRL 16
173#define D2NET_GPIO_BLUE_LED_OFF 23 170#define D2NET_GPIO_BLUE_LED_OFF 23
174#define D2NET_GPIO_SATA0_ACT 14
175#define D2NET_GPIO_SATA1_ACT 15
176 171
177static struct gpio_led d2net_leds[] = { 172static struct gpio_led d2net_leds[] = {
178 { 173 {
179 .name = "d2net:blue:power", 174 .name = "d2net:blue:sata",
175 .default_trigger = "default-on",
180 .gpio = D2NET_GPIO_BLUE_LED_OFF, 176 .gpio = D2NET_GPIO_BLUE_LED_OFF,
181 .active_low = 1, 177 .active_low = 1,
182 }, 178 },
@@ -201,25 +197,22 @@ static struct platform_device d2net_gpio_leds = {
201 197
202static void __init d2net_gpio_leds_init(void) 198static void __init d2net_gpio_leds_init(void)
203{ 199{
200 int err;
201
204 /* Configure GPIO over MPP max number. */ 202 /* Configure GPIO over MPP max number. */
205 orion_gpio_set_valid(D2NET_GPIO_BLUE_LED_OFF, 1); 203 orion_gpio_set_valid(D2NET_GPIO_BLUE_LED_OFF, 1);
206 204
207 if (gpio_request(D2NET_GPIO_SATA0_ACT, "LED SATA0 activity") != 0) 205 /* Configure register blink_ctrl to allow SATA activity LED blinking. */
208 return; 206 err = gpio_request(D2NET_GPIO_BLUE_LED_BLINK_CTRL, "blue LED blink");
209 if (gpio_direction_output(D2NET_GPIO_SATA0_ACT, 1) != 0) 207 if (err == 0) {
210 goto err_free_1; 208 err = gpio_direction_output(D2NET_GPIO_BLUE_LED_BLINK_CTRL, 1);
211 if (gpio_request(D2NET_GPIO_SATA1_ACT, "LED SATA1 activity") != 0) 209 if (err)
212 goto err_free_1; 210 gpio_free(D2NET_GPIO_BLUE_LED_BLINK_CTRL);
213 if (gpio_direction_output(D2NET_GPIO_SATA1_ACT, 1) != 0) 211 }
214 goto err_free_2; 212 if (err)
215 platform_device_register(&d2net_gpio_leds); 213 pr_err("d2net: failed to configure blue LED blink GPIO\n");
216 return;
217 214
218err_free_2: 215 platform_device_register(&d2net_gpio_leds);
219 gpio_free(D2NET_GPIO_SATA1_ACT);
220err_free_1:
221 gpio_free(D2NET_GPIO_SATA0_ACT);
222 return;
223} 216}
224 217
225/**************************************************************************** 218/****************************************************************************
@@ -289,8 +282,8 @@ static struct orion5x_mpp_mode d2net_mpp_modes[] __initdata = {
289 { 11, MPP_UNUSED }, 282 { 11, MPP_UNUSED },
290 { 12, MPP_GPIO }, /* SATA 1 power */ 283 { 12, MPP_GPIO }, /* SATA 1 power */
291 { 13, MPP_UNUSED }, 284 { 13, MPP_UNUSED },
292 { 14, MPP_GPIO }, /* SATA 0 active */ 285 { 14, MPP_SATA_LED }, /* SATA 0 active */
293 { 15, MPP_GPIO }, /* SATA 1 active */ 286 { 15, MPP_SATA_LED }, /* SATA 1 active */
294 { 16, MPP_GPIO }, /* Blue front LED blink control */ 287 { 16, MPP_GPIO }, /* Blue front LED blink control */
295 { 17, MPP_UNUSED }, 288 { 17, MPP_UNUSED },
296 { 18, MPP_GPIO }, /* Front button (0 = Released, 1 = Pushed ) */ 289 { 18, MPP_GPIO }, /* Front button (0 = Released, 1 = Pushed ) */
@@ -301,6 +294,8 @@ static struct orion5x_mpp_mode d2net_mpp_modes[] __initdata = {
301 /* 24: Inhibit board power off (0 = Disabled, 1 = Enabled) */ 294 /* 24: Inhibit board power off (0 = Disabled, 1 = Enabled) */
302}; 295};
303 296
297#define D2NET_GPIO_INHIBIT_POWER_OFF 24
298
304static void __init d2net_init(void) 299static void __init d2net_init(void)
305{ 300{
306 /* 301 /*
@@ -333,6 +328,8 @@ static void __init d2net_init(void)
333 328
334 i2c_register_board_info(0, d2net_i2c_devices, 329 i2c_register_board_info(0, d2net_i2c_devices,
335 ARRAY_SIZE(d2net_i2c_devices)); 330 ARRAY_SIZE(d2net_i2c_devices));
331
332 orion_gpio_set_valid(D2NET_GPIO_INHIBIT_POWER_OFF, 1);
336} 333}
337 334
338/* Warning: LaCie use a wrong mach-type (0x20e=526) in their bootloader. */ 335/* Warning: LaCie use a wrong mach-type (0x20e=526) in their bootloader. */
diff --git a/arch/arm/mach-orion5x/dns323-setup.c b/arch/arm/mach-orion5x/dns323-setup.c
index b31ca4cef365..421b82f7c63d 100644
--- a/arch/arm/mach-orion5x/dns323-setup.c
+++ b/arch/arm/mach-orion5x/dns323-setup.c
@@ -12,6 +12,7 @@
12 12
13#include <linux/kernel.h> 13#include <linux/kernel.h>
14#include <linux/init.h> 14#include <linux/init.h>
15#include <linux/delay.h>
15#include <linux/platform_device.h> 16#include <linux/platform_device.h>
16#include <linux/pci.h> 17#include <linux/pci.h>
17#include <linux/irq.h> 18#include <linux/irq.h>
@@ -32,7 +33,9 @@
32 33
33#define DNS323_GPIO_LED_RIGHT_AMBER 1 34#define DNS323_GPIO_LED_RIGHT_AMBER 1
34#define DNS323_GPIO_LED_LEFT_AMBER 2 35#define DNS323_GPIO_LED_LEFT_AMBER 2
35#define DNS323_GPIO_LED_POWER 5 36#define DNS323_GPIO_SYSTEM_UP 3
37#define DNS323_GPIO_LED_POWER1 4
38#define DNS323_GPIO_LED_POWER2 5
36#define DNS323_GPIO_OVERTEMP 6 39#define DNS323_GPIO_OVERTEMP 6
37#define DNS323_GPIO_RTC 7 40#define DNS323_GPIO_RTC 7
38#define DNS323_GPIO_POWER_OFF 8 41#define DNS323_GPIO_POWER_OFF 8
@@ -235,11 +238,31 @@ error_fail:
235 * GPIO LEDs (simple - doesn't use hardware blinking support) 238 * GPIO LEDs (simple - doesn't use hardware blinking support)
236 */ 239 */
237 240
241#define ORION_BLINK_HALF_PERIOD 100 /* ms */
242
243static int dns323_gpio_blink_set(unsigned gpio,
244 unsigned long *delay_on, unsigned long *delay_off)
245{
246 static int value = 0;
247
248 if (!*delay_on && !*delay_off)
249 *delay_on = *delay_off = ORION_BLINK_HALF_PERIOD;
250
251 if (ORION_BLINK_HALF_PERIOD == *delay_on
252 && ORION_BLINK_HALF_PERIOD == *delay_off) {
253 value = !value;
254 orion_gpio_set_blink(gpio, value);
255 return 0;
256 }
257
258 return -EINVAL;
259}
260
238static struct gpio_led dns323_leds[] = { 261static struct gpio_led dns323_leds[] = {
239 { 262 {
240 .name = "power:blue", 263 .name = "power:blue",
241 .gpio = DNS323_GPIO_LED_POWER, 264 .gpio = DNS323_GPIO_LED_POWER2,
242 .active_low = 1, 265 .default_trigger = "timer",
243 }, { 266 }, {
244 .name = "right:amber", 267 .name = "right:amber",
245 .gpio = DNS323_GPIO_LED_RIGHT_AMBER, 268 .gpio = DNS323_GPIO_LED_RIGHT_AMBER,
@@ -254,6 +277,7 @@ static struct gpio_led dns323_leds[] = {
254static struct gpio_led_platform_data dns323_led_data = { 277static struct gpio_led_platform_data dns323_led_data = {
255 .num_leds = ARRAY_SIZE(dns323_leds), 278 .num_leds = ARRAY_SIZE(dns323_leds),
256 .leds = dns323_leds, 279 .leds = dns323_leds,
280 .gpio_blink_set = dns323_gpio_blink_set,
257}; 281};
258 282
259static struct platform_device dns323_gpio_leds = { 283static struct platform_device dns323_gpio_leds = {
@@ -334,7 +358,7 @@ static struct orion5x_mpp_mode dns323_mv88f5182_mpp_modes[] __initdata = {
334 { 0, MPP_UNUSED }, 358 { 0, MPP_UNUSED },
335 { 1, MPP_GPIO }, /* right amber LED (sata ch0) */ 359 { 1, MPP_GPIO }, /* right amber LED (sata ch0) */
336 { 2, MPP_GPIO }, /* left amber LED (sata ch1) */ 360 { 2, MPP_GPIO }, /* left amber LED (sata ch1) */
337 { 3, MPP_UNUSED }, 361 { 3, MPP_GPIO }, /* system up flag */
338 { 4, MPP_GPIO }, /* power button LED */ 362 { 4, MPP_GPIO }, /* power button LED */
339 { 5, MPP_GPIO }, /* power button LED */ 363 { 5, MPP_GPIO }, /* power button LED */
340 { 6, MPP_GPIO }, /* GMT G751-2f overtemp */ 364 { 6, MPP_GPIO }, /* GMT G751-2f overtemp */
@@ -372,13 +396,23 @@ static struct i2c_board_info __initdata dns323_i2c_devices[] = {
372 }, 396 },
373}; 397};
374 398
375/* DNS-323 specific power off method */ 399/* DNS-323 rev. A specific power off method */
376static void dns323_power_off(void) 400static void dns323a_power_off(void)
377{ 401{
378 pr_info("%s: triggering power-off...\n", __func__); 402 pr_info("%s: triggering power-off...\n", __func__);
379 gpio_set_value(DNS323_GPIO_POWER_OFF, 1); 403 gpio_set_value(DNS323_GPIO_POWER_OFF, 1);
380} 404}
381 405
406/* DNS-323 rev B specific power off method */
407static void dns323b_power_off(void)
408{
409 pr_info("%s: triggering power-off...\n", __func__);
410 /* Pin has to be changed to 1 and back to 0 to do actual power off. */
411 gpio_set_value(DNS323_GPIO_POWER_OFF, 1);
412 mdelay(100);
413 gpio_set_value(DNS323_GPIO_POWER_OFF, 0);
414}
415
382static void __init dns323_init(void) 416static void __init dns323_init(void)
383{ 417{
384 /* Setup basic Orion functions. Need to be called early. */ 418 /* Setup basic Orion functions. Need to be called early. */
@@ -400,6 +434,14 @@ static void __init dns323_init(void)
400 orion5x_setup_dev_boot_win(DNS323_NOR_BOOT_BASE, DNS323_NOR_BOOT_SIZE); 434 orion5x_setup_dev_boot_win(DNS323_NOR_BOOT_BASE, DNS323_NOR_BOOT_SIZE);
401 platform_device_register(&dns323_nor_flash); 435 platform_device_register(&dns323_nor_flash);
402 436
437 /* The 5181 power LED is active low and requires
438 * DNS323_GPIO_LED_POWER1 to also be low.
439 */
440 if (dns323_dev_id() == MV88F5181_DEV_ID) {
441 dns323_leds[0].active_low = 1;
442 gpio_direction_output(DNS323_GPIO_LED_POWER1, 0);
443 }
444
403 platform_device_register(&dns323_gpio_leds); 445 platform_device_register(&dns323_gpio_leds);
404 446
405 platform_device_register(&dns323_button_device); 447 platform_device_register(&dns323_button_device);
@@ -424,11 +466,20 @@ static void __init dns323_init(void)
424 if (dns323_dev_id() == MV88F5182_DEV_ID) 466 if (dns323_dev_id() == MV88F5182_DEV_ID)
425 orion5x_sata_init(&dns323_sata_data); 467 orion5x_sata_init(&dns323_sata_data);
426 468
427 /* register dns323 specific power-off method */ 469 /* The 5182 has flag to indicate the system is up. Without this flag
470 * set, power LED will flash and cannot be controlled via leds-gpio.
471 */
472 if (dns323_dev_id() == MV88F5182_DEV_ID)
473 gpio_set_value(DNS323_GPIO_SYSTEM_UP, 1);
474
475 /* Register dns323 specific power-off method */
428 if (gpio_request(DNS323_GPIO_POWER_OFF, "POWEROFF") != 0 || 476 if (gpio_request(DNS323_GPIO_POWER_OFF, "POWEROFF") != 0 ||
429 gpio_direction_output(DNS323_GPIO_POWER_OFF, 0) != 0) 477 gpio_direction_output(DNS323_GPIO_POWER_OFF, 0) != 0)
430 pr_err("DNS323: failed to setup power-off GPIO\n"); 478 pr_err("DNS323: failed to setup power-off GPIO\n");
431 pm_power_off = dns323_power_off; 479 if (dns323_dev_id() == MV88F5182_DEV_ID)
480 pm_power_off = dns323b_power_off;
481 else
482 pm_power_off = dns323a_power_off;
432} 483}
433 484
434/* Warning: D-Link uses a wrong mach-type (=526) in their bootloader */ 485/* Warning: D-Link uses a wrong mach-type (=526) in their bootloader */
diff --git a/arch/arm/mach-orion5x/include/mach/debug-macro.S b/arch/arm/mach-orion5x/include/mach/debug-macro.S
index c7f808bfe272..91e0e39bb23f 100644
--- a/arch/arm/mach-orion5x/include/mach/debug-macro.S
+++ b/arch/arm/mach-orion5x/include/mach/debug-macro.S
@@ -10,7 +10,7 @@
10 10
11#include <mach/orion5x.h> 11#include <mach/orion5x.h>
12 12
13 .macro addruart,rx 13 .macro addruart, rx, tmp
14 mrc p15, 0, \rx, c1, c0 14 mrc p15, 0, \rx, c1, c0
15 tst \rx, #1 @ MMU enabled? 15 tst \rx, #1 @ MMU enabled?
16 ldreq \rx, =ORION5X_REGS_PHYS_BASE 16 ldreq \rx, =ORION5X_REGS_PHYS_BASE
diff --git a/arch/arm/mach-orion5x/include/mach/vmalloc.h b/arch/arm/mach-orion5x/include/mach/vmalloc.h
index 7147a297e97f..06b50aeff7b9 100644
--- a/arch/arm/mach-orion5x/include/mach/vmalloc.h
+++ b/arch/arm/mach-orion5x/include/mach/vmalloc.h
@@ -2,4 +2,4 @@
2 * arch/arm/mach-orion5x/include/mach/vmalloc.h 2 * arch/arm/mach-orion5x/include/mach/vmalloc.h
3 */ 3 */
4 4
5#define VMALLOC_END 0xfd800000 5#define VMALLOC_END 0xfd800000UL
diff --git a/arch/arm/mach-orion5x/ls_hgl-setup.c b/arch/arm/mach-orion5x/ls_hgl-setup.c
new file mode 100644
index 000000000000..8e569be6e2c7
--- /dev/null
+++ b/arch/arm/mach-orion5x/ls_hgl-setup.c
@@ -0,0 +1,276 @@
1/*
2 * arch/arm/mach-orion5x/ls_hgl-setup.c
3 *
4 * Maintainer: Zhu Qingsen <zhuqs@cn.fujitsu.com>
5 *
6 * This file is licensed under the terms of the GNU General Public
7 * License version 2. This program is licensed "as is" without any
8 * warranty of any kind, whether express or implied.
9 */
10
11#include <linux/kernel.h>
12#include <linux/init.h>
13#include <linux/platform_device.h>
14#include <linux/mtd/physmap.h>
15#include <linux/mv643xx_eth.h>
16#include <linux/leds.h>
17#include <linux/gpio_keys.h>
18#include <linux/input.h>
19#include <linux/i2c.h>
20#include <linux/ata_platform.h>
21#include <linux/gpio.h>
22#include <asm/mach-types.h>
23#include <asm/mach/arch.h>
24#include <asm/system.h>
25#include <mach/orion5x.h>
26#include "common.h"
27#include "mpp.h"
28
29/*****************************************************************************
30 * Linkstation LS-HGL Info
31 ****************************************************************************/
32
33/*
34 * 256K NOR flash Device bus boot chip select
35 */
36
37#define LS_HGL_NOR_BOOT_BASE 0xf4000000
38#define LS_HGL_NOR_BOOT_SIZE SZ_256K
39
40/*****************************************************************************
41 * 256KB NOR Flash on BOOT Device
42 ****************************************************************************/
43
44static struct physmap_flash_data ls_hgl_nor_flash_data = {
45 .width = 1,
46};
47
48static struct resource ls_hgl_nor_flash_resource = {
49 .flags = IORESOURCE_MEM,
50 .start = LS_HGL_NOR_BOOT_BASE,
51 .end = LS_HGL_NOR_BOOT_BASE + LS_HGL_NOR_BOOT_SIZE - 1,
52};
53
54static struct platform_device ls_hgl_nor_flash = {
55 .name = "physmap-flash",
56 .id = 0,
57 .dev = {
58 .platform_data = &ls_hgl_nor_flash_data,
59 },
60 .num_resources = 1,
61 .resource = &ls_hgl_nor_flash_resource,
62};
63
64/*****************************************************************************
65 * Ethernet
66 ****************************************************************************/
67
68static struct mv643xx_eth_platform_data ls_hgl_eth_data = {
69 .phy_addr = 8,
70};
71
72/*****************************************************************************
73 * RTC 5C372a on I2C bus
74 ****************************************************************************/
75
76static struct i2c_board_info __initdata ls_hgl_i2c_rtc = {
77 I2C_BOARD_INFO("rs5c372a", 0x32),
78};
79
80/*****************************************************************************
81 * LEDs attached to GPIO
82 ****************************************************************************/
83
84#define LS_HGL_GPIO_LED_ALARM 2
85#define LS_HGL_GPIO_LED_INFO 3
86#define LS_HGL_GPIO_LED_FUNC 17
87#define LS_HGL_GPIO_LED_PWR 0
88
89
90static struct gpio_led ls_hgl_led_pins[] = {
91 {
92 .name = "alarm:red",
93 .gpio = LS_HGL_GPIO_LED_ALARM,
94 .active_low = 1,
95 }, {
96 .name = "info:amber",
97 .gpio = LS_HGL_GPIO_LED_INFO,
98 .active_low = 1,
99 }, {
100 .name = "func:blue:top",
101 .gpio = LS_HGL_GPIO_LED_FUNC,
102 .active_low = 1,
103 }, {
104 .name = "power:blue:bottom",
105 .gpio = LS_HGL_GPIO_LED_PWR,
106 },
107};
108
109static struct gpio_led_platform_data ls_hgl_led_data = {
110 .leds = ls_hgl_led_pins,
111 .num_leds = ARRAY_SIZE(ls_hgl_led_pins),
112};
113
114static struct platform_device ls_hgl_leds = {
115 .name = "leds-gpio",
116 .id = -1,
117 .dev = {
118 .platform_data = &ls_hgl_led_data,
119 },
120};
121
122/****************************************************************************
123 * GPIO Attached Keys
124 ****************************************************************************/
125#define LS_HGL_GPIO_KEY_FUNC 15
126#define LS_HGL_GPIO_KEY_POWER 8
127#define LS_HGL_GPIO_KEY_AUTOPOWER 10
128
129#define LS_HGL_SW_POWER 0x00
130#define LS_HGL_SW_AUTOPOWER 0x01
131
132static struct gpio_keys_button ls_hgl_buttons[] = {
133 {
134 .code = KEY_OPTION,
135 .gpio = LS_HGL_GPIO_KEY_FUNC,
136 .desc = "Function Button",
137 .active_low = 1,
138 }, {
139 .type = EV_SW,
140 .code = LS_HGL_SW_POWER,
141 .gpio = LS_HGL_GPIO_KEY_POWER,
142 .desc = "Power-on Switch",
143 .active_low = 1,
144 }, {
145 .type = EV_SW,
146 .code = LS_HGL_SW_AUTOPOWER,
147 .gpio = LS_HGL_GPIO_KEY_AUTOPOWER,
148 .desc = "Power-auto Switch",
149 .active_low = 1,
150 },
151};
152
153static struct gpio_keys_platform_data ls_hgl_button_data = {
154 .buttons = ls_hgl_buttons,
155 .nbuttons = ARRAY_SIZE(ls_hgl_buttons),
156};
157
158static struct platform_device ls_hgl_button_device = {
159 .name = "gpio-keys",
160 .id = -1,
161 .num_resources = 0,
162 .dev = {
163 .platform_data = &ls_hgl_button_data,
164 },
165};
166
167
168/*****************************************************************************
169 * SATA
170 ****************************************************************************/
171static struct mv_sata_platform_data ls_hgl_sata_data = {
172 .n_ports = 2,
173};
174
175
176/*****************************************************************************
177 * Linkstation LS-HGL specific power off method: reboot
178 ****************************************************************************/
179/*
180 * On the Linkstation LS-HGL, the shutdown process is following:
181 * - Userland monitors key events until the power switch goes to off position
182 * - The board reboots
183 * - U-boot starts and goes into an idle mode waiting for the user
184 * to move the switch to ON position
185 */
186
187static void ls_hgl_power_off(void)
188{
189 arm_machine_restart('h', NULL);
190}
191
192
193/*****************************************************************************
194 * General Setup
195 ****************************************************************************/
196
197#define LS_HGL_GPIO_USB_POWER 9
198#define LS_HGL_GPIO_AUTO_POWER 10
199#define LS_HGL_GPIO_POWER 8
200
201#define LS_HGL_GPIO_HDD_POWER 1
202
203static struct orion5x_mpp_mode ls_hgl_mpp_modes[] __initdata = {
204 { 0, MPP_GPIO }, /* LED_PWR */
205 { 1, MPP_GPIO }, /* HDD_PWR */
206 { 2, MPP_GPIO }, /* LED_ALARM */
207 { 3, MPP_GPIO }, /* LED_INFO */
208 { 4, MPP_UNUSED },
209 { 5, MPP_UNUSED },
210 { 6, MPP_GPIO }, /* FAN_LCK */
211 { 7, MPP_GPIO }, /* INIT */
212 { 8, MPP_GPIO }, /* POWER */
213 { 9, MPP_GPIO }, /* USB_PWR */
214 { 10, MPP_GPIO }, /* AUTO_POWER */
215 { 11, MPP_UNUSED }, /* LED_ETH (dummy) */
216 { 12, MPP_UNUSED },
217 { 13, MPP_UNUSED },
218 { 14, MPP_UNUSED },
219 { 15, MPP_GPIO }, /* FUNC */
220 { 16, MPP_UNUSED },
221 { 17, MPP_GPIO }, /* LED_FUNC */
222 { 18, MPP_UNUSED },
223 { 19, MPP_UNUSED },
224 { -1 },
225};
226
227static void __init ls_hgl_init(void)
228{
229 /*
230 * Setup basic Orion functions. Need to be called early.
231 */
232 orion5x_init();
233
234 orion5x_mpp_conf(ls_hgl_mpp_modes);
235
236 /*
237 * Configure peripherals.
238 */
239 orion5x_ehci0_init();
240 orion5x_ehci1_init();
241 orion5x_eth_init(&ls_hgl_eth_data);
242 orion5x_i2c_init();
243 orion5x_sata_init(&ls_hgl_sata_data);
244 orion5x_uart0_init();
245 orion5x_xor_init();
246
247 orion5x_setup_dev_boot_win(LS_HGL_NOR_BOOT_BASE,
248 LS_HGL_NOR_BOOT_SIZE);
249 platform_device_register(&ls_hgl_nor_flash);
250
251 platform_device_register(&ls_hgl_button_device);
252
253 platform_device_register(&ls_hgl_leds);
254
255 i2c_register_board_info(0, &ls_hgl_i2c_rtc, 1);
256
257 /* enable USB power */
258 gpio_set_value(LS_HGL_GPIO_USB_POWER, 1);
259
260 /* register power-off method */
261 pm_power_off = ls_hgl_power_off;
262
263 pr_info("%s: finished\n", __func__);
264}
265
266MACHINE_START(LINKSTATION_LS_HGL, "Buffalo Linkstation LS-HGL")
267 /* Maintainer: Zhu Qingsen <zhuqs@cn.fujistu.com> */
268 .phys_io = ORION5X_REGS_PHYS_BASE,
269 .io_pg_offst = ((ORION5X_REGS_VIRT_BASE) >> 18) & 0xFFFC,
270 .boot_params = 0x00000100,
271 .init_machine = ls_hgl_init,
272 .map_io = orion5x_map_io,
273 .init_irq = orion5x_init_irq,
274 .timer = &orion5x_timer,
275 .fixup = tag_fixup_mem32,
276MACHINE_END
diff --git a/arch/arm/mach-orion5x/lsmini-setup.c b/arch/arm/mach-orion5x/lsmini-setup.c
index c9bf6b81a80d..c704f056de1e 100644
--- a/arch/arm/mach-orion5x/lsmini-setup.c
+++ b/arch/arm/mach-orion5x/lsmini-setup.c
@@ -11,7 +11,6 @@
11#include <linux/kernel.h> 11#include <linux/kernel.h>
12#include <linux/init.h> 12#include <linux/init.h>
13#include <linux/platform_device.h> 13#include <linux/platform_device.h>
14#include <linux/pci.h>
15#include <linux/mtd/physmap.h> 14#include <linux/mtd/physmap.h>
16#include <linux/mv643xx_eth.h> 15#include <linux/mv643xx_eth.h>
17#include <linux/leds.h> 16#include <linux/leds.h>
@@ -19,12 +18,13 @@
19#include <linux/input.h> 18#include <linux/input.h>
20#include <linux/i2c.h> 19#include <linux/i2c.h>
21#include <linux/ata_platform.h> 20#include <linux/ata_platform.h>
22#include <asm/mach-types.h>
23#include <linux/gpio.h> 21#include <linux/gpio.h>
22#include <asm/mach-types.h>
24#include <asm/mach/arch.h> 23#include <asm/mach/arch.h>
24#include <asm/system.h>
25#include <mach/orion5x.h>
25#include "common.h" 26#include "common.h"
26#include "mpp.h" 27#include "mpp.h"
27#include "include/mach/system.h"
28 28
29/***************************************************************************** 29/*****************************************************************************
30 * Linkstation Mini Info 30 * Linkstation Mini Info
@@ -186,7 +186,7 @@ static struct mv_sata_platform_data lsmini_sata_data = {
186 186
187static void lsmini_power_off(void) 187static void lsmini_power_off(void)
188{ 188{
189 arch_reset(0, NULL); 189 arm_machine_restart('h', NULL);
190} 190}
191 191
192 192
diff --git a/arch/arm/mach-orion5x/pci.c b/arch/arm/mach-orion5x/pci.c
index 36dc5413cc97..e8706f15a670 100644
--- a/arch/arm/mach-orion5x/pci.c
+++ b/arch/arm/mach-orion5x/pci.c
@@ -12,6 +12,7 @@
12 12
13#include <linux/kernel.h> 13#include <linux/kernel.h>
14#include <linux/pci.h> 14#include <linux/pci.h>
15#include <linux/slab.h>
15#include <linux/mbus.h> 16#include <linux/mbus.h>
16#include <asm/irq.h> 17#include <asm/irq.h>
17#include <asm/mach/pci.h> 18#include <asm/mach/pci.h>
@@ -463,7 +464,7 @@ static void __init orion5x_setup_pci_wins(struct mbus_dram_target_info *dram)
463 writel(win_enable, PCI_BAR_ENABLE); 464 writel(win_enable, PCI_BAR_ENABLE);
464 465
465 /* 466 /*
466 * Disable automatic update of address remaping when writing to BARs. 467 * Disable automatic update of address remapping when writing to BARs.
467 */ 468 */
468 orion5x_setbits(PCI_ADDR_DECODE_CTRL, 1); 469 orion5x_setbits(PCI_ADDR_DECODE_CTRL, 1);
469} 470}
diff --git a/arch/arm/mach-orion5x/wrt350n-v2-setup.c b/arch/arm/mach-orion5x/wrt350n-v2-setup.c
index 1b4ad9d5e2eb..f9f222ebb7ed 100644
--- a/arch/arm/mach-orion5x/wrt350n-v2-setup.c
+++ b/arch/arm/mach-orion5x/wrt350n-v2-setup.c
@@ -15,6 +15,9 @@
15#include <linux/mtd/physmap.h> 15#include <linux/mtd/physmap.h>
16#include <linux/mv643xx_eth.h> 16#include <linux/mv643xx_eth.h>
17#include <linux/ethtool.h> 17#include <linux/ethtool.h>
18#include <linux/leds.h>
19#include <linux/gpio_keys.h>
20#include <linux/input.h>
18#include <net/dsa.h> 21#include <net/dsa.h>
19#include <asm/mach-types.h> 22#include <asm/mach-types.h>
20#include <asm/gpio.h> 23#include <asm/gpio.h>
@@ -24,6 +27,80 @@
24#include "common.h" 27#include "common.h"
25#include "mpp.h" 28#include "mpp.h"
26 29
30/*
31 * LEDs attached to GPIO
32 */
33static struct gpio_led wrt350n_v2_led_pins[] = {
34 {
35 .name = "wrt350nv2:green:power",
36 .gpio = 0,
37 .active_low = 1,
38 }, {
39 .name = "wrt350nv2:green:security",
40 .gpio = 1,
41 .active_low = 1,
42 }, {
43 .name = "wrt350nv2:orange:power",
44 .gpio = 5,
45 .active_low = 1,
46 }, {
47 .name = "wrt350nv2:green:usb",
48 .gpio = 6,
49 .active_low = 1,
50 }, {
51 .name = "wrt350nv2:green:wireless",
52 .gpio = 7,
53 .active_low = 1,
54 },
55};
56
57static struct gpio_led_platform_data wrt350n_v2_led_data = {
58 .leds = wrt350n_v2_led_pins,
59 .num_leds = ARRAY_SIZE(wrt350n_v2_led_pins),
60};
61
62static struct platform_device wrt350n_v2_leds = {
63 .name = "leds-gpio",
64 .id = -1,
65 .dev = {
66 .platform_data = &wrt350n_v2_led_data,
67 },
68};
69
70/*
71 * Buttons attached to GPIO
72 */
73static struct gpio_keys_button wrt350n_v2_buttons[] = {
74 {
75 .code = KEY_RESTART,
76 .gpio = 3,
77 .desc = "Reset Button",
78 .active_low = 1,
79 }, {
80 .code = KEY_WPS_BUTTON,
81 .gpio = 2,
82 .desc = "WPS Button",
83 .active_low = 1,
84 },
85};
86
87static struct gpio_keys_platform_data wrt350n_v2_button_data = {
88 .buttons = wrt350n_v2_buttons,
89 .nbuttons = ARRAY_SIZE(wrt350n_v2_buttons),
90};
91
92static struct platform_device wrt350n_v2_button_device = {
93 .name = "gpio-keys",
94 .id = -1,
95 .num_resources = 0,
96 .dev = {
97 .platform_data = &wrt350n_v2_button_data,
98 },
99};
100
101/*
102 * General setup
103 */
27static struct orion5x_mpp_mode wrt350n_v2_mpp_modes[] __initdata = { 104static struct orion5x_mpp_mode wrt350n_v2_mpp_modes[] __initdata = {
28 { 0, MPP_GPIO }, /* Power LED green (0=on) */ 105 { 0, MPP_GPIO }, /* Power LED green (0=on) */
29 { 1, MPP_GPIO }, /* Security LED (0=on) */ 106 { 1, MPP_GPIO }, /* Security LED (0=on) */
@@ -140,6 +217,8 @@ static void __init wrt350n_v2_init(void)
140 orion5x_setup_dev_boot_win(WRT350N_V2_NOR_BOOT_BASE, 217 orion5x_setup_dev_boot_win(WRT350N_V2_NOR_BOOT_BASE,
141 WRT350N_V2_NOR_BOOT_SIZE); 218 WRT350N_V2_NOR_BOOT_SIZE);
142 platform_device_register(&wrt350n_v2_nor_flash); 219 platform_device_register(&wrt350n_v2_nor_flash);
220 platform_device_register(&wrt350n_v2_leds);
221 platform_device_register(&wrt350n_v2_button_device);
143} 222}
144 223
145static int __init wrt350n_v2_pci_map_irq(struct pci_dev *dev, u8 slot, u8 pin) 224static int __init wrt350n_v2_pci_map_irq(struct pci_dev *dev, u8 slot, u8 pin)