Merge branch 'topic/caiaq' into for-linus
[linux-2.6] / arch / arm / mach-pxa / ezx.c
1 /*
2  *  ezx.c - Common code for the EZX platform.
3  *
4  *  Copyright (C) 2005-2006 Harald Welte <laforge@openezx.org>,
5  *                2007-2008 Daniel Ribeiro <drwyrm@gmail.com>,
6  *                2007-2008 Stefan Schmidt <stefan@datenfreihafen.org>
7  *
8  *  This program is free software; you can redistribute it and/or modify
9  *  it under the terms of the GNU General Public License version 2 as
10  *  published by the Free Software Foundation.
11  *
12  */
13
14 #include <linux/kernel.h>
15 #include <linux/init.h>
16 #include <linux/platform_device.h>
17 #include <linux/delay.h>
18 #include <linux/pwm_backlight.h>
19 #include <linux/input.h>
20
21 #include <asm/setup.h>
22 #include <asm/mach-types.h>
23 #include <asm/mach/arch.h>
24
25 #include <mach/pxa27x.h>
26 #include <mach/pxafb.h>
27 #include <mach/ohci.h>
28 #include <mach/i2c.h>
29 #include <mach/hardware.h>
30 #include <mach/pxa27x_keypad.h>
31
32 #include "devices.h"
33 #include "generic.h"
34
35 static struct platform_pwm_backlight_data ezx_backlight_data = {
36         .pwm_id         = 0,
37         .max_brightness = 1023,
38         .dft_brightness = 1023,
39         .pwm_period_ns  = 78770,
40 };
41
42 static struct platform_device ezx_backlight_device = {
43         .name           = "pwm-backlight",
44         .dev            = {
45                 .parent = &pxa27x_device_pwm0.dev,
46                 .platform_data = &ezx_backlight_data,
47         },
48 };
49
50 static struct pxafb_mode_info mode_ezx_old = {
51         .pixclock               = 150000,
52         .xres                   = 240,
53         .yres                   = 320,
54         .bpp                    = 16,
55         .hsync_len              = 10,
56         .left_margin            = 20,
57         .right_margin           = 10,
58         .vsync_len              = 2,
59         .upper_margin           = 3,
60         .lower_margin           = 2,
61         .sync                   = 0,
62 };
63
64 static struct pxafb_mach_info ezx_fb_info_1 = {
65         .modes          = &mode_ezx_old,
66         .num_modes      = 1,
67         .lcd_conn       = LCD_COLOR_TFT_16BPP,
68 };
69
70 static struct pxafb_mode_info mode_72r89803y01 = {
71         .pixclock               = 192308,
72         .xres                   = 240,
73         .yres                   = 320,
74         .bpp                    = 32,
75         .depth                  = 18,
76         .hsync_len              = 10,
77         .left_margin            = 20,
78         .right_margin           = 10,
79         .vsync_len              = 2,
80         .upper_margin           = 3,
81         .lower_margin           = 2,
82         .sync                   = 0,
83 };
84
85 static struct pxafb_mach_info ezx_fb_info_2 = {
86         .modes          = &mode_72r89803y01,
87         .num_modes      = 1,
88         .lcd_conn       = LCD_COLOR_TFT_18BPP,
89 };
90
91 static struct platform_device *devices[] __initdata = {
92         &ezx_backlight_device,
93 };
94
95 static unsigned long ezx_pin_config[] __initdata = {
96         /* PWM backlight */
97         GPIO16_PWM0_OUT,
98
99         /* BTUART */
100         GPIO42_BTUART_RXD,
101         GPIO43_BTUART_TXD,
102         GPIO44_BTUART_CTS,
103         GPIO45_BTUART_RTS,
104
105         /* I2C */
106         GPIO117_I2C_SCL,
107         GPIO118_I2C_SDA,
108
109         /* PCAP SSP */
110         GPIO29_SSP1_SCLK,
111         GPIO25_SSP1_TXD,
112         GPIO26_SSP1_RXD,
113         GPIO24_GPIO,                            /* pcap chip select */
114         GPIO1_GPIO | WAKEUP_ON_EDGE_RISE,       /* pcap interrupt */
115         GPIO4_GPIO | MFP_LPM_DRIVE_HIGH,        /* WDI_AP */
116         GPIO55_GPIO | MFP_LPM_DRIVE_HIGH,       /* SYS_RESTART */
117
118         /* MMC */
119         GPIO32_MMC_CLK,
120         GPIO92_MMC_DAT_0,
121         GPIO109_MMC_DAT_1,
122         GPIO110_MMC_DAT_2,
123         GPIO111_MMC_DAT_3,
124         GPIO112_MMC_CMD,
125         GPIO11_GPIO,                            /* mmc detect */
126
127         /* usb to external transceiver */
128         GPIO34_USB_P2_2,
129         GPIO35_USB_P2_1,
130         GPIO36_USB_P2_4,
131         GPIO39_USB_P2_6,
132         GPIO40_USB_P2_5,
133         GPIO53_USB_P2_3,
134
135         /* usb to Neptune GSM chip */
136         GPIO30_USB_P3_2,
137         GPIO31_USB_P3_6,
138         GPIO90_USB_P3_5,
139         GPIO91_USB_P3_1,
140         GPIO56_USB_P3_4,
141         GPIO113_USB_P3_3,
142 };
143
144 #if defined(CONFIG_MACH_EZX_A780) || defined(CONFIG_MACH_EZX_E680)
145 static unsigned long gen1_pin_config[] __initdata = {
146         /* flip / lockswitch */
147         GPIO12_GPIO | WAKEUP_ON_EDGE_BOTH,
148
149         /* bluetooth (bcm2035) */
150         GPIO14_GPIO | WAKEUP_ON_EDGE_RISE,      /* HOSTWAKE */
151         GPIO48_GPIO,                            /* RESET */
152         GPIO28_GPIO,                            /* WAKEUP */
153
154         /* Neptune handshake */
155         GPIO0_GPIO | WAKEUP_ON_EDGE_FALL,       /* BP_RDY */
156         GPIO57_GPIO | MFP_LPM_DRIVE_HIGH,       /* AP_RDY */
157         GPIO13_GPIO | WAKEUP_ON_EDGE_BOTH,      /* WDI */
158         GPIO3_GPIO | WAKEUP_ON_EDGE_BOTH,       /* WDI2 */
159         GPIO82_GPIO | MFP_LPM_DRIVE_HIGH,       /* RESET */
160         GPIO99_GPIO | MFP_LPM_DRIVE_HIGH,       /* TC_MM_EN */
161
162         /* sound */
163         GPIO52_SSP3_SCLK,
164         GPIO83_SSP3_SFRM,
165         GPIO81_SSP3_TXD,
166         GPIO89_SSP3_RXD,
167
168         /* ssp2 pins to in */
169         GPIO22_GPIO,                            /* SSP2_SCLK */
170         GPIO37_GPIO,                            /* SSP2_SFRM */
171         GPIO38_GPIO,                            /* SSP2_TXD */
172         GPIO88_GPIO,                            /* SSP2_RXD */
173
174         /* camera */
175         GPIO23_CIF_MCLK,
176         GPIO54_CIF_PCLK,
177         GPIO85_CIF_LV,
178         GPIO84_CIF_FV,
179         GPIO27_CIF_DD_0,
180         GPIO114_CIF_DD_1,
181         GPIO51_CIF_DD_2,
182         GPIO115_CIF_DD_3,
183         GPIO95_CIF_DD_4,
184         GPIO94_CIF_DD_5,
185         GPIO17_CIF_DD_6,
186         GPIO108_CIF_DD_7,
187         GPIO50_GPIO,                            /* CAM_EN */
188         GPIO19_GPIO,                            /* CAM_RST */
189
190         /* EMU */
191         GPIO120_GPIO,                           /* EMU_MUX1 */
192         GPIO119_GPIO,                           /* EMU_MUX2 */
193         GPIO86_GPIO,                            /* SNP_INT_CTL */
194         GPIO87_GPIO,                            /* SNP_INT_IN */
195 };
196 #endif
197
198 #if defined(CONFIG_MACH_EZX_A1200) || defined(CONFIG_MACH_EZX_A910) || \
199         defined(CONFIG_MACH_EZX_E2) || defined(CONFIG_MACH_EZX_E6)
200 static unsigned long gen2_pin_config[] __initdata = {
201         /* flip / lockswitch */
202         GPIO15_GPIO | WAKEUP_ON_EDGE_BOTH,
203
204         /* EOC */
205         GPIO10_GPIO | WAKEUP_ON_EDGE_RISE,
206
207         /* bluetooth (bcm2045) */
208         GPIO13_GPIO | WAKEUP_ON_EDGE_RISE,      /* HOSTWAKE */
209         GPIO37_GPIO,                            /* RESET */
210         GPIO57_GPIO,                            /* WAKEUP */
211
212         /* Neptune handshake */
213         GPIO0_GPIO | WAKEUP_ON_EDGE_FALL,       /* BP_RDY */
214         GPIO96_GPIO | MFP_LPM_DRIVE_HIGH,       /* AP_RDY */
215         GPIO3_GPIO | WAKEUP_ON_EDGE_FALL,       /* WDI */
216         GPIO116_GPIO | MFP_LPM_DRIVE_HIGH,      /* RESET */
217         GPIO41_GPIO,                            /* BP_FLASH */
218
219         /* sound */
220         GPIO52_SSP3_SCLK,
221         GPIO83_SSP3_SFRM,
222         GPIO81_SSP3_TXD,
223         GPIO82_SSP3_RXD,
224
225         /* ssp2 pins to in */
226         GPIO22_GPIO,                            /* SSP2_SCLK */
227         GPIO14_GPIO,                            /* SSP2_SFRM */
228         GPIO38_GPIO,                            /* SSP2_TXD */
229         GPIO88_GPIO,                            /* SSP2_RXD */
230
231         /* camera */
232         GPIO23_CIF_MCLK,
233         GPIO54_CIF_PCLK,
234         GPIO85_CIF_LV,
235         GPIO84_CIF_FV,
236         GPIO27_CIF_DD_0,
237         GPIO114_CIF_DD_1,
238         GPIO51_CIF_DD_2,
239         GPIO115_CIF_DD_3,
240         GPIO95_CIF_DD_4,
241         GPIO48_CIF_DD_5,
242         GPIO93_CIF_DD_6,
243         GPIO12_CIF_DD_7,
244         GPIO50_GPIO,                            /* CAM_EN */
245         GPIO28_GPIO,                            /* CAM_RST */
246         GPIO17_GPIO,                            /* CAM_FLASH */
247 };
248 #endif
249
250 #ifdef CONFIG_MACH_EZX_A780
251 static unsigned long a780_pin_config[] __initdata = {
252         /* keypad */
253         GPIO93_KP_DKIN_0 | WAKEUP_ON_LEVEL_HIGH,
254         GPIO100_KP_MKIN_0 | WAKEUP_ON_LEVEL_HIGH,
255         GPIO101_KP_MKIN_1 | WAKEUP_ON_LEVEL_HIGH,
256         GPIO102_KP_MKIN_2 | WAKEUP_ON_LEVEL_HIGH,
257         GPIO97_KP_MKIN_3 | WAKEUP_ON_LEVEL_HIGH,
258         GPIO98_KP_MKIN_4 | WAKEUP_ON_LEVEL_HIGH,
259         GPIO103_KP_MKOUT_0,
260         GPIO104_KP_MKOUT_1,
261         GPIO105_KP_MKOUT_2,
262         GPIO106_KP_MKOUT_3,
263         GPIO107_KP_MKOUT_4,
264
265         /* attenuate sound */
266         GPIO96_GPIO,
267 };
268 #endif
269
270 #ifdef CONFIG_MACH_EZX_E680
271 static unsigned long e680_pin_config[] __initdata = {
272         /* keypad */
273         GPIO93_KP_DKIN_0 | WAKEUP_ON_LEVEL_HIGH,
274         GPIO96_KP_DKIN_3 | WAKEUP_ON_LEVEL_HIGH,
275         GPIO97_KP_DKIN_4 | WAKEUP_ON_LEVEL_HIGH,
276         GPIO98_KP_DKIN_5 | WAKEUP_ON_LEVEL_HIGH,
277         GPIO100_KP_MKIN_0 | WAKEUP_ON_LEVEL_HIGH,
278         GPIO101_KP_MKIN_1 | WAKEUP_ON_LEVEL_HIGH,
279         GPIO102_KP_MKIN_2 | WAKEUP_ON_LEVEL_HIGH,
280         GPIO103_KP_MKOUT_0,
281         GPIO104_KP_MKOUT_1,
282         GPIO105_KP_MKOUT_2,
283         GPIO106_KP_MKOUT_3,
284
285         /* MIDI */
286         GPIO79_GPIO,                            /* VA_SEL_BUL */
287         GPIO80_GPIO,                            /* FLT_SEL_BUL */
288         GPIO78_GPIO,                            /* MIDI_RESET */
289         GPIO33_GPIO,                            /* MIDI_CS */
290         GPIO15_GPIO,                            /* MIDI_IRQ */
291         GPIO49_GPIO,                            /* MIDI_NPWE */
292         GPIO18_GPIO,                            /* MIDI_RDY */
293
294         /* leds */
295         GPIO46_GPIO,
296         GPIO47_GPIO,
297 };
298 #endif
299
300 #ifdef CONFIG_MACH_EZX_A1200
301 static unsigned long a1200_pin_config[] __initdata = {
302         /* keypad */
303         GPIO100_KP_MKIN_0 | WAKEUP_ON_LEVEL_HIGH,
304         GPIO101_KP_MKIN_1 | WAKEUP_ON_LEVEL_HIGH,
305         GPIO102_KP_MKIN_2 | WAKEUP_ON_LEVEL_HIGH,
306         GPIO97_KP_MKIN_3 | WAKEUP_ON_LEVEL_HIGH,
307         GPIO98_KP_MKIN_4 | WAKEUP_ON_LEVEL_HIGH,
308         GPIO103_KP_MKOUT_0,
309         GPIO104_KP_MKOUT_1,
310         GPIO105_KP_MKOUT_2,
311         GPIO106_KP_MKOUT_3,
312         GPIO107_KP_MKOUT_4,
313         GPIO108_KP_MKOUT_5,
314 };
315 #endif
316
317 #ifdef CONFIG_MACH_EZX_A910
318 static unsigned long a910_pin_config[] __initdata = {
319         /* keypad */
320         GPIO100_KP_MKIN_0 | WAKEUP_ON_LEVEL_HIGH,
321         GPIO101_KP_MKIN_1 | WAKEUP_ON_LEVEL_HIGH,
322         GPIO102_KP_MKIN_2 | WAKEUP_ON_LEVEL_HIGH,
323         GPIO97_KP_MKIN_3 | WAKEUP_ON_LEVEL_HIGH,
324         GPIO98_KP_MKIN_4 | WAKEUP_ON_LEVEL_HIGH,
325         GPIO103_KP_MKOUT_0,
326         GPIO104_KP_MKOUT_1,
327         GPIO105_KP_MKOUT_2,
328         GPIO106_KP_MKOUT_3,
329         GPIO107_KP_MKOUT_4,
330         GPIO108_KP_MKOUT_5,
331
332         /* WLAN */
333         GPIO89_GPIO,                            /* RESET */
334         GPIO33_GPIO,                            /* WAKEUP */
335         GPIO94_GPIO | WAKEUP_ON_LEVEL_HIGH,     /* HOSTWAKE */
336
337         /* MMC CS */
338         GPIO20_GPIO,
339 };
340 #endif
341
342 #ifdef CONFIG_MACH_EZX_E2
343 static unsigned long e2_pin_config[] __initdata = {
344         /* keypad */
345         GPIO100_KP_MKIN_0 | WAKEUP_ON_LEVEL_HIGH,
346         GPIO101_KP_MKIN_1 | WAKEUP_ON_LEVEL_HIGH,
347         GPIO102_KP_MKIN_2 | WAKEUP_ON_LEVEL_HIGH,
348         GPIO97_KP_MKIN_3 | WAKEUP_ON_LEVEL_HIGH,
349         GPIO98_KP_MKIN_4 | WAKEUP_ON_LEVEL_HIGH,
350         GPIO103_KP_MKOUT_0,
351         GPIO104_KP_MKOUT_1,
352         GPIO105_KP_MKOUT_2,
353         GPIO106_KP_MKOUT_3,
354         GPIO107_KP_MKOUT_4,
355         GPIO108_KP_MKOUT_5,
356 };
357 #endif
358
359 #ifdef CONFIG_MACH_EZX_E6
360 static unsigned long e6_pin_config[] __initdata = {
361         /* keypad */
362         GPIO100_KP_MKIN_0 | WAKEUP_ON_LEVEL_HIGH,
363         GPIO101_KP_MKIN_1 | WAKEUP_ON_LEVEL_HIGH,
364         GPIO102_KP_MKIN_2 | WAKEUP_ON_LEVEL_HIGH,
365         GPIO97_KP_MKIN_3 | WAKEUP_ON_LEVEL_HIGH,
366         GPIO98_KP_MKIN_4 | WAKEUP_ON_LEVEL_HIGH,
367         GPIO103_KP_MKOUT_0,
368         GPIO104_KP_MKOUT_1,
369         GPIO105_KP_MKOUT_2,
370         GPIO106_KP_MKOUT_3,
371         GPIO107_KP_MKOUT_4,
372         GPIO108_KP_MKOUT_5,
373 };
374 #endif
375
376 /* KEYPAD */
377 #ifdef CONFIG_MACH_EZX_A780
378 static unsigned int a780_key_map[] = {
379         KEY(0, 0, KEY_SEND),
380         KEY(0, 1, KEY_BACK),
381         KEY(0, 2, KEY_END),
382         KEY(0, 3, KEY_PAGEUP),
383         KEY(0, 4, KEY_UP),
384
385         KEY(1, 0, KEY_NUMERIC_1),
386         KEY(1, 1, KEY_NUMERIC_2),
387         KEY(1, 2, KEY_NUMERIC_3),
388         KEY(1, 3, KEY_SELECT),
389         KEY(1, 4, KEY_KPENTER),
390
391         KEY(2, 0, KEY_NUMERIC_4),
392         KEY(2, 1, KEY_NUMERIC_5),
393         KEY(2, 2, KEY_NUMERIC_6),
394         KEY(2, 3, KEY_RECORD),
395         KEY(2, 4, KEY_LEFT),
396
397         KEY(3, 0, KEY_NUMERIC_7),
398         KEY(3, 1, KEY_NUMERIC_8),
399         KEY(3, 2, KEY_NUMERIC_9),
400         KEY(3, 3, KEY_HOME),
401         KEY(3, 4, KEY_RIGHT),
402
403         KEY(4, 0, KEY_NUMERIC_STAR),
404         KEY(4, 1, KEY_NUMERIC_0),
405         KEY(4, 2, KEY_NUMERIC_POUND),
406         KEY(4, 3, KEY_PAGEDOWN),
407         KEY(4, 4, KEY_DOWN),
408 };
409
410 static struct pxa27x_keypad_platform_data a780_keypad_platform_data = {
411         .matrix_key_rows = 5,
412         .matrix_key_cols = 5,
413         .matrix_key_map = a780_key_map,
414         .matrix_key_map_size = ARRAY_SIZE(a780_key_map),
415
416         .direct_key_map = { KEY_CAMERA },
417         .direct_key_num = 1,
418
419         .debounce_interval = 30,
420 };
421 #endif /* CONFIG_MACH_EZX_A780 */
422
423 #ifdef CONFIG_MACH_EZX_E680
424 static unsigned int e680_key_map[] = {
425         KEY(0, 0, KEY_UP),
426         KEY(0, 1, KEY_RIGHT),
427         KEY(0, 2, KEY_RESERVED),
428         KEY(0, 3, KEY_SEND),
429
430         KEY(1, 0, KEY_DOWN),
431         KEY(1, 1, KEY_LEFT),
432         KEY(1, 2, KEY_PAGEUP),
433         KEY(1, 3, KEY_PAGEDOWN),
434
435         KEY(2, 0, KEY_RESERVED),
436         KEY(2, 1, KEY_RESERVED),
437         KEY(2, 2, KEY_RESERVED),
438         KEY(2, 3, KEY_KPENTER),
439 };
440
441 static struct pxa27x_keypad_platform_data e680_keypad_platform_data = {
442         .matrix_key_rows = 3,
443         .matrix_key_cols = 4,
444         .matrix_key_map = e680_key_map,
445         .matrix_key_map_size = ARRAY_SIZE(e680_key_map),
446
447         .direct_key_map = {
448                 KEY_CAMERA,
449                 KEY_RESERVED,
450                 KEY_RESERVED,
451                 KEY_F1,
452                 KEY_CANCEL,
453                 KEY_F2,
454         },
455         .direct_key_num = 6,
456
457         .debounce_interval = 30,
458 };
459 #endif /* CONFIG_MACH_EZX_E680 */
460
461 #ifdef CONFIG_MACH_EZX_A1200
462 static unsigned int a1200_key_map[] = {
463         KEY(0, 0, KEY_RESERVED),
464         KEY(0, 1, KEY_RIGHT),
465         KEY(0, 2, KEY_PAGEDOWN),
466         KEY(0, 3, KEY_RESERVED),
467         KEY(0, 4, KEY_RESERVED),
468         KEY(0, 5, KEY_RESERVED),
469
470         KEY(1, 0, KEY_RESERVED),
471         KEY(1, 1, KEY_DOWN),
472         KEY(1, 2, KEY_CAMERA),
473         KEY(1, 3, KEY_RESERVED),
474         KEY(1, 4, KEY_RESERVED),
475         KEY(1, 5, KEY_RESERVED),
476
477         KEY(2, 0, KEY_RESERVED),
478         KEY(2, 1, KEY_KPENTER),
479         KEY(2, 2, KEY_RECORD),
480         KEY(2, 3, KEY_RESERVED),
481         KEY(2, 4, KEY_RESERVED),
482         KEY(2, 5, KEY_SELECT),
483
484         KEY(3, 0, KEY_RESERVED),
485         KEY(3, 1, KEY_UP),
486         KEY(3, 2, KEY_SEND),
487         KEY(3, 3, KEY_RESERVED),
488         KEY(3, 4, KEY_RESERVED),
489         KEY(3, 5, KEY_RESERVED),
490
491         KEY(4, 0, KEY_RESERVED),
492         KEY(4, 1, KEY_LEFT),
493         KEY(4, 2, KEY_PAGEUP),
494         KEY(4, 3, KEY_RESERVED),
495         KEY(4, 4, KEY_RESERVED),
496         KEY(4, 5, KEY_RESERVED),
497 };
498
499 static struct pxa27x_keypad_platform_data a1200_keypad_platform_data = {
500         .matrix_key_rows = 5,
501         .matrix_key_cols = 6,
502         .matrix_key_map = a1200_key_map,
503         .matrix_key_map_size = ARRAY_SIZE(a1200_key_map),
504
505         .debounce_interval = 30,
506 };
507 #endif /* CONFIG_MACH_EZX_A1200 */
508
509 #ifdef CONFIG_MACH_EZX_E6
510 static unsigned int e6_key_map[] = {
511         KEY(0, 0, KEY_RESERVED),
512         KEY(0, 1, KEY_RIGHT),
513         KEY(0, 2, KEY_PAGEDOWN),
514         KEY(0, 3, KEY_RESERVED),
515         KEY(0, 4, KEY_RESERVED),
516         KEY(0, 5, KEY_NEXTSONG),
517
518         KEY(1, 0, KEY_RESERVED),
519         KEY(1, 1, KEY_DOWN),
520         KEY(1, 2, KEY_PROG1),
521         KEY(1, 3, KEY_RESERVED),
522         KEY(1, 4, KEY_RESERVED),
523         KEY(1, 5, KEY_RESERVED),
524
525         KEY(2, 0, KEY_RESERVED),
526         KEY(2, 1, KEY_ENTER),
527         KEY(2, 2, KEY_CAMERA),
528         KEY(2, 3, KEY_RESERVED),
529         KEY(2, 4, KEY_RESERVED),
530         KEY(2, 5, KEY_WWW),
531
532         KEY(3, 0, KEY_RESERVED),
533         KEY(3, 1, KEY_UP),
534         KEY(3, 2, KEY_SEND),
535         KEY(3, 3, KEY_RESERVED),
536         KEY(3, 4, KEY_RESERVED),
537         KEY(3, 5, KEY_PLAYPAUSE),
538
539         KEY(4, 0, KEY_RESERVED),
540         KEY(4, 1, KEY_LEFT),
541         KEY(4, 2, KEY_PAGEUP),
542         KEY(4, 3, KEY_RESERVED),
543         KEY(4, 4, KEY_RESERVED),
544         KEY(4, 5, KEY_PREVIOUSSONG),
545 };
546
547 static struct pxa27x_keypad_platform_data e6_keypad_platform_data = {
548         .matrix_key_rows = 5,
549         .matrix_key_cols = 6,
550         .matrix_key_map = e6_key_map,
551         .matrix_key_map_size = ARRAY_SIZE(e6_key_map),
552
553         .debounce_interval = 30,
554 };
555 #endif /* CONFIG_MACH_EZX_E6 */
556
557 #ifdef CONFIG_MACH_EZX_A910
558 static unsigned int a910_key_map[] = {
559         KEY(0, 0, KEY_NUMERIC_6),
560         KEY(0, 1, KEY_RIGHT),
561         KEY(0, 2, KEY_PAGEDOWN),
562         KEY(0, 3, KEY_KPENTER),
563         KEY(0, 4, KEY_NUMERIC_5),
564         KEY(0, 5, KEY_CAMERA),
565
566         KEY(1, 0, KEY_NUMERIC_8),
567         KEY(1, 1, KEY_DOWN),
568         KEY(1, 2, KEY_RESERVED),
569         KEY(1, 3, KEY_F1), /* Left SoftKey */
570         KEY(1, 4, KEY_NUMERIC_STAR),
571         KEY(1, 5, KEY_RESERVED),
572
573         KEY(2, 0, KEY_NUMERIC_7),
574         KEY(2, 1, KEY_NUMERIC_9),
575         KEY(2, 2, KEY_RECORD),
576         KEY(2, 3, KEY_F2), /* Right SoftKey */
577         KEY(2, 4, KEY_BACK),
578         KEY(2, 5, KEY_SELECT),
579
580         KEY(3, 0, KEY_NUMERIC_2),
581         KEY(3, 1, KEY_UP),
582         KEY(3, 2, KEY_SEND),
583         KEY(3, 3, KEY_NUMERIC_0),
584         KEY(3, 4, KEY_NUMERIC_1),
585         KEY(3, 5, KEY_RECORD),
586
587         KEY(4, 0, KEY_NUMERIC_4),
588         KEY(4, 1, KEY_LEFT),
589         KEY(4, 2, KEY_PAGEUP),
590         KEY(4, 3, KEY_NUMERIC_POUND),
591         KEY(4, 4, KEY_NUMERIC_3),
592         KEY(4, 5, KEY_RESERVED),
593 };
594
595 static struct pxa27x_keypad_platform_data a910_keypad_platform_data = {
596         .matrix_key_rows = 5,
597         .matrix_key_cols = 6,
598         .matrix_key_map = a910_key_map,
599         .matrix_key_map_size = ARRAY_SIZE(a910_key_map),
600
601         .debounce_interval = 30,
602 };
603 #endif /* CONFIG_MACH_EZX_A910 */
604
605 #ifdef CONFIG_MACH_EZX_E2
606 static unsigned int e2_key_map[] = {
607         KEY(0, 0, KEY_NUMERIC_6),
608         KEY(0, 1, KEY_RIGHT),
609         KEY(0, 2, KEY_NUMERIC_9),
610         KEY(0, 3, KEY_NEXTSONG),
611         KEY(0, 4, KEY_NUMERIC_5),
612         KEY(0, 5, KEY_F1), /* Left SoftKey */
613
614         KEY(1, 0, KEY_NUMERIC_8),
615         KEY(1, 1, KEY_DOWN),
616         KEY(1, 2, KEY_RESERVED),
617         KEY(1, 3, KEY_PAGEUP),
618         KEY(1, 4, KEY_NUMERIC_STAR),
619         KEY(1, 5, KEY_F2), /* Right SoftKey */
620
621         KEY(2, 0, KEY_NUMERIC_7),
622         KEY(2, 1, KEY_KPENTER),
623         KEY(2, 2, KEY_RECORD),
624         KEY(2, 3, KEY_PAGEDOWN),
625         KEY(2, 4, KEY_BACK),
626         KEY(2, 5, KEY_NUMERIC_0),
627
628         KEY(3, 0, KEY_NUMERIC_2),
629         KEY(3, 1, KEY_UP),
630         KEY(3, 2, KEY_SEND),
631         KEY(3, 3, KEY_PLAYPAUSE),
632         KEY(3, 4, KEY_NUMERIC_1),
633         KEY(3, 5, KEY_SOUND), /* Music SoftKey */
634
635         KEY(4, 0, KEY_NUMERIC_4),
636         KEY(4, 1, KEY_LEFT),
637         KEY(4, 2, KEY_NUMERIC_POUND),
638         KEY(4, 3, KEY_PREVIOUSSONG),
639         KEY(4, 4, KEY_NUMERIC_3),
640         KEY(4, 5, KEY_RESERVED),
641 };
642
643 static struct pxa27x_keypad_platform_data e2_keypad_platform_data = {
644         .matrix_key_rows = 5,
645         .matrix_key_cols = 6,
646         .matrix_key_map = e2_key_map,
647         .matrix_key_map_size = ARRAY_SIZE(e2_key_map),
648
649         .debounce_interval = 30,
650 };
651 #endif /* CONFIG_MACH_EZX_E2 */
652
653 #ifdef CONFIG_MACH_EZX_A780
654 static void __init a780_init(void)
655 {
656         pxa2xx_mfp_config(ARRAY_AND_SIZE(ezx_pin_config));
657         pxa2xx_mfp_config(ARRAY_AND_SIZE(gen1_pin_config));
658         pxa2xx_mfp_config(ARRAY_AND_SIZE(a780_pin_config));
659
660         pxa_set_i2c_info(NULL);
661
662         set_pxa_fb_info(&ezx_fb_info_1);
663
664         pxa_set_keypad_info(&a780_keypad_platform_data);
665
666         platform_add_devices(devices, ARRAY_SIZE(devices));
667 }
668
669 MACHINE_START(EZX_A780, "Motorola EZX A780")
670         .phys_io        = 0x40000000,
671         .io_pg_offst    = (io_p2v(0x40000000) >> 18) & 0xfffc,
672         .boot_params    = 0xa0000100,
673         .map_io         = pxa_map_io,
674         .init_irq       = pxa27x_init_irq,
675         .timer          = &pxa_timer,
676         .init_machine   = a780_init,
677 MACHINE_END
678 #endif
679
680 #ifdef CONFIG_MACH_EZX_E680
681 static struct i2c_board_info __initdata e680_i2c_board_info[] = {
682         { I2C_BOARD_INFO("tea5767", 0x81) },
683 };
684
685 static void __init e680_init(void)
686 {
687         pxa2xx_mfp_config(ARRAY_AND_SIZE(ezx_pin_config));
688         pxa2xx_mfp_config(ARRAY_AND_SIZE(gen1_pin_config));
689         pxa2xx_mfp_config(ARRAY_AND_SIZE(e680_pin_config));
690
691         pxa_set_i2c_info(NULL);
692         i2c_register_board_info(0, ARRAY_AND_SIZE(e680_i2c_board_info));
693
694         set_pxa_fb_info(&ezx_fb_info_1);
695
696         pxa_set_keypad_info(&e680_keypad_platform_data);
697
698         platform_add_devices(devices, ARRAY_SIZE(devices));
699 }
700
701 MACHINE_START(EZX_E680, "Motorola EZX E680")
702         .phys_io        = 0x40000000,
703         .io_pg_offst    = (io_p2v(0x40000000) >> 18) & 0xfffc,
704         .boot_params    = 0xa0000100,
705         .map_io         = pxa_map_io,
706         .init_irq       = pxa27x_init_irq,
707         .timer          = &pxa_timer,
708         .init_machine   = e680_init,
709 MACHINE_END
710 #endif
711
712 #ifdef CONFIG_MACH_EZX_A1200
713 static struct i2c_board_info __initdata a1200_i2c_board_info[] = {
714         { I2C_BOARD_INFO("tea5767", 0x81) },
715 };
716
717 static void __init a1200_init(void)
718 {
719         pxa2xx_mfp_config(ARRAY_AND_SIZE(ezx_pin_config));
720         pxa2xx_mfp_config(ARRAY_AND_SIZE(gen2_pin_config));
721         pxa2xx_mfp_config(ARRAY_AND_SIZE(a1200_pin_config));
722
723         pxa_set_i2c_info(NULL);
724         i2c_register_board_info(0, ARRAY_AND_SIZE(a1200_i2c_board_info));
725
726         set_pxa_fb_info(&ezx_fb_info_2);
727
728         pxa_set_keypad_info(&a1200_keypad_platform_data);
729
730         platform_add_devices(devices, ARRAY_SIZE(devices));
731 }
732
733 MACHINE_START(EZX_A1200, "Motorola EZX A1200")
734         .phys_io        = 0x40000000,
735         .io_pg_offst    = (io_p2v(0x40000000) >> 18) & 0xfffc,
736         .boot_params    = 0xa0000100,
737         .map_io         = pxa_map_io,
738         .init_irq       = pxa27x_init_irq,
739         .timer          = &pxa_timer,
740         .init_machine   = a1200_init,
741 MACHINE_END
742 #endif
743
744 #ifdef CONFIG_MACH_EZX_A910
745 static void __init a910_init(void)
746 {
747         pxa2xx_mfp_config(ARRAY_AND_SIZE(ezx_pin_config));
748         pxa2xx_mfp_config(ARRAY_AND_SIZE(gen2_pin_config));
749         pxa2xx_mfp_config(ARRAY_AND_SIZE(a910_pin_config));
750
751         pxa_set_i2c_info(NULL);
752
753         set_pxa_fb_info(&ezx_fb_info_2);
754
755         pxa_set_keypad_info(&a910_keypad_platform_data);
756
757         platform_add_devices(devices, ARRAY_SIZE(devices));
758 }
759
760 MACHINE_START(EZX_A910, "Motorola EZX A910")
761         .phys_io        = 0x40000000,
762         .io_pg_offst    = (io_p2v(0x40000000) >> 18) & 0xfffc,
763         .boot_params    = 0xa0000100,
764         .map_io         = pxa_map_io,
765         .init_irq       = pxa27x_init_irq,
766         .timer          = &pxa_timer,
767         .init_machine   = a910_init,
768 MACHINE_END
769 #endif
770
771 #ifdef CONFIG_MACH_EZX_E6
772 static struct i2c_board_info __initdata e6_i2c_board_info[] = {
773         { I2C_BOARD_INFO("tea5767", 0x81) },
774 };
775
776 static void __init e6_init(void)
777 {
778         pxa2xx_mfp_config(ARRAY_AND_SIZE(ezx_pin_config));
779         pxa2xx_mfp_config(ARRAY_AND_SIZE(gen2_pin_config));
780         pxa2xx_mfp_config(ARRAY_AND_SIZE(e6_pin_config));
781
782         pxa_set_i2c_info(NULL);
783         i2c_register_board_info(0, ARRAY_AND_SIZE(e6_i2c_board_info));
784
785         set_pxa_fb_info(&ezx_fb_info_2);
786
787         pxa_set_keypad_info(&e6_keypad_platform_data);
788
789         platform_add_devices(devices, ARRAY_SIZE(devices));
790 }
791
792 MACHINE_START(EZX_E6, "Motorola EZX E6")
793         .phys_io        = 0x40000000,
794         .io_pg_offst    = (io_p2v(0x40000000) >> 18) & 0xfffc,
795         .boot_params    = 0xa0000100,
796         .map_io         = pxa_map_io,
797         .init_irq       = pxa27x_init_irq,
798         .timer          = &pxa_timer,
799         .init_machine   = e6_init,
800 MACHINE_END
801 #endif
802
803 #ifdef CONFIG_MACH_EZX_E2
804 static struct i2c_board_info __initdata e2_i2c_board_info[] = {
805         { I2C_BOARD_INFO("tea5767", 0x81) },
806 };
807
808 static void __init e2_init(void)
809 {
810         pxa2xx_mfp_config(ARRAY_AND_SIZE(ezx_pin_config));
811         pxa2xx_mfp_config(ARRAY_AND_SIZE(gen2_pin_config));
812         pxa2xx_mfp_config(ARRAY_AND_SIZE(e2_pin_config));
813
814         pxa_set_i2c_info(NULL);
815         i2c_register_board_info(0, ARRAY_AND_SIZE(e2_i2c_board_info));
816
817         set_pxa_fb_info(&ezx_fb_info_2);
818
819         pxa_set_keypad_info(&e2_keypad_platform_data);
820
821         platform_add_devices(devices, ARRAY_SIZE(devices));
822 }
823
824 MACHINE_START(EZX_E2, "Motorola EZX E2")
825         .phys_io        = 0x40000000,
826         .io_pg_offst    = (io_p2v(0x40000000) >> 18) & 0xfffc,
827         .boot_params    = 0xa0000100,
828         .map_io         = pxa_map_io,
829         .init_irq       = pxa27x_init_irq,
830         .timer          = &pxa_timer,
831         .init_machine   = e2_init,
832 MACHINE_END
833 #endif