aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/arm/mach-omap1/Kconfig2
-rw-r--r--arch/arm/mach-omap1/board-ams-delta.c226
-rw-r--r--arch/arm/plat-omap/include/plat/board-ams-delta.h48
-rw-r--r--drivers/input/serio/ams_delta_serio.c54
-rw-r--r--drivers/leds/Kconfig7
-rw-r--r--drivers/leds/Makefile1
-rw-r--r--drivers/leds/leds-ams-delta.c126
-rw-r--r--drivers/mtd/nand/ams-delta.c74
-rw-r--r--drivers/video/omap/lcd_ams_delta.c27
-rw-r--r--sound/soc/omap/ams-delta.c2
10 files changed, 318 insertions, 249 deletions
diff --git a/arch/arm/mach-omap1/Kconfig b/arch/arm/mach-omap1/Kconfig
index 4f8d66f044e..5b1edbae689 100644
--- a/arch/arm/mach-omap1/Kconfig
+++ b/arch/arm/mach-omap1/Kconfig
@@ -155,6 +155,8 @@ config MACH_AMS_DELTA
155 bool "Amstrad E3 (Delta)" 155 bool "Amstrad E3 (Delta)"
156 depends on ARCH_OMAP1 && ARCH_OMAP15XX 156 depends on ARCH_OMAP1 && ARCH_OMAP15XX
157 select FIQ 157 select FIQ
158 select GPIO_GENERIC_PLATFORM
159 select LEDS_GPIO_REGISTER
158 help 160 help
159 Support for the Amstrad E3 (codename Delta) videophone. Say Y here 161 Support for the Amstrad E3 (codename Delta) videophone. Say Y here
160 if you have such a device. 162 if you have such a device.
diff --git a/arch/arm/mach-omap1/board-ams-delta.c b/arch/arm/mach-omap1/board-ams-delta.c
index 88909cc0b25..87b13039f93 100644
--- a/arch/arm/mach-omap1/board-ams-delta.c
+++ b/arch/arm/mach-omap1/board-ams-delta.c
@@ -11,6 +11,7 @@
11 * it under the terms of the GNU General Public License version 2 as 11 * it under the terms of the GNU General Public License version 2 as
12 * published by the Free Software Foundation. 12 * published by the Free Software Foundation.
13 */ 13 */
14#include <linux/basic_mmio_gpio.h>
14#include <linux/gpio.h> 15#include <linux/gpio.h>
15#include <linux/kernel.h> 16#include <linux/kernel.h>
16#include <linux/init.h> 17#include <linux/init.h>
@@ -40,9 +41,6 @@
40 41
41#include <mach/ams-delta-fiq.h> 42#include <mach/ams-delta-fiq.h>
42 43
43static u8 ams_delta_latch1_reg;
44static u16 ams_delta_latch2_reg;
45
46static const unsigned int ams_delta_keymap[] = { 44static const unsigned int ams_delta_keymap[] = {
47 KEY(0, 0, KEY_F1), /* Advert */ 45 KEY(0, 0, KEY_F1), /* Advert */
48 46
@@ -121,39 +119,32 @@ static const unsigned int ams_delta_keymap[] = {
121 KEY(7, 3, KEY_LEFTCTRL), /* Vol down */ 119 KEY(7, 3, KEY_LEFTCTRL), /* Vol down */
122}; 120};
123 121
124void ams_delta_latch1_write(u8 mask, u8 value) 122#define LATCH1_PHYS 0x01000000
125{ 123#define LATCH1_VIRT 0xEA000000
126 ams_delta_latch1_reg &= ~mask; 124#define MODEM_PHYS 0x04000000
127 ams_delta_latch1_reg |= value; 125#define MODEM_VIRT 0xEB000000
128 *(volatile __u8 *) AMS_DELTA_LATCH1_VIRT = ams_delta_latch1_reg; 126#define LATCH2_PHYS 0x08000000
129} 127#define LATCH2_VIRT 0xEC000000
130
131void ams_delta_latch2_write(u16 mask, u16 value)
132{
133 ams_delta_latch2_reg &= ~mask;
134 ams_delta_latch2_reg |= value;
135 *(volatile __u16 *) AMS_DELTA_LATCH2_VIRT = ams_delta_latch2_reg;
136}
137 128
138static struct map_desc ams_delta_io_desc[] __initdata = { 129static struct map_desc ams_delta_io_desc[] __initdata = {
139 /* AMS_DELTA_LATCH1 */ 130 /* AMS_DELTA_LATCH1 */
140 { 131 {
141 .virtual = AMS_DELTA_LATCH1_VIRT, 132 .virtual = LATCH1_VIRT,
142 .pfn = __phys_to_pfn(AMS_DELTA_LATCH1_PHYS), 133 .pfn = __phys_to_pfn(LATCH1_PHYS),
143 .length = 0x01000000, 134 .length = 0x01000000,
144 .type = MT_DEVICE 135 .type = MT_DEVICE
145 }, 136 },
146 /* AMS_DELTA_LATCH2 */ 137 /* AMS_DELTA_LATCH2 */
147 { 138 {
148 .virtual = AMS_DELTA_LATCH2_VIRT, 139 .virtual = LATCH2_VIRT,
149 .pfn = __phys_to_pfn(AMS_DELTA_LATCH2_PHYS), 140 .pfn = __phys_to_pfn(LATCH2_PHYS),
150 .length = 0x01000000, 141 .length = 0x01000000,
151 .type = MT_DEVICE 142 .type = MT_DEVICE
152 }, 143 },
153 /* AMS_DELTA_MODEM */ 144 /* AMS_DELTA_MODEM */
154 { 145 {
155 .virtual = AMS_DELTA_MODEM_VIRT, 146 .virtual = MODEM_VIRT,
156 .pfn = __phys_to_pfn(AMS_DELTA_MODEM_PHYS), 147 .pfn = __phys_to_pfn(MODEM_PHYS),
157 .length = 0x01000000, 148 .length = 0x01000000,
158 .type = MT_DEVICE 149 .type = MT_DEVICE
159 } 150 }
@@ -173,6 +164,113 @@ static struct omap_board_config_kernel ams_delta_config[] __initdata = {
173 { OMAP_TAG_LCD, &ams_delta_lcd_config }, 164 { OMAP_TAG_LCD, &ams_delta_lcd_config },
174}; 165};
175 166
167#define LATCH1_GPIO_BASE 232
168#define LATCH1_NGPIO 8
169
170static struct resource latch1_resources[] __initconst = {
171 [0] = {
172 .name = "dat",
173 .start = LATCH1_PHYS,
174 .end = LATCH1_PHYS + (LATCH1_NGPIO - 1) / 8,
175 .flags = IORESOURCE_MEM,
176 },
177};
178
179static struct bgpio_pdata latch1_pdata __initconst = {
180 .base = LATCH1_GPIO_BASE,
181 .ngpio = LATCH1_NGPIO,
182};
183
184static struct platform_device latch1_gpio_device = {
185 .name = "basic-mmio-gpio",
186 .id = 0,
187 .resource = latch1_resources,
188 .num_resources = ARRAY_SIZE(latch1_resources),
189 .dev = {
190 .platform_data = &latch1_pdata,
191 },
192};
193
194static struct resource latch2_resources[] __initconst = {
195 [0] = {
196 .name = "dat",
197 .start = LATCH2_PHYS,
198 .end = LATCH2_PHYS + (AMS_DELTA_LATCH2_NGPIO - 1) / 8,
199 .flags = IORESOURCE_MEM,
200 },
201};
202
203static struct bgpio_pdata latch2_pdata __initconst = {
204 .base = AMS_DELTA_LATCH2_GPIO_BASE,
205 .ngpio = AMS_DELTA_LATCH2_NGPIO,
206};
207
208static struct platform_device latch2_gpio_device = {
209 .name = "basic-mmio-gpio",
210 .id = 1,
211 .resource = latch2_resources,
212 .num_resources = ARRAY_SIZE(latch2_resources),
213 .dev = {
214 .platform_data = &latch2_pdata,
215 },
216};
217
218static struct gpio latch_gpios[] __initconst = {
219 {
220 .gpio = LATCH1_GPIO_BASE + 6,
221 .flags = GPIOF_OUT_INIT_LOW,
222 .label = "dockit1",
223 },
224 {
225 .gpio = LATCH1_GPIO_BASE + 7,
226 .flags = GPIOF_OUT_INIT_LOW,
227 .label = "dockit2",
228 },
229 {
230 .gpio = AMS_DELTA_GPIO_PIN_SCARD_RSTIN,
231 .flags = GPIOF_OUT_INIT_LOW,
232 .label = "scard_rstin",
233 },
234 {
235 .gpio = AMS_DELTA_GPIO_PIN_SCARD_CMDVCC,
236 .flags = GPIOF_OUT_INIT_LOW,
237 .label = "scard_cmdvcc",
238 },
239 {
240 .gpio = AMS_DELTA_GPIO_PIN_MODEM_NRESET,
241 .flags = GPIOF_OUT_INIT_LOW,
242 .label = "modem_nreset",
243 },
244 {
245 .gpio = AMS_DELTA_GPIO_PIN_MODEM_CODEC,
246 .flags = GPIOF_OUT_INIT_LOW,
247 .label = "modem_codec",
248 },
249 {
250 .gpio = AMS_DELTA_LATCH2_GPIO_BASE + 14,
251 .flags = GPIOF_OUT_INIT_LOW,
252 .label = "hookflash1",
253 },
254 {
255 .gpio = AMS_DELTA_LATCH2_GPIO_BASE + 15,
256 .flags = GPIOF_OUT_INIT_LOW,
257 .label = "hookflash2",
258 },
259};
260
261void ams_delta_latch_write(int base, int ngpio, u16 mask, u16 value)
262{
263 int bit = 0;
264 u16 bitpos = 1 << bit;
265
266 for (; bit < ngpio; bit++, bitpos = bitpos << 1) {
267 if (!(mask & bitpos))
268 continue;
269 gpio_set_value(base + bit, (value & bitpos) != 0);
270 }
271}
272EXPORT_SYMBOL(ams_delta_latch_write);
273
176static struct resource ams_delta_nand_resources[] = { 274static struct resource ams_delta_nand_resources[] = {
177 [0] = { 275 [0] = {
178 .start = OMAP1_MPUIO_BASE, 276 .start = OMAP1_MPUIO_BASE,
@@ -224,9 +322,45 @@ static struct platform_device ams_delta_lcd_device = {
224 .id = -1, 322 .id = -1,
225}; 323};
226 324
227static struct platform_device ams_delta_led_device = { 325static struct gpio_led gpio_leds[] __initconst = {
228 .name = "ams-delta-led", 326 {
229 .id = -1 327 .name = "camera",
328 .gpio = LATCH1_GPIO_BASE + 0,
329 .default_state = LEDS_GPIO_DEFSTATE_OFF,
330#ifdef CONFIG_LEDS_TRIGGERS
331 .default_trigger = "ams_delta_camera",
332#endif
333 },
334 {
335 .name = "advert",
336 .gpio = LATCH1_GPIO_BASE + 1,
337 .default_state = LEDS_GPIO_DEFSTATE_OFF,
338 },
339 {
340 .name = "email",
341 .gpio = LATCH1_GPIO_BASE + 2,
342 .default_state = LEDS_GPIO_DEFSTATE_OFF,
343 },
344 {
345 .name = "handsfree",
346 .gpio = LATCH1_GPIO_BASE + 3,
347 .default_state = LEDS_GPIO_DEFSTATE_OFF,
348 },
349 {
350 .name = "voicemail",
351 .gpio = LATCH1_GPIO_BASE + 4,
352 .default_state = LEDS_GPIO_DEFSTATE_OFF,
353 },
354 {
355 .name = "voice",
356 .gpio = LATCH1_GPIO_BASE + 5,
357 .default_state = LEDS_GPIO_DEFSTATE_OFF,
358 },
359};
360
361static struct gpio_led_platform_data leds_pdata __initconst = {
362 .leds = gpio_leds,
363 .num_leds = ARRAY_SIZE(gpio_leds),
230}; 364};
231 365
232static struct i2c_board_info ams_delta_camera_board_info[] = { 366static struct i2c_board_info ams_delta_camera_board_info[] = {
@@ -275,13 +409,17 @@ static struct omap1_cam_platform_data ams_delta_camera_platform_data = {
275}; 409};
276 410
277static struct platform_device *ams_delta_devices[] __initdata = { 411static struct platform_device *ams_delta_devices[] __initdata = {
278 &ams_delta_nand_device, 412 &latch1_gpio_device,
413 &latch2_gpio_device,
279 &ams_delta_kp_device, 414 &ams_delta_kp_device,
280 &ams_delta_lcd_device,
281 &ams_delta_led_device,
282 &ams_delta_camera_device, 415 &ams_delta_camera_device,
283}; 416};
284 417
418static struct platform_device *late_devices[] __initconst = {
419 &ams_delta_nand_device,
420 &ams_delta_lcd_device,
421};
422
285static void __init ams_delta_init(void) 423static void __init ams_delta_init(void)
286{ 424{
287 /* mux pins for uarts */ 425 /* mux pins for uarts */
@@ -307,15 +445,13 @@ static void __init ams_delta_init(void)
307 omap_serial_init(); 445 omap_serial_init();
308 omap_register_i2c_bus(1, 100, NULL, 0); 446 omap_register_i2c_bus(1, 100, NULL, 0);
309 447
310 /* Clear latch2 (NAND, LCD, modem enable) */
311 ams_delta_latch2_write(~0, 0);
312
313 omap1_usb_init(&ams_delta_usb_config); 448 omap1_usb_init(&ams_delta_usb_config);
314 omap1_set_camera_info(&ams_delta_camera_platform_data); 449 omap1_set_camera_info(&ams_delta_camera_platform_data);
315#ifdef CONFIG_LEDS_TRIGGERS 450#ifdef CONFIG_LEDS_TRIGGERS
316 led_trigger_register_simple("ams_delta_camera", 451 led_trigger_register_simple("ams_delta_camera",
317 &ams_delta_camera_led_trigger); 452 &ams_delta_camera_led_trigger);
318#endif 453#endif
454 gpio_led_register_device(-1, &leds_pdata);
319 platform_add_devices(ams_delta_devices, ARRAY_SIZE(ams_delta_devices)); 455 platform_add_devices(ams_delta_devices, ARRAY_SIZE(ams_delta_devices));
320 456
321 ams_delta_init_fiq(); 457 ams_delta_init_fiq();
@@ -325,8 +461,8 @@ static void __init ams_delta_init(void)
325 461
326static struct plat_serial8250_port ams_delta_modem_ports[] = { 462static struct plat_serial8250_port ams_delta_modem_ports[] = {
327 { 463 {
328 .membase = IOMEM(AMS_DELTA_MODEM_VIRT), 464 .membase = IOMEM(MODEM_VIRT),
329 .mapbase = AMS_DELTA_MODEM_PHYS, 465 .mapbase = MODEM_PHYS,
330 .irq = -EINVAL, /* changed later */ 466 .irq = -EINVAL, /* changed later */
331 .flags = UPF_BOOT_AUTOCONF, 467 .flags = UPF_BOOT_AUTOCONF,
332 .irqflags = IRQF_TRIGGER_RISING, 468 .irqflags = IRQF_TRIGGER_RISING,
@@ -345,13 +481,21 @@ static struct platform_device ams_delta_modem_device = {
345 }, 481 },
346}; 482};
347 483
348static int __init ams_delta_modem_init(void) 484static int __init late_init(void)
349{ 485{
350 int err; 486 int err;
351 487
352 if (!machine_is_ams_delta()) 488 if (!machine_is_ams_delta())
353 return -ENODEV; 489 return -ENODEV;
354 490
491 err = gpio_request_array(latch_gpios, ARRAY_SIZE(latch_gpios));
492 if (err) {
493 pr_err("Couldn't take over latch1/latch2 GPIO pins\n");
494 return err;
495 }
496
497 platform_add_devices(late_devices, ARRAY_SIZE(late_devices));
498
355 omap_cfg_reg(M14_1510_GPIO2); 499 omap_cfg_reg(M14_1510_GPIO2);
356 ams_delta_modem_ports[0].irq = 500 ams_delta_modem_ports[0].irq =
357 gpio_to_irq(AMS_DELTA_GPIO_PIN_MODEM_IRQ); 501 gpio_to_irq(AMS_DELTA_GPIO_PIN_MODEM_IRQ);
@@ -367,9 +511,16 @@ static int __init ams_delta_modem_init(void)
367 AMS_DELTA_LATCH2_MODEM_NRESET | AMS_DELTA_LATCH2_MODEM_CODEC, 511 AMS_DELTA_LATCH2_MODEM_NRESET | AMS_DELTA_LATCH2_MODEM_CODEC,
368 AMS_DELTA_LATCH2_MODEM_NRESET | AMS_DELTA_LATCH2_MODEM_CODEC); 512 AMS_DELTA_LATCH2_MODEM_NRESET | AMS_DELTA_LATCH2_MODEM_CODEC);
369 513
370 return platform_device_register(&ams_delta_modem_device); 514 err = platform_device_register(&ams_delta_modem_device);
515 if (err)
516 goto gpio_free;
517 return 0;
518
519gpio_free:
520 gpio_free(AMS_DELTA_GPIO_PIN_MODEM_IRQ);
521 return err;
371} 522}
372arch_initcall(ams_delta_modem_init); 523late_initcall(late_init);
373 524
374static void __init ams_delta_map_io(void) 525static void __init ams_delta_map_io(void)
375{ 526{
@@ -388,6 +539,3 @@ MACHINE_START(AMS_DELTA, "Amstrad E3 (Delta)")
388 .timer = &omap1_timer, 539 .timer = &omap1_timer,
389 .restart = omap1_restart, 540 .restart = omap1_restart,
390MACHINE_END 541MACHINE_END
391
392EXPORT_SYMBOL(ams_delta_latch1_write);
393EXPORT_SYMBOL(ams_delta_latch2_write);
diff --git a/arch/arm/plat-omap/include/plat/board-ams-delta.h b/arch/arm/plat-omap/include/plat/board-ams-delta.h
index 51b102dc906..027e79eead5 100644
--- a/arch/arm/plat-omap/include/plat/board-ams-delta.h
+++ b/arch/arm/plat-omap/include/plat/board-ams-delta.h
@@ -28,30 +28,6 @@
28 28
29#if defined (CONFIG_MACH_AMS_DELTA) 29#if defined (CONFIG_MACH_AMS_DELTA)
30 30
31#define AMS_DELTA_LATCH1_PHYS 0x01000000
32#define AMS_DELTA_LATCH1_VIRT 0xEA000000
33#define AMS_DELTA_MODEM_PHYS 0x04000000
34#define AMS_DELTA_MODEM_VIRT 0xEB000000
35#define AMS_DELTA_LATCH2_PHYS 0x08000000
36#define AMS_DELTA_LATCH2_VIRT 0xEC000000
37
38#define AMS_DELTA_LATCH1_LED_CAMERA 0x01
39#define AMS_DELTA_LATCH1_LED_ADVERT 0x02
40#define AMS_DELTA_LATCH1_LED_EMAIL 0x04
41#define AMS_DELTA_LATCH1_LED_HANDSFREE 0x08
42#define AMS_DELTA_LATCH1_LED_VOICEMAIL 0x10
43#define AMS_DELTA_LATCH1_LED_VOICE 0x20
44
45#define AMS_DELTA_LATCH2_LCD_VBLEN 0x0001
46#define AMS_DELTA_LATCH2_LCD_NDISP 0x0002
47#define AMS_DELTA_LATCH2_NAND_NCE 0x0004
48#define AMS_DELTA_LATCH2_NAND_NRE 0x0008
49#define AMS_DELTA_LATCH2_NAND_NWP 0x0010
50#define AMS_DELTA_LATCH2_NAND_NWE 0x0020
51#define AMS_DELTA_LATCH2_NAND_ALE 0x0040
52#define AMS_DELTA_LATCH2_NAND_CLE 0x0080
53#define AMD_DELTA_LATCH2_KEYBRD_PWR 0x0100
54#define AMD_DELTA_LATCH2_KEYBRD_DATA 0x0200
55#define AMD_DELTA_LATCH2_SCARD_RSTIN 0x0400 31#define AMD_DELTA_LATCH2_SCARD_RSTIN 0x0400
56#define AMD_DELTA_LATCH2_SCARD_CMDVCC 0x0800 32#define AMD_DELTA_LATCH2_SCARD_CMDVCC 0x0800
57#define AMS_DELTA_LATCH2_MODEM_NRESET 0x1000 33#define AMS_DELTA_LATCH2_MODEM_NRESET 0x1000
@@ -66,9 +42,29 @@
66#define AMS_DELTA_GPIO_PIN_CONFIG 11 42#define AMS_DELTA_GPIO_PIN_CONFIG 11
67#define AMS_DELTA_GPIO_PIN_NAND_RB 12 43#define AMS_DELTA_GPIO_PIN_NAND_RB 12
68 44
45#define AMS_DELTA_GPIO_PIN_LCD_VBLEN 240
46#define AMS_DELTA_GPIO_PIN_LCD_NDISP 241
47#define AMS_DELTA_GPIO_PIN_NAND_NCE 242
48#define AMS_DELTA_GPIO_PIN_NAND_NRE 243
49#define AMS_DELTA_GPIO_PIN_NAND_NWP 244
50#define AMS_DELTA_GPIO_PIN_NAND_NWE 245
51#define AMS_DELTA_GPIO_PIN_NAND_ALE 246
52#define AMS_DELTA_GPIO_PIN_NAND_CLE 247
53#define AMS_DELTA_GPIO_PIN_KEYBRD_PWR 248
54#define AMS_DELTA_GPIO_PIN_KEYBRD_DATAOUT 249
55#define AMS_DELTA_GPIO_PIN_SCARD_RSTIN 250
56#define AMS_DELTA_GPIO_PIN_SCARD_CMDVCC 251
57#define AMS_DELTA_GPIO_PIN_MODEM_NRESET 252
58#define AMS_DELTA_GPIO_PIN_MODEM_CODEC 253
59
60#define AMS_DELTA_LATCH2_GPIO_BASE AMS_DELTA_GPIO_PIN_LCD_VBLEN
61#define AMS_DELTA_LATCH2_NGPIO 16
62
69#ifndef __ASSEMBLY__ 63#ifndef __ASSEMBLY__
70void ams_delta_latch1_write(u8 mask, u8 value); 64void ams_delta_latch_write(int base, int ngpio, u16 mask, u16 value);
71void ams_delta_latch2_write(u16 mask, u16 value); 65#define ams_delta_latch2_write(mask, value) \
66 ams_delta_latch_write(AMS_DELTA_LATCH2_GPIO_BASE, \
67 AMS_DELTA_LATCH2_NGPIO, (mask), (value))
72#endif 68#endif
73 69
74#endif /* CONFIG_MACH_AMS_DELTA */ 70#endif /* CONFIG_MACH_AMS_DELTA */
diff --git a/drivers/input/serio/ams_delta_serio.c b/drivers/input/serio/ams_delta_serio.c
index d4d08bd9205..0571e2ec358 100644
--- a/drivers/input/serio/ams_delta_serio.c
+++ b/drivers/input/serio/ams_delta_serio.c
@@ -92,8 +92,7 @@ static irqreturn_t ams_delta_serio_interrupt(int irq, void *dev_id)
92static int ams_delta_serio_open(struct serio *serio) 92static int ams_delta_serio_open(struct serio *serio)
93{ 93{
94 /* enable keyboard */ 94 /* enable keyboard */
95 ams_delta_latch2_write(AMD_DELTA_LATCH2_KEYBRD_PWR, 95 gpio_set_value(AMS_DELTA_GPIO_PIN_KEYBRD_PWR, 1);
96 AMD_DELTA_LATCH2_KEYBRD_PWR);
97 96
98 return 0; 97 return 0;
99} 98}
@@ -101,9 +100,32 @@ static int ams_delta_serio_open(struct serio *serio)
101static void ams_delta_serio_close(struct serio *serio) 100static void ams_delta_serio_close(struct serio *serio)
102{ 101{
103 /* disable keyboard */ 102 /* disable keyboard */
104 ams_delta_latch2_write(AMD_DELTA_LATCH2_KEYBRD_PWR, 0); 103 gpio_set_value(AMS_DELTA_GPIO_PIN_KEYBRD_PWR, 0);
105} 104}
106 105
106static struct gpio ams_delta_gpios[] __initconst_or_module = {
107 {
108 .gpio = AMS_DELTA_GPIO_PIN_KEYBRD_DATA,
109 .flags = GPIOF_DIR_IN,
110 .label = "serio-data",
111 },
112 {
113 .gpio = AMS_DELTA_GPIO_PIN_KEYBRD_CLK,
114 .flags = GPIOF_DIR_IN,
115 .label = "serio-clock",
116 },
117 {
118 .gpio = AMS_DELTA_GPIO_PIN_KEYBRD_PWR,
119 .flags = GPIOF_OUT_INIT_LOW,
120 .label = "serio-power",
121 },
122 {
123 .gpio = AMS_DELTA_GPIO_PIN_KEYBRD_DATAOUT,
124 .flags = GPIOF_OUT_INIT_LOW,
125 .label = "serio-dataout",
126 },
127};
128
107static int __init ams_delta_serio_init(void) 129static int __init ams_delta_serio_init(void)
108{ 130{
109 int err; 131 int err;
@@ -123,19 +145,12 @@ static int __init ams_delta_serio_init(void)
123 strlcpy(ams_delta_serio->phys, "GPIO/serio0", 145 strlcpy(ams_delta_serio->phys, "GPIO/serio0",
124 sizeof(ams_delta_serio->phys)); 146 sizeof(ams_delta_serio->phys));
125 147
126 err = gpio_request(AMS_DELTA_GPIO_PIN_KEYBRD_DATA, "serio-data"); 148 err = gpio_request_array(ams_delta_gpios,
149 ARRAY_SIZE(ams_delta_gpios));
127 if (err) { 150 if (err) {
128 pr_err("ams_delta_serio: Couldn't request gpio pin for data\n"); 151 pr_err("ams_delta_serio: Couldn't request gpio pins\n");
129 goto serio; 152 goto serio;
130 } 153 }
131 gpio_direction_input(AMS_DELTA_GPIO_PIN_KEYBRD_DATA);
132
133 err = gpio_request(AMS_DELTA_GPIO_PIN_KEYBRD_CLK, "serio-clock");
134 if (err) {
135 pr_err("ams_delta_serio: couldn't request gpio pin for clock\n");
136 goto gpio_data;
137 }
138 gpio_direction_input(AMS_DELTA_GPIO_PIN_KEYBRD_CLK);
139 154
140 err = request_irq(gpio_to_irq(AMS_DELTA_GPIO_PIN_KEYBRD_CLK), 155 err = request_irq(gpio_to_irq(AMS_DELTA_GPIO_PIN_KEYBRD_CLK),
141 ams_delta_serio_interrupt, IRQ_TYPE_EDGE_RISING, 156 ams_delta_serio_interrupt, IRQ_TYPE_EDGE_RISING,
@@ -143,7 +158,7 @@ static int __init ams_delta_serio_init(void)
143 if (err < 0) { 158 if (err < 0) {
144 pr_err("ams_delta_serio: couldn't request gpio interrupt %d\n", 159 pr_err("ams_delta_serio: couldn't request gpio interrupt %d\n",
145 gpio_to_irq(AMS_DELTA_GPIO_PIN_KEYBRD_CLK)); 160 gpio_to_irq(AMS_DELTA_GPIO_PIN_KEYBRD_CLK));
146 goto gpio_clk; 161 goto gpio;
147 } 162 }
148 /* 163 /*
149 * Since GPIO register handling for keyboard clock pin is performed 164 * Since GPIO register handling for keyboard clock pin is performed
@@ -157,10 +172,9 @@ static int __init ams_delta_serio_init(void)
157 dev_info(&ams_delta_serio->dev, "%s\n", ams_delta_serio->name); 172 dev_info(&ams_delta_serio->dev, "%s\n", ams_delta_serio->name);
158 173
159 return 0; 174 return 0;
160gpio_clk: 175gpio:
161 gpio_free(AMS_DELTA_GPIO_PIN_KEYBRD_CLK); 176 gpio_free_array(ams_delta_gpios,
162gpio_data: 177 ARRAY_SIZE(ams_delta_gpios));
163 gpio_free(AMS_DELTA_GPIO_PIN_KEYBRD_DATA);
164serio: 178serio:
165 kfree(ams_delta_serio); 179 kfree(ams_delta_serio);
166 return err; 180 return err;
@@ -171,7 +185,7 @@ static void __exit ams_delta_serio_exit(void)
171{ 185{
172 serio_unregister_port(ams_delta_serio); 186 serio_unregister_port(ams_delta_serio);
173 free_irq(OMAP_GPIO_IRQ(AMS_DELTA_GPIO_PIN_KEYBRD_CLK), 0); 187 free_irq(OMAP_GPIO_IRQ(AMS_DELTA_GPIO_PIN_KEYBRD_CLK), 0);
174 gpio_free(AMS_DELTA_GPIO_PIN_KEYBRD_CLK); 188 gpio_free_array(ams_delta_gpios,
175 gpio_free(AMS_DELTA_GPIO_PIN_KEYBRD_DATA); 189 ARRAY_SIZE(ams_delta_gpios));
176} 190}
177module_exit(ams_delta_serio_exit); 191module_exit(ams_delta_serio_exit);
diff --git a/drivers/leds/Kconfig b/drivers/leds/Kconfig
index 9ca28fced2b..f5d5c03676f 100644
--- a/drivers/leds/Kconfig
+++ b/drivers/leds/Kconfig
@@ -74,13 +74,6 @@ config LEDS_S3C24XX
74 This option enables support for LEDs connected to GPIO lines 74 This option enables support for LEDs connected to GPIO lines
75 on Samsung S3C24XX series CPUs, such as the S3C2410 and S3C2440. 75 on Samsung S3C24XX series CPUs, such as the S3C2410 and S3C2440.
76 76
77config LEDS_AMS_DELTA
78 tristate "LED Support for the Amstrad Delta (E3)"
79 depends on LEDS_CLASS
80 depends on MACH_AMS_DELTA
81 help
82 This option enables support for the LEDs on Amstrad Delta (E3).
83
84config LEDS_NET48XX 77config LEDS_NET48XX
85 tristate "LED Support for Soekris net48xx series Error LED" 78 tristate "LED Support for Soekris net48xx series Error LED"
86 depends on LEDS_CLASS 79 depends on LEDS_CLASS
diff --git a/drivers/leds/Makefile b/drivers/leds/Makefile
index 1fc6875a8b2..8cab1bb96b5 100644
--- a/drivers/leds/Makefile
+++ b/drivers/leds/Makefile
@@ -12,7 +12,6 @@ obj-$(CONFIG_LEDS_LOCOMO) += leds-locomo.o
12obj-$(CONFIG_LEDS_LM3530) += leds-lm3530.o 12obj-$(CONFIG_LEDS_LM3530) += leds-lm3530.o
13obj-$(CONFIG_LEDS_MIKROTIK_RB532) += leds-rb532.o 13obj-$(CONFIG_LEDS_MIKROTIK_RB532) += leds-rb532.o
14obj-$(CONFIG_LEDS_S3C24XX) += leds-s3c24xx.o 14obj-$(CONFIG_LEDS_S3C24XX) += leds-s3c24xx.o
15obj-$(CONFIG_LEDS_AMS_DELTA) += leds-ams-delta.o
16obj-$(CONFIG_LEDS_NET48XX) += leds-net48xx.o 15obj-$(CONFIG_LEDS_NET48XX) += leds-net48xx.o
17obj-$(CONFIG_LEDS_NET5501) += leds-net5501.o 16obj-$(CONFIG_LEDS_NET5501) += leds-net5501.o
18obj-$(CONFIG_LEDS_WRAP) += leds-wrap.o 17obj-$(CONFIG_LEDS_WRAP) += leds-wrap.o
diff --git a/drivers/leds/leds-ams-delta.c b/drivers/leds/leds-ams-delta.c
deleted file mode 100644
index 07428357c83..00000000000
--- a/drivers/leds/leds-ams-delta.c
+++ /dev/null
@@ -1,126 +0,0 @@
1/*
2 * LEDs driver for Amstrad Delta (E3)
3 *
4 * Copyright (C) 2006 Jonathan McDowell <noodles@earth.li>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 */
10
11#include <linux/module.h>
12#include <linux/kernel.h>
13#include <linux/init.h>
14#include <linux/platform_device.h>
15#include <linux/leds.h>
16#include <plat/board-ams-delta.h>
17
18/*
19 * Our context
20 */
21struct ams_delta_led {
22 struct led_classdev cdev;
23 u8 bitmask;
24};
25
26static void ams_delta_led_set(struct led_classdev *led_cdev,
27 enum led_brightness value)
28{
29 struct ams_delta_led *led_dev =
30 container_of(led_cdev, struct ams_delta_led, cdev);
31
32 if (value)
33 ams_delta_latch1_write(led_dev->bitmask, led_dev->bitmask);
34 else
35 ams_delta_latch1_write(led_dev->bitmask, 0);
36}
37
38static struct ams_delta_led ams_delta_leds[] = {
39 {
40 .cdev = {
41 .name = "ams-delta::camera",
42 .brightness_set = ams_delta_led_set,
43 },
44 .bitmask = AMS_DELTA_LATCH1_LED_CAMERA,
45 },
46 {
47 .cdev = {
48 .name = "ams-delta::advert",
49 .brightness_set = ams_delta_led_set,
50 },
51 .bitmask = AMS_DELTA_LATCH1_LED_ADVERT,
52 },
53 {
54 .cdev = {
55 .name = "ams-delta::email",
56 .brightness_set = ams_delta_led_set,
57 },
58 .bitmask = AMS_DELTA_LATCH1_LED_EMAIL,
59 },
60 {
61 .cdev = {
62 .name = "ams-delta::handsfree",
63 .brightness_set = ams_delta_led_set,
64 },
65 .bitmask = AMS_DELTA_LATCH1_LED_HANDSFREE,
66 },
67 {
68 .cdev = {
69 .name = "ams-delta::voicemail",
70 .brightness_set = ams_delta_led_set,
71 },
72 .bitmask = AMS_DELTA_LATCH1_LED_VOICEMAIL,
73 },
74 {
75 .cdev = {
76 .name = "ams-delta::voice",
77 .brightness_set = ams_delta_led_set,
78 },
79 .bitmask = AMS_DELTA_LATCH1_LED_VOICE,
80 },
81};
82
83static int ams_delta_led_probe(struct platform_device *pdev)
84{
85 int i, ret;
86
87 for (i = 0; i < ARRAY_SIZE(ams_delta_leds); i++) {
88 ams_delta_leds[i].cdev.flags |= LED_CORE_SUSPENDRESUME;
89 ret = led_classdev_register(&pdev->dev,
90 &ams_delta_leds[i].cdev);
91 if (ret < 0)
92 goto fail;
93 }
94
95 return 0;
96fail:
97 while (--i >= 0)
98 led_classdev_unregister(&ams_delta_leds[i].cdev);
99 return ret;
100}
101
102static int ams_delta_led_remove(struct platform_device *pdev)
103{
104 int i;
105
106 for (i = 0; i < ARRAY_SIZE(ams_delta_leds); i++)
107 led_classdev_unregister(&ams_delta_leds[i].cdev);
108
109 return 0;
110}
111
112static struct platform_driver ams_delta_led_driver = {
113 .probe = ams_delta_led_probe,
114 .remove = ams_delta_led_remove,
115 .driver = {
116 .name = "ams-delta-led",
117 .owner = THIS_MODULE,
118 },
119};
120
121module_platform_driver(ams_delta_led_driver);
122
123MODULE_AUTHOR("Jonathan McDowell <noodles@earth.li>");
124MODULE_DESCRIPTION("Amstrad Delta LED driver");
125MODULE_LICENSE("GPL");
126MODULE_ALIAS("platform:ams-delta-led");
diff --git a/drivers/mtd/nand/ams-delta.c b/drivers/mtd/nand/ams-delta.c
index 3197e9764fc..85934dc8546 100644
--- a/drivers/mtd/nand/ams-delta.c
+++ b/drivers/mtd/nand/ams-delta.c
@@ -26,7 +26,7 @@
26#include <asm/io.h> 26#include <asm/io.h>
27#include <mach/hardware.h> 27#include <mach/hardware.h>
28#include <asm/sizes.h> 28#include <asm/sizes.h>
29#include <asm/gpio.h> 29#include <linux/gpio.h>
30#include <plat/board-ams-delta.h> 30#include <plat/board-ams-delta.h>
31 31
32/* 32/*
@@ -34,8 +34,6 @@
34 */ 34 */
35static struct mtd_info *ams_delta_mtd = NULL; 35static struct mtd_info *ams_delta_mtd = NULL;
36 36
37#define NAND_MASK (AMS_DELTA_LATCH2_NAND_NRE | AMS_DELTA_LATCH2_NAND_NWE | AMS_DELTA_LATCH2_NAND_CLE | AMS_DELTA_LATCH2_NAND_ALE | AMS_DELTA_LATCH2_NAND_NCE | AMS_DELTA_LATCH2_NAND_NWP)
38
39/* 37/*
40 * Define partitions for flash devices 38 * Define partitions for flash devices
41 */ 39 */
@@ -68,10 +66,9 @@ static void ams_delta_write_byte(struct mtd_info *mtd, u_char byte)
68 66
69 writew(0, io_base + OMAP_MPUIO_IO_CNTL); 67 writew(0, io_base + OMAP_MPUIO_IO_CNTL);
70 writew(byte, this->IO_ADDR_W); 68 writew(byte, this->IO_ADDR_W);
71 ams_delta_latch2_write(AMS_DELTA_LATCH2_NAND_NWE, 0); 69 gpio_set_value(AMS_DELTA_GPIO_PIN_NAND_NWE, 0);
72 ndelay(40); 70 ndelay(40);
73 ams_delta_latch2_write(AMS_DELTA_LATCH2_NAND_NWE, 71 gpio_set_value(AMS_DELTA_GPIO_PIN_NAND_NWE, 1);
74 AMS_DELTA_LATCH2_NAND_NWE);
75} 72}
76 73
77static u_char ams_delta_read_byte(struct mtd_info *mtd) 74static u_char ams_delta_read_byte(struct mtd_info *mtd)
@@ -80,12 +77,11 @@ static u_char ams_delta_read_byte(struct mtd_info *mtd)
80 struct nand_chip *this = mtd->priv; 77 struct nand_chip *this = mtd->priv;
81 void __iomem *io_base = this->priv; 78 void __iomem *io_base = this->priv;
82 79
83 ams_delta_latch2_write(AMS_DELTA_LATCH2_NAND_NRE, 0); 80 gpio_set_value(AMS_DELTA_GPIO_PIN_NAND_NRE, 0);
84 ndelay(40); 81 ndelay(40);
85 writew(~0, io_base + OMAP_MPUIO_IO_CNTL); 82 writew(~0, io_base + OMAP_MPUIO_IO_CNTL);
86 res = readw(this->IO_ADDR_R); 83 res = readw(this->IO_ADDR_R);
87 ams_delta_latch2_write(AMS_DELTA_LATCH2_NAND_NRE, 84 gpio_set_value(AMS_DELTA_GPIO_PIN_NAND_NRE, 1);
88 AMS_DELTA_LATCH2_NAND_NRE);
89 85
90 return res; 86 return res;
91} 87}
@@ -132,15 +128,12 @@ static void ams_delta_hwcontrol(struct mtd_info *mtd, int cmd,
132{ 128{
133 129
134 if (ctrl & NAND_CTRL_CHANGE) { 130 if (ctrl & NAND_CTRL_CHANGE) {
135 unsigned long bits; 131 gpio_set_value(AMS_DELTA_GPIO_PIN_NAND_NCE,
136 132 (ctrl & NAND_NCE) == 0);
137 bits = (~ctrl & NAND_NCE) ? AMS_DELTA_LATCH2_NAND_NCE : 0; 133 gpio_set_value(AMS_DELTA_GPIO_PIN_NAND_CLE,
138 bits |= (ctrl & NAND_CLE) ? AMS_DELTA_LATCH2_NAND_CLE : 0; 134 (ctrl & NAND_CLE) != 0);
139 bits |= (ctrl & NAND_ALE) ? AMS_DELTA_LATCH2_NAND_ALE : 0; 135 gpio_set_value(AMS_DELTA_GPIO_PIN_NAND_ALE,
140 136 (ctrl & NAND_ALE) != 0);
141 ams_delta_latch2_write(AMS_DELTA_LATCH2_NAND_CLE |
142 AMS_DELTA_LATCH2_NAND_ALE |
143 AMS_DELTA_LATCH2_NAND_NCE, bits);
144 } 137 }
145 138
146 if (cmd != NAND_CMD_NONE) 139 if (cmd != NAND_CMD_NONE)
@@ -152,6 +145,39 @@ static int ams_delta_nand_ready(struct mtd_info *mtd)
152 return gpio_get_value(AMS_DELTA_GPIO_PIN_NAND_RB); 145 return gpio_get_value(AMS_DELTA_GPIO_PIN_NAND_RB);
153} 146}
154 147
148static struct gpio _mandatory_gpio[] __initconst_or_module = {
149 {
150 .gpio = AMS_DELTA_GPIO_PIN_NAND_NCE,
151 .flags = GPIOF_OUT_INIT_HIGH,
152 .label = "nand_nce",
153 },
154 {
155 .gpio = AMS_DELTA_GPIO_PIN_NAND_NRE,
156 .flags = GPIOF_OUT_INIT_HIGH,
157 .label = "nand_nre",
158 },
159 {
160 .gpio = AMS_DELTA_GPIO_PIN_NAND_NWP,
161 .flags = GPIOF_OUT_INIT_HIGH,
162 .label = "nand_nwp",
163 },
164 {
165 .gpio = AMS_DELTA_GPIO_PIN_NAND_NWE,
166 .flags = GPIOF_OUT_INIT_HIGH,
167 .label = "nand_nwe",
168 },
169 {
170 .gpio = AMS_DELTA_GPIO_PIN_NAND_ALE,
171 .flags = GPIOF_OUT_INIT_LOW,
172 .label = "nand_ale",
173 },
174 {
175 .gpio = AMS_DELTA_GPIO_PIN_NAND_CLE,
176 .flags = GPIOF_OUT_INIT_LOW,
177 .label = "nand_cle",
178 },
179};
180
155/* 181/*
156 * Main initialization routine 182 * Main initialization routine
157 */ 183 */
@@ -223,10 +249,9 @@ static int __devinit ams_delta_init(struct platform_device *pdev)
223 platform_set_drvdata(pdev, io_base); 249 platform_set_drvdata(pdev, io_base);
224 250
225 /* Set chip enabled, but */ 251 /* Set chip enabled, but */
226 ams_delta_latch2_write(NAND_MASK, AMS_DELTA_LATCH2_NAND_NRE | 252 err = gpio_request_array(_mandatory_gpio, ARRAY_SIZE(_mandatory_gpio));
227 AMS_DELTA_LATCH2_NAND_NWE | 253 if (err)
228 AMS_DELTA_LATCH2_NAND_NCE | 254 goto out_gpio;
229 AMS_DELTA_LATCH2_NAND_NWP);
230 255
231 /* Scan to find existence of the device */ 256 /* Scan to find existence of the device */
232 if (nand_scan(ams_delta_mtd, 1)) { 257 if (nand_scan(ams_delta_mtd, 1)) {
@@ -241,7 +266,10 @@ static int __devinit ams_delta_init(struct platform_device *pdev)
241 goto out; 266 goto out;
242 267
243 out_mtd: 268 out_mtd:
269 gpio_free_array(_mandatory_gpio, ARRAY_SIZE(_mandatory_gpio));
270out_gpio:
244 platform_set_drvdata(pdev, NULL); 271 platform_set_drvdata(pdev, NULL);
272 gpio_free(AMS_DELTA_GPIO_PIN_NAND_RB);
245 iounmap(io_base); 273 iounmap(io_base);
246out_release_io: 274out_release_io:
247 release_mem_region(res->start, resource_size(res)); 275 release_mem_region(res->start, resource_size(res));
@@ -262,6 +290,8 @@ static int __devexit ams_delta_cleanup(struct platform_device *pdev)
262 /* Release resources, unregister device */ 290 /* Release resources, unregister device */
263 nand_release(ams_delta_mtd); 291 nand_release(ams_delta_mtd);
264 292
293 gpio_free_array(_mandatory_gpio, ARRAY_SIZE(_mandatory_gpio));
294 gpio_free(AMS_DELTA_GPIO_PIN_NAND_RB);
265 iounmap(io_base); 295 iounmap(io_base);
266 release_mem_region(res->start, resource_size(res)); 296 release_mem_region(res->start, resource_size(res));
267 297
diff --git a/drivers/video/omap/lcd_ams_delta.c b/drivers/video/omap/lcd_ams_delta.c
index 0fdd6f6873b..0e71e2898b1 100644
--- a/drivers/video/omap/lcd_ams_delta.c
+++ b/drivers/video/omap/lcd_ams_delta.c
@@ -25,6 +25,7 @@
25#include <linux/io.h> 25#include <linux/io.h>
26#include <linux/delay.h> 26#include <linux/delay.h>
27#include <linux/lcd.h> 27#include <linux/lcd.h>
28#include <linux/gpio.h>
28 29
29#include <plat/board-ams-delta.h> 30#include <plat/board-ams-delta.h>
30#include <mach/hardware.h> 31#include <mach/hardware.h>
@@ -98,29 +99,41 @@ static struct lcd_ops ams_delta_lcd_ops = {
98 99
99/* omapfb panel section */ 100/* omapfb panel section */
100 101
102static struct gpio _gpios[] __initconst_or_module = {
103 {
104 .gpio = AMS_DELTA_GPIO_PIN_LCD_VBLEN,
105 .flags = GPIOF_OUT_INIT_LOW,
106 .label = "lcd_vblen",
107 },
108 {
109 .gpio = AMS_DELTA_GPIO_PIN_LCD_NDISP,
110 .flags = GPIOF_OUT_INIT_LOW,
111 .label = "lcd_ndisp",
112 },
113};
114
101static int ams_delta_panel_init(struct lcd_panel *panel, 115static int ams_delta_panel_init(struct lcd_panel *panel,
102 struct omapfb_device *fbdev) 116 struct omapfb_device *fbdev)
103{ 117{
104 return 0; 118 return gpio_request_array(_gpios, ARRAY_SIZE(_gpios));
105} 119}
106 120
107static void ams_delta_panel_cleanup(struct lcd_panel *panel) 121static void ams_delta_panel_cleanup(struct lcd_panel *panel)
108{ 122{
123 gpio_free_array(_gpios, ARRAY_SIZE(_gpios));
109} 124}
110 125
111static int ams_delta_panel_enable(struct lcd_panel *panel) 126static int ams_delta_panel_enable(struct lcd_panel *panel)
112{ 127{
113 ams_delta_latch2_write(AMS_DELTA_LATCH2_LCD_NDISP, 128 gpio_set_value(AMS_DELTA_GPIO_PIN_LCD_NDISP, 1);
114 AMS_DELTA_LATCH2_LCD_NDISP); 129 gpio_set_value(AMS_DELTA_GPIO_PIN_LCD_VBLEN, 1);
115 ams_delta_latch2_write(AMS_DELTA_LATCH2_LCD_VBLEN,
116 AMS_DELTA_LATCH2_LCD_VBLEN);
117 return 0; 130 return 0;
118} 131}
119 132
120static void ams_delta_panel_disable(struct lcd_panel *panel) 133static void ams_delta_panel_disable(struct lcd_panel *panel)
121{ 134{
122 ams_delta_latch2_write(AMS_DELTA_LATCH2_LCD_VBLEN, 0); 135 gpio_set_value(AMS_DELTA_GPIO_PIN_LCD_VBLEN, 0);
123 ams_delta_latch2_write(AMS_DELTA_LATCH2_LCD_NDISP, 0); 136 gpio_set_value(AMS_DELTA_GPIO_PIN_LCD_NDISP, 0);
124} 137}
125 138
126static unsigned long ams_delta_panel_get_caps(struct lcd_panel *panel) 139static unsigned long ams_delta_panel_get_caps(struct lcd_panel *panel)
diff --git a/sound/soc/omap/ams-delta.c b/sound/soc/omap/ams-delta.c
index a67f4370bc9..da6e005c1c4 100644
--- a/sound/soc/omap/ams-delta.c
+++ b/sound/soc/omap/ams-delta.c
@@ -635,7 +635,7 @@ err:
635 platform_device_put(ams_delta_audio_platform_device); 635 platform_device_put(ams_delta_audio_platform_device);
636 return ret; 636 return ret;
637} 637}
638module_init(ams_delta_module_init); 638late_initcall(ams_delta_module_init);
639 639
640static void __exit ams_delta_module_exit(void) 640static void __exit ams_delta_module_exit(void)
641{ 641{