[kernel] refresh 2.6.26 patches
[openwrt.git] / target / linux / ixp4xx / patches-2.6.26 / 301-avila_led.patch
1 --- a/arch/arm/mach-ixp4xx/avila-setup.c
2 +++ b/arch/arm/mach-ixp4xx/avila-setup.c
3 @@ -26,6 +26,7 @@
4  # include <linux/eeprom.h>
5  #endif
6  
7 +#include <linux/leds.h>
8  #include <linux/i2c-gpio.h>
9  
10  #include <asm/types.h>
11 @@ -172,6 +173,72 @@ static struct platform_device avila_npec
12         .dev.platform_data      = &avila_npec_data,
13  };
14  
15 +static struct gpio_led avila_gpio_leds[] = {
16 +       {
17 +               .name           = "user",  /* green led */
18 +               .gpio           = AVILA_GW23XX_LED_USER_GPIO,
19 +               .active_low     = 1,
20 +       }
21 +};
22 +
23 +static struct gpio_led_platform_data avila_gpio_leds_data = {
24 +       .num_leds               = 1,
25 +       .leds                   = avila_gpio_leds,
26 +};
27 +
28 +static struct platform_device avila_gpio_leds_device = {
29 +       .name                   = "leds-gpio",
30 +       .id                     = -1,
31 +       .dev.platform_data      = &avila_gpio_leds_data,
32 +};
33 +
34 +static struct latch_led avila_latch_leds[] = {
35 +       {
36 +               .name   = "led0",  /* green led */
37 +               .bit    = 0,
38 +       },
39 +       {
40 +               .name   = "led1",  /* green led */
41 +               .bit    = 1,
42 +       },
43 +       {
44 +               .name   = "led2",  /* green led */
45 +               .bit    = 2,
46 +       },
47 +       {
48 +               .name   = "led3",  /* green led */
49 +               .bit    = 3,
50 +       },
51 +       {
52 +               .name   = "led4",  /* green led */
53 +               .bit    = 4,
54 +       },
55 +       {
56 +               .name   = "led5",  /* green led */
57 +               .bit    = 5,
58 +       },
59 +       {
60 +               .name   = "led6",  /* green led */
61 +               .bit    = 6,
62 +       },
63 +       {
64 +               .name   = "led7",  /* green led */
65 +               .bit    = 7,
66 +       }
67 +};
68 +
69 +static struct latch_led_platform_data avila_latch_leds_data = {
70 +       .num_leds       = 8,
71 +       .leds           = avila_latch_leds,
72 +       .mem            = 0x51000000,
73 +};
74 +
75 +static struct platform_device avila_latch_leds_device = {
76 +       .name                   = "leds-latch",
77 +       .id                     = -1,
78 +       .dev.platform_data      = &avila_latch_leds_data,
79 +};
80 +
81  static struct platform_device *avila_devices[] __initdata = {
82         &avila_i2c_gpio,
83         &avila_flash,
84 @@ -182,6 +249,8 @@ static void __init avila_gw23xx_setup(vo
85  {
86         platform_device_register(&avila_npeb_device);
87         platform_device_register(&avila_npec_device);
88 +
89 +       platform_device_register(&avila_gpio_leds_device);
90  }
91  
92  #ifdef CONFIG_SENSORS_EEPROM
93 @@ -189,6 +258,8 @@ static void __init avila_gw2342_setup(vo
94  {
95         platform_device_register(&avila_npeb_device);
96         platform_device_register(&avila_npec_device);
97 +
98 +       platform_device_register(&avila_gpio_leds_device);
99  }
100  
101  static void __init avila_gw2345_setup(void)
102 @@ -199,22 +270,30 @@ static void __init avila_gw2345_setup(vo
103  
104         avila_npec_data.phy = 5; /* port 5 of the KS8995 switch */
105         platform_device_register(&avila_npec_device);
106 +
107 +       platform_device_register(&avila_gpio_leds_device);
108  }
109  
110  static void __init avila_gw2347_setup(void)
111  {
112         platform_device_register(&avila_npeb_device);
113 +
114 +       avila_gpio_leds[0].gpio = AVILA_GW23X7_LED_USER_GPIO;
115 +       platform_device_register(&avila_gpio_leds_device);
116  }
117  
118  static void __init avila_gw2348_setup(void)
119  {
120         platform_device_register(&avila_npeb_device);
121         platform_device_register(&avila_npec_device);
122 +
123 +       platform_device_register(&avila_gpio_leds_device);
124  }
125  
126  static void __init avila_gw2353_setup(void)
127  {
128         platform_device_register(&avila_npeb_device);
129 +       platform_device_register(&avila_gpio_leds_device);
130  }
131  
132  static void __init avila_gw2355_setup(void)
133 @@ -225,11 +304,29 @@ static void __init avila_gw2355_setup(vo
134  
135         avila_npec_data.phy = 16;
136         platform_device_register(&avila_npec_device);
137 +
138 +       platform_device_register(&avila_gpio_leds_device);
139 +
140 +       *IXP4XX_EXP_CS4 |= 0xbfff3c03;
141 +       avila_latch_leds[0].name = "RXD";
142 +       avila_latch_leds[1].name = "TXD";
143 +       avila_latch_leds[2].name = "POL";
144 +       avila_latch_leds[3].name = "LNK";
145 +       avila_latch_leds[4].name = "ERR";
146 +       avila_latch_leds_data.num_leds = 5;
147 +       avila_latch_leds_data.mem = 0x54000000;
148 +       platform_device_register(&avila_latch_leds_device);
149  }
150  
151  static void __init avila_gw2357_setup(void)
152  {
153         platform_device_register(&avila_npeb_device);
154 +
155 +       avila_gpio_leds[0].gpio = AVILA_GW23X7_LED_USER_GPIO;
156 +       platform_device_register(&avila_gpio_leds_device);
157 +
158 +       *IXP4XX_EXP_CS1 |= 0xbfff3c03;
159 +       platform_device_register(&avila_latch_leds_device);
160  }
161  
162  static struct avila_board_info avila_boards[] __initdata = {
163 --- a/include/asm-arm/arch-ixp4xx/avila.h
164 +++ b/include/asm-arm/arch-ixp4xx/avila.h
165 @@ -36,4 +36,6 @@
166  #define AVILA_PCI_INTC_PIN     9
167  #define AVILA_PCI_INTD_PIN     8
168  
169 -
170 +/* User LEDs */
171 +#define AVILA_GW23XX_LED_USER_GPIO     3
172 +#define AVILA_GW23X7_LED_USER_GPIO     4