diff options
author | Russell King <rmk+kernel@arm.linux.org.uk> | 2010-01-27 17:16:05 -0500 |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2010-01-27 17:16:05 -0500 |
commit | 00e4acb1e2352477e4d0a19dcbff2af870e8b401 (patch) | |
tree | d6481ecd452d1a491f996cd897251f2b3a92c2d9 /arch | |
parent | b04da8bfdfbbd79544cab2fadfdc12e87eb01600 (diff) | |
parent | cf11052a95275c942c1f45ea5fde43ce45bbba6d (diff) |
Merge branch 'for-rmk' of git://git.marvell.com/orion
Diffstat (limited to 'arch')
-rw-r--r-- | arch/arm/mach-kirkwood/rd88f6192-nas-setup.c | 6 | ||||
-rw-r--r-- | arch/arm/mach-orion5x/dns323-setup.c | 33 | ||||
-rw-r--r-- | arch/arm/mach-orion5x/wrt350n-v2-setup.c | 79 | ||||
-rw-r--r-- | arch/arm/plat-orion/pcie.c | 6 |
4 files changed, 118 insertions, 6 deletions
diff --git a/arch/arm/mach-kirkwood/rd88f6192-nas-setup.c b/arch/arm/mach-kirkwood/rd88f6192-nas-setup.c index 8bf4153d0840..3bf6304158f6 100644 --- a/arch/arm/mach-kirkwood/rd88f6192-nas-setup.c +++ b/arch/arm/mach-kirkwood/rd88f6192-nas-setup.c | |||
@@ -13,6 +13,7 @@ | |||
13 | #include <linux/platform_device.h> | 13 | #include <linux/platform_device.h> |
14 | #include <linux/ata_platform.h> | 14 | #include <linux/ata_platform.h> |
15 | #include <linux/mv643xx_eth.h> | 15 | #include <linux/mv643xx_eth.h> |
16 | #include <linux/gpio.h> | ||
16 | #include <linux/spi/flash.h> | 17 | #include <linux/spi/flash.h> |
17 | #include <linux/spi/spi.h> | 18 | #include <linux/spi/spi.h> |
18 | #include <linux/spi/orion_spi.h> | 19 | #include <linux/spi/orion_spi.h> |
@@ -53,6 +54,11 @@ static void __init rd88f6192_init(void) | |||
53 | */ | 54 | */ |
54 | kirkwood_init(); | 55 | kirkwood_init(); |
55 | 56 | ||
57 | orion_gpio_set_valid(RD88F6192_GPIO_USB_VBUS, 1); | ||
58 | if (gpio_request(RD88F6192_GPIO_USB_VBUS, "USB VBUS") != 0 || | ||
59 | gpio_direction_output(RD88F6192_GPIO_USB_VBUS, 1) != 0) | ||
60 | pr_err("RD-88F6192-NAS: failed to setup USB VBUS GPIO\n"); | ||
61 | |||
56 | kirkwood_ehci_init(); | 62 | kirkwood_ehci_init(); |
57 | kirkwood_ge00_init(&rd88f6192_ge00_data); | 63 | kirkwood_ge00_init(&rd88f6192_ge00_data); |
58 | kirkwood_sata_init(&rd88f6192_sata_data); | 64 | kirkwood_sata_init(&rd88f6192_sata_data); |
diff --git a/arch/arm/mach-orion5x/dns323-setup.c b/arch/arm/mach-orion5x/dns323-setup.c index b31ca4cef365..8f159db4d08a 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,6 +33,7 @@ | |||
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 |
36 | #define DNS323_GPIO_SYSTEM_UP 3 | ||
35 | #define DNS323_GPIO_LED_POWER 5 | 37 | #define DNS323_GPIO_LED_POWER 5 |
36 | #define DNS323_GPIO_OVERTEMP 6 | 38 | #define DNS323_GPIO_OVERTEMP 6 |
37 | #define DNS323_GPIO_RTC 7 | 39 | #define DNS323_GPIO_RTC 7 |
@@ -239,7 +241,7 @@ static struct gpio_led dns323_leds[] = { | |||
239 | { | 241 | { |
240 | .name = "power:blue", | 242 | .name = "power:blue", |
241 | .gpio = DNS323_GPIO_LED_POWER, | 243 | .gpio = DNS323_GPIO_LED_POWER, |
242 | .active_low = 1, | 244 | .default_state = LEDS_GPIO_DEFSTATE_ON, |
243 | }, { | 245 | }, { |
244 | .name = "right:amber", | 246 | .name = "right:amber", |
245 | .gpio = DNS323_GPIO_LED_RIGHT_AMBER, | 247 | .gpio = DNS323_GPIO_LED_RIGHT_AMBER, |
@@ -334,7 +336,7 @@ static struct orion5x_mpp_mode dns323_mv88f5182_mpp_modes[] __initdata = { | |||
334 | { 0, MPP_UNUSED }, | 336 | { 0, MPP_UNUSED }, |
335 | { 1, MPP_GPIO }, /* right amber LED (sata ch0) */ | 337 | { 1, MPP_GPIO }, /* right amber LED (sata ch0) */ |
336 | { 2, MPP_GPIO }, /* left amber LED (sata ch1) */ | 338 | { 2, MPP_GPIO }, /* left amber LED (sata ch1) */ |
337 | { 3, MPP_UNUSED }, | 339 | { 3, MPP_GPIO }, /* system up flag */ |
338 | { 4, MPP_GPIO }, /* power button LED */ | 340 | { 4, MPP_GPIO }, /* power button LED */ |
339 | { 5, MPP_GPIO }, /* power button LED */ | 341 | { 5, MPP_GPIO }, /* power button LED */ |
340 | { 6, MPP_GPIO }, /* GMT G751-2f overtemp */ | 342 | { 6, MPP_GPIO }, /* GMT G751-2f overtemp */ |
@@ -372,13 +374,23 @@ static struct i2c_board_info __initdata dns323_i2c_devices[] = { | |||
372 | }, | 374 | }, |
373 | }; | 375 | }; |
374 | 376 | ||
375 | /* DNS-323 specific power off method */ | 377 | /* DNS-323 rev. A specific power off method */ |
376 | static void dns323_power_off(void) | 378 | static void dns323a_power_off(void) |
377 | { | 379 | { |
378 | pr_info("%s: triggering power-off...\n", __func__); | 380 | pr_info("%s: triggering power-off...\n", __func__); |
379 | gpio_set_value(DNS323_GPIO_POWER_OFF, 1); | 381 | gpio_set_value(DNS323_GPIO_POWER_OFF, 1); |
380 | } | 382 | } |
381 | 383 | ||
384 | /* DNS-323 rev B specific power off method */ | ||
385 | static void dns323b_power_off(void) | ||
386 | { | ||
387 | pr_info("%s: triggering power-off...\n", __func__); | ||
388 | /* Pin has to be changed to 1 and back to 0 to do actual power off. */ | ||
389 | gpio_set_value(DNS323_GPIO_POWER_OFF, 1); | ||
390 | mdelay(100); | ||
391 | gpio_set_value(DNS323_GPIO_POWER_OFF, 0); | ||
392 | } | ||
393 | |||
382 | static void __init dns323_init(void) | 394 | static void __init dns323_init(void) |
383 | { | 395 | { |
384 | /* Setup basic Orion functions. Need to be called early. */ | 396 | /* Setup basic Orion functions. Need to be called early. */ |
@@ -424,11 +436,20 @@ static void __init dns323_init(void) | |||
424 | if (dns323_dev_id() == MV88F5182_DEV_ID) | 436 | if (dns323_dev_id() == MV88F5182_DEV_ID) |
425 | orion5x_sata_init(&dns323_sata_data); | 437 | orion5x_sata_init(&dns323_sata_data); |
426 | 438 | ||
427 | /* register dns323 specific power-off method */ | 439 | /* The 5182 has flag to indicate the system is up. Without this flag |
440 | * set, power LED will flash and cannot be controlled via leds-gpio. | ||
441 | */ | ||
442 | if (dns323_dev_id() == MV88F5182_DEV_ID) | ||
443 | gpio_set_value(DNS323_GPIO_SYSTEM_UP, 1); | ||
444 | |||
445 | /* Register dns323 specific power-off method */ | ||
428 | if (gpio_request(DNS323_GPIO_POWER_OFF, "POWEROFF") != 0 || | 446 | if (gpio_request(DNS323_GPIO_POWER_OFF, "POWEROFF") != 0 || |
429 | gpio_direction_output(DNS323_GPIO_POWER_OFF, 0) != 0) | 447 | gpio_direction_output(DNS323_GPIO_POWER_OFF, 0) != 0) |
430 | pr_err("DNS323: failed to setup power-off GPIO\n"); | 448 | pr_err("DNS323: failed to setup power-off GPIO\n"); |
431 | pm_power_off = dns323_power_off; | 449 | if (dns323_dev_id() == MV88F5182_DEV_ID) |
450 | pm_power_off = dns323b_power_off; | ||
451 | else | ||
452 | pm_power_off = dns323a_power_off; | ||
432 | } | 453 | } |
433 | 454 | ||
434 | /* Warning: D-Link uses a wrong mach-type (=526) in their bootloader */ | 455 | /* Warning: D-Link uses a wrong mach-type (=526) in their bootloader */ |
diff --git a/arch/arm/mach-orion5x/wrt350n-v2-setup.c b/arch/arm/mach-orion5x/wrt350n-v2-setup.c index 1b4ad9d5e2eb..cb0feca193d4 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 | */ | ||
33 | static 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 | |||
57 | static 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 | |||
62 | static 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 | */ | ||
73 | static 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_WLAN, | ||
81 | .gpio = 2, | ||
82 | .desc = "WPS Button", | ||
83 | .active_low = 1, | ||
84 | }, | ||
85 | }; | ||
86 | |||
87 | static struct gpio_keys_platform_data wrt350n_v2_button_data = { | ||
88 | .buttons = wrt350n_v2_buttons, | ||
89 | .nbuttons = ARRAY_SIZE(wrt350n_v2_buttons), | ||
90 | }; | ||
91 | |||
92 | static 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 | */ | ||
27 | static struct orion5x_mpp_mode wrt350n_v2_mpp_modes[] __initdata = { | 104 | static 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 | ||
145 | static int __init wrt350n_v2_pci_map_irq(struct pci_dev *dev, u8 slot, u8 pin) | 224 | static int __init wrt350n_v2_pci_map_irq(struct pci_dev *dev, u8 slot, u8 pin) |
diff --git a/arch/arm/plat-orion/pcie.c b/arch/arm/plat-orion/pcie.c index d41d41d78ad9..54c84a492a0f 100644 --- a/arch/arm/plat-orion/pcie.c +++ b/arch/arm/plat-orion/pcie.c | |||
@@ -133,6 +133,12 @@ static void __init orion_pcie_setup_wins(void __iomem *base, | |||
133 | } | 133 | } |
134 | 134 | ||
135 | /* | 135 | /* |
136 | * Round up 'size' to the nearest power of two. | ||
137 | */ | ||
138 | if ((size & (size - 1)) != 0) | ||
139 | size = 1 << fls(size); | ||
140 | |||
141 | /* | ||
136 | * Setup BAR[1] to all DRAM banks. | 142 | * Setup BAR[1] to all DRAM banks. |
137 | */ | 143 | */ |
138 | writel(dram->cs[0].base, base + PCIE_BAR_LO_OFF(1)); | 144 | writel(dram->cs[0].base, base + PCIE_BAR_LO_OFF(1)); |