blob: 8308eee5a92468d79873980bff22d69c3b8b6fda [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 Ospite405ac402009-11-12 15:47:04 +010020#include <linux/gpio.h>
Antonio Ospite1ce2c512009-06-01 12:26:58 +020021#include <linux/gpio_keys.h>
Antonio Ospite87303b82009-11-03 17:45:33 +010022#include <linux/leds-lp3944.h>
Sebastian Andrzej Siewiorb4593962011-02-23 12:38:16 +010023#include <linux/i2c/pxa-i2c.h>
Stefan Schmidt9ab24e42008-07-09 08:08:17 +010024
Antonio Ospite405ac402009-11-12 15:47:04 +010025#include <media/soc_camera.h>
26
Stefan Schmidt9ab24e42008-07-09 08:08:17 +010027#include <asm/setup.h>
Eric Miao51c62982009-01-02 23:17:22 +080028#include <asm/mach-types.h>
29#include <asm/mach/arch.h>
30
31#include <mach/pxa27x.h>
Russell Kinga09e64f2008-08-05 16:14:15 +010032#include <mach/pxafb.h>
33#include <mach/ohci.h>
Russell King05678a92008-11-28 16:04:54 +000034#include <mach/hardware.h>
Mark F. Brown4a2490e2010-09-03 18:28:06 -040035#include <plat/pxa27x_keypad.h>
Antonio Ospite405ac402009-11-12 15:47:04 +010036#include <mach/camera.h>
Stefan Schmidt9ab24e42008-07-09 08:08:17 +010037
Stefan Schmidt9ab24e42008-07-09 08:08:17 +010038#include "devices.h"
39#include "generic.h"
40
Haojian Zhuang6ac6b812010-08-20 15:23:59 +080041#define EZX_NR_IRQS (IRQ_BOARD_START + 24)
42
Antonio Ospite1ce2c512009-06-01 12:26:58 +020043#define GPIO12_A780_FLIP_LID 12
44#define GPIO15_A1200_FLIP_LID 15
45#define GPIO15_A910_FLIP_LID 15
46#define GPIO12_E680_LOCK_SWITCH 12
47#define GPIO15_E6_LOCK_SWITCH 15
Antonio Ospite405ac402009-11-12 15:47:04 +010048#define GPIO50_nCAM_EN 50
49#define GPIO19_GEN1_CAM_RST 19
50#define GPIO28_GEN2_CAM_RST 28
Antonio Ospite1ce2c512009-06-01 12:26:58 +020051
Stefan Schmidt9ab24e42008-07-09 08:08:17 +010052static struct platform_pwm_backlight_data ezx_backlight_data = {
53 .pwm_id = 0,
54 .max_brightness = 1023,
55 .dft_brightness = 1023,
56 .pwm_period_ns = 78770,
57};
58
59static struct platform_device ezx_backlight_device = {
60 .name = "pwm-backlight",
61 .dev = {
62 .parent = &pxa27x_device_pwm0.dev,
63 .platform_data = &ezx_backlight_data,
64 },
65};
66
67static struct pxafb_mode_info mode_ezx_old = {
68 .pixclock = 150000,
69 .xres = 240,
70 .yres = 320,
71 .bpp = 16,
72 .hsync_len = 10,
73 .left_margin = 20,
74 .right_margin = 10,
75 .vsync_len = 2,
76 .upper_margin = 3,
77 .lower_margin = 2,
78 .sync = 0,
79};
80
81static struct pxafb_mach_info ezx_fb_info_1 = {
82 .modes = &mode_ezx_old,
83 .num_modes = 1,
84 .lcd_conn = LCD_COLOR_TFT_16BPP,
85};
86
87static struct pxafb_mode_info mode_72r89803y01 = {
88 .pixclock = 192308,
89 .xres = 240,
90 .yres = 320,
91 .bpp = 32,
92 .depth = 18,
93 .hsync_len = 10,
94 .left_margin = 20,
95 .right_margin = 10,
96 .vsync_len = 2,
97 .upper_margin = 3,
98 .lower_margin = 2,
99 .sync = 0,
100};
101
102static struct pxafb_mach_info ezx_fb_info_2 = {
103 .modes = &mode_72r89803y01,
104 .num_modes = 1,
105 .lcd_conn = LCD_COLOR_TFT_18BPP,
106};
107
Antonio Ospite1ce2c512009-06-01 12:26:58 +0200108static struct platform_device *ezx_devices[] __initdata = {
Stefan Schmidt9ab24e42008-07-09 08:08:17 +0100109 &ezx_backlight_device,
110};
111
112static unsigned long ezx_pin_config[] __initdata = {
113 /* PWM backlight */
114 GPIO16_PWM0_OUT,
115
116 /* BTUART */
117 GPIO42_BTUART_RXD,
118 GPIO43_BTUART_TXD,
119 GPIO44_BTUART_CTS,
120 GPIO45_BTUART_RTS,
121
Eric Miao6f584cf2008-11-28 16:00:24 +0800122 /* I2C */
123 GPIO117_I2C_SCL,
124 GPIO118_I2C_SDA,
Stefan Schmidt9078ac22008-12-08 15:58:08 +0100125
126 /* PCAP SSP */
127 GPIO29_SSP1_SCLK,
128 GPIO25_SSP1_TXD,
129 GPIO26_SSP1_RXD,
130 GPIO24_GPIO, /* pcap chip select */
Daniel Ribeiroff713382009-05-15 06:33:50 -0300131 GPIO1_GPIO | WAKEUP_ON_EDGE_RISE, /* pcap interrupt */
132 GPIO4_GPIO | MFP_LPM_DRIVE_HIGH, /* WDI_AP */
133 GPIO55_GPIO | MFP_LPM_DRIVE_HIGH, /* SYS_RESTART */
Stefan Schmidt9078ac22008-12-08 15:58:08 +0100134
135 /* MMC */
136 GPIO32_MMC_CLK,
137 GPIO92_MMC_DAT_0,
138 GPIO109_MMC_DAT_1,
139 GPIO110_MMC_DAT_2,
140 GPIO111_MMC_DAT_3,
141 GPIO112_MMC_CMD,
142 GPIO11_GPIO, /* mmc detect */
143
144 /* usb to external transceiver */
145 GPIO34_USB_P2_2,
146 GPIO35_USB_P2_1,
147 GPIO36_USB_P2_4,
148 GPIO39_USB_P2_6,
149 GPIO40_USB_P2_5,
150 GPIO53_USB_P2_3,
151
152 /* usb to Neptune GSM chip */
153 GPIO30_USB_P3_2,
154 GPIO31_USB_P3_6,
155 GPIO90_USB_P3_5,
156 GPIO91_USB_P3_1,
157 GPIO56_USB_P3_4,
158 GPIO113_USB_P3_3,
Stefan Schmidt9ab24e42008-07-09 08:08:17 +0100159};
160
Stefan Schmidt9078ac22008-12-08 15:58:08 +0100161#if defined(CONFIG_MACH_EZX_A780) || defined(CONFIG_MACH_EZX_E680)
162static unsigned long gen1_pin_config[] __initdata = {
163 /* flip / lockswitch */
Daniel Ribeiroff713382009-05-15 06:33:50 -0300164 GPIO12_GPIO | WAKEUP_ON_EDGE_BOTH,
Stefan Schmidt9078ac22008-12-08 15:58:08 +0100165
166 /* bluetooth (bcm2035) */
Daniel Ribeiroff713382009-05-15 06:33:50 -0300167 GPIO14_GPIO | WAKEUP_ON_EDGE_RISE, /* HOSTWAKE */
Stefan Schmidt9078ac22008-12-08 15:58:08 +0100168 GPIO48_GPIO, /* RESET */
169 GPIO28_GPIO, /* WAKEUP */
170
171 /* Neptune handshake */
Daniel Ribeiroff713382009-05-15 06:33:50 -0300172 GPIO0_GPIO | WAKEUP_ON_EDGE_FALL, /* BP_RDY */
173 GPIO57_GPIO | MFP_LPM_DRIVE_HIGH, /* AP_RDY */
174 GPIO13_GPIO | WAKEUP_ON_EDGE_BOTH, /* WDI */
175 GPIO3_GPIO | WAKEUP_ON_EDGE_BOTH, /* WDI2 */
176 GPIO82_GPIO | MFP_LPM_DRIVE_HIGH, /* RESET */
177 GPIO99_GPIO | MFP_LPM_DRIVE_HIGH, /* TC_MM_EN */
Stefan Schmidt9078ac22008-12-08 15:58:08 +0100178
179 /* sound */
180 GPIO52_SSP3_SCLK,
181 GPIO83_SSP3_SFRM,
182 GPIO81_SSP3_TXD,
183 GPIO89_SSP3_RXD,
184
185 /* ssp2 pins to in */
186 GPIO22_GPIO, /* SSP2_SCLK */
187 GPIO37_GPIO, /* SSP2_SFRM */
188 GPIO38_GPIO, /* SSP2_TXD */
189 GPIO88_GPIO, /* SSP2_RXD */
190
191 /* camera */
192 GPIO23_CIF_MCLK,
193 GPIO54_CIF_PCLK,
194 GPIO85_CIF_LV,
195 GPIO84_CIF_FV,
196 GPIO27_CIF_DD_0,
197 GPIO114_CIF_DD_1,
198 GPIO51_CIF_DD_2,
199 GPIO115_CIF_DD_3,
200 GPIO95_CIF_DD_4,
201 GPIO94_CIF_DD_5,
202 GPIO17_CIF_DD_6,
203 GPIO108_CIF_DD_7,
Antonio Ospite405ac402009-11-12 15:47:04 +0100204 GPIO50_GPIO | MFP_LPM_DRIVE_HIGH, /* CAM_EN */
205 GPIO19_GPIO | MFP_LPM_DRIVE_HIGH, /* CAM_RST */
Stefan Schmidt9078ac22008-12-08 15:58:08 +0100206
207 /* EMU */
208 GPIO120_GPIO, /* EMU_MUX1 */
209 GPIO119_GPIO, /* EMU_MUX2 */
210 GPIO86_GPIO, /* SNP_INT_CTL */
211 GPIO87_GPIO, /* SNP_INT_IN */
212};
213#endif
214
215#if defined(CONFIG_MACH_EZX_A1200) || defined(CONFIG_MACH_EZX_A910) || \
216 defined(CONFIG_MACH_EZX_E2) || defined(CONFIG_MACH_EZX_E6)
217static unsigned long gen2_pin_config[] __initdata = {
218 /* flip / lockswitch */
Daniel Ribeiroff713382009-05-15 06:33:50 -0300219 GPIO15_GPIO | WAKEUP_ON_EDGE_BOTH,
Stefan Schmidt9078ac22008-12-08 15:58:08 +0100220
221 /* EOC */
Daniel Ribeiroff713382009-05-15 06:33:50 -0300222 GPIO10_GPIO | WAKEUP_ON_EDGE_RISE,
Stefan Schmidt9078ac22008-12-08 15:58:08 +0100223
224 /* bluetooth (bcm2045) */
Daniel Ribeiroff713382009-05-15 06:33:50 -0300225 GPIO13_GPIO | WAKEUP_ON_EDGE_RISE, /* HOSTWAKE */
Stefan Schmidt9078ac22008-12-08 15:58:08 +0100226 GPIO37_GPIO, /* RESET */
227 GPIO57_GPIO, /* WAKEUP */
228
229 /* Neptune handshake */
Daniel Ribeiroff713382009-05-15 06:33:50 -0300230 GPIO0_GPIO | WAKEUP_ON_EDGE_FALL, /* BP_RDY */
231 GPIO96_GPIO | MFP_LPM_DRIVE_HIGH, /* AP_RDY */
232 GPIO3_GPIO | WAKEUP_ON_EDGE_FALL, /* WDI */
233 GPIO116_GPIO | MFP_LPM_DRIVE_HIGH, /* RESET */
Stefan Schmidt9078ac22008-12-08 15:58:08 +0100234 GPIO41_GPIO, /* BP_FLASH */
235
236 /* sound */
237 GPIO52_SSP3_SCLK,
238 GPIO83_SSP3_SFRM,
239 GPIO81_SSP3_TXD,
240 GPIO82_SSP3_RXD,
241
242 /* ssp2 pins to in */
243 GPIO22_GPIO, /* SSP2_SCLK */
244 GPIO14_GPIO, /* SSP2_SFRM */
245 GPIO38_GPIO, /* SSP2_TXD */
246 GPIO88_GPIO, /* SSP2_RXD */
247
248 /* camera */
249 GPIO23_CIF_MCLK,
250 GPIO54_CIF_PCLK,
251 GPIO85_CIF_LV,
252 GPIO84_CIF_FV,
253 GPIO27_CIF_DD_0,
254 GPIO114_CIF_DD_1,
255 GPIO51_CIF_DD_2,
256 GPIO115_CIF_DD_3,
257 GPIO95_CIF_DD_4,
258 GPIO48_CIF_DD_5,
259 GPIO93_CIF_DD_6,
260 GPIO12_CIF_DD_7,
Antonio Ospite405ac402009-11-12 15:47:04 +0100261 GPIO50_GPIO | MFP_LPM_DRIVE_HIGH, /* CAM_EN */
262 GPIO28_GPIO | MFP_LPM_DRIVE_HIGH, /* CAM_RST */
Stefan Schmidt9078ac22008-12-08 15:58:08 +0100263 GPIO17_GPIO, /* CAM_FLASH */
264};
265#endif
266
267#ifdef CONFIG_MACH_EZX_A780
268static unsigned long a780_pin_config[] __initdata = {
269 /* keypad */
270 GPIO93_KP_DKIN_0 | WAKEUP_ON_LEVEL_HIGH,
271 GPIO100_KP_MKIN_0 | WAKEUP_ON_LEVEL_HIGH,
272 GPIO101_KP_MKIN_1 | WAKEUP_ON_LEVEL_HIGH,
273 GPIO102_KP_MKIN_2 | WAKEUP_ON_LEVEL_HIGH,
274 GPIO97_KP_MKIN_3 | WAKEUP_ON_LEVEL_HIGH,
275 GPIO98_KP_MKIN_4 | WAKEUP_ON_LEVEL_HIGH,
276 GPIO103_KP_MKOUT_0,
277 GPIO104_KP_MKOUT_1,
278 GPIO105_KP_MKOUT_2,
279 GPIO106_KP_MKOUT_3,
280 GPIO107_KP_MKOUT_4,
281
282 /* attenuate sound */
283 GPIO96_GPIO,
284};
285#endif
286
287#ifdef CONFIG_MACH_EZX_E680
288static unsigned long e680_pin_config[] __initdata = {
289 /* keypad */
290 GPIO93_KP_DKIN_0 | WAKEUP_ON_LEVEL_HIGH,
291 GPIO96_KP_DKIN_3 | WAKEUP_ON_LEVEL_HIGH,
292 GPIO97_KP_DKIN_4 | WAKEUP_ON_LEVEL_HIGH,
293 GPIO98_KP_DKIN_5 | WAKEUP_ON_LEVEL_HIGH,
294 GPIO100_KP_MKIN_0 | WAKEUP_ON_LEVEL_HIGH,
295 GPIO101_KP_MKIN_1 | WAKEUP_ON_LEVEL_HIGH,
296 GPIO102_KP_MKIN_2 | WAKEUP_ON_LEVEL_HIGH,
297 GPIO103_KP_MKOUT_0,
298 GPIO104_KP_MKOUT_1,
299 GPIO105_KP_MKOUT_2,
300 GPIO106_KP_MKOUT_3,
301
302 /* MIDI */
303 GPIO79_GPIO, /* VA_SEL_BUL */
304 GPIO80_GPIO, /* FLT_SEL_BUL */
305 GPIO78_GPIO, /* MIDI_RESET */
306 GPIO33_GPIO, /* MIDI_CS */
307 GPIO15_GPIO, /* MIDI_IRQ */
308 GPIO49_GPIO, /* MIDI_NPWE */
309 GPIO18_GPIO, /* MIDI_RDY */
310
311 /* leds */
312 GPIO46_GPIO,
313 GPIO47_GPIO,
314};
315#endif
316
317#ifdef CONFIG_MACH_EZX_A1200
318static unsigned long a1200_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#endif
333
334#ifdef CONFIG_MACH_EZX_A910
335static unsigned long a910_pin_config[] __initdata = {
336 /* keypad */
337 GPIO100_KP_MKIN_0 | WAKEUP_ON_LEVEL_HIGH,
338 GPIO101_KP_MKIN_1 | WAKEUP_ON_LEVEL_HIGH,
339 GPIO102_KP_MKIN_2 | WAKEUP_ON_LEVEL_HIGH,
340 GPIO97_KP_MKIN_3 | WAKEUP_ON_LEVEL_HIGH,
341 GPIO98_KP_MKIN_4 | WAKEUP_ON_LEVEL_HIGH,
342 GPIO103_KP_MKOUT_0,
343 GPIO104_KP_MKOUT_1,
344 GPIO105_KP_MKOUT_2,
345 GPIO106_KP_MKOUT_3,
346 GPIO107_KP_MKOUT_4,
347 GPIO108_KP_MKOUT_5,
348
349 /* WLAN */
350 GPIO89_GPIO, /* RESET */
351 GPIO33_GPIO, /* WAKEUP */
352 GPIO94_GPIO | WAKEUP_ON_LEVEL_HIGH, /* HOSTWAKE */
353
354 /* MMC CS */
355 GPIO20_GPIO,
356};
357#endif
358
359#ifdef CONFIG_MACH_EZX_E2
360static unsigned long e2_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#ifdef CONFIG_MACH_EZX_E6
377static unsigned long e6_pin_config[] __initdata = {
378 /* keypad */
379 GPIO100_KP_MKIN_0 | WAKEUP_ON_LEVEL_HIGH,
380 GPIO101_KP_MKIN_1 | WAKEUP_ON_LEVEL_HIGH,
381 GPIO102_KP_MKIN_2 | WAKEUP_ON_LEVEL_HIGH,
382 GPIO97_KP_MKIN_3 | WAKEUP_ON_LEVEL_HIGH,
383 GPIO98_KP_MKIN_4 | WAKEUP_ON_LEVEL_HIGH,
384 GPIO103_KP_MKOUT_0,
385 GPIO104_KP_MKOUT_1,
386 GPIO105_KP_MKOUT_2,
387 GPIO106_KP_MKOUT_3,
388 GPIO107_KP_MKOUT_4,
389 GPIO108_KP_MKOUT_5,
390};
391#endif
392
Stefan Schmidtfe9490c2008-12-08 15:58:09 +0100393/* KEYPAD */
394#ifdef CONFIG_MACH_EZX_A780
395static unsigned int a780_key_map[] = {
396 KEY(0, 0, KEY_SEND),
397 KEY(0, 1, KEY_BACK),
398 KEY(0, 2, KEY_END),
399 KEY(0, 3, KEY_PAGEUP),
400 KEY(0, 4, KEY_UP),
401
402 KEY(1, 0, KEY_NUMERIC_1),
403 KEY(1, 1, KEY_NUMERIC_2),
404 KEY(1, 2, KEY_NUMERIC_3),
405 KEY(1, 3, KEY_SELECT),
406 KEY(1, 4, KEY_KPENTER),
407
408 KEY(2, 0, KEY_NUMERIC_4),
409 KEY(2, 1, KEY_NUMERIC_5),
410 KEY(2, 2, KEY_NUMERIC_6),
411 KEY(2, 3, KEY_RECORD),
412 KEY(2, 4, KEY_LEFT),
413
414 KEY(3, 0, KEY_NUMERIC_7),
415 KEY(3, 1, KEY_NUMERIC_8),
416 KEY(3, 2, KEY_NUMERIC_9),
417 KEY(3, 3, KEY_HOME),
418 KEY(3, 4, KEY_RIGHT),
419
420 KEY(4, 0, KEY_NUMERIC_STAR),
421 KEY(4, 1, KEY_NUMERIC_0),
422 KEY(4, 2, KEY_NUMERIC_POUND),
423 KEY(4, 3, KEY_PAGEDOWN),
424 KEY(4, 4, KEY_DOWN),
425};
426
427static struct pxa27x_keypad_platform_data a780_keypad_platform_data = {
428 .matrix_key_rows = 5,
429 .matrix_key_cols = 5,
430 .matrix_key_map = a780_key_map,
431 .matrix_key_map_size = ARRAY_SIZE(a780_key_map),
432
433 .direct_key_map = { KEY_CAMERA },
434 .direct_key_num = 1,
435
436 .debounce_interval = 30,
437};
438#endif /* CONFIG_MACH_EZX_A780 */
439
440#ifdef CONFIG_MACH_EZX_E680
441static unsigned int e680_key_map[] = {
442 KEY(0, 0, KEY_UP),
443 KEY(0, 1, KEY_RIGHT),
444 KEY(0, 2, KEY_RESERVED),
445 KEY(0, 3, KEY_SEND),
446
447 KEY(1, 0, KEY_DOWN),
448 KEY(1, 1, KEY_LEFT),
449 KEY(1, 2, KEY_PAGEUP),
450 KEY(1, 3, KEY_PAGEDOWN),
451
452 KEY(2, 0, KEY_RESERVED),
453 KEY(2, 1, KEY_RESERVED),
454 KEY(2, 2, KEY_RESERVED),
455 KEY(2, 3, KEY_KPENTER),
456};
457
458static struct pxa27x_keypad_platform_data e680_keypad_platform_data = {
459 .matrix_key_rows = 3,
460 .matrix_key_cols = 4,
461 .matrix_key_map = e680_key_map,
462 .matrix_key_map_size = ARRAY_SIZE(e680_key_map),
463
464 .direct_key_map = {
465 KEY_CAMERA,
466 KEY_RESERVED,
467 KEY_RESERVED,
468 KEY_F1,
469 KEY_CANCEL,
470 KEY_F2,
471 },
472 .direct_key_num = 6,
473
474 .debounce_interval = 30,
475};
476#endif /* CONFIG_MACH_EZX_E680 */
477
478#ifdef CONFIG_MACH_EZX_A1200
479static unsigned int a1200_key_map[] = {
480 KEY(0, 0, KEY_RESERVED),
481 KEY(0, 1, KEY_RIGHT),
482 KEY(0, 2, KEY_PAGEDOWN),
483 KEY(0, 3, KEY_RESERVED),
484 KEY(0, 4, KEY_RESERVED),
485 KEY(0, 5, KEY_RESERVED),
486
487 KEY(1, 0, KEY_RESERVED),
488 KEY(1, 1, KEY_DOWN),
489 KEY(1, 2, KEY_CAMERA),
490 KEY(1, 3, KEY_RESERVED),
491 KEY(1, 4, KEY_RESERVED),
492 KEY(1, 5, KEY_RESERVED),
493
494 KEY(2, 0, KEY_RESERVED),
495 KEY(2, 1, KEY_KPENTER),
496 KEY(2, 2, KEY_RECORD),
497 KEY(2, 3, KEY_RESERVED),
498 KEY(2, 4, KEY_RESERVED),
499 KEY(2, 5, KEY_SELECT),
500
501 KEY(3, 0, KEY_RESERVED),
502 KEY(3, 1, KEY_UP),
503 KEY(3, 2, KEY_SEND),
504 KEY(3, 3, KEY_RESERVED),
505 KEY(3, 4, KEY_RESERVED),
506 KEY(3, 5, KEY_RESERVED),
507
508 KEY(4, 0, KEY_RESERVED),
509 KEY(4, 1, KEY_LEFT),
510 KEY(4, 2, KEY_PAGEUP),
511 KEY(4, 3, KEY_RESERVED),
512 KEY(4, 4, KEY_RESERVED),
513 KEY(4, 5, KEY_RESERVED),
514};
515
516static struct pxa27x_keypad_platform_data a1200_keypad_platform_data = {
517 .matrix_key_rows = 5,
518 .matrix_key_cols = 6,
519 .matrix_key_map = a1200_key_map,
520 .matrix_key_map_size = ARRAY_SIZE(a1200_key_map),
521
522 .debounce_interval = 30,
523};
524#endif /* CONFIG_MACH_EZX_A1200 */
525
526#ifdef CONFIG_MACH_EZX_E6
527static unsigned int e6_key_map[] = {
528 KEY(0, 0, KEY_RESERVED),
529 KEY(0, 1, KEY_RIGHT),
530 KEY(0, 2, KEY_PAGEDOWN),
531 KEY(0, 3, KEY_RESERVED),
532 KEY(0, 4, KEY_RESERVED),
533 KEY(0, 5, KEY_NEXTSONG),
534
535 KEY(1, 0, KEY_RESERVED),
536 KEY(1, 1, KEY_DOWN),
537 KEY(1, 2, KEY_PROG1),
538 KEY(1, 3, KEY_RESERVED),
539 KEY(1, 4, KEY_RESERVED),
540 KEY(1, 5, KEY_RESERVED),
541
542 KEY(2, 0, KEY_RESERVED),
543 KEY(2, 1, KEY_ENTER),
544 KEY(2, 2, KEY_CAMERA),
545 KEY(2, 3, KEY_RESERVED),
546 KEY(2, 4, KEY_RESERVED),
547 KEY(2, 5, KEY_WWW),
548
549 KEY(3, 0, KEY_RESERVED),
550 KEY(3, 1, KEY_UP),
551 KEY(3, 2, KEY_SEND),
552 KEY(3, 3, KEY_RESERVED),
553 KEY(3, 4, KEY_RESERVED),
554 KEY(3, 5, KEY_PLAYPAUSE),
555
556 KEY(4, 0, KEY_RESERVED),
557 KEY(4, 1, KEY_LEFT),
558 KEY(4, 2, KEY_PAGEUP),
559 KEY(4, 3, KEY_RESERVED),
560 KEY(4, 4, KEY_RESERVED),
561 KEY(4, 5, KEY_PREVIOUSSONG),
562};
563
564static struct pxa27x_keypad_platform_data e6_keypad_platform_data = {
565 .matrix_key_rows = 5,
566 .matrix_key_cols = 6,
567 .matrix_key_map = e6_key_map,
568 .matrix_key_map_size = ARRAY_SIZE(e6_key_map),
569
570 .debounce_interval = 30,
571};
572#endif /* CONFIG_MACH_EZX_E6 */
573
574#ifdef CONFIG_MACH_EZX_A910
575static unsigned int a910_key_map[] = {
576 KEY(0, 0, KEY_NUMERIC_6),
577 KEY(0, 1, KEY_RIGHT),
578 KEY(0, 2, KEY_PAGEDOWN),
579 KEY(0, 3, KEY_KPENTER),
580 KEY(0, 4, KEY_NUMERIC_5),
581 KEY(0, 5, KEY_CAMERA),
582
583 KEY(1, 0, KEY_NUMERIC_8),
584 KEY(1, 1, KEY_DOWN),
585 KEY(1, 2, KEY_RESERVED),
586 KEY(1, 3, KEY_F1), /* Left SoftKey */
587 KEY(1, 4, KEY_NUMERIC_STAR),
588 KEY(1, 5, KEY_RESERVED),
589
590 KEY(2, 0, KEY_NUMERIC_7),
591 KEY(2, 1, KEY_NUMERIC_9),
592 KEY(2, 2, KEY_RECORD),
593 KEY(2, 3, KEY_F2), /* Right SoftKey */
594 KEY(2, 4, KEY_BACK),
595 KEY(2, 5, KEY_SELECT),
596
597 KEY(3, 0, KEY_NUMERIC_2),
598 KEY(3, 1, KEY_UP),
599 KEY(3, 2, KEY_SEND),
600 KEY(3, 3, KEY_NUMERIC_0),
601 KEY(3, 4, KEY_NUMERIC_1),
602 KEY(3, 5, KEY_RECORD),
603
604 KEY(4, 0, KEY_NUMERIC_4),
605 KEY(4, 1, KEY_LEFT),
606 KEY(4, 2, KEY_PAGEUP),
607 KEY(4, 3, KEY_NUMERIC_POUND),
608 KEY(4, 4, KEY_NUMERIC_3),
609 KEY(4, 5, KEY_RESERVED),
610};
611
612static struct pxa27x_keypad_platform_data a910_keypad_platform_data = {
613 .matrix_key_rows = 5,
614 .matrix_key_cols = 6,
615 .matrix_key_map = a910_key_map,
616 .matrix_key_map_size = ARRAY_SIZE(a910_key_map),
617
618 .debounce_interval = 30,
619};
620#endif /* CONFIG_MACH_EZX_A910 */
621
622#ifdef CONFIG_MACH_EZX_E2
623static unsigned int e2_key_map[] = {
624 KEY(0, 0, KEY_NUMERIC_6),
625 KEY(0, 1, KEY_RIGHT),
626 KEY(0, 2, KEY_NUMERIC_9),
627 KEY(0, 3, KEY_NEXTSONG),
628 KEY(0, 4, KEY_NUMERIC_5),
629 KEY(0, 5, KEY_F1), /* Left SoftKey */
630
631 KEY(1, 0, KEY_NUMERIC_8),
632 KEY(1, 1, KEY_DOWN),
633 KEY(1, 2, KEY_RESERVED),
634 KEY(1, 3, KEY_PAGEUP),
635 KEY(1, 4, KEY_NUMERIC_STAR),
636 KEY(1, 5, KEY_F2), /* Right SoftKey */
637
638 KEY(2, 0, KEY_NUMERIC_7),
639 KEY(2, 1, KEY_KPENTER),
640 KEY(2, 2, KEY_RECORD),
641 KEY(2, 3, KEY_PAGEDOWN),
642 KEY(2, 4, KEY_BACK),
643 KEY(2, 5, KEY_NUMERIC_0),
644
645 KEY(3, 0, KEY_NUMERIC_2),
646 KEY(3, 1, KEY_UP),
647 KEY(3, 2, KEY_SEND),
648 KEY(3, 3, KEY_PLAYPAUSE),
649 KEY(3, 4, KEY_NUMERIC_1),
650 KEY(3, 5, KEY_SOUND), /* Music SoftKey */
651
652 KEY(4, 0, KEY_NUMERIC_4),
653 KEY(4, 1, KEY_LEFT),
654 KEY(4, 2, KEY_NUMERIC_POUND),
655 KEY(4, 3, KEY_PREVIOUSSONG),
656 KEY(4, 4, KEY_NUMERIC_3),
657 KEY(4, 5, KEY_RESERVED),
658};
659
660static struct pxa27x_keypad_platform_data e2_keypad_platform_data = {
661 .matrix_key_rows = 5,
662 .matrix_key_cols = 6,
663 .matrix_key_map = e2_key_map,
664 .matrix_key_map_size = ARRAY_SIZE(e2_key_map),
665
666 .debounce_interval = 30,
667};
668#endif /* CONFIG_MACH_EZX_E2 */
669
Stefan Schmidt9078ac22008-12-08 15:58:08 +0100670#ifdef CONFIG_MACH_EZX_A780
Antonio Ospite1ce2c512009-06-01 12:26:58 +0200671/* gpio_keys */
672static struct gpio_keys_button a780_buttons[] = {
673 [0] = {
674 .code = SW_LID,
675 .gpio = GPIO12_A780_FLIP_LID,
676 .active_low = 0,
677 .desc = "A780 flip lid",
678 .type = EV_SW,
679 .wakeup = 1,
680 },
681};
682
683static struct gpio_keys_platform_data a780_gpio_keys_platform_data = {
684 .buttons = a780_buttons,
685 .nbuttons = ARRAY_SIZE(a780_buttons),
686};
687
688static struct platform_device a780_gpio_keys = {
689 .name = "gpio-keys",
690 .id = -1,
691 .dev = {
692 .platform_data = &a780_gpio_keys_platform_data,
693 },
694};
695
Antonio Ospite405ac402009-11-12 15:47:04 +0100696/* camera */
697static int a780_camera_init(void)
698{
699 int err;
700
701 /*
702 * GPIO50_nCAM_EN is active low
703 * GPIO19_GEN1_CAM_RST is active on rising edge
704 */
705 err = gpio_request(GPIO50_nCAM_EN, "nCAM_EN");
706 if (err) {
707 pr_err("%s: Failed to request nCAM_EN\n", __func__);
708 goto fail;
709 }
710
711 err = gpio_request(GPIO19_GEN1_CAM_RST, "CAM_RST");
712 if (err) {
713 pr_err("%s: Failed to request CAM_RST\n", __func__);
714 goto fail_gpio_cam_rst;
715 }
716
717 gpio_direction_output(GPIO50_nCAM_EN, 1);
718 gpio_direction_output(GPIO19_GEN1_CAM_RST, 0);
719
720 return 0;
721
722fail_gpio_cam_rst:
723 gpio_free(GPIO50_nCAM_EN);
724fail:
725 return err;
726}
727
728static int a780_camera_power(struct device *dev, int on)
729{
730 gpio_set_value(GPIO50_nCAM_EN, !on);
731 return 0;
732}
733
734static int a780_camera_reset(struct device *dev)
735{
736 gpio_set_value(GPIO19_GEN1_CAM_RST, 0);
737 msleep(10);
738 gpio_set_value(GPIO19_GEN1_CAM_RST, 1);
739
740 return 0;
741}
742
743struct pxacamera_platform_data a780_pxacamera_platform_data = {
744 .flags = PXA_CAMERA_MASTER | PXA_CAMERA_DATAWIDTH_8 |
745 PXA_CAMERA_PCLK_EN | PXA_CAMERA_MCLK_EN,
746 .mclk_10khz = 5000,
747};
748
749static struct i2c_board_info a780_camera_i2c_board_info = {
750 I2C_BOARD_INFO("mt9m111", 0x5d),
751};
752
753static struct soc_camera_link a780_iclink = {
754 .bus_id = 0,
755 .flags = SOCAM_SENSOR_INVERT_PCLK,
756 .i2c_adapter_id = 0,
757 .board_info = &a780_camera_i2c_board_info,
Antonio Ospite405ac402009-11-12 15:47:04 +0100758 .power = a780_camera_power,
759 .reset = a780_camera_reset,
760};
761
762static struct platform_device a780_camera = {
763 .name = "soc-camera-pdrv",
764 .id = 0,
765 .dev = {
766 .platform_data = &a780_iclink,
767 },
768};
769
Antonio Ospite1ce2c512009-06-01 12:26:58 +0200770static struct platform_device *a780_devices[] __initdata = {
771 &a780_gpio_keys,
772};
773
Stefan Schmidt9078ac22008-12-08 15:58:08 +0100774static void __init a780_init(void)
Stefan Schmidt9ab24e42008-07-09 08:08:17 +0100775{
776 pxa2xx_mfp_config(ARRAY_AND_SIZE(ezx_pin_config));
Stefan Schmidt9078ac22008-12-08 15:58:08 +0100777 pxa2xx_mfp_config(ARRAY_AND_SIZE(gen1_pin_config));
778 pxa2xx_mfp_config(ARRAY_AND_SIZE(a780_pin_config));
779
Russell Kingcc155c62009-11-09 13:34:08 +0800780 pxa_set_ffuart_info(NULL);
781 pxa_set_btuart_info(NULL);
782 pxa_set_stuart_info(NULL);
783
Stefan Schmidt9ab24e42008-07-09 08:08:17 +0100784 pxa_set_i2c_info(NULL);
Stefan Schmidt9078ac22008-12-08 15:58:08 +0100785
Russell King - ARM Linux4321e1a2011-02-15 15:37:30 +0800786 pxa_set_fb_info(NULL, &ezx_fb_info_1);
Stefan Schmidt9ab24e42008-07-09 08:08:17 +0100787
Stefan Schmidtfe9490c2008-12-08 15:58:09 +0100788 pxa_set_keypad_info(&a780_keypad_platform_data);
Stefan Schmidt9ab24e42008-07-09 08:08:17 +0100789
Antonio Ospite405ac402009-11-12 15:47:04 +0100790 if (a780_camera_init() == 0) {
791 pxa_set_camera_info(&a780_pxacamera_platform_data);
792 platform_device_register(&a780_camera);
793 }
794
Antonio Ospite1ce2c512009-06-01 12:26:58 +0200795 platform_add_devices(ARRAY_AND_SIZE(ezx_devices));
796 platform_add_devices(ARRAY_AND_SIZE(a780_devices));
Stefan Schmidt9ab24e42008-07-09 08:08:17 +0100797}
798
Stefan Schmidt9ab24e42008-07-09 08:08:17 +0100799MACHINE_START(EZX_A780, "Motorola EZX A780")
Nicolas Pitre7375aba2011-07-05 22:38:15 -0400800 .atag_offset = 0x100,
Marek Vasut851982c2010-10-11 02:20:19 +0200801 .map_io = pxa27x_map_io,
Haojian Zhuang6ac6b812010-08-20 15:23:59 +0800802 .nr_irqs = EZX_NR_IRQS,
Stefan Schmidt9ab24e42008-07-09 08:08:17 +0100803 .init_irq = pxa27x_init_irq,
Eric Miao8a97ae22011-05-18 21:30:04 +0800804 .handle_irq = pxa27x_handle_irq,
Stefan Schmidt9ab24e42008-07-09 08:08:17 +0100805 .timer = &pxa_timer,
Stefan Schmidt9078ac22008-12-08 15:58:08 +0100806 .init_machine = a780_init,
Stefan Schmidt9ab24e42008-07-09 08:08:17 +0100807MACHINE_END
808#endif
809
810#ifdef CONFIG_MACH_EZX_E680
Antonio Ospite1ce2c512009-06-01 12:26:58 +0200811/* gpio_keys */
812static struct gpio_keys_button e680_buttons[] = {
813 [0] = {
814 .code = KEY_SCREENLOCK,
815 .gpio = GPIO12_E680_LOCK_SWITCH,
816 .active_low = 0,
817 .desc = "E680 lock switch",
818 .type = EV_KEY,
819 .wakeup = 1,
820 },
821};
822
823static struct gpio_keys_platform_data e680_gpio_keys_platform_data = {
824 .buttons = e680_buttons,
825 .nbuttons = ARRAY_SIZE(e680_buttons),
826};
827
828static struct platform_device e680_gpio_keys = {
829 .name = "gpio-keys",
830 .id = -1,
831 .dev = {
832 .platform_data = &e680_gpio_keys_platform_data,
833 },
834};
835
Stefan Schmidtbc09cf62008-12-08 15:58:10 +0100836static struct i2c_board_info __initdata e680_i2c_board_info[] = {
837 { I2C_BOARD_INFO("tea5767", 0x81) },
838};
839
Antonio Ospite1ce2c512009-06-01 12:26:58 +0200840static struct platform_device *e680_devices[] __initdata = {
841 &e680_gpio_keys,
842};
843
Stefan Schmidt9078ac22008-12-08 15:58:08 +0100844static void __init e680_init(void)
845{
846 pxa2xx_mfp_config(ARRAY_AND_SIZE(ezx_pin_config));
847 pxa2xx_mfp_config(ARRAY_AND_SIZE(gen1_pin_config));
848 pxa2xx_mfp_config(ARRAY_AND_SIZE(e680_pin_config));
849
Russell Kingcc155c62009-11-09 13:34:08 +0800850 pxa_set_ffuart_info(NULL);
851 pxa_set_btuart_info(NULL);
852 pxa_set_stuart_info(NULL);
853
Stefan Schmidt9078ac22008-12-08 15:58:08 +0100854 pxa_set_i2c_info(NULL);
Stefan Schmidtbc09cf62008-12-08 15:58:10 +0100855 i2c_register_board_info(0, ARRAY_AND_SIZE(e680_i2c_board_info));
Stefan Schmidt9078ac22008-12-08 15:58:08 +0100856
Russell King - ARM Linux4321e1a2011-02-15 15:37:30 +0800857 pxa_set_fb_info(NULL, &ezx_fb_info_1);
Stefan Schmidt9078ac22008-12-08 15:58:08 +0100858
Stefan Schmidtfe9490c2008-12-08 15:58:09 +0100859 pxa_set_keypad_info(&e680_keypad_platform_data);
860
Antonio Ospite1ce2c512009-06-01 12:26:58 +0200861 platform_add_devices(ARRAY_AND_SIZE(ezx_devices));
862 platform_add_devices(ARRAY_AND_SIZE(e680_devices));
Stefan Schmidt9078ac22008-12-08 15:58:08 +0100863}
864
Stefan Schmidt9ab24e42008-07-09 08:08:17 +0100865MACHINE_START(EZX_E680, "Motorola EZX E680")
Nicolas Pitre7375aba2011-07-05 22:38:15 -0400866 .atag_offset = 0x100,
Marek Vasut851982c2010-10-11 02:20:19 +0200867 .map_io = pxa27x_map_io,
Haojian Zhuang6ac6b812010-08-20 15:23:59 +0800868 .nr_irqs = EZX_NR_IRQS,
Stefan Schmidt9ab24e42008-07-09 08:08:17 +0100869 .init_irq = pxa27x_init_irq,
Eric Miao8a97ae22011-05-18 21:30:04 +0800870 .handle_irq = pxa27x_handle_irq,
Stefan Schmidt9ab24e42008-07-09 08:08:17 +0100871 .timer = &pxa_timer,
Stefan Schmidt9078ac22008-12-08 15:58:08 +0100872 .init_machine = e680_init,
Stefan Schmidt9ab24e42008-07-09 08:08:17 +0100873MACHINE_END
874#endif
875
876#ifdef CONFIG_MACH_EZX_A1200
Antonio Ospite1ce2c512009-06-01 12:26:58 +0200877/* gpio_keys */
878static struct gpio_keys_button a1200_buttons[] = {
879 [0] = {
880 .code = SW_LID,
881 .gpio = GPIO15_A1200_FLIP_LID,
882 .active_low = 0,
883 .desc = "A1200 flip lid",
884 .type = EV_SW,
885 .wakeup = 1,
886 },
887};
888
889static struct gpio_keys_platform_data a1200_gpio_keys_platform_data = {
890 .buttons = a1200_buttons,
891 .nbuttons = ARRAY_SIZE(a1200_buttons),
892};
893
894static struct platform_device a1200_gpio_keys = {
895 .name = "gpio-keys",
896 .id = -1,
897 .dev = {
898 .platform_data = &a1200_gpio_keys_platform_data,
899 },
900};
901
Stefan Schmidtbc09cf62008-12-08 15:58:10 +0100902static struct i2c_board_info __initdata a1200_i2c_board_info[] = {
903 { I2C_BOARD_INFO("tea5767", 0x81) },
904};
905
Antonio Ospite1ce2c512009-06-01 12:26:58 +0200906static struct platform_device *a1200_devices[] __initdata = {
907 &a1200_gpio_keys,
908};
909
Stefan Schmidt9078ac22008-12-08 15:58:08 +0100910static void __init a1200_init(void)
911{
912 pxa2xx_mfp_config(ARRAY_AND_SIZE(ezx_pin_config));
913 pxa2xx_mfp_config(ARRAY_AND_SIZE(gen2_pin_config));
914 pxa2xx_mfp_config(ARRAY_AND_SIZE(a1200_pin_config));
915
Russell Kingcc155c62009-11-09 13:34:08 +0800916 pxa_set_ffuart_info(NULL);
917 pxa_set_btuart_info(NULL);
918 pxa_set_stuart_info(NULL);
919
Stefan Schmidt9078ac22008-12-08 15:58:08 +0100920 pxa_set_i2c_info(NULL);
Stefan Schmidtbc09cf62008-12-08 15:58:10 +0100921 i2c_register_board_info(0, ARRAY_AND_SIZE(a1200_i2c_board_info));
Stefan Schmidt9078ac22008-12-08 15:58:08 +0100922
Russell King - ARM Linux4321e1a2011-02-15 15:37:30 +0800923 pxa_set_fb_info(NULL, &ezx_fb_info_2);
Stefan Schmidt9078ac22008-12-08 15:58:08 +0100924
Stefan Schmidtfe9490c2008-12-08 15:58:09 +0100925 pxa_set_keypad_info(&a1200_keypad_platform_data);
926
Antonio Ospite1ce2c512009-06-01 12:26:58 +0200927 platform_add_devices(ARRAY_AND_SIZE(ezx_devices));
928 platform_add_devices(ARRAY_AND_SIZE(a1200_devices));
Stefan Schmidt9078ac22008-12-08 15:58:08 +0100929}
930
Stefan Schmidt9ab24e42008-07-09 08:08:17 +0100931MACHINE_START(EZX_A1200, "Motorola EZX A1200")
Nicolas Pitre7375aba2011-07-05 22:38:15 -0400932 .atag_offset = 0x100,
Marek Vasut851982c2010-10-11 02:20:19 +0200933 .map_io = pxa27x_map_io,
Haojian Zhuang6ac6b812010-08-20 15:23:59 +0800934 .nr_irqs = EZX_NR_IRQS,
Stefan Schmidt9ab24e42008-07-09 08:08:17 +0100935 .init_irq = pxa27x_init_irq,
Eric Miao8a97ae22011-05-18 21:30:04 +0800936 .handle_irq = pxa27x_handle_irq,
Stefan Schmidt9ab24e42008-07-09 08:08:17 +0100937 .timer = &pxa_timer,
Stefan Schmidt9078ac22008-12-08 15:58:08 +0100938 .init_machine = a1200_init,
Stefan Schmidt9ab24e42008-07-09 08:08:17 +0100939MACHINE_END
940#endif
941
942#ifdef CONFIG_MACH_EZX_A910
Antonio Ospite1ce2c512009-06-01 12:26:58 +0200943/* gpio_keys */
944static struct gpio_keys_button a910_buttons[] = {
945 [0] = {
946 .code = SW_LID,
947 .gpio = GPIO15_A910_FLIP_LID,
948 .active_low = 0,
949 .desc = "A910 flip lid",
950 .type = EV_SW,
951 .wakeup = 1,
952 },
953};
954
955static struct gpio_keys_platform_data a910_gpio_keys_platform_data = {
956 .buttons = a910_buttons,
957 .nbuttons = ARRAY_SIZE(a910_buttons),
958};
959
960static struct platform_device a910_gpio_keys = {
961 .name = "gpio-keys",
962 .id = -1,
963 .dev = {
964 .platform_data = &a910_gpio_keys_platform_data,
965 },
966};
967
Antonio Ospite405ac402009-11-12 15:47:04 +0100968/* camera */
969static int a910_camera_init(void)
970{
971 int err;
972
973 /*
974 * GPIO50_nCAM_EN is active low
975 * GPIO28_GEN2_CAM_RST is active on rising edge
976 */
977 err = gpio_request(GPIO50_nCAM_EN, "nCAM_EN");
978 if (err) {
979 pr_err("%s: Failed to request nCAM_EN\n", __func__);
980 goto fail;
981 }
982
983 err = gpio_request(GPIO28_GEN2_CAM_RST, "CAM_RST");
984 if (err) {
985 pr_err("%s: Failed to request CAM_RST\n", __func__);
986 goto fail_gpio_cam_rst;
987 }
988
989 gpio_direction_output(GPIO50_nCAM_EN, 1);
990 gpio_direction_output(GPIO28_GEN2_CAM_RST, 0);
991
992 return 0;
993
994fail_gpio_cam_rst:
995 gpio_free(GPIO50_nCAM_EN);
996fail:
997 return err;
998}
999
1000static int a910_camera_power(struct device *dev, int on)
1001{
1002 gpio_set_value(GPIO50_nCAM_EN, !on);
1003 return 0;
1004}
1005
1006static int a910_camera_reset(struct device *dev)
1007{
1008 gpio_set_value(GPIO28_GEN2_CAM_RST, 0);
1009 msleep(10);
1010 gpio_set_value(GPIO28_GEN2_CAM_RST, 1);
1011
1012 return 0;
1013}
1014
1015struct pxacamera_platform_data a910_pxacamera_platform_data = {
1016 .flags = PXA_CAMERA_MASTER | PXA_CAMERA_DATAWIDTH_8 |
1017 PXA_CAMERA_PCLK_EN | PXA_CAMERA_MCLK_EN,
1018 .mclk_10khz = 5000,
1019};
1020
1021static struct i2c_board_info a910_camera_i2c_board_info = {
1022 I2C_BOARD_INFO("mt9m111", 0x5d),
1023};
1024
1025static struct soc_camera_link a910_iclink = {
1026 .bus_id = 0,
1027 .i2c_adapter_id = 0,
1028 .board_info = &a910_camera_i2c_board_info,
Antonio Ospite405ac402009-11-12 15:47:04 +01001029 .power = a910_camera_power,
1030 .reset = a910_camera_reset,
1031};
1032
1033static struct platform_device a910_camera = {
1034 .name = "soc-camera-pdrv",
1035 .id = 0,
1036 .dev = {
1037 .platform_data = &a910_iclink,
1038 },
1039};
1040
Antonio Ospite87303b82009-11-03 17:45:33 +01001041/* leds-lp3944 */
1042static struct lp3944_platform_data a910_lp3944_leds = {
1043 .leds_size = LP3944_LEDS_MAX,
1044 .leds = {
1045 [0] = {
1046 .name = "a910:red:",
1047 .status = LP3944_LED_STATUS_OFF,
1048 .type = LP3944_LED_TYPE_LED,
1049 },
1050 [1] = {
1051 .name = "a910:green:",
1052 .status = LP3944_LED_STATUS_OFF,
1053 .type = LP3944_LED_TYPE_LED,
1054 },
1055 [2] {
1056 .name = "a910:blue:",
1057 .status = LP3944_LED_STATUS_OFF,
1058 .type = LP3944_LED_TYPE_LED,
1059 },
1060 /* Leds 3 and 4 are used as display power switches */
1061 [3] = {
1062 .name = "a910::cli_display",
1063 .status = LP3944_LED_STATUS_OFF,
1064 .type = LP3944_LED_TYPE_LED_INVERTED
1065 },
1066 [4] = {
1067 .name = "a910::main_display",
1068 .status = LP3944_LED_STATUS_ON,
1069 .type = LP3944_LED_TYPE_LED_INVERTED
1070 },
1071 [5] = { .type = LP3944_LED_TYPE_NONE },
1072 [6] = {
1073 .name = "a910::torch",
1074 .status = LP3944_LED_STATUS_OFF,
1075 .type = LP3944_LED_TYPE_LED,
1076 },
1077 [7] = {
1078 .name = "a910::flash",
1079 .status = LP3944_LED_STATUS_OFF,
1080 .type = LP3944_LED_TYPE_LED_INVERTED,
1081 },
1082 },
1083};
1084
1085static struct i2c_board_info __initdata a910_i2c_board_info[] = {
1086 {
1087 I2C_BOARD_INFO("lp3944", 0x60),
1088 .platform_data = &a910_lp3944_leds,
1089 },
1090};
1091
Antonio Ospite1ce2c512009-06-01 12:26:58 +02001092static struct platform_device *a910_devices[] __initdata = {
1093 &a910_gpio_keys,
1094};
1095
Stefan Schmidt9078ac22008-12-08 15:58:08 +01001096static void __init a910_init(void)
1097{
1098 pxa2xx_mfp_config(ARRAY_AND_SIZE(ezx_pin_config));
1099 pxa2xx_mfp_config(ARRAY_AND_SIZE(gen2_pin_config));
1100 pxa2xx_mfp_config(ARRAY_AND_SIZE(a910_pin_config));
1101
Russell Kingcc155c62009-11-09 13:34:08 +08001102 pxa_set_ffuart_info(NULL);
1103 pxa_set_btuart_info(NULL);
1104 pxa_set_stuart_info(NULL);
1105
Stefan Schmidt9078ac22008-12-08 15:58:08 +01001106 pxa_set_i2c_info(NULL);
Antonio Ospite87303b82009-11-03 17:45:33 +01001107 i2c_register_board_info(0, ARRAY_AND_SIZE(a910_i2c_board_info));
Stefan Schmidt9078ac22008-12-08 15:58:08 +01001108
Russell King - ARM Linux4321e1a2011-02-15 15:37:30 +08001109 pxa_set_fb_info(NULL, &ezx_fb_info_2);
Stefan Schmidt9078ac22008-12-08 15:58:08 +01001110
Stefan Schmidtfe9490c2008-12-08 15:58:09 +01001111 pxa_set_keypad_info(&a910_keypad_platform_data);
1112
Antonio Ospite405ac402009-11-12 15:47:04 +01001113 if (a910_camera_init() == 0) {
1114 pxa_set_camera_info(&a910_pxacamera_platform_data);
1115 platform_device_register(&a910_camera);
1116 }
1117
Antonio Ospite1ce2c512009-06-01 12:26:58 +02001118 platform_add_devices(ARRAY_AND_SIZE(ezx_devices));
1119 platform_add_devices(ARRAY_AND_SIZE(a910_devices));
Stefan Schmidt9078ac22008-12-08 15:58:08 +01001120}
1121
Stefan Schmidt9ab24e42008-07-09 08:08:17 +01001122MACHINE_START(EZX_A910, "Motorola EZX A910")
Nicolas Pitre7375aba2011-07-05 22:38:15 -04001123 .atag_offset = 0x100,
Marek Vasut851982c2010-10-11 02:20:19 +02001124 .map_io = pxa27x_map_io,
Haojian Zhuang6ac6b812010-08-20 15:23:59 +08001125 .nr_irqs = EZX_NR_IRQS,
Stefan Schmidt9ab24e42008-07-09 08:08:17 +01001126 .init_irq = pxa27x_init_irq,
Eric Miao8a97ae22011-05-18 21:30:04 +08001127 .handle_irq = pxa27x_handle_irq,
Stefan Schmidt9ab24e42008-07-09 08:08:17 +01001128 .timer = &pxa_timer,
Stefan Schmidt9078ac22008-12-08 15:58:08 +01001129 .init_machine = a910_init,
Stefan Schmidt9ab24e42008-07-09 08:08:17 +01001130MACHINE_END
1131#endif
1132
1133#ifdef CONFIG_MACH_EZX_E6
Antonio Ospite1ce2c512009-06-01 12:26:58 +02001134/* gpio_keys */
1135static struct gpio_keys_button e6_buttons[] = {
1136 [0] = {
1137 .code = KEY_SCREENLOCK,
1138 .gpio = GPIO15_E6_LOCK_SWITCH,
1139 .active_low = 0,
1140 .desc = "E6 lock switch",
1141 .type = EV_KEY,
1142 .wakeup = 1,
1143 },
1144};
1145
1146static struct gpio_keys_platform_data e6_gpio_keys_platform_data = {
1147 .buttons = e6_buttons,
1148 .nbuttons = ARRAY_SIZE(e6_buttons),
1149};
1150
1151static struct platform_device e6_gpio_keys = {
1152 .name = "gpio-keys",
1153 .id = -1,
1154 .dev = {
1155 .platform_data = &e6_gpio_keys_platform_data,
1156 },
1157};
1158
Stefan Schmidtbc09cf62008-12-08 15:58:10 +01001159static struct i2c_board_info __initdata e6_i2c_board_info[] = {
1160 { I2C_BOARD_INFO("tea5767", 0x81) },
1161};
1162
Antonio Ospite1ce2c512009-06-01 12:26:58 +02001163static struct platform_device *e6_devices[] __initdata = {
1164 &e6_gpio_keys,
1165};
1166
Stefan Schmidt9078ac22008-12-08 15:58:08 +01001167static void __init e6_init(void)
1168{
1169 pxa2xx_mfp_config(ARRAY_AND_SIZE(ezx_pin_config));
1170 pxa2xx_mfp_config(ARRAY_AND_SIZE(gen2_pin_config));
1171 pxa2xx_mfp_config(ARRAY_AND_SIZE(e6_pin_config));
1172
Russell Kingcc155c62009-11-09 13:34:08 +08001173 pxa_set_ffuart_info(NULL);
1174 pxa_set_btuart_info(NULL);
1175 pxa_set_stuart_info(NULL);
1176
Stefan Schmidt9078ac22008-12-08 15:58:08 +01001177 pxa_set_i2c_info(NULL);
Stefan Schmidtbc09cf62008-12-08 15:58:10 +01001178 i2c_register_board_info(0, ARRAY_AND_SIZE(e6_i2c_board_info));
Stefan Schmidt9078ac22008-12-08 15:58:08 +01001179
Russell King - ARM Linux4321e1a2011-02-15 15:37:30 +08001180 pxa_set_fb_info(NULL, &ezx_fb_info_2);
Stefan Schmidt9078ac22008-12-08 15:58:08 +01001181
Stefan Schmidtfe9490c2008-12-08 15:58:09 +01001182 pxa_set_keypad_info(&e6_keypad_platform_data);
1183
Antonio Ospite1ce2c512009-06-01 12:26:58 +02001184 platform_add_devices(ARRAY_AND_SIZE(ezx_devices));
1185 platform_add_devices(ARRAY_AND_SIZE(e6_devices));
Stefan Schmidt9078ac22008-12-08 15:58:08 +01001186}
1187
Stefan Schmidt9ab24e42008-07-09 08:08:17 +01001188MACHINE_START(EZX_E6, "Motorola EZX E6")
Nicolas Pitre7375aba2011-07-05 22:38:15 -04001189 .atag_offset = 0x100,
Marek Vasut851982c2010-10-11 02:20:19 +02001190 .map_io = pxa27x_map_io,
Haojian Zhuang6ac6b812010-08-20 15:23:59 +08001191 .nr_irqs = EZX_NR_IRQS,
Stefan Schmidt9ab24e42008-07-09 08:08:17 +01001192 .init_irq = pxa27x_init_irq,
Eric Miao8a97ae22011-05-18 21:30:04 +08001193 .handle_irq = pxa27x_handle_irq,
Stefan Schmidt9ab24e42008-07-09 08:08:17 +01001194 .timer = &pxa_timer,
Stefan Schmidt9078ac22008-12-08 15:58:08 +01001195 .init_machine = e6_init,
Stefan Schmidt9ab24e42008-07-09 08:08:17 +01001196MACHINE_END
1197#endif
1198
1199#ifdef CONFIG_MACH_EZX_E2
Stefan Schmidtbc09cf62008-12-08 15:58:10 +01001200static struct i2c_board_info __initdata e2_i2c_board_info[] = {
1201 { I2C_BOARD_INFO("tea5767", 0x81) },
1202};
1203
Antonio Ospite1ce2c512009-06-01 12:26:58 +02001204static struct platform_device *e2_devices[] __initdata = {
1205};
1206
Stefan Schmidt9078ac22008-12-08 15:58:08 +01001207static void __init e2_init(void)
1208{
1209 pxa2xx_mfp_config(ARRAY_AND_SIZE(ezx_pin_config));
1210 pxa2xx_mfp_config(ARRAY_AND_SIZE(gen2_pin_config));
1211 pxa2xx_mfp_config(ARRAY_AND_SIZE(e2_pin_config));
1212
Russell Kingcc155c62009-11-09 13:34:08 +08001213 pxa_set_ffuart_info(NULL);
1214 pxa_set_btuart_info(NULL);
1215 pxa_set_stuart_info(NULL);
1216
Stefan Schmidt9078ac22008-12-08 15:58:08 +01001217 pxa_set_i2c_info(NULL);
Stefan Schmidtbc09cf62008-12-08 15:58:10 +01001218 i2c_register_board_info(0, ARRAY_AND_SIZE(e2_i2c_board_info));
Stefan Schmidt9078ac22008-12-08 15:58:08 +01001219
Russell King - ARM Linux4321e1a2011-02-15 15:37:30 +08001220 pxa_set_fb_info(NULL, &ezx_fb_info_2);
Stefan Schmidt9078ac22008-12-08 15:58:08 +01001221
Stefan Schmidtfe9490c2008-12-08 15:58:09 +01001222 pxa_set_keypad_info(&e2_keypad_platform_data);
1223
Antonio Ospite1ce2c512009-06-01 12:26:58 +02001224 platform_add_devices(ARRAY_AND_SIZE(ezx_devices));
1225 platform_add_devices(ARRAY_AND_SIZE(e2_devices));
Stefan Schmidt9078ac22008-12-08 15:58:08 +01001226}
1227
Stefan Schmidt9ab24e42008-07-09 08:08:17 +01001228MACHINE_START(EZX_E2, "Motorola EZX E2")
Nicolas Pitre7375aba2011-07-05 22:38:15 -04001229 .atag_offset = 0x100,
Marek Vasut851982c2010-10-11 02:20:19 +02001230 .map_io = pxa27x_map_io,
Haojian Zhuang6ac6b812010-08-20 15:23:59 +08001231 .nr_irqs = EZX_NR_IRQS,
Stefan Schmidt9ab24e42008-07-09 08:08:17 +01001232 .init_irq = pxa27x_init_irq,
Eric Miao8a97ae22011-05-18 21:30:04 +08001233 .handle_irq = pxa27x_handle_irq,
Stefan Schmidt9ab24e42008-07-09 08:08:17 +01001234 .timer = &pxa_timer,
Stefan Schmidt9078ac22008-12-08 15:58:08 +01001235 .init_machine = e2_init,
Stefan Schmidt9ab24e42008-07-09 08:08:17 +01001236MACHINE_END
1237#endif