ixp4xx: Add HSS audio driver for Avila product family
[openwrt.git] / target / linux / ixp4xx / patches-3.3 / 301-avila_led.patch
1 --- a/arch/arm/mach-ixp4xx/avila-setup.c
2 +++ b/arch/arm/mach-ixp4xx/avila-setup.c
3 @@ -22,6 +22,7 @@
4  #include <linux/serial_8250.h>
5  #include <linux/i2c.h>
6  #include <linux/i2c/at24.h>
7 +#include <linux/leds.h>
8  #include <linux/i2c-gpio.h>
9  #include <asm/types.h>
10  #include <asm/setup.h>
11 @@ -170,6 +171,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 @@ -180,12 +247,16 @@ 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  static void __init avila_gw2342_setup(void)
93  {
94         platform_device_register(&avila_npeb_device);
95         platform_device_register(&avila_npec_device);
96 +
97 +       platform_device_register(&avila_gpio_leds_device);
98  }
99  
100  static void __init avila_gw2345_setup(void)
101 @@ -196,22 +267,30 @@ static void __init avila_gw2345_setup(vo
102  
103         avila_npec_data.phy = 5; /* port 5 of the KS8995 switch */
104         platform_device_register(&avila_npec_device);
105 +
106 +       platform_device_register(&avila_gpio_leds_device);
107  }
108  
109  static void __init avila_gw2347_setup(void)
110  {
111         platform_device_register(&avila_npeb_device);
112 +
113 +       avila_gpio_leds[0].gpio = AVILA_GW23X7_LED_USER_GPIO;
114 +       platform_device_register(&avila_gpio_leds_device);
115  }
116  
117  static void __init avila_gw2348_setup(void)
118  {
119         platform_device_register(&avila_npeb_device);
120         platform_device_register(&avila_npec_device);
121 +
122 +       platform_device_register(&avila_gpio_leds_device);
123  }
124  
125  static void __init avila_gw2353_setup(void)
126  {
127         platform_device_register(&avila_npeb_device);
128 +       platform_device_register(&avila_gpio_leds_device);
129  }
130  
131  static void __init avila_gw2355_setup(void)
132 @@ -222,11 +301,29 @@ static void __init avila_gw2355_setup(vo
133  
134         avila_npec_data.phy = 16;
135         platform_device_register(&avila_npec_device);
136 +
137 +       platform_device_register(&avila_gpio_leds_device);
138 +
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);
148  }
149  
150  static void __init avila_gw2357_setup(void)
151  {
152         platform_device_register(&avila_npeb_device);
153 +
154 +       avila_gpio_leds[0].gpio = AVILA_GW23X7_LED_USER_GPIO;
155 +       platform_device_register(&avila_gpio_leds_device);
156 +
157 +       *IXP4XX_EXP_CS1 |= 0xbfff3c03;
158 +       platform_device_register(&avila_latch_leds_device);
159  }
160  
161  static struct avila_board_info avila_boards[] __initdata = {