1 --- a/arch/arm/mach-ixp4xx/avila-setup.c
2 +++ b/arch/arm/mach-ixp4xx/avila-setup.c
5 #include <linux/i2c/at24.h>
7 +#include <linux/leds.h>
8 #include <linux/i2c-gpio.h>
10 #include <asm/types.h>
11 @@ -170,6 +171,72 @@ static struct platform_device avila_npec
12 .dev.platform_data = &avila_npec_data,
15 +static struct gpio_led avila_gpio_leds[] = {
17 + .name = "user", /* green led */
18 + .gpio = AVILA_GW23XX_LED_USER_GPIO,
23 +static struct gpio_led_platform_data avila_gpio_leds_data = {
25 + .leds = avila_gpio_leds,
28 +static struct platform_device avila_gpio_leds_device = {
29 + .name = "leds-gpio",
31 + .dev.platform_data = &avila_gpio_leds_data,
34 +static struct latch_led avila_latch_leds[] = {
36 + .name = "led0", /* green led */
40 + .name = "led1", /* green led */
44 + .name = "led2", /* green led */
48 + .name = "led3", /* green led */
52 + .name = "led4", /* green led */
56 + .name = "led5", /* green led */
60 + .name = "led6", /* green led */
64 + .name = "led7", /* green led */
69 +static struct latch_led_platform_data avila_latch_leds_data = {
71 + .leds = avila_latch_leds,
75 +static struct platform_device avila_latch_leds_device = {
76 + .name = "leds-latch",
78 + .dev.platform_data = &avila_latch_leds_data,
81 static struct platform_device *avila_devices[] __initdata = {
84 @@ -180,12 +247,16 @@ static void __init avila_gw23xx_setup(vo
86 platform_device_register(&avila_npeb_device);
87 platform_device_register(&avila_npec_device);
89 + platform_device_register(&avila_gpio_leds_device);
92 static void __init avila_gw2342_setup(void)
94 platform_device_register(&avila_npeb_device);
95 platform_device_register(&avila_npec_device);
97 + platform_device_register(&avila_gpio_leds_device);
100 static void __init avila_gw2345_setup(void)
101 @@ -196,22 +267,30 @@ static void __init avila_gw2345_setup(vo
103 avila_npec_data.phy = 5; /* port 5 of the KS8995 switch */
104 platform_device_register(&avila_npec_device);
106 + platform_device_register(&avila_gpio_leds_device);
109 static void __init avila_gw2347_setup(void)
111 platform_device_register(&avila_npeb_device);
113 + avila_gpio_leds[0].gpio = AVILA_GW23X7_LED_USER_GPIO;
114 + platform_device_register(&avila_gpio_leds_device);
117 static void __init avila_gw2348_setup(void)
119 platform_device_register(&avila_npeb_device);
120 platform_device_register(&avila_npec_device);
122 + platform_device_register(&avila_gpio_leds_device);
125 static void __init avila_gw2353_setup(void)
127 platform_device_register(&avila_npeb_device);
128 + platform_device_register(&avila_gpio_leds_device);
131 static void __init avila_gw2355_setup(void)
132 @@ -222,11 +301,29 @@ static void __init avila_gw2355_setup(vo
134 avila_npec_data.phy = 16;
135 platform_device_register(&avila_npec_device);
137 + platform_device_register(&avila_gpio_leds_device);
139 + *IXP4XX_EXP_CS4 |= 0xbfff3c03;
140 + avila_latch_leds[0].name = "RXD";
141 + avila_latch_leds[1].name = "TXD";
142 + avila_latch_leds[2].name = "POL";
143 + avila_latch_leds[3].name = "LNK";
144 + avila_latch_leds[4].name = "ERR";
145 + avila_latch_leds_data.num_leds = 5;
146 + avila_latch_leds_data.mem = 0x54000000;
147 + platform_device_register(&avila_latch_leds_device);
150 static void __init avila_gw2357_setup(void)
152 platform_device_register(&avila_npeb_device);
154 + avila_gpio_leds[0].gpio = AVILA_GW23X7_LED_USER_GPIO;
155 + platform_device_register(&avila_gpio_leds_device);
157 + *IXP4XX_EXP_CS1 |= 0xbfff3c03;
158 + platform_device_register(&avila_latch_leds_device);
161 static struct avila_board_info avila_boards[] __initdata = {
162 --- a/arch/arm/mach-ixp4xx/include/mach/avila.h
163 +++ b/arch/arm/mach-ixp4xx/include/mach/avila.h
165 #define AVILA_PCI_INTC_PIN 9
166 #define AVILA_PCI_INTD_PIN 8
170 +#define AVILA_GW23XX_LED_USER_GPIO 3
171 +#define AVILA_GW23X7_LED_USER_GPIO 4