1 // SPDX-License-Identifier: GPL-2.0-only
2 /*
3  *  ezx.c - Common code for the EZX platform.
4  *
5  *  Copyright (C) 2005-2006 Harald Welte <laforge@openezx.org>,
6  *		  2007-2008 Daniel Ribeiro <drwyrm@gmail.com>,
7  *		  2007-2008 Stefan Schmidt <stefan@datenfreihafen.org>
8  */
9 
10 #include <linux/kernel.h>
11 #include <linux/init.h>
12 #include <linux/platform_device.h>
13 #include <linux/delay.h>
14 #include <linux/pwm.h>
15 #include <linux/pwm_backlight.h>
16 #include <linux/regulator/machine.h>
17 #include <linux/regulator/fixed.h>
18 #include <linux/input.h>
19 #include <linux/gpio.h>
20 #include <linux/gpio/machine.h>
21 #include <linux/gpio_keys.h>
22 #include <linux/leds-lp3944.h>
23 #include <linux/platform_data/i2c-pxa.h>
24 
25 #include <asm/setup.h>
26 #include <asm/mach-types.h>
27 #include <asm/mach/arch.h>
28 
29 #include "pxa27x.h"
30 #include <linux/platform_data/video-pxafb.h>
31 #include <linux/platform_data/usb-ohci-pxa27x.h>
32 #include <mach/hardware.h>
33 #include <linux/platform_data/keypad-pxa27x.h>
34 #include <linux/platform_data/media/camera-pxa.h>
35 
36 #include "devices.h"
37 #include "generic.h"
38 
39 #define EZX_NR_IRQS			(IRQ_BOARD_START + 24)
40 
41 #define GPIO12_A780_FLIP_LID 		12
42 #define GPIO15_A1200_FLIP_LID 		15
43 #define GPIO15_A910_FLIP_LID 		15
44 #define GPIO12_E680_LOCK_SWITCH 	12
45 #define GPIO15_E6_LOCK_SWITCH 		15
46 #define GPIO50_nCAM_EN			50
47 #define GPIO19_GEN1_CAM_RST		19
48 #define GPIO28_GEN2_CAM_RST		28
49 
50 static struct pwm_lookup ezx_pwm_lookup[] __maybe_unused = {
51 	PWM_LOOKUP("pxa27x-pwm.0", 0, "pwm-backlight.0", NULL, 78700,
52 		   PWM_POLARITY_NORMAL),
53 };
54 
55 static struct platform_pwm_backlight_data ezx_backlight_data = {
56 	.max_brightness	= 1023,
57 	.dft_brightness	= 1023,
58 	.enable_gpio	= -1,
59 };
60 
61 static struct platform_device ezx_backlight_device = {
62 	.name		= "pwm-backlight",
63 	.dev		= {
64 		.parent	= &pxa27x_device_pwm0.dev,
65 		.platform_data = &ezx_backlight_data,
66 	},
67 };
68 
69 static struct pxafb_mode_info mode_ezx_old = {
70 	.pixclock		= 150000,
71 	.xres			= 240,
72 	.yres			= 320,
73 	.bpp			= 16,
74 	.hsync_len		= 10,
75 	.left_margin		= 20,
76 	.right_margin		= 10,
77 	.vsync_len		= 2,
78 	.upper_margin		= 3,
79 	.lower_margin		= 2,
80 	.sync			= 0,
81 };
82 
83 static struct pxafb_mach_info ezx_fb_info_1 __maybe_unused = {
84 	.modes		= &mode_ezx_old,
85 	.num_modes	= 1,
86 	.lcd_conn	= LCD_COLOR_TFT_16BPP,
87 };
88 
89 static struct pxafb_mode_info mode_72r89803y01 = {
90 	.pixclock		= 192308,
91 	.xres			= 240,
92 	.yres			= 320,
93 	.bpp			= 32,
94 	.depth			= 18,
95 	.hsync_len		= 10,
96 	.left_margin		= 20,
97 	.right_margin		= 10,
98 	.vsync_len		= 2,
99 	.upper_margin		= 3,
100 	.lower_margin		= 2,
101 	.sync			= 0,
102 };
103 
104 static struct pxafb_mach_info ezx_fb_info_2 __maybe_unused = {
105 	.modes		= &mode_72r89803y01,
106 	.num_modes	= 1,
107 	.lcd_conn	= LCD_COLOR_TFT_18BPP,
108 };
109 
110 static struct platform_device *ezx_devices[] __initdata __maybe_unused = {
111 	&ezx_backlight_device,
112 };
113 
114 static unsigned long ezx_pin_config[] __initdata __maybe_unused = {
115 	/* PWM backlight */
116 	GPIO16_PWM0_OUT,
117 
118 	/* BTUART */
119 	GPIO42_BTUART_RXD,
120 	GPIO43_BTUART_TXD,
121 	GPIO44_BTUART_CTS,
122 	GPIO45_BTUART_RTS,
123 
124 	/* I2C */
125 	GPIO117_I2C_SCL,
126 	GPIO118_I2C_SDA,
127 
128 	/* PCAP SSP */
129 	GPIO29_SSP1_SCLK,
130 	GPIO25_SSP1_TXD,
131 	GPIO26_SSP1_RXD,
132 	GPIO24_GPIO,				/* pcap chip select */
133 	GPIO1_GPIO | WAKEUP_ON_EDGE_RISE,	/* pcap interrupt */
134 	GPIO4_GPIO | MFP_LPM_DRIVE_HIGH,	/* WDI_AP */
135 	GPIO55_GPIO | MFP_LPM_DRIVE_HIGH,	/* SYS_RESTART */
136 
137 	/* MMC */
138 	GPIO32_MMC_CLK,
139 	GPIO92_MMC_DAT_0,
140 	GPIO109_MMC_DAT_1,
141 	GPIO110_MMC_DAT_2,
142 	GPIO111_MMC_DAT_3,
143 	GPIO112_MMC_CMD,
144 	GPIO11_GPIO,				/* mmc detect */
145 
146 	/* usb to external transceiver */
147 	GPIO34_USB_P2_2,
148 	GPIO35_USB_P2_1,
149 	GPIO36_USB_P2_4,
150 	GPIO39_USB_P2_6,
151 	GPIO40_USB_P2_5,
152 	GPIO53_USB_P2_3,
153 
154 	/* usb to Neptune GSM chip */
155 	GPIO30_USB_P3_2,
156 	GPIO31_USB_P3_6,
157 	GPIO90_USB_P3_5,
158 	GPIO91_USB_P3_1,
159 	GPIO56_USB_P3_4,
160 	GPIO113_USB_P3_3,
161 };
162 
163 #if defined(CONFIG_MACH_EZX_A780) || defined(CONFIG_MACH_EZX_E680)
164 static unsigned long gen1_pin_config[] __initdata = {
165 	/* flip / lockswitch */
166 	GPIO12_GPIO | WAKEUP_ON_EDGE_BOTH,
167 
168 	/* bluetooth (bcm2035) */
169 	GPIO14_GPIO | WAKEUP_ON_EDGE_RISE,	/* HOSTWAKE */
170 	GPIO48_GPIO,				/* RESET */
171 	GPIO28_GPIO,				/* WAKEUP */
172 
173 	/* Neptune handshake */
174 	GPIO0_GPIO | WAKEUP_ON_EDGE_FALL,	/* BP_RDY */
175 	GPIO57_GPIO | MFP_LPM_DRIVE_HIGH,	/* AP_RDY */
176 	GPIO13_GPIO | WAKEUP_ON_EDGE_BOTH,	/* WDI */
177 	GPIO3_GPIO | WAKEUP_ON_EDGE_BOTH,	/* WDI2 */
178 	GPIO82_GPIO | MFP_LPM_DRIVE_HIGH,	/* RESET */
179 	GPIO99_GPIO | MFP_LPM_DRIVE_HIGH,	/* TC_MM_EN */
180 
181 	/* sound */
182 	GPIO52_SSP3_SCLK,
183 	GPIO83_SSP3_SFRM,
184 	GPIO81_SSP3_TXD,
185 	GPIO89_SSP3_RXD,
186 
187 	/* ssp2 pins to in */
188 	GPIO22_GPIO,				/* SSP2_SCLK */
189 	GPIO37_GPIO,				/* SSP2_SFRM */
190 	GPIO38_GPIO,				/* SSP2_TXD */
191 	GPIO88_GPIO,				/* SSP2_RXD */
192 
193 	/* camera */
194 	GPIO23_CIF_MCLK,
195 	GPIO54_CIF_PCLK,
196 	GPIO85_CIF_LV,
197 	GPIO84_CIF_FV,
198 	GPIO27_CIF_DD_0,
199 	GPIO114_CIF_DD_1,
200 	GPIO51_CIF_DD_2,
201 	GPIO115_CIF_DD_3,
202 	GPIO95_CIF_DD_4,
203 	GPIO94_CIF_DD_5,
204 	GPIO17_CIF_DD_6,
205 	GPIO108_CIF_DD_7,
206 	GPIO50_GPIO | MFP_LPM_DRIVE_HIGH,	/* CAM_EN */
207 	GPIO19_GPIO | MFP_LPM_DRIVE_HIGH,	/* CAM_RST */
208 
209 	/* EMU */
210 	GPIO120_GPIO,				/* EMU_MUX1 */
211 	GPIO119_GPIO,				/* EMU_MUX2 */
212 	GPIO86_GPIO,				/* SNP_INT_CTL */
213 	GPIO87_GPIO,				/* SNP_INT_IN */
214 };
215 #endif
216 
217 #if defined(CONFIG_MACH_EZX_A1200) || defined(CONFIG_MACH_EZX_A910) || \
218 	defined(CONFIG_MACH_EZX_E2) || defined(CONFIG_MACH_EZX_E6)
219 static unsigned long gen2_pin_config[] __initdata = {
220 	/* flip / lockswitch */
221 	GPIO15_GPIO | WAKEUP_ON_EDGE_BOTH,
222 
223 	/* EOC */
224 	GPIO10_GPIO | WAKEUP_ON_EDGE_RISE,
225 
226 	/* bluetooth (bcm2045) */
227 	GPIO13_GPIO | WAKEUP_ON_EDGE_RISE,	/* HOSTWAKE */
228 	GPIO37_GPIO,				/* RESET */
229 	GPIO57_GPIO,				/* WAKEUP */
230 
231 	/* Neptune handshake */
232 	GPIO0_GPIO | WAKEUP_ON_EDGE_FALL,	/* BP_RDY */
233 	GPIO96_GPIO | MFP_LPM_DRIVE_HIGH,	/* AP_RDY */
234 	GPIO3_GPIO | WAKEUP_ON_EDGE_FALL,	/* WDI */
235 	GPIO116_GPIO | MFP_LPM_DRIVE_HIGH,	/* RESET */
236 	GPIO41_GPIO,				/* BP_FLASH */
237 
238 	/* sound */
239 	GPIO52_SSP3_SCLK,
240 	GPIO83_SSP3_SFRM,
241 	GPIO81_SSP3_TXD,
242 	GPIO82_SSP3_RXD,
243 
244 	/* ssp2 pins to in */
245 	GPIO22_GPIO,				/* SSP2_SCLK */
246 	GPIO14_GPIO,				/* SSP2_SFRM */
247 	GPIO38_GPIO,				/* SSP2_TXD */
248 	GPIO88_GPIO,				/* SSP2_RXD */
249 
250 	/* camera */
251 	GPIO23_CIF_MCLK,
252 	GPIO54_CIF_PCLK,
253 	GPIO85_CIF_LV,
254 	GPIO84_CIF_FV,
255 	GPIO27_CIF_DD_0,
256 	GPIO114_CIF_DD_1,
257 	GPIO51_CIF_DD_2,
258 	GPIO115_CIF_DD_3,
259 	GPIO95_CIF_DD_4,
260 	GPIO48_CIF_DD_5,
261 	GPIO93_CIF_DD_6,
262 	GPIO12_CIF_DD_7,
263 	GPIO50_GPIO | MFP_LPM_DRIVE_HIGH,	/* CAM_EN */
264 	GPIO28_GPIO | MFP_LPM_DRIVE_HIGH,	/* CAM_RST */
265 	GPIO17_GPIO,				/* CAM_FLASH */
266 };
267 #endif
268 
269 #ifdef CONFIG_MACH_EZX_A780
270 static unsigned long a780_pin_config[] __initdata = {
271 	/* keypad */
272 	GPIO93_KP_DKIN_0 | WAKEUP_ON_LEVEL_HIGH,
273 	GPIO100_KP_MKIN_0 | WAKEUP_ON_LEVEL_HIGH,
274 	GPIO101_KP_MKIN_1 | WAKEUP_ON_LEVEL_HIGH,
275 	GPIO102_KP_MKIN_2 | WAKEUP_ON_LEVEL_HIGH,
276 	GPIO97_KP_MKIN_3 | WAKEUP_ON_LEVEL_HIGH,
277 	GPIO98_KP_MKIN_4 | WAKEUP_ON_LEVEL_HIGH,
278 	GPIO103_KP_MKOUT_0,
279 	GPIO104_KP_MKOUT_1,
280 	GPIO105_KP_MKOUT_2,
281 	GPIO106_KP_MKOUT_3,
282 	GPIO107_KP_MKOUT_4,
283 
284 	/* attenuate sound */
285 	GPIO96_GPIO,
286 };
287 #endif
288 
289 #ifdef CONFIG_MACH_EZX_E680
290 static unsigned long e680_pin_config[] __initdata = {
291 	/* keypad */
292 	GPIO93_KP_DKIN_0 | WAKEUP_ON_LEVEL_HIGH,
293 	GPIO96_KP_DKIN_3 | WAKEUP_ON_LEVEL_HIGH,
294 	GPIO97_KP_DKIN_4 | WAKEUP_ON_LEVEL_HIGH,
295 	GPIO98_KP_DKIN_5 | WAKEUP_ON_LEVEL_HIGH,
296 	GPIO100_KP_MKIN_0 | WAKEUP_ON_LEVEL_HIGH,
297 	GPIO101_KP_MKIN_1 | WAKEUP_ON_LEVEL_HIGH,
298 	GPIO102_KP_MKIN_2 | WAKEUP_ON_LEVEL_HIGH,
299 	GPIO103_KP_MKOUT_0,
300 	GPIO104_KP_MKOUT_1,
301 	GPIO105_KP_MKOUT_2,
302 	GPIO106_KP_MKOUT_3,
303 
304 	/* MIDI */
305 	GPIO79_GPIO,				/* VA_SEL_BUL */
306 	GPIO80_GPIO,				/* FLT_SEL_BUL */
307 	GPIO78_GPIO,				/* MIDI_RESET */
308 	GPIO33_GPIO,				/* MIDI_CS */
309 	GPIO15_GPIO,				/* MIDI_IRQ */
310 	GPIO49_GPIO,				/* MIDI_NPWE */
311 	GPIO18_GPIO,				/* MIDI_RDY */
312 
313 	/* leds */
314 	GPIO46_GPIO,
315 	GPIO47_GPIO,
316 };
317 #endif
318 
319 #ifdef CONFIG_MACH_EZX_A1200
320 static unsigned long a1200_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 #endif
335 
336 #ifdef CONFIG_MACH_EZX_A910
337 static unsigned long a910_pin_config[] __initdata = {
338 	/* keypad */
339 	GPIO100_KP_MKIN_0 | WAKEUP_ON_LEVEL_HIGH,
340 	GPIO101_KP_MKIN_1 | WAKEUP_ON_LEVEL_HIGH,
341 	GPIO102_KP_MKIN_2 | WAKEUP_ON_LEVEL_HIGH,
342 	GPIO97_KP_MKIN_3 | WAKEUP_ON_LEVEL_HIGH,
343 	GPIO98_KP_MKIN_4 | WAKEUP_ON_LEVEL_HIGH,
344 	GPIO103_KP_MKOUT_0,
345 	GPIO104_KP_MKOUT_1,
346 	GPIO105_KP_MKOUT_2,
347 	GPIO106_KP_MKOUT_3,
348 	GPIO107_KP_MKOUT_4,
349 	GPIO108_KP_MKOUT_5,
350 
351 	/* WLAN */
352 	GPIO89_GPIO,				/* RESET */
353 	GPIO33_GPIO,				/* WAKEUP */
354 	GPIO94_GPIO | WAKEUP_ON_LEVEL_HIGH,	/* HOSTWAKE */
355 
356 	/* MMC CS */
357 	GPIO20_GPIO,
358 };
359 #endif
360 
361 #ifdef CONFIG_MACH_EZX_E2
362 static unsigned long e2_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 #ifdef CONFIG_MACH_EZX_E6
379 static unsigned long e6_pin_config[] __initdata = {
380 	/* keypad */
381 	GPIO100_KP_MKIN_0 | WAKEUP_ON_LEVEL_HIGH,
382 	GPIO101_KP_MKIN_1 | WAKEUP_ON_LEVEL_HIGH,
383 	GPIO102_KP_MKIN_2 | WAKEUP_ON_LEVEL_HIGH,
384 	GPIO97_KP_MKIN_3 | WAKEUP_ON_LEVEL_HIGH,
385 	GPIO98_KP_MKIN_4 | WAKEUP_ON_LEVEL_HIGH,
386 	GPIO103_KP_MKOUT_0,
387 	GPIO104_KP_MKOUT_1,
388 	GPIO105_KP_MKOUT_2,
389 	GPIO106_KP_MKOUT_3,
390 	GPIO107_KP_MKOUT_4,
391 	GPIO108_KP_MKOUT_5,
392 };
393 #endif
394 
395 /* KEYPAD */
396 #ifdef CONFIG_MACH_EZX_A780
397 static const unsigned int a780_key_map[] = {
398 	KEY(0, 0, KEY_SEND),
399 	KEY(0, 1, KEY_BACK),
400 	KEY(0, 2, KEY_END),
401 	KEY(0, 3, KEY_PAGEUP),
402 	KEY(0, 4, KEY_UP),
403 
404 	KEY(1, 0, KEY_NUMERIC_1),
405 	KEY(1, 1, KEY_NUMERIC_2),
406 	KEY(1, 2, KEY_NUMERIC_3),
407 	KEY(1, 3, KEY_SELECT),
408 	KEY(1, 4, KEY_KPENTER),
409 
410 	KEY(2, 0, KEY_NUMERIC_4),
411 	KEY(2, 1, KEY_NUMERIC_5),
412 	KEY(2, 2, KEY_NUMERIC_6),
413 	KEY(2, 3, KEY_RECORD),
414 	KEY(2, 4, KEY_LEFT),
415 
416 	KEY(3, 0, KEY_NUMERIC_7),
417 	KEY(3, 1, KEY_NUMERIC_8),
418 	KEY(3, 2, KEY_NUMERIC_9),
419 	KEY(3, 3, KEY_HOME),
420 	KEY(3, 4, KEY_RIGHT),
421 
422 	KEY(4, 0, KEY_NUMERIC_STAR),
423 	KEY(4, 1, KEY_NUMERIC_0),
424 	KEY(4, 2, KEY_NUMERIC_POUND),
425 	KEY(4, 3, KEY_PAGEDOWN),
426 	KEY(4, 4, KEY_DOWN),
427 };
428 
429 static struct matrix_keymap_data a780_matrix_keymap_data = {
430 	.keymap			= a780_key_map,
431 	.keymap_size		= ARRAY_SIZE(a780_key_map),
432 };
433 
434 static struct pxa27x_keypad_platform_data a780_keypad_platform_data = {
435 	.matrix_key_rows = 5,
436 	.matrix_key_cols = 5,
437 	.matrix_keymap_data = &a780_matrix_keymap_data,
438 
439 	.direct_key_map = { KEY_CAMERA },
440 	.direct_key_num = 1,
441 
442 	.debounce_interval = 30,
443 };
444 #endif /* CONFIG_MACH_EZX_A780 */
445 
446 #ifdef CONFIG_MACH_EZX_E680
447 static const unsigned int e680_key_map[] = {
448 	KEY(0, 0, KEY_UP),
449 	KEY(0, 1, KEY_RIGHT),
450 	KEY(0, 2, KEY_RESERVED),
451 	KEY(0, 3, KEY_SEND),
452 
453 	KEY(1, 0, KEY_DOWN),
454 	KEY(1, 1, KEY_LEFT),
455 	KEY(1, 2, KEY_PAGEUP),
456 	KEY(1, 3, KEY_PAGEDOWN),
457 
458 	KEY(2, 0, KEY_RESERVED),
459 	KEY(2, 1, KEY_RESERVED),
460 	KEY(2, 2, KEY_RESERVED),
461 	KEY(2, 3, KEY_KPENTER),
462 };
463 
464 static struct matrix_keymap_data e680_matrix_keymap_data = {
465 	.keymap			= e680_key_map,
466 	.keymap_size		= ARRAY_SIZE(e680_key_map),
467 };
468 
469 static struct pxa27x_keypad_platform_data e680_keypad_platform_data = {
470 	.matrix_key_rows = 3,
471 	.matrix_key_cols = 4,
472 	.matrix_keymap_data = &e680_matrix_keymap_data,
473 
474 	.direct_key_map = {
475 		KEY_CAMERA,
476 		KEY_RESERVED,
477 		KEY_RESERVED,
478 		KEY_F1,
479 		KEY_CANCEL,
480 		KEY_F2,
481 	},
482 	.direct_key_num = 6,
483 
484 	.debounce_interval = 30,
485 };
486 #endif /* CONFIG_MACH_EZX_E680 */
487 
488 #ifdef CONFIG_MACH_EZX_A1200
489 static const unsigned int a1200_key_map[] = {
490 	KEY(0, 0, KEY_RESERVED),
491 	KEY(0, 1, KEY_RIGHT),
492 	KEY(0, 2, KEY_PAGEDOWN),
493 	KEY(0, 3, KEY_RESERVED),
494 	KEY(0, 4, KEY_RESERVED),
495 	KEY(0, 5, KEY_RESERVED),
496 
497 	KEY(1, 0, KEY_RESERVED),
498 	KEY(1, 1, KEY_DOWN),
499 	KEY(1, 2, KEY_CAMERA),
500 	KEY(1, 3, KEY_RESERVED),
501 	KEY(1, 4, KEY_RESERVED),
502 	KEY(1, 5, KEY_RESERVED),
503 
504 	KEY(2, 0, KEY_RESERVED),
505 	KEY(2, 1, KEY_KPENTER),
506 	KEY(2, 2, KEY_RECORD),
507 	KEY(2, 3, KEY_RESERVED),
508 	KEY(2, 4, KEY_RESERVED),
509 	KEY(2, 5, KEY_SELECT),
510 
511 	KEY(3, 0, KEY_RESERVED),
512 	KEY(3, 1, KEY_UP),
513 	KEY(3, 2, KEY_SEND),
514 	KEY(3, 3, KEY_RESERVED),
515 	KEY(3, 4, KEY_RESERVED),
516 	KEY(3, 5, KEY_RESERVED),
517 
518 	KEY(4, 0, KEY_RESERVED),
519 	KEY(4, 1, KEY_LEFT),
520 	KEY(4, 2, KEY_PAGEUP),
521 	KEY(4, 3, KEY_RESERVED),
522 	KEY(4, 4, KEY_RESERVED),
523 	KEY(4, 5, KEY_RESERVED),
524 };
525 
526 static struct matrix_keymap_data a1200_matrix_keymap_data = {
527 	.keymap			= a1200_key_map,
528 	.keymap_size		= ARRAY_SIZE(a1200_key_map),
529 };
530 
531 static struct pxa27x_keypad_platform_data a1200_keypad_platform_data = {
532 	.matrix_key_rows = 5,
533 	.matrix_key_cols = 6,
534 	.matrix_keymap_data = &a1200_matrix_keymap_data,
535 
536 	.debounce_interval = 30,
537 };
538 #endif /* CONFIG_MACH_EZX_A1200 */
539 
540 #ifdef CONFIG_MACH_EZX_E6
541 static const unsigned int e6_key_map[] = {
542 	KEY(0, 0, KEY_RESERVED),
543 	KEY(0, 1, KEY_RIGHT),
544 	KEY(0, 2, KEY_PAGEDOWN),
545 	KEY(0, 3, KEY_RESERVED),
546 	KEY(0, 4, KEY_RESERVED),
547 	KEY(0, 5, KEY_NEXTSONG),
548 
549 	KEY(1, 0, KEY_RESERVED),
550 	KEY(1, 1, KEY_DOWN),
551 	KEY(1, 2, KEY_PROG1),
552 	KEY(1, 3, KEY_RESERVED),
553 	KEY(1, 4, KEY_RESERVED),
554 	KEY(1, 5, KEY_RESERVED),
555 
556 	KEY(2, 0, KEY_RESERVED),
557 	KEY(2, 1, KEY_ENTER),
558 	KEY(2, 2, KEY_CAMERA),
559 	KEY(2, 3, KEY_RESERVED),
560 	KEY(2, 4, KEY_RESERVED),
561 	KEY(2, 5, KEY_WWW),
562 
563 	KEY(3, 0, KEY_RESERVED),
564 	KEY(3, 1, KEY_UP),
565 	KEY(3, 2, KEY_SEND),
566 	KEY(3, 3, KEY_RESERVED),
567 	KEY(3, 4, KEY_RESERVED),
568 	KEY(3, 5, KEY_PLAYPAUSE),
569 
570 	KEY(4, 0, KEY_RESERVED),
571 	KEY(4, 1, KEY_LEFT),
572 	KEY(4, 2, KEY_PAGEUP),
573 	KEY(4, 3, KEY_RESERVED),
574 	KEY(4, 4, KEY_RESERVED),
575 	KEY(4, 5, KEY_PREVIOUSSONG),
576 };
577 
578 static struct matrix_keymap_data e6_keymap_data = {
579 	.keymap			= e6_key_map,
580 	.keymap_size		= ARRAY_SIZE(e6_key_map),
581 };
582 
583 static struct pxa27x_keypad_platform_data e6_keypad_platform_data = {
584 	.matrix_key_rows = 5,
585 	.matrix_key_cols = 6,
586 	.matrix_keymap_data = &e6_keymap_data,
587 
588 	.debounce_interval = 30,
589 };
590 #endif /* CONFIG_MACH_EZX_E6 */
591 
592 #ifdef CONFIG_MACH_EZX_A910
593 static const unsigned int a910_key_map[] = {
594 	KEY(0, 0, KEY_NUMERIC_6),
595 	KEY(0, 1, KEY_RIGHT),
596 	KEY(0, 2, KEY_PAGEDOWN),
597 	KEY(0, 3, KEY_KPENTER),
598 	KEY(0, 4, KEY_NUMERIC_5),
599 	KEY(0, 5, KEY_CAMERA),
600 
601 	KEY(1, 0, KEY_NUMERIC_8),
602 	KEY(1, 1, KEY_DOWN),
603 	KEY(1, 2, KEY_RESERVED),
604 	KEY(1, 3, KEY_F1), /* Left SoftKey */
605 	KEY(1, 4, KEY_NUMERIC_STAR),
606 	KEY(1, 5, KEY_RESERVED),
607 
608 	KEY(2, 0, KEY_NUMERIC_7),
609 	KEY(2, 1, KEY_NUMERIC_9),
610 	KEY(2, 2, KEY_RECORD),
611 	KEY(2, 3, KEY_F2), /* Right SoftKey */
612 	KEY(2, 4, KEY_BACK),
613 	KEY(2, 5, KEY_SELECT),
614 
615 	KEY(3, 0, KEY_NUMERIC_2),
616 	KEY(3, 1, KEY_UP),
617 	KEY(3, 2, KEY_SEND),
618 	KEY(3, 3, KEY_NUMERIC_0),
619 	KEY(3, 4, KEY_NUMERIC_1),
620 	KEY(3, 5, KEY_RECORD),
621 
622 	KEY(4, 0, KEY_NUMERIC_4),
623 	KEY(4, 1, KEY_LEFT),
624 	KEY(4, 2, KEY_PAGEUP),
625 	KEY(4, 3, KEY_NUMERIC_POUND),
626 	KEY(4, 4, KEY_NUMERIC_3),
627 	KEY(4, 5, KEY_RESERVED),
628 };
629 
630 static struct matrix_keymap_data a910_matrix_keymap_data = {
631 	.keymap			= a910_key_map,
632 	.keymap_size		= ARRAY_SIZE(a910_key_map),
633 };
634 
635 static struct pxa27x_keypad_platform_data a910_keypad_platform_data = {
636 	.matrix_key_rows = 5,
637 	.matrix_key_cols = 6,
638 	.matrix_keymap_data = &a910_matrix_keymap_data,
639 
640 	.debounce_interval = 30,
641 };
642 #endif /* CONFIG_MACH_EZX_A910 */
643 
644 #ifdef CONFIG_MACH_EZX_E2
645 static const unsigned int e2_key_map[] = {
646 	KEY(0, 0, KEY_NUMERIC_6),
647 	KEY(0, 1, KEY_RIGHT),
648 	KEY(0, 2, KEY_NUMERIC_9),
649 	KEY(0, 3, KEY_NEXTSONG),
650 	KEY(0, 4, KEY_NUMERIC_5),
651 	KEY(0, 5, KEY_F1), /* Left SoftKey */
652 
653 	KEY(1, 0, KEY_NUMERIC_8),
654 	KEY(1, 1, KEY_DOWN),
655 	KEY(1, 2, KEY_RESERVED),
656 	KEY(1, 3, KEY_PAGEUP),
657 	KEY(1, 4, KEY_NUMERIC_STAR),
658 	KEY(1, 5, KEY_F2), /* Right SoftKey */
659 
660 	KEY(2, 0, KEY_NUMERIC_7),
661 	KEY(2, 1, KEY_KPENTER),
662 	KEY(2, 2, KEY_RECORD),
663 	KEY(2, 3, KEY_PAGEDOWN),
664 	KEY(2, 4, KEY_BACK),
665 	KEY(2, 5, KEY_NUMERIC_0),
666 
667 	KEY(3, 0, KEY_NUMERIC_2),
668 	KEY(3, 1, KEY_UP),
669 	KEY(3, 2, KEY_SEND),
670 	KEY(3, 3, KEY_PLAYPAUSE),
671 	KEY(3, 4, KEY_NUMERIC_1),
672 	KEY(3, 5, KEY_SOUND), /* Music SoftKey */
673 
674 	KEY(4, 0, KEY_NUMERIC_4),
675 	KEY(4, 1, KEY_LEFT),
676 	KEY(4, 2, KEY_NUMERIC_POUND),
677 	KEY(4, 3, KEY_PREVIOUSSONG),
678 	KEY(4, 4, KEY_NUMERIC_3),
679 	KEY(4, 5, KEY_RESERVED),
680 };
681 
682 static struct matrix_keymap_data e2_matrix_keymap_data = {
683 	.keymap			= e2_key_map,
684 	.keymap_size		= ARRAY_SIZE(e2_key_map),
685 };
686 
687 static struct pxa27x_keypad_platform_data e2_keypad_platform_data = {
688 	.matrix_key_rows = 5,
689 	.matrix_key_cols = 6,
690 	.matrix_keymap_data = &e2_matrix_keymap_data,
691 
692 	.debounce_interval = 30,
693 };
694 #endif /* CONFIG_MACH_EZX_E2 */
695 
696 #if defined(CONFIG_MACH_EZX_A780) || defined(CONFIG_MACH_EZX_A910)
697 /* camera */
698 static struct regulator_consumer_supply camera_regulator_supplies[] = {
699 	REGULATOR_SUPPLY("vdd", "0-005d"),
700 };
701 
702 static struct regulator_init_data camera_regulator_initdata = {
703 	.consumer_supplies = camera_regulator_supplies,
704 	.num_consumer_supplies = ARRAY_SIZE(camera_regulator_supplies),
705 	.constraints = {
706 		.valid_ops_mask = REGULATOR_CHANGE_STATUS,
707 	},
708 };
709 
710 static struct fixed_voltage_config camera_regulator_config = {
711 	.supply_name		= "camera_vdd",
712 	.microvolts		= 2800000,
713 	.init_data		= &camera_regulator_initdata,
714 };
715 
716 static struct platform_device camera_supply_regulator_device = {
717 	.name	= "reg-fixed-voltage",
718 	.id	= 1,
719 	.dev	= {
720 		.platform_data = &camera_regulator_config,
721 	},
722 };
723 
724 static struct gpiod_lookup_table camera_supply_gpiod_table = {
725 	.dev_id = "reg-fixed-voltage.1",
726 	.table = {
727 		GPIO_LOOKUP("gpio-pxa", GPIO50_nCAM_EN,
728 			    NULL, GPIO_ACTIVE_LOW),
729 		{ },
730 	},
731 };
732 #endif
733 
734 #ifdef CONFIG_MACH_EZX_A780
735 /* gpio_keys */
736 static struct gpio_keys_button a780_buttons[] = {
737 	[0] = {
738 		.code       = SW_LID,
739 		.gpio       = GPIO12_A780_FLIP_LID,
740 		.active_low = 0,
741 		.desc       = "A780 flip lid",
742 		.type       = EV_SW,
743 		.wakeup     = 1,
744 	},
745 };
746 
747 static struct gpio_keys_platform_data a780_gpio_keys_platform_data = {
748 	.buttons  = a780_buttons,
749 	.nbuttons = ARRAY_SIZE(a780_buttons),
750 };
751 
752 static struct platform_device a780_gpio_keys = {
753 	.name = "gpio-keys",
754 	.id   = -1,
755 	.dev  = {
756 		.platform_data = &a780_gpio_keys_platform_data,
757 	},
758 };
759 
760 /* camera */
a780_camera_reset(struct device * dev)761 static int a780_camera_reset(struct device *dev)
762 {
763 	gpio_set_value(GPIO19_GEN1_CAM_RST, 0);
764 	msleep(10);
765 	gpio_set_value(GPIO19_GEN1_CAM_RST, 1);
766 
767 	return 0;
768 }
769 
a780_camera_init(void)770 static int a780_camera_init(void)
771 {
772 	int err;
773 
774 	/*
775 	 * GPIO50_nCAM_EN is active low
776 	 * GPIO19_GEN1_CAM_RST is active on rising edge
777 	 */
778 	err = gpio_request(GPIO19_GEN1_CAM_RST, "CAM_RST");
779 	if (err) {
780 		pr_err("%s: Failed to request CAM_RST\n", __func__);
781 		return err;
782 	}
783 
784 	gpio_direction_output(GPIO19_GEN1_CAM_RST, 0);
785 	a780_camera_reset(NULL);
786 
787 	return 0;
788 }
789 
790 struct pxacamera_platform_data a780_pxacamera_platform_data = {
791 	.flags  = PXA_CAMERA_MASTER | PXA_CAMERA_DATAWIDTH_8 |
792 		PXA_CAMERA_PCLK_EN | PXA_CAMERA_MCLK_EN |
793 		PXA_CAMERA_PCP,
794 	.mclk_10khz = 5000,
795 	.sensor_i2c_adapter_id = 0,
796 	.sensor_i2c_address = 0x5d,
797 };
798 
799 static struct i2c_board_info a780_i2c_board_info[] = {
800 	{
801 		I2C_BOARD_INFO("mt9m111", 0x5d),
802 	},
803 };
804 
805 static struct platform_device *a780_devices[] __initdata = {
806 	&a780_gpio_keys,
807 	&camera_supply_regulator_device,
808 };
809 
a780_init(void)810 static void __init a780_init(void)
811 {
812 	pxa2xx_mfp_config(ARRAY_AND_SIZE(ezx_pin_config));
813 	pxa2xx_mfp_config(ARRAY_AND_SIZE(gen1_pin_config));
814 	pxa2xx_mfp_config(ARRAY_AND_SIZE(a780_pin_config));
815 
816 	pxa_set_ffuart_info(NULL);
817 	pxa_set_btuart_info(NULL);
818 	pxa_set_stuart_info(NULL);
819 
820 	pxa_set_i2c_info(NULL);
821 	i2c_register_board_info(0, ARRAY_AND_SIZE(a780_i2c_board_info));
822 
823 	pxa_set_fb_info(NULL, &ezx_fb_info_1);
824 
825 	pxa_set_keypad_info(&a780_keypad_platform_data);
826 
827 	if (a780_camera_init() == 0)
828 		pxa_set_camera_info(&a780_pxacamera_platform_data);
829 
830 	gpiod_add_lookup_table(&camera_supply_gpiod_table);
831 	pwm_add_table(ezx_pwm_lookup, ARRAY_SIZE(ezx_pwm_lookup));
832 	platform_add_devices(ARRAY_AND_SIZE(ezx_devices));
833 	platform_add_devices(ARRAY_AND_SIZE(a780_devices));
834 	regulator_has_full_constraints();
835 }
836 
837 MACHINE_START(EZX_A780, "Motorola EZX A780")
838 	.atag_offset    = 0x100,
839 	.map_io         = pxa27x_map_io,
840 	.nr_irqs	= EZX_NR_IRQS,
841 	.init_irq       = pxa27x_init_irq,
842 	.handle_irq       = pxa27x_handle_irq,
843 	.init_time	= pxa_timer_init,
844 	.init_machine   = a780_init,
845 	.restart	= pxa_restart,
846 MACHINE_END
847 #endif
848 
849 #ifdef CONFIG_MACH_EZX_E680
850 /* gpio_keys */
851 static struct gpio_keys_button e680_buttons[] = {
852 	[0] = {
853 		.code       = KEY_SCREENLOCK,
854 		.gpio       = GPIO12_E680_LOCK_SWITCH,
855 		.active_low = 0,
856 		.desc       = "E680 lock switch",
857 		.type       = EV_KEY,
858 		.wakeup     = 1,
859 	},
860 };
861 
862 static struct gpio_keys_platform_data e680_gpio_keys_platform_data = {
863 	.buttons  = e680_buttons,
864 	.nbuttons = ARRAY_SIZE(e680_buttons),
865 };
866 
867 static struct platform_device e680_gpio_keys = {
868 	.name = "gpio-keys",
869 	.id   = -1,
870 	.dev  = {
871 		.platform_data = &e680_gpio_keys_platform_data,
872 	},
873 };
874 
875 static struct i2c_board_info __initdata e680_i2c_board_info[] = {
876 	{ I2C_BOARD_INFO("tea5767", 0x81) },
877 };
878 
879 static struct platform_device *e680_devices[] __initdata = {
880 	&e680_gpio_keys,
881 };
882 
e680_init(void)883 static void __init e680_init(void)
884 {
885 	pxa2xx_mfp_config(ARRAY_AND_SIZE(ezx_pin_config));
886 	pxa2xx_mfp_config(ARRAY_AND_SIZE(gen1_pin_config));
887 	pxa2xx_mfp_config(ARRAY_AND_SIZE(e680_pin_config));
888 
889 	pxa_set_ffuart_info(NULL);
890 	pxa_set_btuart_info(NULL);
891 	pxa_set_stuart_info(NULL);
892 
893 	pxa_set_i2c_info(NULL);
894 	i2c_register_board_info(0, ARRAY_AND_SIZE(e680_i2c_board_info));
895 
896 	pxa_set_fb_info(NULL, &ezx_fb_info_1);
897 
898 	pxa_set_keypad_info(&e680_keypad_platform_data);
899 
900 	pwm_add_table(ezx_pwm_lookup, ARRAY_SIZE(ezx_pwm_lookup));
901 	platform_add_devices(ARRAY_AND_SIZE(ezx_devices));
902 	platform_add_devices(ARRAY_AND_SIZE(e680_devices));
903 }
904 
905 MACHINE_START(EZX_E680, "Motorola EZX E680")
906 	.atag_offset    = 0x100,
907 	.map_io         = pxa27x_map_io,
908 	.nr_irqs	= EZX_NR_IRQS,
909 	.init_irq       = pxa27x_init_irq,
910 	.handle_irq       = pxa27x_handle_irq,
911 	.init_time	= pxa_timer_init,
912 	.init_machine   = e680_init,
913 	.restart	= pxa_restart,
914 MACHINE_END
915 #endif
916 
917 #ifdef CONFIG_MACH_EZX_A1200
918 /* gpio_keys */
919 static struct gpio_keys_button a1200_buttons[] = {
920 	[0] = {
921 		.code       = SW_LID,
922 		.gpio       = GPIO15_A1200_FLIP_LID,
923 		.active_low = 0,
924 		.desc       = "A1200 flip lid",
925 		.type       = EV_SW,
926 		.wakeup     = 1,
927 	},
928 };
929 
930 static struct gpio_keys_platform_data a1200_gpio_keys_platform_data = {
931 	.buttons  = a1200_buttons,
932 	.nbuttons = ARRAY_SIZE(a1200_buttons),
933 };
934 
935 static struct platform_device a1200_gpio_keys = {
936 	.name = "gpio-keys",
937 	.id   = -1,
938 	.dev  = {
939 		.platform_data = &a1200_gpio_keys_platform_data,
940 	},
941 };
942 
943 static struct i2c_board_info __initdata a1200_i2c_board_info[] = {
944 	{ I2C_BOARD_INFO("tea5767", 0x81) },
945 };
946 
947 static struct platform_device *a1200_devices[] __initdata = {
948 	&a1200_gpio_keys,
949 };
950 
a1200_init(void)951 static void __init a1200_init(void)
952 {
953 	pxa2xx_mfp_config(ARRAY_AND_SIZE(ezx_pin_config));
954 	pxa2xx_mfp_config(ARRAY_AND_SIZE(gen2_pin_config));
955 	pxa2xx_mfp_config(ARRAY_AND_SIZE(a1200_pin_config));
956 
957 	pxa_set_ffuart_info(NULL);
958 	pxa_set_btuart_info(NULL);
959 	pxa_set_stuart_info(NULL);
960 
961 	pxa_set_i2c_info(NULL);
962 	i2c_register_board_info(0, ARRAY_AND_SIZE(a1200_i2c_board_info));
963 
964 	pxa_set_fb_info(NULL, &ezx_fb_info_2);
965 
966 	pxa_set_keypad_info(&a1200_keypad_platform_data);
967 
968 	pwm_add_table(ezx_pwm_lookup, ARRAY_SIZE(ezx_pwm_lookup));
969 	platform_add_devices(ARRAY_AND_SIZE(ezx_devices));
970 	platform_add_devices(ARRAY_AND_SIZE(a1200_devices));
971 }
972 
973 MACHINE_START(EZX_A1200, "Motorola EZX A1200")
974 	.atag_offset    = 0x100,
975 	.map_io         = pxa27x_map_io,
976 	.nr_irqs	= EZX_NR_IRQS,
977 	.init_irq       = pxa27x_init_irq,
978 	.handle_irq       = pxa27x_handle_irq,
979 	.init_time	= pxa_timer_init,
980 	.init_machine   = a1200_init,
981 	.restart	= pxa_restart,
982 MACHINE_END
983 #endif
984 
985 #ifdef CONFIG_MACH_EZX_A910
986 /* gpio_keys */
987 static struct gpio_keys_button a910_buttons[] = {
988 	[0] = {
989 		.code       = SW_LID,
990 		.gpio       = GPIO15_A910_FLIP_LID,
991 		.active_low = 0,
992 		.desc       = "A910 flip lid",
993 		.type       = EV_SW,
994 		.wakeup     = 1,
995 	},
996 };
997 
998 static struct gpio_keys_platform_data a910_gpio_keys_platform_data = {
999 	.buttons  = a910_buttons,
1000 	.nbuttons = ARRAY_SIZE(a910_buttons),
1001 };
1002 
1003 static struct platform_device a910_gpio_keys = {
1004 	.name = "gpio-keys",
1005 	.id   = -1,
1006 	.dev  = {
1007 		.platform_data = &a910_gpio_keys_platform_data,
1008 	},
1009 };
1010 
1011 /* camera */
a910_camera_reset(struct device * dev)1012 static int a910_camera_reset(struct device *dev)
1013 {
1014 	gpio_set_value(GPIO28_GEN2_CAM_RST, 0);
1015 	msleep(10);
1016 	gpio_set_value(GPIO28_GEN2_CAM_RST, 1);
1017 
1018 	return 0;
1019 }
1020 
a910_camera_init(void)1021 static int a910_camera_init(void)
1022 {
1023 	int err;
1024 
1025 	/*
1026 	 * GPIO50_nCAM_EN is active low
1027 	 * GPIO28_GEN2_CAM_RST is active on rising edge
1028 	 */
1029 	err = gpio_request(GPIO28_GEN2_CAM_RST, "CAM_RST");
1030 	if (err) {
1031 		pr_err("%s: Failed to request CAM_RST\n", __func__);
1032 		return err;
1033 	}
1034 
1035 	gpio_direction_output(GPIO28_GEN2_CAM_RST, 0);
1036 	a910_camera_reset(NULL);
1037 
1038 	return 0;
1039 }
1040 
1041 struct pxacamera_platform_data a910_pxacamera_platform_data = {
1042 	.flags  = PXA_CAMERA_MASTER | PXA_CAMERA_DATAWIDTH_8 |
1043 		PXA_CAMERA_PCLK_EN | PXA_CAMERA_MCLK_EN |
1044 		PXA_CAMERA_PCP,
1045 	.mclk_10khz = 5000,
1046 	.sensor_i2c_adapter_id = 0,
1047 	.sensor_i2c_address = 0x5d,
1048 };
1049 
1050 /* leds-lp3944 */
1051 static struct lp3944_platform_data a910_lp3944_leds = {
1052 	.leds_size = LP3944_LEDS_MAX,
1053 	.leds = {
1054 		[0] = {
1055 			.name = "a910:red:",
1056 			.status = LP3944_LED_STATUS_OFF,
1057 			.type = LP3944_LED_TYPE_LED,
1058 		},
1059 		[1] = {
1060 			.name = "a910:green:",
1061 			.status = LP3944_LED_STATUS_OFF,
1062 			.type = LP3944_LED_TYPE_LED,
1063 		},
1064 		[2] {
1065 			.name = "a910:blue:",
1066 			.status = LP3944_LED_STATUS_OFF,
1067 			.type = LP3944_LED_TYPE_LED,
1068 		},
1069 		/* Leds 3 and 4 are used as display power switches */
1070 		[3] = {
1071 			.name = "a910::cli_display",
1072 			.status = LP3944_LED_STATUS_OFF,
1073 			.type = LP3944_LED_TYPE_LED_INVERTED
1074 		},
1075 		[4] = {
1076 			.name = "a910::main_display",
1077 			.status = LP3944_LED_STATUS_ON,
1078 			.type = LP3944_LED_TYPE_LED_INVERTED
1079 		},
1080 		[5] = { .type = LP3944_LED_TYPE_NONE },
1081 		[6] = {
1082 			.name = "a910::torch",
1083 			.status = LP3944_LED_STATUS_OFF,
1084 			.type = LP3944_LED_TYPE_LED,
1085 		},
1086 		[7] = {
1087 			.name = "a910::flash",
1088 			.status = LP3944_LED_STATUS_OFF,
1089 			.type = LP3944_LED_TYPE_LED_INVERTED,
1090 		},
1091 	},
1092 };
1093 
1094 static struct i2c_board_info __initdata a910_i2c_board_info[] = {
1095 	{
1096 		I2C_BOARD_INFO("lp3944", 0x60),
1097 		.platform_data = &a910_lp3944_leds,
1098 	},
1099 	{
1100 		I2C_BOARD_INFO("mt9m111", 0x5d),
1101 	},
1102 };
1103 
1104 static struct platform_device *a910_devices[] __initdata = {
1105 	&a910_gpio_keys,
1106 	&camera_supply_regulator_device,
1107 };
1108 
a910_init(void)1109 static void __init a910_init(void)
1110 {
1111 	pxa2xx_mfp_config(ARRAY_AND_SIZE(ezx_pin_config));
1112 	pxa2xx_mfp_config(ARRAY_AND_SIZE(gen2_pin_config));
1113 	pxa2xx_mfp_config(ARRAY_AND_SIZE(a910_pin_config));
1114 
1115 	pxa_set_ffuart_info(NULL);
1116 	pxa_set_btuart_info(NULL);
1117 	pxa_set_stuart_info(NULL);
1118 
1119 	pxa_set_i2c_info(NULL);
1120 	i2c_register_board_info(0, ARRAY_AND_SIZE(a910_i2c_board_info));
1121 
1122 	pxa_set_fb_info(NULL, &ezx_fb_info_2);
1123 
1124 	pxa_set_keypad_info(&a910_keypad_platform_data);
1125 
1126 	if (a910_camera_init() == 0)
1127 		pxa_set_camera_info(&a910_pxacamera_platform_data);
1128 
1129 	gpiod_add_lookup_table(&camera_supply_gpiod_table);
1130 	pwm_add_table(ezx_pwm_lookup, ARRAY_SIZE(ezx_pwm_lookup));
1131 	platform_add_devices(ARRAY_AND_SIZE(ezx_devices));
1132 	platform_add_devices(ARRAY_AND_SIZE(a910_devices));
1133 	regulator_has_full_constraints();
1134 }
1135 
1136 MACHINE_START(EZX_A910, "Motorola EZX A910")
1137 	.atag_offset    = 0x100,
1138 	.map_io         = pxa27x_map_io,
1139 	.nr_irqs	= EZX_NR_IRQS,
1140 	.init_irq       = pxa27x_init_irq,
1141 	.handle_irq       = pxa27x_handle_irq,
1142 	.init_time	= pxa_timer_init,
1143 	.init_machine   = a910_init,
1144 	.restart	= pxa_restart,
1145 MACHINE_END
1146 #endif
1147 
1148 #ifdef CONFIG_MACH_EZX_E6
1149 /* gpio_keys */
1150 static struct gpio_keys_button e6_buttons[] = {
1151 	[0] = {
1152 		.code       = KEY_SCREENLOCK,
1153 		.gpio       = GPIO15_E6_LOCK_SWITCH,
1154 		.active_low = 0,
1155 		.desc       = "E6 lock switch",
1156 		.type       = EV_KEY,
1157 		.wakeup     = 1,
1158 	},
1159 };
1160 
1161 static struct gpio_keys_platform_data e6_gpio_keys_platform_data = {
1162 	.buttons  = e6_buttons,
1163 	.nbuttons = ARRAY_SIZE(e6_buttons),
1164 };
1165 
1166 static struct platform_device e6_gpio_keys = {
1167 	.name = "gpio-keys",
1168 	.id   = -1,
1169 	.dev  = {
1170 		.platform_data = &e6_gpio_keys_platform_data,
1171 	},
1172 };
1173 
1174 static struct i2c_board_info __initdata e6_i2c_board_info[] = {
1175 	{ I2C_BOARD_INFO("tea5767", 0x81) },
1176 };
1177 
1178 static struct platform_device *e6_devices[] __initdata = {
1179 	&e6_gpio_keys,
1180 };
1181 
e6_init(void)1182 static void __init e6_init(void)
1183 {
1184 	pxa2xx_mfp_config(ARRAY_AND_SIZE(ezx_pin_config));
1185 	pxa2xx_mfp_config(ARRAY_AND_SIZE(gen2_pin_config));
1186 	pxa2xx_mfp_config(ARRAY_AND_SIZE(e6_pin_config));
1187 
1188 	pxa_set_ffuart_info(NULL);
1189 	pxa_set_btuart_info(NULL);
1190 	pxa_set_stuart_info(NULL);
1191 
1192 	pxa_set_i2c_info(NULL);
1193 	i2c_register_board_info(0, ARRAY_AND_SIZE(e6_i2c_board_info));
1194 
1195 	pxa_set_fb_info(NULL, &ezx_fb_info_2);
1196 
1197 	pxa_set_keypad_info(&e6_keypad_platform_data);
1198 
1199 	pwm_add_table(ezx_pwm_lookup, ARRAY_SIZE(ezx_pwm_lookup));
1200 	platform_add_devices(ARRAY_AND_SIZE(ezx_devices));
1201 	platform_add_devices(ARRAY_AND_SIZE(e6_devices));
1202 }
1203 
1204 MACHINE_START(EZX_E6, "Motorola EZX E6")
1205 	.atag_offset    = 0x100,
1206 	.map_io         = pxa27x_map_io,
1207 	.nr_irqs	= EZX_NR_IRQS,
1208 	.init_irq       = pxa27x_init_irq,
1209 	.handle_irq       = pxa27x_handle_irq,
1210 	.init_time	= pxa_timer_init,
1211 	.init_machine   = e6_init,
1212 	.restart	= pxa_restart,
1213 MACHINE_END
1214 #endif
1215 
1216 #ifdef CONFIG_MACH_EZX_E2
1217 static struct i2c_board_info __initdata e2_i2c_board_info[] = {
1218 	{ I2C_BOARD_INFO("tea5767", 0x81) },
1219 };
1220 
1221 static struct platform_device *e2_devices[] __initdata = {
1222 };
1223 
e2_init(void)1224 static void __init e2_init(void)
1225 {
1226 	pxa2xx_mfp_config(ARRAY_AND_SIZE(ezx_pin_config));
1227 	pxa2xx_mfp_config(ARRAY_AND_SIZE(gen2_pin_config));
1228 	pxa2xx_mfp_config(ARRAY_AND_SIZE(e2_pin_config));
1229 
1230 	pxa_set_ffuart_info(NULL);
1231 	pxa_set_btuart_info(NULL);
1232 	pxa_set_stuart_info(NULL);
1233 
1234 	pxa_set_i2c_info(NULL);
1235 	i2c_register_board_info(0, ARRAY_AND_SIZE(e2_i2c_board_info));
1236 
1237 	pxa_set_fb_info(NULL, &ezx_fb_info_2);
1238 
1239 	pxa_set_keypad_info(&e2_keypad_platform_data);
1240 
1241 	pwm_add_table(ezx_pwm_lookup, ARRAY_SIZE(ezx_pwm_lookup));
1242 	platform_add_devices(ARRAY_AND_SIZE(ezx_devices));
1243 	platform_add_devices(ARRAY_AND_SIZE(e2_devices));
1244 }
1245 
1246 MACHINE_START(EZX_E2, "Motorola EZX E2")
1247 	.atag_offset    = 0x100,
1248 	.map_io         = pxa27x_map_io,
1249 	.nr_irqs	= EZX_NR_IRQS,
1250 	.init_irq       = pxa27x_init_irq,
1251 	.handle_irq       = pxa27x_handle_irq,
1252 	.init_time	= pxa_timer_init,
1253 	.init_machine   = e2_init,
1254 	.restart	= pxa_restart,
1255 MACHINE_END
1256 #endif
1257