1
2
3
4
5
6
7
8
9
10
11#include <linux/gpio/driver.h>
12#include <linux/gpio/machine.h>
13#include <linux/gpio.h>
14#include <linux/kernel.h>
15#include <linux/init.h>
16#include <linux/input.h>
17#include <linux/interrupt.h>
18#include <linux/leds.h>
19#include <linux/platform_device.h>
20#include <linux/regulator/consumer.h>
21#include <linux/regulator/fixed.h>
22#include <linux/regulator/machine.h>
23#include <linux/serial_8250.h>
24#include <linux/export.h>
25#include <linux/omapfb.h>
26#include <linux/io.h>
27#include <linux/platform_data/gpio-omap.h>
28
29#include <media/soc_camera.h>
30
31#include <asm/serial.h>
32#include <asm/mach-types.h>
33#include <asm/mach/arch.h>
34#include <asm/mach/map.h>
35
36#include <linux/platform_data/keypad-omap.h>
37#include <mach/mux.h>
38
39#include <mach/hardware.h>
40#include "camera.h"
41#include <mach/usb.h>
42
43#include "ams-delta-fiq.h"
44#include "board-ams-delta.h"
45#include "iomap.h"
46#include "common.h"
47
48static const unsigned int ams_delta_keymap[] = {
49 KEY(0, 0, KEY_F1),
50
51 KEY(0, 3, KEY_COFFEE),
52 KEY(0, 2, KEY_QUESTION),
53 KEY(2, 3, KEY_CONNECT),
54 KEY(1, 2, KEY_SHOP),
55 KEY(1, 1, KEY_PHONE),
56
57 KEY(0, 1, KEY_DELETE),
58 KEY(2, 2, KEY_PLAY),
59 KEY(1, 0, KEY_PAGEUP),
60 KEY(1, 3, KEY_PAGEDOWN),
61 KEY(2, 0, KEY_EMAIL),
62 KEY(2, 1, KEY_STOP),
63
64
65 KEY(0, 7, KEY_KP1),
66 KEY(0, 6, KEY_KP2),
67 KEY(0, 5, KEY_KP3),
68 KEY(1, 7, KEY_KP4),
69 KEY(1, 6, KEY_KP5),
70 KEY(1, 5, KEY_KP6),
71 KEY(2, 7, KEY_KP7),
72 KEY(2, 6, KEY_KP8),
73 KEY(2, 5, KEY_KP9),
74 KEY(3, 6, KEY_KP0),
75 KEY(3, 7, KEY_KPASTERISK),
76 KEY(3, 5, KEY_KPDOT),
77 KEY(7, 2, KEY_NUMLOCK),
78 KEY(7, 1, KEY_KPMINUS),
79 KEY(6, 1, KEY_KPPLUS),
80 KEY(7, 6, KEY_KPSLASH),
81 KEY(6, 0, KEY_ENTER),
82
83 KEY(7, 4, KEY_CAMERA),
84
85 KEY(0, 4, KEY_F2),
86 KEY(1, 4, KEY_F3),
87 KEY(2, 4, KEY_F4),
88 KEY(7, 7, KEY_F5),
89 KEY(7, 5, KEY_F6),
90
91
92 KEY(3, 4, KEY_Q),
93 KEY(3, 3, KEY_W),
94 KEY(3, 2, KEY_E),
95 KEY(3, 1, KEY_R),
96 KEY(3, 0, KEY_T),
97 KEY(4, 7, KEY_Y),
98 KEY(4, 6, KEY_U),
99 KEY(4, 5, KEY_I),
100 KEY(4, 4, KEY_O),
101 KEY(4, 3, KEY_P),
102
103 KEY(4, 2, KEY_A),
104 KEY(4, 1, KEY_S),
105 KEY(4, 0, KEY_D),
106 KEY(5, 7, KEY_F),
107 KEY(5, 6, KEY_G),
108 KEY(5, 5, KEY_H),
109 KEY(5, 4, KEY_J),
110 KEY(5, 3, KEY_K),
111 KEY(5, 2, KEY_L),
112
113 KEY(5, 1, KEY_Z),
114 KEY(5, 0, KEY_X),
115 KEY(6, 7, KEY_C),
116 KEY(6, 6, KEY_V),
117 KEY(6, 5, KEY_B),
118 KEY(6, 4, KEY_N),
119 KEY(6, 3, KEY_M),
120 KEY(6, 2, KEY_SPACE),
121
122 KEY(7, 0, KEY_LEFTSHIFT),
123 KEY(7, 3, KEY_LEFTCTRL),
124};
125
126#define LATCH1_PHYS 0x01000000
127#define LATCH1_VIRT 0xEA000000
128#define MODEM_PHYS 0x04000000
129#define MODEM_VIRT 0xEB000000
130#define LATCH2_PHYS 0x08000000
131#define LATCH2_VIRT 0xEC000000
132
133static struct map_desc ams_delta_io_desc[] __initdata = {
134
135 {
136 .virtual = LATCH1_VIRT,
137 .pfn = __phys_to_pfn(LATCH1_PHYS),
138 .length = 0x01000000,
139 .type = MT_DEVICE
140 },
141
142 {
143 .virtual = LATCH2_VIRT,
144 .pfn = __phys_to_pfn(LATCH2_PHYS),
145 .length = 0x01000000,
146 .type = MT_DEVICE
147 },
148
149 {
150 .virtual = MODEM_VIRT,
151 .pfn = __phys_to_pfn(MODEM_PHYS),
152 .length = 0x01000000,
153 .type = MT_DEVICE
154 }
155};
156
157static const struct omap_lcd_config ams_delta_lcd_config __initconst = {
158 .ctrl_name = "internal",
159};
160
161static struct omap_usb_config ams_delta_usb_config __initdata = {
162 .register_host = 1,
163 .hmc_mode = 16,
164 .pins[0] = 2,
165};
166
167#define LATCH1_NGPIO 8
168
169static struct resource latch1_resources[] = {
170 [0] = {
171 .name = "dat",
172 .start = LATCH1_PHYS,
173 .end = LATCH1_PHYS + (LATCH1_NGPIO - 1) / 8,
174 .flags = IORESOURCE_MEM,
175 },
176};
177
178#define LATCH1_LABEL "latch1"
179
180static struct bgpio_pdata latch1_pdata = {
181 .label = LATCH1_LABEL,
182 .base = -1,
183 .ngpio = LATCH1_NGPIO,
184};
185
186static struct platform_device latch1_gpio_device = {
187 .name = "basic-mmio-gpio",
188 .id = 0,
189 .resource = latch1_resources,
190 .num_resources = ARRAY_SIZE(latch1_resources),
191 .dev = {
192 .platform_data = &latch1_pdata,
193 },
194};
195
196#define LATCH1_PIN_LED_CAMERA 0
197#define LATCH1_PIN_LED_ADVERT 1
198#define LATCH1_PIN_LED_MAIL 2
199#define LATCH1_PIN_LED_HANDSFREE 3
200#define LATCH1_PIN_LED_VOICEMAIL 4
201#define LATCH1_PIN_LED_VOICE 5
202#define LATCH1_PIN_DOCKIT1 6
203#define LATCH1_PIN_DOCKIT2 7
204
205#define LATCH2_NGPIO 16
206
207static struct resource latch2_resources[] = {
208 [0] = {
209 .name = "dat",
210 .start = LATCH2_PHYS,
211 .end = LATCH2_PHYS + (LATCH2_NGPIO - 1) / 8,
212 .flags = IORESOURCE_MEM,
213 },
214};
215
216#define LATCH2_LABEL "latch2"
217
218static struct bgpio_pdata latch2_pdata = {
219 .label = LATCH2_LABEL,
220 .base = -1,
221 .ngpio = LATCH2_NGPIO,
222};
223
224static struct platform_device latch2_gpio_device = {
225 .name = "basic-mmio-gpio",
226 .id = 1,
227 .resource = latch2_resources,
228 .num_resources = ARRAY_SIZE(latch2_resources),
229 .dev = {
230 .platform_data = &latch2_pdata,
231 },
232};
233
234#define LATCH2_PIN_LCD_VBLEN 0
235#define LATCH2_PIN_LCD_NDISP 1
236#define LATCH2_PIN_NAND_NCE 2
237#define LATCH2_PIN_NAND_NRE 3
238#define LATCH2_PIN_NAND_NWP 4
239#define LATCH2_PIN_NAND_NWE 5
240#define LATCH2_PIN_NAND_ALE 6
241#define LATCH2_PIN_NAND_CLE 7
242#define LATCH2_PIN_KEYBRD_PWR 8
243#define LATCH2_PIN_KEYBRD_DATAOUT 9
244#define LATCH2_PIN_SCARD_RSTIN 10
245#define LATCH2_PIN_SCARD_CMDVCC 11
246#define LATCH2_PIN_MODEM_NRESET 12
247#define LATCH2_PIN_MODEM_CODEC 13
248#define LATCH2_PIN_AUDIO_MUTE 14
249#define LATCH2_PIN_HOOKFLASH 15
250
251static struct regulator_consumer_supply modem_nreset_consumers[] = {
252 REGULATOR_SUPPLY("RESET#", "serial8250.1"),
253 REGULATOR_SUPPLY("POR", "cx20442-codec"),
254};
255
256static struct regulator_init_data modem_nreset_data = {
257 .constraints = {
258 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
259 .boot_on = 1,
260 },
261 .num_consumer_supplies = ARRAY_SIZE(modem_nreset_consumers),
262 .consumer_supplies = modem_nreset_consumers,
263};
264
265static struct fixed_voltage_config modem_nreset_config = {
266 .supply_name = "modem_nreset",
267 .microvolts = 3300000,
268 .startup_delay = 25000,
269 .enabled_at_boot = 1,
270 .init_data = &modem_nreset_data,
271};
272
273static struct platform_device modem_nreset_device = {
274 .name = "reg-fixed-voltage",
275 .id = -1,
276 .dev = {
277 .platform_data = &modem_nreset_config,
278 },
279};
280
281static struct gpiod_lookup_table ams_delta_nreset_gpiod_table = {
282 .dev_id = "reg-fixed-voltage",
283 .table = {
284 GPIO_LOOKUP(LATCH2_LABEL, LATCH2_PIN_MODEM_NRESET,
285 NULL, GPIO_ACTIVE_HIGH),
286 { },
287 },
288};
289
290struct modem_private_data {
291 struct regulator *regulator;
292};
293
294static struct modem_private_data modem_priv;
295
296static struct platform_device ams_delta_nand_device = {
297 .name = "ams-delta-nand",
298 .id = -1,
299};
300
301#define OMAP_GPIO_LABEL "gpio-0-15"
302#define OMAP_MPUIO_LABEL "mpuio"
303
304static struct gpiod_lookup_table ams_delta_nand_gpio_table = {
305 .table = {
306 GPIO_LOOKUP(OMAP_GPIO_LABEL, AMS_DELTA_GPIO_PIN_NAND_RB, "rdy",
307 0),
308 GPIO_LOOKUP(LATCH2_LABEL, LATCH2_PIN_NAND_NCE, "nce", 0),
309 GPIO_LOOKUP(LATCH2_LABEL, LATCH2_PIN_NAND_NRE, "nre", 0),
310 GPIO_LOOKUP(LATCH2_LABEL, LATCH2_PIN_NAND_NWP, "nwp", 0),
311 GPIO_LOOKUP(LATCH2_LABEL, LATCH2_PIN_NAND_NWE, "nwe", 0),
312 GPIO_LOOKUP(LATCH2_LABEL, LATCH2_PIN_NAND_ALE, "ale", 0),
313 GPIO_LOOKUP(LATCH2_LABEL, LATCH2_PIN_NAND_CLE, "cle", 0),
314 GPIO_LOOKUP_IDX(OMAP_MPUIO_LABEL, 0, "data", 0, 0),
315 GPIO_LOOKUP_IDX(OMAP_MPUIO_LABEL, 1, "data", 1, 0),
316 GPIO_LOOKUP_IDX(OMAP_MPUIO_LABEL, 2, "data", 2, 0),
317 GPIO_LOOKUP_IDX(OMAP_MPUIO_LABEL, 3, "data", 3, 0),
318 GPIO_LOOKUP_IDX(OMAP_MPUIO_LABEL, 4, "data", 4, 0),
319 GPIO_LOOKUP_IDX(OMAP_MPUIO_LABEL, 5, "data", 5, 0),
320 GPIO_LOOKUP_IDX(OMAP_MPUIO_LABEL, 6, "data", 6, 0),
321 GPIO_LOOKUP_IDX(OMAP_MPUIO_LABEL, 7, "data", 7, 0),
322 { },
323 },
324};
325
326static struct resource ams_delta_kp_resources[] = {
327 [0] = {
328 .start = INT_KEYBOARD,
329 .end = INT_KEYBOARD,
330 .flags = IORESOURCE_IRQ,
331 },
332};
333
334static const struct matrix_keymap_data ams_delta_keymap_data = {
335 .keymap = ams_delta_keymap,
336 .keymap_size = ARRAY_SIZE(ams_delta_keymap),
337};
338
339static struct omap_kp_platform_data ams_delta_kp_data = {
340 .rows = 8,
341 .cols = 8,
342 .keymap_data = &ams_delta_keymap_data,
343 .delay = 9,
344};
345
346static struct platform_device ams_delta_kp_device = {
347 .name = "omap-keypad",
348 .id = -1,
349 .dev = {
350 .platform_data = &ams_delta_kp_data,
351 },
352 .num_resources = ARRAY_SIZE(ams_delta_kp_resources),
353 .resource = ams_delta_kp_resources,
354};
355
356static struct platform_device ams_delta_lcd_device = {
357 .name = "lcd_ams_delta",
358 .id = -1,
359};
360
361static struct gpiod_lookup_table ams_delta_lcd_gpio_table = {
362 .table = {
363 GPIO_LOOKUP(LATCH2_LABEL, LATCH2_PIN_LCD_VBLEN, "vblen", 0),
364 GPIO_LOOKUP(LATCH2_LABEL, LATCH2_PIN_LCD_NDISP, "ndisp", 0),
365 { },
366 },
367};
368
369static struct gpio_led gpio_leds[] __initdata = {
370 [LATCH1_PIN_LED_CAMERA] = {
371 .name = "camera",
372 .default_state = LEDS_GPIO_DEFSTATE_OFF,
373#ifdef CONFIG_LEDS_TRIGGERS
374 .default_trigger = "ams_delta_camera",
375#endif
376 },
377 [LATCH1_PIN_LED_ADVERT] = {
378 .name = "advert",
379 .default_state = LEDS_GPIO_DEFSTATE_OFF,
380 },
381 [LATCH1_PIN_LED_MAIL] = {
382 .name = "email",
383 .default_state = LEDS_GPIO_DEFSTATE_OFF,
384 },
385 [LATCH1_PIN_LED_HANDSFREE] = {
386 .name = "handsfree",
387 .default_state = LEDS_GPIO_DEFSTATE_OFF,
388 },
389 [LATCH1_PIN_LED_VOICEMAIL] = {
390 .name = "voicemail",
391 .default_state = LEDS_GPIO_DEFSTATE_OFF,
392 },
393 [LATCH1_PIN_LED_VOICE] = {
394 .name = "voice",
395 .default_state = LEDS_GPIO_DEFSTATE_OFF,
396 },
397};
398
399static const struct gpio_led_platform_data leds_pdata __initconst = {
400 .leds = gpio_leds,
401 .num_leds = ARRAY_SIZE(gpio_leds),
402};
403
404static struct gpiod_lookup_table leds_gpio_table = {
405 .table = {
406 GPIO_LOOKUP_IDX(LATCH1_LABEL, LATCH1_PIN_LED_CAMERA, NULL,
407 LATCH1_PIN_LED_CAMERA, 0),
408 GPIO_LOOKUP_IDX(LATCH1_LABEL, LATCH1_PIN_LED_ADVERT, NULL,
409 LATCH1_PIN_LED_ADVERT, 0),
410 GPIO_LOOKUP_IDX(LATCH1_LABEL, LATCH1_PIN_LED_MAIL, NULL,
411 LATCH1_PIN_LED_MAIL, 0),
412 GPIO_LOOKUP_IDX(LATCH1_LABEL, LATCH1_PIN_LED_HANDSFREE, NULL,
413 LATCH1_PIN_LED_HANDSFREE, 0),
414 GPIO_LOOKUP_IDX(LATCH1_LABEL, LATCH1_PIN_LED_VOICEMAIL, NULL,
415 LATCH1_PIN_LED_VOICEMAIL, 0),
416 GPIO_LOOKUP_IDX(LATCH1_LABEL, LATCH1_PIN_LED_VOICE, NULL,
417 LATCH1_PIN_LED_VOICE, 0),
418 { },
419 },
420};
421
422static struct i2c_board_info ams_delta_camera_board_info[] = {
423 {
424 I2C_BOARD_INFO("ov6650", 0x60),
425 },
426};
427
428#ifdef CONFIG_LEDS_TRIGGERS
429DEFINE_LED_TRIGGER(ams_delta_camera_led_trigger);
430
431static int ams_delta_camera_power(struct device *dev, int power)
432{
433
434
435
436 if (power)
437 led_trigger_event(ams_delta_camera_led_trigger, LED_FULL);
438 else
439 led_trigger_event(ams_delta_camera_led_trigger, LED_OFF);
440 return 0;
441}
442#else
443#define ams_delta_camera_power NULL
444#endif
445
446static struct soc_camera_link ams_delta_iclink = {
447 .bus_id = 0,
448 .i2c_adapter_id = 1,
449 .board_info = &ams_delta_camera_board_info[0],
450 .module_name = "ov6650",
451 .power = ams_delta_camera_power,
452};
453
454static struct platform_device ams_delta_camera_device = {
455 .name = "soc-camera-pdrv",
456 .id = 0,
457 .dev = {
458 .platform_data = &ams_delta_iclink,
459 },
460};
461
462static struct omap1_cam_platform_data ams_delta_camera_platform_data = {
463 .camexclk_khz = 12000,
464 .lclk_khz_max = 1334,
465};
466
467static struct platform_device ams_delta_audio_device = {
468 .name = "ams-delta-audio",
469 .id = -1,
470};
471
472static struct gpiod_lookup_table ams_delta_audio_gpio_table = {
473 .table = {
474 GPIO_LOOKUP(OMAP_GPIO_LABEL, AMS_DELTA_GPIO_PIN_HOOK_SWITCH,
475 "hook_switch", 0),
476 GPIO_LOOKUP(LATCH2_LABEL, LATCH2_PIN_MODEM_CODEC,
477 "modem_codec", 0),
478 { },
479 },
480};
481
482static struct platform_device cx20442_codec_device = {
483 .name = "cx20442-codec",
484 .id = -1,
485};
486
487static struct resource ams_delta_serio_resources[] = {
488 {
489 .flags = IORESOURCE_IRQ,
490
491
492
493
494
495 .start = -EINVAL,
496 .end = -EINVAL,
497 },
498};
499
500static struct platform_device ams_delta_serio_device = {
501 .name = "ams-delta-serio",
502 .id = PLATFORM_DEVID_NONE,
503 .dev = {
504
505
506
507
508
509 .platform_data = NULL,
510 },
511 .num_resources = ARRAY_SIZE(ams_delta_serio_resources),
512 .resource = ams_delta_serio_resources,
513};
514
515static struct regulator_consumer_supply keybrd_pwr_consumers[] = {
516
517
518
519
520 REGULATOR_SUPPLY("vcc", NULL),
521};
522
523static struct regulator_init_data keybrd_pwr_initdata = {
524 .constraints = {
525 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
526 },
527 .num_consumer_supplies = ARRAY_SIZE(keybrd_pwr_consumers),
528 .consumer_supplies = keybrd_pwr_consumers,
529};
530
531static struct fixed_voltage_config keybrd_pwr_config = {
532 .supply_name = "keybrd_pwr",
533 .microvolts = 5000000,
534 .init_data = &keybrd_pwr_initdata,
535};
536
537static struct platform_device keybrd_pwr_device = {
538 .name = "reg-fixed-voltage",
539 .id = PLATFORM_DEVID_AUTO,
540 .dev = {
541 .platform_data = &keybrd_pwr_config,
542 },
543};
544
545static struct gpiod_lookup_table keybrd_pwr_gpio_table = {
546 .table = {
547 GPIO_LOOKUP(LATCH2_LABEL, LATCH2_PIN_KEYBRD_PWR, NULL,
548 GPIO_ACTIVE_HIGH),
549 { },
550 },
551};
552
553static struct platform_device *ams_delta_devices[] __initdata = {
554 &latch1_gpio_device,
555 &latch2_gpio_device,
556 &ams_delta_kp_device,
557 &ams_delta_camera_device,
558 &ams_delta_audio_device,
559 &ams_delta_serio_device,
560 &ams_delta_nand_device,
561 &ams_delta_lcd_device,
562 &cx20442_codec_device,
563};
564
565static struct gpiod_lookup_table *ams_delta_gpio_tables[] __initdata = {
566 &ams_delta_nreset_gpiod_table,
567 &ams_delta_audio_gpio_table,
568 &keybrd_pwr_gpio_table,
569 &ams_delta_lcd_gpio_table,
570 &ams_delta_nand_gpio_table,
571};
572
573
574
575
576
577
578
579
580
581
582static int gpiochip_match_by_label(struct gpio_chip *chip, void *data)
583{
584 char *label = data;
585
586 return !strcmp(label, chip->label);
587}
588
589static struct gpiod_hog ams_delta_gpio_hogs[] = {
590 GPIO_HOG(LATCH2_LABEL, LATCH2_PIN_KEYBRD_DATAOUT, "keybrd_dataout",
591 GPIO_ACTIVE_HIGH, GPIOD_OUT_LOW),
592 GPIO_HOG(LATCH2_LABEL, LATCH2_PIN_AUDIO_MUTE, "audio_mute",
593 GPIO_ACTIVE_HIGH, GPIOD_OUT_LOW),
594 {},
595};
596
597static struct plat_serial8250_port ams_delta_modem_ports[];
598
599
600
601
602
603
604static void __init modem_assign_irq(struct gpio_chip *chip)
605{
606 struct gpio_desc *gpiod;
607
608 gpiod = gpiochip_request_own_desc(chip, AMS_DELTA_GPIO_PIN_MODEM_IRQ,
609 "modem_irq", 0);
610 if (IS_ERR(gpiod)) {
611 pr_err("%s: modem IRQ GPIO request failed (%ld)\n", __func__,
612 PTR_ERR(gpiod));
613 } else {
614 gpiod_direction_input(gpiod);
615 ams_delta_modem_ports[0].irq = gpiod_to_irq(gpiod);
616 }
617}
618
619
620
621
622
623
624
625
626
627
628static void __init omap_gpio_deps_init(void)
629{
630 struct gpio_chip *chip;
631
632 chip = gpiochip_find(OMAP_GPIO_LABEL, gpiochip_match_by_label);
633 if (!chip) {
634 pr_err("%s: OMAP GPIO chip not found\n", __func__);
635 return;
636 }
637
638
639
640
641
642 ams_delta_init_fiq(chip, &ams_delta_serio_device);
643
644 modem_assign_irq(chip);
645}
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674static void __init ams_delta_latch2_init(void)
675{
676 u16 latch2 = 1 << LATCH2_PIN_MODEM_NRESET | 1 << LATCH2_PIN_MODEM_CODEC;
677
678 __raw_writew(latch2, LATCH2_VIRT);
679}
680
681static void __init ams_delta_init(void)
682{
683 struct platform_device *leds_pdev;
684
685
686 omap_cfg_reg(UART1_TX);
687 omap_cfg_reg(UART1_RTS);
688
689
690 omap_cfg_reg(H19_1610_CAM_EXCLK);
691 omap_cfg_reg(J15_1610_CAM_LCLK);
692 omap_cfg_reg(L18_1610_CAM_VS);
693 omap_cfg_reg(L15_1610_CAM_HS);
694 omap_cfg_reg(L19_1610_CAM_D0);
695 omap_cfg_reg(K14_1610_CAM_D1);
696 omap_cfg_reg(K15_1610_CAM_D2);
697 omap_cfg_reg(K19_1610_CAM_D3);
698 omap_cfg_reg(K18_1610_CAM_D4);
699 omap_cfg_reg(J14_1610_CAM_D5);
700 omap_cfg_reg(J19_1610_CAM_D6);
701 omap_cfg_reg(J18_1610_CAM_D7);
702
703 omap_gpio_deps_init();
704 ams_delta_latch2_init();
705 gpiod_add_hogs(ams_delta_gpio_hogs);
706
707 omap_serial_init();
708 omap_register_i2c_bus(1, 100, NULL, 0);
709
710 omap1_usb_init(&ams_delta_usb_config);
711 omap1_set_camera_info(&ams_delta_camera_platform_data);
712#ifdef CONFIG_LEDS_TRIGGERS
713 led_trigger_register_simple("ams_delta_camera",
714 &ams_delta_camera_led_trigger);
715#endif
716 platform_add_devices(ams_delta_devices, ARRAY_SIZE(ams_delta_devices));
717
718
719
720
721
722 keybrd_pwr_consumers[0].dev_name =
723 dev_name(&ams_delta_serio_device.dev);
724
725
726
727
728
729
730 platform_device_register(&keybrd_pwr_device);
731
732
733
734
735
736 ams_delta_audio_gpio_table.dev_id =
737 dev_name(&ams_delta_audio_device.dev);
738 keybrd_pwr_gpio_table.dev_id = dev_name(&keybrd_pwr_device.dev);
739 ams_delta_nand_gpio_table.dev_id = dev_name(&ams_delta_nand_device.dev);
740 ams_delta_lcd_gpio_table.dev_id = dev_name(&ams_delta_lcd_device.dev);
741
742
743
744
745 gpiod_add_lookup_tables(ams_delta_gpio_tables,
746 ARRAY_SIZE(ams_delta_gpio_tables));
747
748 leds_pdev = gpio_led_register_device(PLATFORM_DEVID_NONE, &leds_pdata);
749 if (!IS_ERR_OR_NULL(leds_pdev)) {
750 leds_gpio_table.dev_id = dev_name(&leds_pdev->dev);
751 gpiod_add_lookup_table(&leds_gpio_table);
752 }
753
754 omap_writew(omap_readw(ARM_RSTCT1) | 0x0004, ARM_RSTCT1);
755
756 omapfb_set_lcd_config(&ams_delta_lcd_config);
757}
758
759static void modem_pm(struct uart_port *port, unsigned int state, unsigned old)
760{
761 struct modem_private_data *priv = port->private_data;
762 int ret;
763
764 if (!priv)
765 return;
766
767 if (IS_ERR(priv->regulator))
768 return;
769
770 if (state == old)
771 return;
772
773 if (state == 0)
774 ret = regulator_enable(priv->regulator);
775 else if (old == 0)
776 ret = regulator_disable(priv->regulator);
777 else
778 ret = 0;
779
780 if (ret)
781 dev_warn(port->dev,
782 "ams_delta modem_pm: failed to %sable regulator: %d\n",
783 state ? "dis" : "en", ret);
784}
785
786static struct plat_serial8250_port ams_delta_modem_ports[] = {
787 {
788 .membase = IOMEM(MODEM_VIRT),
789 .mapbase = MODEM_PHYS,
790 .irq = IRQ_NOTCONNECTED,
791 .flags = UPF_BOOT_AUTOCONF,
792 .irqflags = IRQF_TRIGGER_RISING,
793 .iotype = UPIO_MEM,
794 .regshift = 1,
795 .uartclk = BASE_BAUD * 16,
796 .pm = modem_pm,
797 .private_data = &modem_priv,
798 },
799 { },
800};
801
802static struct platform_device ams_delta_modem_device = {
803 .name = "serial8250",
804 .id = PLAT8250_DEV_PLATFORM1,
805 .dev = {
806 .platform_data = ams_delta_modem_ports,
807 },
808};
809
810static int __init modem_nreset_init(void)
811{
812 int err;
813
814 err = platform_device_register(&modem_nreset_device);
815 if (err)
816 pr_err("Couldn't register the modem regulator device\n");
817
818 return err;
819}
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839static int __init ams_delta_modem_init(void)
840{
841 int err;
842
843 if (!machine_is_ams_delta())
844 return -ENODEV;
845
846 omap_cfg_reg(M14_1510_GPIO2);
847
848
849 modem_priv.regulator = ERR_PTR(-ENODEV);
850
851 err = platform_device_register(&ams_delta_modem_device);
852
853 return err;
854}
855arch_initcall_sync(ams_delta_modem_init);
856
857static int __init late_init(void)
858{
859 int err;
860
861 err = modem_nreset_init();
862 if (err)
863 return err;
864
865
866
867
868
869 modem_priv.regulator = regulator_get(&ams_delta_modem_device.dev,
870 "RESET#");
871 if (IS_ERR(modem_priv.regulator)) {
872 err = PTR_ERR(modem_priv.regulator);
873 goto unregister;
874 }
875 return 0;
876
877unregister:
878 platform_device_unregister(&ams_delta_modem_device);
879 return err;
880}
881
882static void __init ams_delta_init_late(void)
883{
884 omap1_init_late();
885 late_init();
886}
887
888static void __init ams_delta_map_io(void)
889{
890 omap15xx_map_io();
891 iotable_init(ams_delta_io_desc, ARRAY_SIZE(ams_delta_io_desc));
892}
893
894MACHINE_START(AMS_DELTA, "Amstrad E3 (Delta)")
895
896 .atag_offset = 0x100,
897 .map_io = ams_delta_map_io,
898 .init_early = omap1_init_early,
899 .init_irq = omap1_init_irq,
900 .handle_irq = omap1_handle_irq,
901 .init_machine = ams_delta_init,
902 .init_late = ams_delta_init_late,
903 .init_time = omap1_timer_init,
904 .restart = omap1_restart,
905MACHINE_END
906