]>
Commit | Line | Data |
---|---|---|
9b6553cd TL |
1 | /* |
2 | * linux/arch/arm/mach-omap1/board-ams-delta.c | |
3 | * | |
4 | * Modified from board-generic.c | |
5 | * | |
6 | * Board specific inits for the Amstrad E3 (codename Delta) videophone | |
7 | * | |
8 | * Copyright (C) 2006 Jonathan McDowell <noodles@earth.li> | |
9 | * | |
10 | * This program is free software; you can redistribute it and/or modify | |
11 | * it under the terms of the GNU General Public License version 2 as | |
12 | * published by the Free Software Foundation. | |
13 | */ | |
937eb4bb | 14 | #include <linux/basic_mmio_gpio.h> |
2f8163ba | 15 | #include <linux/gpio.h> |
9b6553cd TL |
16 | #include <linux/kernel.h> |
17 | #include <linux/init.h> | |
325d50b6 | 18 | #include <linux/input.h> |
eff443df | 19 | #include <linux/interrupt.h> |
243e76b4 | 20 | #include <linux/leds.h> |
9b6553cd | 21 | #include <linux/platform_device.h> |
eff443df | 22 | #include <linux/serial_8250.h> |
dc28094b | 23 | #include <linux/export.h> |
9b6553cd | 24 | |
8452e9ef JK |
25 | #include <media/soc_camera.h> |
26 | ||
eff443df | 27 | #include <asm/serial.h> |
a09e64fb | 28 | #include <mach/hardware.h> |
9b6553cd TL |
29 | #include <asm/mach-types.h> |
30 | #include <asm/mach/arch.h> | |
31 | #include <asm/mach/map.h> | |
32 | ||
7489ffce | 33 | #include <plat/io.h> |
ce491cf8 | 34 | #include <plat/board-ams-delta.h> |
ce491cf8 TL |
35 | #include <plat/keypad.h> |
36 | #include <plat/mux.h> | |
37 | #include <plat/usb.h> | |
38 | #include <plat/board.h> | |
39 | #include <plat/common.h> | |
8452e9ef | 40 | #include <mach/camera.h> |
9b6553cd | 41 | |
e6f740f5 JK |
42 | #include <mach/ams-delta-fiq.h> |
43 | ||
da1f026b | 44 | static const unsigned int ams_delta_keymap[] = { |
a524626b | 45 | KEY(0, 0, KEY_F1), /* Advert */ |
325d50b6 | 46 | |
da1f026b JK |
47 | KEY(0, 3, KEY_COFFEE), /* Games */ |
48 | KEY(0, 2, KEY_QUESTION), /* Directory */ | |
49 | KEY(2, 3, KEY_CONNECT), /* Internet */ | |
50 | KEY(1, 2, KEY_SHOP), /* Services */ | |
a524626b | 51 | KEY(1, 1, KEY_PHONE), /* VoiceMail */ |
325d50b6 | 52 | |
da1f026b | 53 | KEY(0, 1, KEY_DELETE), /* Delete */ |
a524626b | 54 | KEY(2, 2, KEY_PLAY), /* Play */ |
da1f026b JK |
55 | KEY(1, 0, KEY_PAGEUP), /* Up */ |
56 | KEY(1, 3, KEY_PAGEDOWN), /* Down */ | |
57 | KEY(2, 0, KEY_EMAIL), /* ReadEmail */ | |
58 | KEY(2, 1, KEY_STOP), /* Stop */ | |
325d50b6 JM |
59 | |
60 | /* Numeric keypad portion */ | |
da1f026b JK |
61 | KEY(0, 7, KEY_KP1), |
62 | KEY(0, 6, KEY_KP2), | |
63 | KEY(0, 5, KEY_KP3), | |
64 | KEY(1, 7, KEY_KP4), | |
65 | KEY(1, 6, KEY_KP5), | |
66 | KEY(1, 5, KEY_KP6), | |
67 | KEY(2, 7, KEY_KP7), | |
68 | KEY(2, 6, KEY_KP8), | |
69 | KEY(2, 5, KEY_KP9), | |
70 | KEY(3, 6, KEY_KP0), | |
71 | KEY(3, 7, KEY_KPASTERISK), | |
72 | KEY(3, 5, KEY_KPDOT), /* # key */ | |
73 | KEY(7, 2, KEY_NUMLOCK), /* Mute */ | |
74 | KEY(7, 1, KEY_KPMINUS), /* Recall */ | |
75 | KEY(6, 1, KEY_KPPLUS), /* Redial */ | |
76 | KEY(7, 6, KEY_KPSLASH), /* Handsfree */ | |
77 | KEY(6, 0, KEY_ENTER), /* Video */ | |
78 | ||
79 | KEY(7, 4, KEY_CAMERA), /* Photo */ | |
80 | ||
81 | KEY(0, 4, KEY_F2), /* Home */ | |
82 | KEY(1, 4, KEY_F3), /* Office */ | |
83 | KEY(2, 4, KEY_F4), /* Mobile */ | |
a524626b | 84 | KEY(7, 7, KEY_F5), /* SMS */ |
da1f026b | 85 | KEY(7, 5, KEY_F6), /* Email */ |
325d50b6 JM |
86 | |
87 | /* QWERTY portion of keypad */ | |
da1f026b | 88 | KEY(3, 4, KEY_Q), |
325d50b6 | 89 | KEY(3, 3, KEY_W), |
da1f026b JK |
90 | KEY(3, 2, KEY_E), |
91 | KEY(3, 1, KEY_R), | |
92 | KEY(3, 0, KEY_T), | |
93 | KEY(4, 7, KEY_Y), | |
94 | KEY(4, 6, KEY_U), | |
95 | KEY(4, 5, KEY_I), | |
325d50b6 | 96 | KEY(4, 4, KEY_O), |
da1f026b | 97 | KEY(4, 3, KEY_P), |
325d50b6 | 98 | |
da1f026b JK |
99 | KEY(4, 2, KEY_A), |
100 | KEY(4, 1, KEY_S), | |
101 | KEY(4, 0, KEY_D), | |
102 | KEY(5, 7, KEY_F), | |
103 | KEY(5, 6, KEY_G), | |
325d50b6 | 104 | KEY(5, 5, KEY_H), |
da1f026b JK |
105 | KEY(5, 4, KEY_J), |
106 | KEY(5, 3, KEY_K), | |
107 | KEY(5, 2, KEY_L), | |
325d50b6 | 108 | |
da1f026b JK |
109 | KEY(5, 1, KEY_Z), |
110 | KEY(5, 0, KEY_X), | |
111 | KEY(6, 7, KEY_C), | |
325d50b6 | 112 | KEY(6, 6, KEY_V), |
da1f026b JK |
113 | KEY(6, 5, KEY_B), |
114 | KEY(6, 4, KEY_N), | |
115 | KEY(6, 3, KEY_M), | |
116 | KEY(6, 2, KEY_SPACE), | |
325d50b6 | 117 | |
da1f026b JK |
118 | KEY(7, 0, KEY_LEFTSHIFT), /* Vol up */ |
119 | KEY(7, 3, KEY_LEFTCTRL), /* Vol down */ | |
325d50b6 JM |
120 | }; |
121 | ||
937eb4bb JK |
122 | #define LATCH1_PHYS 0x01000000 |
123 | #define LATCH1_VIRT 0xEA000000 | |
124 | #define MODEM_PHYS 0x04000000 | |
125 | #define MODEM_VIRT 0xEB000000 | |
126 | #define LATCH2_PHYS 0x08000000 | |
127 | #define LATCH2_VIRT 0xEC000000 | |
9b6553cd | 128 | |
9b6553cd | 129 | static struct map_desc ams_delta_io_desc[] __initdata = { |
6e2d4107 | 130 | /* AMS_DELTA_LATCH1 */ |
9b6553cd | 131 | { |
937eb4bb JK |
132 | .virtual = LATCH1_VIRT, |
133 | .pfn = __phys_to_pfn(LATCH1_PHYS), | |
9b6553cd TL |
134 | .length = 0x01000000, |
135 | .type = MT_DEVICE | |
136 | }, | |
6e2d4107 | 137 | /* AMS_DELTA_LATCH2 */ |
9b6553cd | 138 | { |
937eb4bb JK |
139 | .virtual = LATCH2_VIRT, |
140 | .pfn = __phys_to_pfn(LATCH2_PHYS), | |
9b6553cd TL |
141 | .length = 0x01000000, |
142 | .type = MT_DEVICE | |
143 | }, | |
6e2d4107 | 144 | /* AMS_DELTA_MODEM */ |
9b6553cd | 145 | { |
937eb4bb JK |
146 | .virtual = MODEM_VIRT, |
147 | .pfn = __phys_to_pfn(MODEM_PHYS), | |
9b6553cd TL |
148 | .length = 0x01000000, |
149 | .type = MT_DEVICE | |
150 | } | |
151 | }; | |
152 | ||
bdc58fb9 | 153 | static struct omap_lcd_config ams_delta_lcd_config = { |
a524626b TL |
154 | .ctrl_name = "internal", |
155 | }; | |
156 | ||
07116152 JM |
157 | static struct omap_usb_config ams_delta_usb_config __initdata = { |
158 | .register_host = 1, | |
159 | .hmc_mode = 16, | |
160 | .pins[0] = 2, | |
161 | }; | |
162 | ||
a7e2a89a | 163 | static struct omap_board_config_kernel ams_delta_config[] __initdata = { |
a524626b | 164 | { OMAP_TAG_LCD, &ams_delta_lcd_config }, |
9b6553cd TL |
165 | }; |
166 | ||
937eb4bb JK |
167 | static struct resource latch1_resources[] __initconst = { |
168 | [0] = { | |
169 | .name = "dat", | |
170 | .start = LATCH1_PHYS, | |
171 | .end = LATCH1_PHYS + (AMS_DELTA_LATCH1_NGPIO - 1) / 8, | |
172 | .flags = IORESOURCE_MEM, | |
173 | }, | |
174 | }; | |
175 | ||
176 | static struct bgpio_pdata latch1_pdata __initconst = { | |
177 | .base = AMS_DELTA_LATCH1_GPIO_BASE, | |
178 | .ngpio = AMS_DELTA_LATCH1_NGPIO, | |
179 | }; | |
180 | ||
181 | static struct platform_device latch1_gpio_device = { | |
182 | .name = "basic-mmio-gpio", | |
183 | .id = 0, | |
184 | .resource = latch1_resources, | |
185 | .num_resources = ARRAY_SIZE(latch1_resources), | |
186 | .dev = { | |
187 | .platform_data = &latch1_pdata, | |
188 | }, | |
189 | }; | |
190 | ||
191 | static struct resource latch2_resources[] __initconst = { | |
192 | [0] = { | |
193 | .name = "dat", | |
194 | .start = LATCH2_PHYS, | |
195 | .end = LATCH2_PHYS + (AMS_DELTA_LATCH2_NGPIO - 1) / 8, | |
196 | .flags = IORESOURCE_MEM, | |
197 | }, | |
198 | }; | |
199 | ||
200 | static struct bgpio_pdata latch2_pdata __initconst = { | |
201 | .base = AMS_DELTA_LATCH2_GPIO_BASE, | |
202 | .ngpio = AMS_DELTA_LATCH2_NGPIO, | |
203 | }; | |
204 | ||
205 | static struct platform_device latch2_gpio_device = { | |
206 | .name = "basic-mmio-gpio", | |
207 | .id = 1, | |
208 | .resource = latch2_resources, | |
209 | .num_resources = ARRAY_SIZE(latch2_resources), | |
210 | .dev = { | |
211 | .platform_data = &latch2_pdata, | |
212 | }, | |
213 | }; | |
214 | ||
215 | static struct gpio latch_gpios[] __initconst = { | |
216 | { | |
217 | .gpio = AMS_DELTA_GPIO_PIN_LED_CAMERA, | |
218 | .flags = GPIOF_OUT_INIT_LOW, | |
219 | .label = "led_camera", | |
220 | }, | |
221 | { | |
222 | .gpio = AMS_DELTA_GPIO_PIN_LED_ADVERT, | |
223 | .flags = GPIOF_OUT_INIT_LOW, | |
224 | .label = "led_advert", | |
225 | }, | |
226 | { | |
227 | .gpio = AMS_DELTA_GPIO_PIN_LED_EMAIL, | |
228 | .flags = GPIOF_OUT_INIT_LOW, | |
229 | .label = "led_email", | |
230 | }, | |
231 | { | |
232 | .gpio = AMS_DELTA_GPIO_PIN_LED_HANDSFREE, | |
233 | .flags = GPIOF_OUT_INIT_LOW, | |
234 | .label = "led_handsfree", | |
235 | }, | |
236 | { | |
237 | .gpio = AMS_DELTA_GPIO_PIN_LED_VOICEMAIL, | |
238 | .flags = GPIOF_OUT_INIT_LOW, | |
239 | .label = "led_voicemail", | |
240 | }, | |
241 | { | |
242 | .gpio = AMS_DELTA_GPIO_PIN_LED_VOICE, | |
243 | .flags = GPIOF_OUT_INIT_LOW, | |
244 | .label = "led_voice", | |
245 | }, | |
246 | { | |
247 | .gpio = AMS_DELTA_LATCH1_GPIO_BASE + 6, | |
248 | .flags = GPIOF_OUT_INIT_LOW, | |
249 | .label = "dockit1", | |
250 | }, | |
251 | { | |
252 | .gpio = AMS_DELTA_LATCH1_GPIO_BASE + 7, | |
253 | .flags = GPIOF_OUT_INIT_LOW, | |
254 | .label = "dockit2", | |
255 | }, | |
256 | { | |
257 | .gpio = AMS_DELTA_GPIO_PIN_LCD_VBLEN, | |
258 | .flags = GPIOF_OUT_INIT_LOW, | |
259 | .label = "lcd_vblen", | |
260 | }, | |
261 | { | |
262 | .gpio = AMS_DELTA_GPIO_PIN_LCD_NDISP, | |
263 | .flags = GPIOF_OUT_INIT_LOW, | |
264 | .label = "lcd_ndisp", | |
265 | }, | |
266 | { | |
267 | .gpio = AMS_DELTA_GPIO_PIN_NAND_NCE, | |
268 | .flags = GPIOF_OUT_INIT_LOW, | |
269 | .label = "nand_nce", | |
270 | }, | |
271 | { | |
272 | .gpio = AMS_DELTA_GPIO_PIN_NAND_NRE, | |
273 | .flags = GPIOF_OUT_INIT_LOW, | |
274 | .label = "nand_nre", | |
275 | }, | |
276 | { | |
277 | .gpio = AMS_DELTA_GPIO_PIN_NAND_NWP, | |
278 | .flags = GPIOF_OUT_INIT_LOW, | |
279 | .label = "nand_nwp", | |
280 | }, | |
281 | { | |
282 | .gpio = AMS_DELTA_GPIO_PIN_NAND_NWE, | |
283 | .flags = GPIOF_OUT_INIT_LOW, | |
284 | .label = "nand_nwe", | |
285 | }, | |
286 | { | |
287 | .gpio = AMS_DELTA_GPIO_PIN_NAND_ALE, | |
288 | .flags = GPIOF_OUT_INIT_LOW, | |
289 | .label = "nand_ale", | |
290 | }, | |
291 | { | |
292 | .gpio = AMS_DELTA_GPIO_PIN_NAND_CLE, | |
293 | .flags = GPIOF_OUT_INIT_LOW, | |
294 | .label = "nand_cle", | |
295 | }, | |
296 | { | |
297 | .gpio = AMS_DELTA_GPIO_PIN_KEYBRD_PWR, | |
298 | .flags = GPIOF_OUT_INIT_LOW, | |
299 | .label = "keybrd_pwr", | |
300 | }, | |
301 | { | |
302 | .gpio = AMS_DELTA_GPIO_PIN_KEYBRD_DATAOUT, | |
303 | .flags = GPIOF_OUT_INIT_LOW, | |
304 | .label = "keybrd_dataout", | |
305 | }, | |
306 | { | |
307 | .gpio = AMS_DELTA_GPIO_PIN_SCARD_RSTIN, | |
308 | .flags = GPIOF_OUT_INIT_LOW, | |
309 | .label = "scard_rstin", | |
310 | }, | |
311 | { | |
312 | .gpio = AMS_DELTA_GPIO_PIN_SCARD_CMDVCC, | |
313 | .flags = GPIOF_OUT_INIT_LOW, | |
314 | .label = "scard_cmdvcc", | |
315 | }, | |
316 | { | |
317 | .gpio = AMS_DELTA_GPIO_PIN_MODEM_NRESET, | |
318 | .flags = GPIOF_OUT_INIT_LOW, | |
319 | .label = "modem_nreset", | |
320 | }, | |
321 | { | |
322 | .gpio = AMS_DELTA_GPIO_PIN_MODEM_CODEC, | |
323 | .flags = GPIOF_OUT_INIT_LOW, | |
324 | .label = "modem_codec", | |
325 | }, | |
326 | { | |
327 | .gpio = AMS_DELTA_LATCH2_GPIO_BASE + 14, | |
328 | .flags = GPIOF_OUT_INIT_LOW, | |
329 | .label = "hookflash1", | |
330 | }, | |
331 | { | |
332 | .gpio = AMS_DELTA_LATCH2_GPIO_BASE + 15, | |
333 | .flags = GPIOF_OUT_INIT_LOW, | |
334 | .label = "hookflash2", | |
335 | }, | |
336 | }; | |
337 | ||
338 | void ams_delta_latch_write(int base, int ngpio, u16 mask, u16 value) | |
339 | { | |
340 | int bit = 0; | |
341 | u16 bitpos = 1 << bit; | |
342 | ||
343 | for (; bit < ngpio; bit++, bitpos = bitpos << 1) { | |
344 | if (!(mask & bitpos)) | |
345 | continue; | |
346 | gpio_set_value(base + bit, (value & bitpos) != 0); | |
347 | } | |
348 | } | |
349 | EXPORT_SYMBOL(ams_delta_latch_write); | |
350 | ||
eaca491f JK |
351 | static struct resource ams_delta_nand_resources[] = { |
352 | [0] = { | |
353 | .start = OMAP1_MPUIO_BASE, | |
354 | .end = OMAP1_MPUIO_BASE + | |
355 | OMAP_MPUIO_IO_CNTL + sizeof(u32) - 1, | |
356 | .flags = IORESOURCE_MEM, | |
357 | }, | |
358 | }; | |
359 | ||
7e95d1f1 JK |
360 | static struct platform_device ams_delta_nand_device = { |
361 | .name = "ams-delta-nand", | |
eaca491f JK |
362 | .id = -1, |
363 | .num_resources = ARRAY_SIZE(ams_delta_nand_resources), | |
364 | .resource = ams_delta_nand_resources, | |
7e95d1f1 JK |
365 | }; |
366 | ||
325d50b6 JM |
367 | static struct resource ams_delta_kp_resources[] = { |
368 | [0] = { | |
369 | .start = INT_KEYBOARD, | |
370 | .end = INT_KEYBOARD, | |
371 | .flags = IORESOURCE_IRQ, | |
372 | }, | |
373 | }; | |
374 | ||
da1f026b JK |
375 | static const struct matrix_keymap_data ams_delta_keymap_data = { |
376 | .keymap = ams_delta_keymap, | |
377 | .keymap_size = ARRAY_SIZE(ams_delta_keymap), | |
378 | }; | |
379 | ||
bdc58fb9 | 380 | static struct omap_kp_platform_data ams_delta_kp_data __initdata = { |
325d50b6 JM |
381 | .rows = 8, |
382 | .cols = 8, | |
da1f026b | 383 | .keymap_data = &ams_delta_keymap_data, |
325d50b6 JM |
384 | .delay = 9, |
385 | }; | |
386 | ||
07ad6ab3 | 387 | static struct platform_device ams_delta_kp_device = { |
325d50b6 JM |
388 | .name = "omap-keypad", |
389 | .id = -1, | |
390 | .dev = { | |
391 | .platform_data = &ams_delta_kp_data, | |
392 | }, | |
393 | .num_resources = ARRAY_SIZE(ams_delta_kp_resources), | |
394 | .resource = ams_delta_kp_resources, | |
395 | }; | |
396 | ||
07ad6ab3 | 397 | static struct platform_device ams_delta_lcd_device = { |
a524626b TL |
398 | .name = "lcd_ams_delta", |
399 | .id = -1, | |
400 | }; | |
401 | ||
07ad6ab3 | 402 | static struct platform_device ams_delta_led_device = { |
9becde79 JM |
403 | .name = "ams-delta-led", |
404 | .id = -1 | |
405 | }; | |
406 | ||
8452e9ef JK |
407 | static struct i2c_board_info ams_delta_camera_board_info[] = { |
408 | { | |
409 | I2C_BOARD_INFO("ov6650", 0x60), | |
410 | }, | |
411 | }; | |
412 | ||
243e76b4 JK |
413 | #ifdef CONFIG_LEDS_TRIGGERS |
414 | DEFINE_LED_TRIGGER(ams_delta_camera_led_trigger); | |
415 | ||
416 | static int ams_delta_camera_power(struct device *dev, int power) | |
417 | { | |
418 | /* | |
419 | * turn on camera LED | |
420 | */ | |
421 | if (power) | |
422 | led_trigger_event(ams_delta_camera_led_trigger, LED_FULL); | |
423 | else | |
424 | led_trigger_event(ams_delta_camera_led_trigger, LED_OFF); | |
425 | return 0; | |
426 | } | |
427 | #else | |
428 | #define ams_delta_camera_power NULL | |
429 | #endif | |
430 | ||
a7e2a89a | 431 | static struct soc_camera_link ams_delta_iclink = { |
8452e9ef JK |
432 | .bus_id = 0, /* OMAP1 SoC camera bus */ |
433 | .i2c_adapter_id = 1, | |
434 | .board_info = &ams_delta_camera_board_info[0], | |
435 | .module_name = "ov6650", | |
243e76b4 | 436 | .power = ams_delta_camera_power, |
8452e9ef JK |
437 | }; |
438 | ||
07ad6ab3 | 439 | static struct platform_device ams_delta_camera_device = { |
8452e9ef JK |
440 | .name = "soc-camera-pdrv", |
441 | .id = 0, | |
442 | .dev = { | |
443 | .platform_data = &ams_delta_iclink, | |
444 | }, | |
445 | }; | |
446 | ||
447 | static struct omap1_cam_platform_data ams_delta_camera_platform_data = { | |
448 | .camexclk_khz = 12000, /* default 12MHz clock, no extra DPLL */ | |
449 | .lclk_khz_max = 1334, /* results in 5fps CIF, 10fps QCIF */ | |
450 | }; | |
451 | ||
9becde79 | 452 | static struct platform_device *ams_delta_devices[] __initdata = { |
937eb4bb JK |
453 | &latch1_gpio_device, |
454 | &latch2_gpio_device, | |
325d50b6 | 455 | &ams_delta_kp_device, |
f7519d8c JK |
456 | &ams_delta_camera_device, |
457 | }; | |
458 | ||
937eb4bb | 459 | static struct platform_device *late_devices[] __initconst = { |
f7519d8c | 460 | &ams_delta_nand_device, |
a524626b | 461 | &ams_delta_lcd_device, |
9becde79 JM |
462 | &ams_delta_led_device, |
463 | }; | |
464 | ||
9b6553cd TL |
465 | static void __init ams_delta_init(void) |
466 | { | |
c33da3a8 JK |
467 | /* mux pins for uarts */ |
468 | omap_cfg_reg(UART1_TX); | |
469 | omap_cfg_reg(UART1_RTS); | |
470 | ||
8452e9ef JK |
471 | /* parallel camera interface */ |
472 | omap_cfg_reg(H19_1610_CAM_EXCLK); | |
473 | omap_cfg_reg(J15_1610_CAM_LCLK); | |
474 | omap_cfg_reg(L18_1610_CAM_VS); | |
475 | omap_cfg_reg(L15_1610_CAM_HS); | |
476 | omap_cfg_reg(L19_1610_CAM_D0); | |
477 | omap_cfg_reg(K14_1610_CAM_D1); | |
478 | omap_cfg_reg(K15_1610_CAM_D2); | |
479 | omap_cfg_reg(K19_1610_CAM_D3); | |
480 | omap_cfg_reg(K18_1610_CAM_D4); | |
481 | omap_cfg_reg(J14_1610_CAM_D5); | |
482 | omap_cfg_reg(J19_1610_CAM_D6); | |
483 | omap_cfg_reg(J18_1610_CAM_D7); | |
484 | ||
9b6553cd TL |
485 | omap_board_config = ams_delta_config; |
486 | omap_board_config_size = ARRAY_SIZE(ams_delta_config); | |
487 | omap_serial_init(); | |
1ed16a86 | 488 | omap_register_i2c_bus(1, 100, NULL, 0); |
9b6553cd | 489 | |
dd0cdd88 | 490 | omap1_usb_init(&ams_delta_usb_config); |
8452e9ef | 491 | omap1_set_camera_info(&ams_delta_camera_platform_data); |
243e76b4 JK |
492 | #ifdef CONFIG_LEDS_TRIGGERS |
493 | led_trigger_register_simple("ams_delta_camera", | |
494 | &ams_delta_camera_led_trigger); | |
495 | #endif | |
9becde79 | 496 | platform_add_devices(ams_delta_devices, ARRAY_SIZE(ams_delta_devices)); |
b3dba0b8 | 497 | |
e6f740f5 | 498 | ams_delta_init_fiq(); |
e6f740f5 | 499 | |
b3dba0b8 | 500 | omap_writew(omap_readw(ARM_RSTCT1) | 0x0004, ARM_RSTCT1); |
9b6553cd TL |
501 | } |
502 | ||
eff443df JK |
503 | static struct plat_serial8250_port ams_delta_modem_ports[] = { |
504 | { | |
937eb4bb JK |
505 | .membase = IOMEM(MODEM_VIRT), |
506 | .mapbase = MODEM_PHYS, | |
eff443df JK |
507 | .irq = -EINVAL, /* changed later */ |
508 | .flags = UPF_BOOT_AUTOCONF, | |
509 | .irqflags = IRQF_TRIGGER_RISING, | |
510 | .iotype = UPIO_MEM, | |
511 | .regshift = 1, | |
512 | .uartclk = BASE_BAUD * 16, | |
513 | }, | |
514 | { }, | |
515 | }; | |
516 | ||
517 | static struct platform_device ams_delta_modem_device = { | |
518 | .name = "serial8250", | |
519 | .id = PLAT8250_DEV_PLATFORM1, | |
520 | .dev = { | |
521 | .platform_data = ams_delta_modem_ports, | |
522 | }, | |
523 | }; | |
524 | ||
f7519d8c | 525 | static int __init late_init(void) |
eff443df | 526 | { |
4cb2dc67 JK |
527 | int err; |
528 | ||
7f9187c2 TL |
529 | if (!machine_is_ams_delta()) |
530 | return -ENODEV; | |
531 | ||
937eb4bb JK |
532 | err = gpio_request_array(latch_gpios, ARRAY_SIZE(latch_gpios)); |
533 | if (err) { | |
534 | pr_err("Couldn't take over latch1/latch2 GPIO pins\n"); | |
535 | return err; | |
536 | } | |
f7519d8c JK |
537 | |
538 | platform_add_devices(late_devices, ARRAY_SIZE(late_devices)); | |
539 | ||
eff443df | 540 | omap_cfg_reg(M14_1510_GPIO2); |
4cb2dc67 JK |
541 | ams_delta_modem_ports[0].irq = |
542 | gpio_to_irq(AMS_DELTA_GPIO_PIN_MODEM_IRQ); | |
543 | ||
544 | err = gpio_request(AMS_DELTA_GPIO_PIN_MODEM_IRQ, "modem"); | |
545 | if (err) { | |
546 | pr_err("Couldn't request gpio pin for modem\n"); | |
547 | return err; | |
548 | } | |
549 | gpio_direction_input(AMS_DELTA_GPIO_PIN_MODEM_IRQ); | |
eff443df JK |
550 | |
551 | ams_delta_latch2_write( | |
552 | AMS_DELTA_LATCH2_MODEM_NRESET | AMS_DELTA_LATCH2_MODEM_CODEC, | |
553 | AMS_DELTA_LATCH2_MODEM_NRESET | AMS_DELTA_LATCH2_MODEM_CODEC); | |
554 | ||
f7519d8c JK |
555 | err = platform_device_register(&ams_delta_modem_device); |
556 | if (err) | |
557 | goto gpio_free; | |
558 | return 0; | |
559 | ||
560 | gpio_free: | |
561 | gpio_free(AMS_DELTA_GPIO_PIN_MODEM_IRQ); | |
562 | return err; | |
eff443df | 563 | } |
f7519d8c | 564 | late_initcall(late_init); |
eff443df | 565 | |
5bb01a99 TL |
566 | static void __init ams_delta_map_io(void) |
567 | { | |
568 | omap15xx_map_io(); | |
569 | iotable_init(ams_delta_io_desc, ARRAY_SIZE(ams_delta_io_desc)); | |
570 | } | |
571 | ||
9b6553cd TL |
572 | MACHINE_START(AMS_DELTA, "Amstrad E3 (Delta)") |
573 | /* Maintainer: Jonathan McDowell <noodles@earth.li> */ | |
246e389d | 574 | .atag_offset = 0x100, |
5bb01a99 | 575 | .map_io = ams_delta_map_io, |
7b88e62f | 576 | .init_early = omap1_init_early, |
71ee7dad | 577 | .reserve = omap_reserve, |
7b88e62f | 578 | .init_irq = omap1_init_irq, |
9b6553cd | 579 | .init_machine = ams_delta_init, |
e74984e4 | 580 | .timer = &omap1_timer, |
9b6553cd | 581 | MACHINE_END |