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