blob: 588b265e5755e150dad5bb049fec275867515d20 [file] [log] [blame]
Stefan Schmidt9ab24e42008-07-09 08:08:17 +01001/*
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>
Stefan Schmidtfe9490c2008-12-08 15:58:09 +010019#include <linux/input.h>
Antonio Ospite1ce2c512009-06-01 12:26:58 +020020#include <linux/gpio_keys.h>
Stefan Schmidt9ab24e42008-07-09 08:08:17 +010021
22#include <asm/setup.h>
Eric Miao51c62982009-01-02 23:17:22 +080023#include <asm/mach-types.h>
24#include <asm/mach/arch.h>
25
26#include <mach/pxa27x.h>
Russell Kinga09e64f2008-08-05 16:14:15 +010027#include <mach/pxafb.h>
28#include <mach/ohci.h>
Eric Miaof0a83702009-04-13 15:03:11 +080029#include <plat/i2c.h>
Russell King05678a92008-11-28 16:04:54 +000030#include <mach/hardware.h>
Stefan Schmidtfe9490c2008-12-08 15:58:09 +010031#include <mach/pxa27x_keypad.h>
Stefan Schmidt9ab24e42008-07-09 08:08:17 +010032
Stefan Schmidt9ab24e42008-07-09 08:08:17 +010033#include "devices.h"
34#include "generic.h"
35
Antonio Ospite1ce2c512009-06-01 12:26:58 +020036#define GPIO12_A780_FLIP_LID 12
37#define GPIO15_A1200_FLIP_LID 15
38#define GPIO15_A910_FLIP_LID 15
39#define GPIO12_E680_LOCK_SWITCH 12
40#define GPIO15_E6_LOCK_SWITCH 15
41
Stefan Schmidt9ab24e42008-07-09 08:08:17 +010042static struct platform_pwm_backlight_data ezx_backlight_data = {
43 .pwm_id = 0,
44 .max_brightness = 1023,
45 .dft_brightness = 1023,
46 .pwm_period_ns = 78770,
47};
48
49static struct platform_device ezx_backlight_device = {
50 .name = "pwm-backlight",
51 .dev = {
52 .parent = &pxa27x_device_pwm0.dev,
53 .platform_data = &ezx_backlight_data,
54 },
55};
56
57static struct pxafb_mode_info mode_ezx_old = {
58 .pixclock = 150000,
59 .xres = 240,
60 .yres = 320,
61 .bpp = 16,
62 .hsync_len = 10,
63 .left_margin = 20,
64 .right_margin = 10,
65 .vsync_len = 2,
66 .upper_margin = 3,
67 .lower_margin = 2,
68 .sync = 0,
69};
70
71static struct pxafb_mach_info ezx_fb_info_1 = {
72 .modes = &mode_ezx_old,
73 .num_modes = 1,
74 .lcd_conn = LCD_COLOR_TFT_16BPP,
75};
76
77static struct pxafb_mode_info mode_72r89803y01 = {
78 .pixclock = 192308,
79 .xres = 240,
80 .yres = 320,
81 .bpp = 32,
82 .depth = 18,
83 .hsync_len = 10,
84 .left_margin = 20,
85 .right_margin = 10,
86 .vsync_len = 2,
87 .upper_margin = 3,
88 .lower_margin = 2,
89 .sync = 0,
90};
91
92static struct pxafb_mach_info ezx_fb_info_2 = {
93 .modes = &mode_72r89803y01,
94 .num_modes = 1,
95 .lcd_conn = LCD_COLOR_TFT_18BPP,
96};
97
Antonio Ospite1ce2c512009-06-01 12:26:58 +020098static struct platform_device *ezx_devices[] __initdata = {
Stefan Schmidt9ab24e42008-07-09 08:08:17 +010099 &ezx_backlight_device,
100};
101
102static unsigned long ezx_pin_config[] __initdata = {
103 /* PWM backlight */
104 GPIO16_PWM0_OUT,
105
106 /* BTUART */
107 GPIO42_BTUART_RXD,
108 GPIO43_BTUART_TXD,
109 GPIO44_BTUART_CTS,
110 GPIO45_BTUART_RTS,
111
Eric Miao6f584cf2008-11-28 16:00:24 +0800112 /* I2C */
113 GPIO117_I2C_SCL,
114 GPIO118_I2C_SDA,
Stefan Schmidt9078ac22008-12-08 15:58:08 +0100115
116 /* PCAP SSP */
117 GPIO29_SSP1_SCLK,
118 GPIO25_SSP1_TXD,
119 GPIO26_SSP1_RXD,
120 GPIO24_GPIO, /* pcap chip select */
Daniel Ribeiroff713382009-05-15 06:33:50 -0300121 GPIO1_GPIO | WAKEUP_ON_EDGE_RISE, /* pcap interrupt */
122 GPIO4_GPIO | MFP_LPM_DRIVE_HIGH, /* WDI_AP */
123 GPIO55_GPIO | MFP_LPM_DRIVE_HIGH, /* SYS_RESTART */
Stefan Schmidt9078ac22008-12-08 15:58:08 +0100124
125 /* MMC */
126 GPIO32_MMC_CLK,
127 GPIO92_MMC_DAT_0,
128 GPIO109_MMC_DAT_1,
129 GPIO110_MMC_DAT_2,
130 GPIO111_MMC_DAT_3,
131 GPIO112_MMC_CMD,
132 GPIO11_GPIO, /* mmc detect */
133
134 /* usb to external transceiver */
135 GPIO34_USB_P2_2,
136 GPIO35_USB_P2_1,
137 GPIO36_USB_P2_4,
138 GPIO39_USB_P2_6,
139 GPIO40_USB_P2_5,
140 GPIO53_USB_P2_3,
141
142 /* usb to Neptune GSM chip */
143 GPIO30_USB_P3_2,
144 GPIO31_USB_P3_6,
145 GPIO90_USB_P3_5,
146 GPIO91_USB_P3_1,
147 GPIO56_USB_P3_4,
148 GPIO113_USB_P3_3,
Stefan Schmidt9ab24e42008-07-09 08:08:17 +0100149};
150
Stefan Schmidt9078ac22008-12-08 15:58:08 +0100151#if defined(CONFIG_MACH_EZX_A780) || defined(CONFIG_MACH_EZX_E680)
152static unsigned long gen1_pin_config[] __initdata = {
153 /* flip / lockswitch */
Daniel Ribeiroff713382009-05-15 06:33:50 -0300154 GPIO12_GPIO | WAKEUP_ON_EDGE_BOTH,
Stefan Schmidt9078ac22008-12-08 15:58:08 +0100155
156 /* bluetooth (bcm2035) */
Daniel Ribeiroff713382009-05-15 06:33:50 -0300157 GPIO14_GPIO | WAKEUP_ON_EDGE_RISE, /* HOSTWAKE */
Stefan Schmidt9078ac22008-12-08 15:58:08 +0100158 GPIO48_GPIO, /* RESET */
159 GPIO28_GPIO, /* WAKEUP */
160
161 /* Neptune handshake */
Daniel Ribeiroff713382009-05-15 06:33:50 -0300162 GPIO0_GPIO | WAKEUP_ON_EDGE_FALL, /* BP_RDY */
163 GPIO57_GPIO | MFP_LPM_DRIVE_HIGH, /* AP_RDY */
164 GPIO13_GPIO | WAKEUP_ON_EDGE_BOTH, /* WDI */
165 GPIO3_GPIO | WAKEUP_ON_EDGE_BOTH, /* WDI2 */
166 GPIO82_GPIO | MFP_LPM_DRIVE_HIGH, /* RESET */
167 GPIO99_GPIO | MFP_LPM_DRIVE_HIGH, /* TC_MM_EN */
Stefan Schmidt9078ac22008-12-08 15:58:08 +0100168
169 /* sound */
170 GPIO52_SSP3_SCLK,
171 GPIO83_SSP3_SFRM,
172 GPIO81_SSP3_TXD,
173 GPIO89_SSP3_RXD,
174
175 /* ssp2 pins to in */
176 GPIO22_GPIO, /* SSP2_SCLK */
177 GPIO37_GPIO, /* SSP2_SFRM */
178 GPIO38_GPIO, /* SSP2_TXD */
179 GPIO88_GPIO, /* SSP2_RXD */
180
181 /* camera */
182 GPIO23_CIF_MCLK,
183 GPIO54_CIF_PCLK,
184 GPIO85_CIF_LV,
185 GPIO84_CIF_FV,
186 GPIO27_CIF_DD_0,
187 GPIO114_CIF_DD_1,
188 GPIO51_CIF_DD_2,
189 GPIO115_CIF_DD_3,
190 GPIO95_CIF_DD_4,
191 GPIO94_CIF_DD_5,
192 GPIO17_CIF_DD_6,
193 GPIO108_CIF_DD_7,
194 GPIO50_GPIO, /* CAM_EN */
195 GPIO19_GPIO, /* CAM_RST */
196
197 /* EMU */
198 GPIO120_GPIO, /* EMU_MUX1 */
199 GPIO119_GPIO, /* EMU_MUX2 */
200 GPIO86_GPIO, /* SNP_INT_CTL */
201 GPIO87_GPIO, /* SNP_INT_IN */
202};
203#endif
204
205#if defined(CONFIG_MACH_EZX_A1200) || defined(CONFIG_MACH_EZX_A910) || \
206 defined(CONFIG_MACH_EZX_E2) || defined(CONFIG_MACH_EZX_E6)
207static unsigned long gen2_pin_config[] __initdata = {
208 /* flip / lockswitch */
Daniel Ribeiroff713382009-05-15 06:33:50 -0300209 GPIO15_GPIO | WAKEUP_ON_EDGE_BOTH,
Stefan Schmidt9078ac22008-12-08 15:58:08 +0100210
211 /* EOC */
Daniel Ribeiroff713382009-05-15 06:33:50 -0300212 GPIO10_GPIO | WAKEUP_ON_EDGE_RISE,
Stefan Schmidt9078ac22008-12-08 15:58:08 +0100213
214 /* bluetooth (bcm2045) */
Daniel Ribeiroff713382009-05-15 06:33:50 -0300215 GPIO13_GPIO | WAKEUP_ON_EDGE_RISE, /* HOSTWAKE */
Stefan Schmidt9078ac22008-12-08 15:58:08 +0100216 GPIO37_GPIO, /* RESET */
217 GPIO57_GPIO, /* WAKEUP */
218
219 /* Neptune handshake */
Daniel Ribeiroff713382009-05-15 06:33:50 -0300220 GPIO0_GPIO | WAKEUP_ON_EDGE_FALL, /* BP_RDY */
221 GPIO96_GPIO | MFP_LPM_DRIVE_HIGH, /* AP_RDY */
222 GPIO3_GPIO | WAKEUP_ON_EDGE_FALL, /* WDI */
223 GPIO116_GPIO | MFP_LPM_DRIVE_HIGH, /* RESET */
Stefan Schmidt9078ac22008-12-08 15:58:08 +0100224 GPIO41_GPIO, /* BP_FLASH */
225
226 /* sound */
227 GPIO52_SSP3_SCLK,
228 GPIO83_SSP3_SFRM,
229 GPIO81_SSP3_TXD,
230 GPIO82_SSP3_RXD,
231
232 /* ssp2 pins to in */
233 GPIO22_GPIO, /* SSP2_SCLK */
234 GPIO14_GPIO, /* SSP2_SFRM */
235 GPIO38_GPIO, /* SSP2_TXD */
236 GPIO88_GPIO, /* SSP2_RXD */
237
238 /* camera */
239 GPIO23_CIF_MCLK,
240 GPIO54_CIF_PCLK,
241 GPIO85_CIF_LV,
242 GPIO84_CIF_FV,
243 GPIO27_CIF_DD_0,
244 GPIO114_CIF_DD_1,
245 GPIO51_CIF_DD_2,
246 GPIO115_CIF_DD_3,
247 GPIO95_CIF_DD_4,
248 GPIO48_CIF_DD_5,
249 GPIO93_CIF_DD_6,
250 GPIO12_CIF_DD_7,
251 GPIO50_GPIO, /* CAM_EN */
252 GPIO28_GPIO, /* CAM_RST */
253 GPIO17_GPIO, /* CAM_FLASH */
254};
255#endif
256
257#ifdef CONFIG_MACH_EZX_A780
258static unsigned long a780_pin_config[] __initdata = {
259 /* keypad */
260 GPIO93_KP_DKIN_0 | WAKEUP_ON_LEVEL_HIGH,
261 GPIO100_KP_MKIN_0 | WAKEUP_ON_LEVEL_HIGH,
262 GPIO101_KP_MKIN_1 | WAKEUP_ON_LEVEL_HIGH,
263 GPIO102_KP_MKIN_2 | WAKEUP_ON_LEVEL_HIGH,
264 GPIO97_KP_MKIN_3 | WAKEUP_ON_LEVEL_HIGH,
265 GPIO98_KP_MKIN_4 | WAKEUP_ON_LEVEL_HIGH,
266 GPIO103_KP_MKOUT_0,
267 GPIO104_KP_MKOUT_1,
268 GPIO105_KP_MKOUT_2,
269 GPIO106_KP_MKOUT_3,
270 GPIO107_KP_MKOUT_4,
271
272 /* attenuate sound */
273 GPIO96_GPIO,
274};
275#endif
276
277#ifdef CONFIG_MACH_EZX_E680
278static unsigned long e680_pin_config[] __initdata = {
279 /* keypad */
280 GPIO93_KP_DKIN_0 | WAKEUP_ON_LEVEL_HIGH,
281 GPIO96_KP_DKIN_3 | WAKEUP_ON_LEVEL_HIGH,
282 GPIO97_KP_DKIN_4 | WAKEUP_ON_LEVEL_HIGH,
283 GPIO98_KP_DKIN_5 | WAKEUP_ON_LEVEL_HIGH,
284 GPIO100_KP_MKIN_0 | WAKEUP_ON_LEVEL_HIGH,
285 GPIO101_KP_MKIN_1 | WAKEUP_ON_LEVEL_HIGH,
286 GPIO102_KP_MKIN_2 | WAKEUP_ON_LEVEL_HIGH,
287 GPIO103_KP_MKOUT_0,
288 GPIO104_KP_MKOUT_1,
289 GPIO105_KP_MKOUT_2,
290 GPIO106_KP_MKOUT_3,
291
292 /* MIDI */
293 GPIO79_GPIO, /* VA_SEL_BUL */
294 GPIO80_GPIO, /* FLT_SEL_BUL */
295 GPIO78_GPIO, /* MIDI_RESET */
296 GPIO33_GPIO, /* MIDI_CS */
297 GPIO15_GPIO, /* MIDI_IRQ */
298 GPIO49_GPIO, /* MIDI_NPWE */
299 GPIO18_GPIO, /* MIDI_RDY */
300
301 /* leds */
302 GPIO46_GPIO,
303 GPIO47_GPIO,
304};
305#endif
306
307#ifdef CONFIG_MACH_EZX_A1200
308static unsigned long a1200_pin_config[] __initdata = {
309 /* keypad */
310 GPIO100_KP_MKIN_0 | WAKEUP_ON_LEVEL_HIGH,
311 GPIO101_KP_MKIN_1 | WAKEUP_ON_LEVEL_HIGH,
312 GPIO102_KP_MKIN_2 | WAKEUP_ON_LEVEL_HIGH,
313 GPIO97_KP_MKIN_3 | WAKEUP_ON_LEVEL_HIGH,
314 GPIO98_KP_MKIN_4 | WAKEUP_ON_LEVEL_HIGH,
315 GPIO103_KP_MKOUT_0,
316 GPIO104_KP_MKOUT_1,
317 GPIO105_KP_MKOUT_2,
318 GPIO106_KP_MKOUT_3,
319 GPIO107_KP_MKOUT_4,
320 GPIO108_KP_MKOUT_5,
321};
322#endif
323
324#ifdef CONFIG_MACH_EZX_A910
325static unsigned long a910_pin_config[] __initdata = {
326 /* keypad */
327 GPIO100_KP_MKIN_0 | WAKEUP_ON_LEVEL_HIGH,
328 GPIO101_KP_MKIN_1 | WAKEUP_ON_LEVEL_HIGH,
329 GPIO102_KP_MKIN_2 | WAKEUP_ON_LEVEL_HIGH,
330 GPIO97_KP_MKIN_3 | WAKEUP_ON_LEVEL_HIGH,
331 GPIO98_KP_MKIN_4 | WAKEUP_ON_LEVEL_HIGH,
332 GPIO103_KP_MKOUT_0,
333 GPIO104_KP_MKOUT_1,
334 GPIO105_KP_MKOUT_2,
335 GPIO106_KP_MKOUT_3,
336 GPIO107_KP_MKOUT_4,
337 GPIO108_KP_MKOUT_5,
338
339 /* WLAN */
340 GPIO89_GPIO, /* RESET */
341 GPIO33_GPIO, /* WAKEUP */
342 GPIO94_GPIO | WAKEUP_ON_LEVEL_HIGH, /* HOSTWAKE */
343
344 /* MMC CS */
345 GPIO20_GPIO,
346};
347#endif
348
349#ifdef CONFIG_MACH_EZX_E2
350static unsigned long e2_pin_config[] __initdata = {
351 /* keypad */
352 GPIO100_KP_MKIN_0 | WAKEUP_ON_LEVEL_HIGH,
353 GPIO101_KP_MKIN_1 | WAKEUP_ON_LEVEL_HIGH,
354 GPIO102_KP_MKIN_2 | WAKEUP_ON_LEVEL_HIGH,
355 GPIO97_KP_MKIN_3 | WAKEUP_ON_LEVEL_HIGH,
356 GPIO98_KP_MKIN_4 | WAKEUP_ON_LEVEL_HIGH,
357 GPIO103_KP_MKOUT_0,
358 GPIO104_KP_MKOUT_1,
359 GPIO105_KP_MKOUT_2,
360 GPIO106_KP_MKOUT_3,
361 GPIO107_KP_MKOUT_4,
362 GPIO108_KP_MKOUT_5,
363};
364#endif
365
366#ifdef CONFIG_MACH_EZX_E6
367static unsigned long e6_pin_config[] __initdata = {
368 /* keypad */
369 GPIO100_KP_MKIN_0 | WAKEUP_ON_LEVEL_HIGH,
370 GPIO101_KP_MKIN_1 | WAKEUP_ON_LEVEL_HIGH,
371 GPIO102_KP_MKIN_2 | WAKEUP_ON_LEVEL_HIGH,
372 GPIO97_KP_MKIN_3 | WAKEUP_ON_LEVEL_HIGH,
373 GPIO98_KP_MKIN_4 | WAKEUP_ON_LEVEL_HIGH,
374 GPIO103_KP_MKOUT_0,
375 GPIO104_KP_MKOUT_1,
376 GPIO105_KP_MKOUT_2,
377 GPIO106_KP_MKOUT_3,
378 GPIO107_KP_MKOUT_4,
379 GPIO108_KP_MKOUT_5,
380};
381#endif
382
Stefan Schmidtfe9490c2008-12-08 15:58:09 +0100383/* KEYPAD */
384#ifdef CONFIG_MACH_EZX_A780
385static unsigned int a780_key_map[] = {
386 KEY(0, 0, KEY_SEND),
387 KEY(0, 1, KEY_BACK),
388 KEY(0, 2, KEY_END),
389 KEY(0, 3, KEY_PAGEUP),
390 KEY(0, 4, KEY_UP),
391
392 KEY(1, 0, KEY_NUMERIC_1),
393 KEY(1, 1, KEY_NUMERIC_2),
394 KEY(1, 2, KEY_NUMERIC_3),
395 KEY(1, 3, KEY_SELECT),
396 KEY(1, 4, KEY_KPENTER),
397
398 KEY(2, 0, KEY_NUMERIC_4),
399 KEY(2, 1, KEY_NUMERIC_5),
400 KEY(2, 2, KEY_NUMERIC_6),
401 KEY(2, 3, KEY_RECORD),
402 KEY(2, 4, KEY_LEFT),
403
404 KEY(3, 0, KEY_NUMERIC_7),
405 KEY(3, 1, KEY_NUMERIC_8),
406 KEY(3, 2, KEY_NUMERIC_9),
407 KEY(3, 3, KEY_HOME),
408 KEY(3, 4, KEY_RIGHT),
409
410 KEY(4, 0, KEY_NUMERIC_STAR),
411 KEY(4, 1, KEY_NUMERIC_0),
412 KEY(4, 2, KEY_NUMERIC_POUND),
413 KEY(4, 3, KEY_PAGEDOWN),
414 KEY(4, 4, KEY_DOWN),
415};
416
417static struct pxa27x_keypad_platform_data a780_keypad_platform_data = {
418 .matrix_key_rows = 5,
419 .matrix_key_cols = 5,
420 .matrix_key_map = a780_key_map,
421 .matrix_key_map_size = ARRAY_SIZE(a780_key_map),
422
423 .direct_key_map = { KEY_CAMERA },
424 .direct_key_num = 1,
425
426 .debounce_interval = 30,
427};
428#endif /* CONFIG_MACH_EZX_A780 */
429
430#ifdef CONFIG_MACH_EZX_E680
431static unsigned int e680_key_map[] = {
432 KEY(0, 0, KEY_UP),
433 KEY(0, 1, KEY_RIGHT),
434 KEY(0, 2, KEY_RESERVED),
435 KEY(0, 3, KEY_SEND),
436
437 KEY(1, 0, KEY_DOWN),
438 KEY(1, 1, KEY_LEFT),
439 KEY(1, 2, KEY_PAGEUP),
440 KEY(1, 3, KEY_PAGEDOWN),
441
442 KEY(2, 0, KEY_RESERVED),
443 KEY(2, 1, KEY_RESERVED),
444 KEY(2, 2, KEY_RESERVED),
445 KEY(2, 3, KEY_KPENTER),
446};
447
448static struct pxa27x_keypad_platform_data e680_keypad_platform_data = {
449 .matrix_key_rows = 3,
450 .matrix_key_cols = 4,
451 .matrix_key_map = e680_key_map,
452 .matrix_key_map_size = ARRAY_SIZE(e680_key_map),
453
454 .direct_key_map = {
455 KEY_CAMERA,
456 KEY_RESERVED,
457 KEY_RESERVED,
458 KEY_F1,
459 KEY_CANCEL,
460 KEY_F2,
461 },
462 .direct_key_num = 6,
463
464 .debounce_interval = 30,
465};
466#endif /* CONFIG_MACH_EZX_E680 */
467
468#ifdef CONFIG_MACH_EZX_A1200
469static unsigned int a1200_key_map[] = {
470 KEY(0, 0, KEY_RESERVED),
471 KEY(0, 1, KEY_RIGHT),
472 KEY(0, 2, KEY_PAGEDOWN),
473 KEY(0, 3, KEY_RESERVED),
474 KEY(0, 4, KEY_RESERVED),
475 KEY(0, 5, KEY_RESERVED),
476
477 KEY(1, 0, KEY_RESERVED),
478 KEY(1, 1, KEY_DOWN),
479 KEY(1, 2, KEY_CAMERA),
480 KEY(1, 3, KEY_RESERVED),
481 KEY(1, 4, KEY_RESERVED),
482 KEY(1, 5, KEY_RESERVED),
483
484 KEY(2, 0, KEY_RESERVED),
485 KEY(2, 1, KEY_KPENTER),
486 KEY(2, 2, KEY_RECORD),
487 KEY(2, 3, KEY_RESERVED),
488 KEY(2, 4, KEY_RESERVED),
489 KEY(2, 5, KEY_SELECT),
490
491 KEY(3, 0, KEY_RESERVED),
492 KEY(3, 1, KEY_UP),
493 KEY(3, 2, KEY_SEND),
494 KEY(3, 3, KEY_RESERVED),
495 KEY(3, 4, KEY_RESERVED),
496 KEY(3, 5, KEY_RESERVED),
497
498 KEY(4, 0, KEY_RESERVED),
499 KEY(4, 1, KEY_LEFT),
500 KEY(4, 2, KEY_PAGEUP),
501 KEY(4, 3, KEY_RESERVED),
502 KEY(4, 4, KEY_RESERVED),
503 KEY(4, 5, KEY_RESERVED),
504};
505
506static struct pxa27x_keypad_platform_data a1200_keypad_platform_data = {
507 .matrix_key_rows = 5,
508 .matrix_key_cols = 6,
509 .matrix_key_map = a1200_key_map,
510 .matrix_key_map_size = ARRAY_SIZE(a1200_key_map),
511
512 .debounce_interval = 30,
513};
514#endif /* CONFIG_MACH_EZX_A1200 */
515
516#ifdef CONFIG_MACH_EZX_E6
517static unsigned int e6_key_map[] = {
518 KEY(0, 0, KEY_RESERVED),
519 KEY(0, 1, KEY_RIGHT),
520 KEY(0, 2, KEY_PAGEDOWN),
521 KEY(0, 3, KEY_RESERVED),
522 KEY(0, 4, KEY_RESERVED),
523 KEY(0, 5, KEY_NEXTSONG),
524
525 KEY(1, 0, KEY_RESERVED),
526 KEY(1, 1, KEY_DOWN),
527 KEY(1, 2, KEY_PROG1),
528 KEY(1, 3, KEY_RESERVED),
529 KEY(1, 4, KEY_RESERVED),
530 KEY(1, 5, KEY_RESERVED),
531
532 KEY(2, 0, KEY_RESERVED),
533 KEY(2, 1, KEY_ENTER),
534 KEY(2, 2, KEY_CAMERA),
535 KEY(2, 3, KEY_RESERVED),
536 KEY(2, 4, KEY_RESERVED),
537 KEY(2, 5, KEY_WWW),
538
539 KEY(3, 0, KEY_RESERVED),
540 KEY(3, 1, KEY_UP),
541 KEY(3, 2, KEY_SEND),
542 KEY(3, 3, KEY_RESERVED),
543 KEY(3, 4, KEY_RESERVED),
544 KEY(3, 5, KEY_PLAYPAUSE),
545
546 KEY(4, 0, KEY_RESERVED),
547 KEY(4, 1, KEY_LEFT),
548 KEY(4, 2, KEY_PAGEUP),
549 KEY(4, 3, KEY_RESERVED),
550 KEY(4, 4, KEY_RESERVED),
551 KEY(4, 5, KEY_PREVIOUSSONG),
552};
553
554static struct pxa27x_keypad_platform_data e6_keypad_platform_data = {
555 .matrix_key_rows = 5,
556 .matrix_key_cols = 6,
557 .matrix_key_map = e6_key_map,
558 .matrix_key_map_size = ARRAY_SIZE(e6_key_map),
559
560 .debounce_interval = 30,
561};
562#endif /* CONFIG_MACH_EZX_E6 */
563
564#ifdef CONFIG_MACH_EZX_A910
565static unsigned int a910_key_map[] = {
566 KEY(0, 0, KEY_NUMERIC_6),
567 KEY(0, 1, KEY_RIGHT),
568 KEY(0, 2, KEY_PAGEDOWN),
569 KEY(0, 3, KEY_KPENTER),
570 KEY(0, 4, KEY_NUMERIC_5),
571 KEY(0, 5, KEY_CAMERA),
572
573 KEY(1, 0, KEY_NUMERIC_8),
574 KEY(1, 1, KEY_DOWN),
575 KEY(1, 2, KEY_RESERVED),
576 KEY(1, 3, KEY_F1), /* Left SoftKey */
577 KEY(1, 4, KEY_NUMERIC_STAR),
578 KEY(1, 5, KEY_RESERVED),
579
580 KEY(2, 0, KEY_NUMERIC_7),
581 KEY(2, 1, KEY_NUMERIC_9),
582 KEY(2, 2, KEY_RECORD),
583 KEY(2, 3, KEY_F2), /* Right SoftKey */
584 KEY(2, 4, KEY_BACK),
585 KEY(2, 5, KEY_SELECT),
586
587 KEY(3, 0, KEY_NUMERIC_2),
588 KEY(3, 1, KEY_UP),
589 KEY(3, 2, KEY_SEND),
590 KEY(3, 3, KEY_NUMERIC_0),
591 KEY(3, 4, KEY_NUMERIC_1),
592 KEY(3, 5, KEY_RECORD),
593
594 KEY(4, 0, KEY_NUMERIC_4),
595 KEY(4, 1, KEY_LEFT),
596 KEY(4, 2, KEY_PAGEUP),
597 KEY(4, 3, KEY_NUMERIC_POUND),
598 KEY(4, 4, KEY_NUMERIC_3),
599 KEY(4, 5, KEY_RESERVED),
600};
601
602static struct pxa27x_keypad_platform_data a910_keypad_platform_data = {
603 .matrix_key_rows = 5,
604 .matrix_key_cols = 6,
605 .matrix_key_map = a910_key_map,
606 .matrix_key_map_size = ARRAY_SIZE(a910_key_map),
607
608 .debounce_interval = 30,
609};
610#endif /* CONFIG_MACH_EZX_A910 */
611
612#ifdef CONFIG_MACH_EZX_E2
613static unsigned int e2_key_map[] = {
614 KEY(0, 0, KEY_NUMERIC_6),
615 KEY(0, 1, KEY_RIGHT),
616 KEY(0, 2, KEY_NUMERIC_9),
617 KEY(0, 3, KEY_NEXTSONG),
618 KEY(0, 4, KEY_NUMERIC_5),
619 KEY(0, 5, KEY_F1), /* Left SoftKey */
620
621 KEY(1, 0, KEY_NUMERIC_8),
622 KEY(1, 1, KEY_DOWN),
623 KEY(1, 2, KEY_RESERVED),
624 KEY(1, 3, KEY_PAGEUP),
625 KEY(1, 4, KEY_NUMERIC_STAR),
626 KEY(1, 5, KEY_F2), /* Right SoftKey */
627
628 KEY(2, 0, KEY_NUMERIC_7),
629 KEY(2, 1, KEY_KPENTER),
630 KEY(2, 2, KEY_RECORD),
631 KEY(2, 3, KEY_PAGEDOWN),
632 KEY(2, 4, KEY_BACK),
633 KEY(2, 5, KEY_NUMERIC_0),
634
635 KEY(3, 0, KEY_NUMERIC_2),
636 KEY(3, 1, KEY_UP),
637 KEY(3, 2, KEY_SEND),
638 KEY(3, 3, KEY_PLAYPAUSE),
639 KEY(3, 4, KEY_NUMERIC_1),
640 KEY(3, 5, KEY_SOUND), /* Music SoftKey */
641
642 KEY(4, 0, KEY_NUMERIC_4),
643 KEY(4, 1, KEY_LEFT),
644 KEY(4, 2, KEY_NUMERIC_POUND),
645 KEY(4, 3, KEY_PREVIOUSSONG),
646 KEY(4, 4, KEY_NUMERIC_3),
647 KEY(4, 5, KEY_RESERVED),
648};
649
650static struct pxa27x_keypad_platform_data e2_keypad_platform_data = {
651 .matrix_key_rows = 5,
652 .matrix_key_cols = 6,
653 .matrix_key_map = e2_key_map,
654 .matrix_key_map_size = ARRAY_SIZE(e2_key_map),
655
656 .debounce_interval = 30,
657};
658#endif /* CONFIG_MACH_EZX_E2 */
659
Stefan Schmidt9078ac22008-12-08 15:58:08 +0100660#ifdef CONFIG_MACH_EZX_A780
Antonio Ospite1ce2c512009-06-01 12:26:58 +0200661/* gpio_keys */
662static struct gpio_keys_button a780_buttons[] = {
663 [0] = {
664 .code = SW_LID,
665 .gpio = GPIO12_A780_FLIP_LID,
666 .active_low = 0,
667 .desc = "A780 flip lid",
668 .type = EV_SW,
669 .wakeup = 1,
670 },
671};
672
673static struct gpio_keys_platform_data a780_gpio_keys_platform_data = {
674 .buttons = a780_buttons,
675 .nbuttons = ARRAY_SIZE(a780_buttons),
676};
677
678static struct platform_device a780_gpio_keys = {
679 .name = "gpio-keys",
680 .id = -1,
681 .dev = {
682 .platform_data = &a780_gpio_keys_platform_data,
683 },
684};
685
686static struct platform_device *a780_devices[] __initdata = {
687 &a780_gpio_keys,
688};
689
Stefan Schmidt9078ac22008-12-08 15:58:08 +0100690static void __init a780_init(void)
Stefan Schmidt9ab24e42008-07-09 08:08:17 +0100691{
692 pxa2xx_mfp_config(ARRAY_AND_SIZE(ezx_pin_config));
Stefan Schmidt9078ac22008-12-08 15:58:08 +0100693 pxa2xx_mfp_config(ARRAY_AND_SIZE(gen1_pin_config));
694 pxa2xx_mfp_config(ARRAY_AND_SIZE(a780_pin_config));
695
Stefan Schmidt9ab24e42008-07-09 08:08:17 +0100696 pxa_set_i2c_info(NULL);
Stefan Schmidt9078ac22008-12-08 15:58:08 +0100697
698 set_pxa_fb_info(&ezx_fb_info_1);
Stefan Schmidt9ab24e42008-07-09 08:08:17 +0100699
Stefan Schmidtfe9490c2008-12-08 15:58:09 +0100700 pxa_set_keypad_info(&a780_keypad_platform_data);
Stefan Schmidt9ab24e42008-07-09 08:08:17 +0100701
Antonio Ospite1ce2c512009-06-01 12:26:58 +0200702 platform_add_devices(ARRAY_AND_SIZE(ezx_devices));
703 platform_add_devices(ARRAY_AND_SIZE(a780_devices));
Stefan Schmidt9ab24e42008-07-09 08:08:17 +0100704}
705
Stefan Schmidt9ab24e42008-07-09 08:08:17 +0100706MACHINE_START(EZX_A780, "Motorola EZX A780")
707 .phys_io = 0x40000000,
708 .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc,
Stefan Schmidt9ab24e42008-07-09 08:08:17 +0100709 .boot_params = 0xa0000100,
710 .map_io = pxa_map_io,
711 .init_irq = pxa27x_init_irq,
712 .timer = &pxa_timer,
Stefan Schmidt9078ac22008-12-08 15:58:08 +0100713 .init_machine = a780_init,
Stefan Schmidt9ab24e42008-07-09 08:08:17 +0100714MACHINE_END
715#endif
716
717#ifdef CONFIG_MACH_EZX_E680
Antonio Ospite1ce2c512009-06-01 12:26:58 +0200718/* gpio_keys */
719static struct gpio_keys_button e680_buttons[] = {
720 [0] = {
721 .code = KEY_SCREENLOCK,
722 .gpio = GPIO12_E680_LOCK_SWITCH,
723 .active_low = 0,
724 .desc = "E680 lock switch",
725 .type = EV_KEY,
726 .wakeup = 1,
727 },
728};
729
730static struct gpio_keys_platform_data e680_gpio_keys_platform_data = {
731 .buttons = e680_buttons,
732 .nbuttons = ARRAY_SIZE(e680_buttons),
733};
734
735static struct platform_device e680_gpio_keys = {
736 .name = "gpio-keys",
737 .id = -1,
738 .dev = {
739 .platform_data = &e680_gpio_keys_platform_data,
740 },
741};
742
Stefan Schmidtbc09cf62008-12-08 15:58:10 +0100743static struct i2c_board_info __initdata e680_i2c_board_info[] = {
744 { I2C_BOARD_INFO("tea5767", 0x81) },
745};
746
Antonio Ospite1ce2c512009-06-01 12:26:58 +0200747static struct platform_device *e680_devices[] __initdata = {
748 &e680_gpio_keys,
749};
750
Stefan Schmidt9078ac22008-12-08 15:58:08 +0100751static void __init e680_init(void)
752{
753 pxa2xx_mfp_config(ARRAY_AND_SIZE(ezx_pin_config));
754 pxa2xx_mfp_config(ARRAY_AND_SIZE(gen1_pin_config));
755 pxa2xx_mfp_config(ARRAY_AND_SIZE(e680_pin_config));
756
757 pxa_set_i2c_info(NULL);
Stefan Schmidtbc09cf62008-12-08 15:58:10 +0100758 i2c_register_board_info(0, ARRAY_AND_SIZE(e680_i2c_board_info));
Stefan Schmidt9078ac22008-12-08 15:58:08 +0100759
760 set_pxa_fb_info(&ezx_fb_info_1);
761
Stefan Schmidtfe9490c2008-12-08 15:58:09 +0100762 pxa_set_keypad_info(&e680_keypad_platform_data);
763
Antonio Ospite1ce2c512009-06-01 12:26:58 +0200764 platform_add_devices(ARRAY_AND_SIZE(ezx_devices));
765 platform_add_devices(ARRAY_AND_SIZE(e680_devices));
Stefan Schmidt9078ac22008-12-08 15:58:08 +0100766}
767
Stefan Schmidt9ab24e42008-07-09 08:08:17 +0100768MACHINE_START(EZX_E680, "Motorola EZX E680")
769 .phys_io = 0x40000000,
770 .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc,
Stefan Schmidt9ab24e42008-07-09 08:08:17 +0100771 .boot_params = 0xa0000100,
772 .map_io = pxa_map_io,
773 .init_irq = pxa27x_init_irq,
774 .timer = &pxa_timer,
Stefan Schmidt9078ac22008-12-08 15:58:08 +0100775 .init_machine = e680_init,
Stefan Schmidt9ab24e42008-07-09 08:08:17 +0100776MACHINE_END
777#endif
778
779#ifdef CONFIG_MACH_EZX_A1200
Antonio Ospite1ce2c512009-06-01 12:26:58 +0200780/* gpio_keys */
781static struct gpio_keys_button a1200_buttons[] = {
782 [0] = {
783 .code = SW_LID,
784 .gpio = GPIO15_A1200_FLIP_LID,
785 .active_low = 0,
786 .desc = "A1200 flip lid",
787 .type = EV_SW,
788 .wakeup = 1,
789 },
790};
791
792static struct gpio_keys_platform_data a1200_gpio_keys_platform_data = {
793 .buttons = a1200_buttons,
794 .nbuttons = ARRAY_SIZE(a1200_buttons),
795};
796
797static struct platform_device a1200_gpio_keys = {
798 .name = "gpio-keys",
799 .id = -1,
800 .dev = {
801 .platform_data = &a1200_gpio_keys_platform_data,
802 },
803};
804
Stefan Schmidtbc09cf62008-12-08 15:58:10 +0100805static struct i2c_board_info __initdata a1200_i2c_board_info[] = {
806 { I2C_BOARD_INFO("tea5767", 0x81) },
807};
808
Antonio Ospite1ce2c512009-06-01 12:26:58 +0200809static struct platform_device *a1200_devices[] __initdata = {
810 &a1200_gpio_keys,
811};
812
Stefan Schmidt9078ac22008-12-08 15:58:08 +0100813static void __init a1200_init(void)
814{
815 pxa2xx_mfp_config(ARRAY_AND_SIZE(ezx_pin_config));
816 pxa2xx_mfp_config(ARRAY_AND_SIZE(gen2_pin_config));
817 pxa2xx_mfp_config(ARRAY_AND_SIZE(a1200_pin_config));
818
819 pxa_set_i2c_info(NULL);
Stefan Schmidtbc09cf62008-12-08 15:58:10 +0100820 i2c_register_board_info(0, ARRAY_AND_SIZE(a1200_i2c_board_info));
Stefan Schmidt9078ac22008-12-08 15:58:08 +0100821
822 set_pxa_fb_info(&ezx_fb_info_2);
823
Stefan Schmidtfe9490c2008-12-08 15:58:09 +0100824 pxa_set_keypad_info(&a1200_keypad_platform_data);
825
Antonio Ospite1ce2c512009-06-01 12:26:58 +0200826 platform_add_devices(ARRAY_AND_SIZE(ezx_devices));
827 platform_add_devices(ARRAY_AND_SIZE(a1200_devices));
Stefan Schmidt9078ac22008-12-08 15:58:08 +0100828}
829
Stefan Schmidt9ab24e42008-07-09 08:08:17 +0100830MACHINE_START(EZX_A1200, "Motorola EZX A1200")
831 .phys_io = 0x40000000,
832 .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc,
Stefan Schmidt9ab24e42008-07-09 08:08:17 +0100833 .boot_params = 0xa0000100,
834 .map_io = pxa_map_io,
835 .init_irq = pxa27x_init_irq,
836 .timer = &pxa_timer,
Stefan Schmidt9078ac22008-12-08 15:58:08 +0100837 .init_machine = a1200_init,
Stefan Schmidt9ab24e42008-07-09 08:08:17 +0100838MACHINE_END
839#endif
840
841#ifdef CONFIG_MACH_EZX_A910
Antonio Ospite1ce2c512009-06-01 12:26:58 +0200842/* gpio_keys */
843static struct gpio_keys_button a910_buttons[] = {
844 [0] = {
845 .code = SW_LID,
846 .gpio = GPIO15_A910_FLIP_LID,
847 .active_low = 0,
848 .desc = "A910 flip lid",
849 .type = EV_SW,
850 .wakeup = 1,
851 },
852};
853
854static struct gpio_keys_platform_data a910_gpio_keys_platform_data = {
855 .buttons = a910_buttons,
856 .nbuttons = ARRAY_SIZE(a910_buttons),
857};
858
859static struct platform_device a910_gpio_keys = {
860 .name = "gpio-keys",
861 .id = -1,
862 .dev = {
863 .platform_data = &a910_gpio_keys_platform_data,
864 },
865};
866
867static struct platform_device *a910_devices[] __initdata = {
868 &a910_gpio_keys,
869};
870
Stefan Schmidt9078ac22008-12-08 15:58:08 +0100871static void __init a910_init(void)
872{
873 pxa2xx_mfp_config(ARRAY_AND_SIZE(ezx_pin_config));
874 pxa2xx_mfp_config(ARRAY_AND_SIZE(gen2_pin_config));
875 pxa2xx_mfp_config(ARRAY_AND_SIZE(a910_pin_config));
876
877 pxa_set_i2c_info(NULL);
878
879 set_pxa_fb_info(&ezx_fb_info_2);
880
Stefan Schmidtfe9490c2008-12-08 15:58:09 +0100881 pxa_set_keypad_info(&a910_keypad_platform_data);
882
Antonio Ospite1ce2c512009-06-01 12:26:58 +0200883 platform_add_devices(ARRAY_AND_SIZE(ezx_devices));
884 platform_add_devices(ARRAY_AND_SIZE(a910_devices));
Stefan Schmidt9078ac22008-12-08 15:58:08 +0100885}
886
Stefan Schmidt9ab24e42008-07-09 08:08:17 +0100887MACHINE_START(EZX_A910, "Motorola EZX A910")
888 .phys_io = 0x40000000,
889 .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc,
Stefan Schmidt9ab24e42008-07-09 08:08:17 +0100890 .boot_params = 0xa0000100,
891 .map_io = pxa_map_io,
892 .init_irq = pxa27x_init_irq,
893 .timer = &pxa_timer,
Stefan Schmidt9078ac22008-12-08 15:58:08 +0100894 .init_machine = a910_init,
Stefan Schmidt9ab24e42008-07-09 08:08:17 +0100895MACHINE_END
896#endif
897
898#ifdef CONFIG_MACH_EZX_E6
Antonio Ospite1ce2c512009-06-01 12:26:58 +0200899/* gpio_keys */
900static struct gpio_keys_button e6_buttons[] = {
901 [0] = {
902 .code = KEY_SCREENLOCK,
903 .gpio = GPIO15_E6_LOCK_SWITCH,
904 .active_low = 0,
905 .desc = "E6 lock switch",
906 .type = EV_KEY,
907 .wakeup = 1,
908 },
909};
910
911static struct gpio_keys_platform_data e6_gpio_keys_platform_data = {
912 .buttons = e6_buttons,
913 .nbuttons = ARRAY_SIZE(e6_buttons),
914};
915
916static struct platform_device e6_gpio_keys = {
917 .name = "gpio-keys",
918 .id = -1,
919 .dev = {
920 .platform_data = &e6_gpio_keys_platform_data,
921 },
922};
923
Stefan Schmidtbc09cf62008-12-08 15:58:10 +0100924static struct i2c_board_info __initdata e6_i2c_board_info[] = {
925 { I2C_BOARD_INFO("tea5767", 0x81) },
926};
927
Antonio Ospite1ce2c512009-06-01 12:26:58 +0200928static struct platform_device *e6_devices[] __initdata = {
929 &e6_gpio_keys,
930};
931
Stefan Schmidt9078ac22008-12-08 15:58:08 +0100932static void __init e6_init(void)
933{
934 pxa2xx_mfp_config(ARRAY_AND_SIZE(ezx_pin_config));
935 pxa2xx_mfp_config(ARRAY_AND_SIZE(gen2_pin_config));
936 pxa2xx_mfp_config(ARRAY_AND_SIZE(e6_pin_config));
937
938 pxa_set_i2c_info(NULL);
Stefan Schmidtbc09cf62008-12-08 15:58:10 +0100939 i2c_register_board_info(0, ARRAY_AND_SIZE(e6_i2c_board_info));
Stefan Schmidt9078ac22008-12-08 15:58:08 +0100940
941 set_pxa_fb_info(&ezx_fb_info_2);
942
Stefan Schmidtfe9490c2008-12-08 15:58:09 +0100943 pxa_set_keypad_info(&e6_keypad_platform_data);
944
Antonio Ospite1ce2c512009-06-01 12:26:58 +0200945 platform_add_devices(ARRAY_AND_SIZE(ezx_devices));
946 platform_add_devices(ARRAY_AND_SIZE(e6_devices));
Stefan Schmidt9078ac22008-12-08 15:58:08 +0100947}
948
Stefan Schmidt9ab24e42008-07-09 08:08:17 +0100949MACHINE_START(EZX_E6, "Motorola EZX E6")
950 .phys_io = 0x40000000,
951 .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc,
Stefan Schmidt9ab24e42008-07-09 08:08:17 +0100952 .boot_params = 0xa0000100,
953 .map_io = pxa_map_io,
954 .init_irq = pxa27x_init_irq,
955 .timer = &pxa_timer,
Stefan Schmidt9078ac22008-12-08 15:58:08 +0100956 .init_machine = e6_init,
Stefan Schmidt9ab24e42008-07-09 08:08:17 +0100957MACHINE_END
958#endif
959
960#ifdef CONFIG_MACH_EZX_E2
Stefan Schmidtbc09cf62008-12-08 15:58:10 +0100961static struct i2c_board_info __initdata e2_i2c_board_info[] = {
962 { I2C_BOARD_INFO("tea5767", 0x81) },
963};
964
Antonio Ospite1ce2c512009-06-01 12:26:58 +0200965static struct platform_device *e2_devices[] __initdata = {
966};
967
Stefan Schmidt9078ac22008-12-08 15:58:08 +0100968static void __init e2_init(void)
969{
970 pxa2xx_mfp_config(ARRAY_AND_SIZE(ezx_pin_config));
971 pxa2xx_mfp_config(ARRAY_AND_SIZE(gen2_pin_config));
972 pxa2xx_mfp_config(ARRAY_AND_SIZE(e2_pin_config));
973
974 pxa_set_i2c_info(NULL);
Stefan Schmidtbc09cf62008-12-08 15:58:10 +0100975 i2c_register_board_info(0, ARRAY_AND_SIZE(e2_i2c_board_info));
Stefan Schmidt9078ac22008-12-08 15:58:08 +0100976
977 set_pxa_fb_info(&ezx_fb_info_2);
978
Stefan Schmidtfe9490c2008-12-08 15:58:09 +0100979 pxa_set_keypad_info(&e2_keypad_platform_data);
980
Antonio Ospite1ce2c512009-06-01 12:26:58 +0200981 platform_add_devices(ARRAY_AND_SIZE(ezx_devices));
982 platform_add_devices(ARRAY_AND_SIZE(e2_devices));
Stefan Schmidt9078ac22008-12-08 15:58:08 +0100983}
984
Stefan Schmidt9ab24e42008-07-09 08:08:17 +0100985MACHINE_START(EZX_E2, "Motorola EZX E2")
986 .phys_io = 0x40000000,
987 .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc,
Stefan Schmidt9ab24e42008-07-09 08:08:17 +0100988 .boot_params = 0xa0000100,
989 .map_io = pxa_map_io,
990 .init_irq = pxa27x_init_irq,
991 .timer = &pxa_timer,
Stefan Schmidt9078ac22008-12-08 15:58:08 +0100992 .init_machine = e2_init,
Stefan Schmidt9ab24e42008-07-09 08:08:17 +0100993MACHINE_END
994#endif