aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-orion5x
diff options
context:
space:
mode:
authorDirk Teurlings <dirk@upexia.nl>2010-01-13 14:03:30 -0500
committerNicolas Pitre <nico@fluxnic.net>2010-01-13 14:32:20 -0500
commite9cfa167b6b598a364c53459bee93b508f073c65 (patch)
treed4306f2780aebf13b48f2575ba206142ecbbd487 /arch/arm/mach-orion5x
parent81143d2a65364ce5ae5c97b4c10d7d9bbe4428fd (diff)
[ARM] Orion5x: add GPIO LED and buttons for wrt350n v2
Signed-off-by: Dirk Teurlings <dirk@upexia.nl> Signed-off-by: Lennert Buytenhek <buytenh@marvell.com> Signed-off-by: Nicolas Pitre <nico@marvell.com>
Diffstat (limited to 'arch/arm/mach-orion5x')
-rw-r--r--arch/arm/mach-orion5x/wrt350n-v2-setup.c79
1 files changed, 79 insertions, 0 deletions
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 */
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_WLAN,
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)