blob: ab93441e596ed7eb6d3e0f4552d029626e81e42c [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>
Arnd Bergmann293b2da2012-08-24 15:16:48 +020032#include <linux/platform_data/video-pxafb.h>
33#include <linux/platform_data/usb-ohci-pxa27x.h>
Russell King05678a92008-11-28 16:04:54 +000034#include <mach/hardware.h>
Arnd Bergmann293b2da2012-08-24 15:16:48 +020035#include <linux/platform_data/keypad-pxa27x.h>
36#include <linux/platform_data/camera-pxa.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,
Thierry Redingdb011202013-08-30 12:15:24 +020057 .enable_gpio = -1,
Stefan Schmidt9ab24e42008-07-09 08:08:17 +010058};
59
60static struct platform_device ezx_backlight_device = {
61 .name = "pwm-backlight",
62 .dev = {
63 .parent = &pxa27x_device_pwm0.dev,
64 .platform_data = &ezx_backlight_data,
65 },
66};
67
68static struct pxafb_mode_info mode_ezx_old = {
69 .pixclock = 150000,
70 .xres = 240,
71 .yres = 320,
72 .bpp = 16,
73 .hsync_len = 10,
74 .left_margin = 20,
75 .right_margin = 10,
76 .vsync_len = 2,
77 .upper_margin = 3,
78 .lower_margin = 2,
79 .sync = 0,
80};
81
82static struct pxafb_mach_info ezx_fb_info_1 = {
83 .modes = &mode_ezx_old,
84 .num_modes = 1,
85 .lcd_conn = LCD_COLOR_TFT_16BPP,
86};
87
88static struct pxafb_mode_info mode_72r89803y01 = {
89 .pixclock = 192308,
90 .xres = 240,
91 .yres = 320,
92 .bpp = 32,
93 .depth = 18,
94 .hsync_len = 10,
95 .left_margin = 20,
96 .right_margin = 10,
97 .vsync_len = 2,
98 .upper_margin = 3,
99 .lower_margin = 2,
100 .sync = 0,
101};
102
103static struct pxafb_mach_info ezx_fb_info_2 = {
104 .modes = &mode_72r89803y01,
105 .num_modes = 1,
106 .lcd_conn = LCD_COLOR_TFT_18BPP,
107};
108
Antonio Ospite1ce2c512009-06-01 12:26:58 +0200109static struct platform_device *ezx_devices[] __initdata = {
Stefan Schmidt9ab24e42008-07-09 08:08:17 +0100110 &ezx_backlight_device,
111};
112
113static unsigned long ezx_pin_config[] __initdata = {
114 /* PWM backlight */
115 GPIO16_PWM0_OUT,
116
117 /* BTUART */
118 GPIO42_BTUART_RXD,
119 GPIO43_BTUART_TXD,
120 GPIO44_BTUART_CTS,
121 GPIO45_BTUART_RTS,
122
Eric Miao6f584cf2008-11-28 16:00:24 +0800123 /* I2C */
124 GPIO117_I2C_SCL,
125 GPIO118_I2C_SDA,
Stefan Schmidt9078ac22008-12-08 15:58:08 +0100126
127 /* PCAP SSP */
128 GPIO29_SSP1_SCLK,
129 GPIO25_SSP1_TXD,
130 GPIO26_SSP1_RXD,
131 GPIO24_GPIO, /* pcap chip select */
Daniel Ribeiroff713382009-05-15 06:33:50 -0300132 GPIO1_GPIO | WAKEUP_ON_EDGE_RISE, /* pcap interrupt */
133 GPIO4_GPIO | MFP_LPM_DRIVE_HIGH, /* WDI_AP */
134 GPIO55_GPIO | MFP_LPM_DRIVE_HIGH, /* SYS_RESTART */
Stefan Schmidt9078ac22008-12-08 15:58:08 +0100135
136 /* MMC */
137 GPIO32_MMC_CLK,
138 GPIO92_MMC_DAT_0,
139 GPIO109_MMC_DAT_1,
140 GPIO110_MMC_DAT_2,
141 GPIO111_MMC_DAT_3,
142 GPIO112_MMC_CMD,
143 GPIO11_GPIO, /* mmc detect */
144
145 /* usb to external transceiver */
146 GPIO34_USB_P2_2,
147 GPIO35_USB_P2_1,
148 GPIO36_USB_P2_4,
149 GPIO39_USB_P2_6,
150 GPIO40_USB_P2_5,
151 GPIO53_USB_P2_3,
152
153 /* usb to Neptune GSM chip */
154 GPIO30_USB_P3_2,
155 GPIO31_USB_P3_6,
156 GPIO90_USB_P3_5,
157 GPIO91_USB_P3_1,
158 GPIO56_USB_P3_4,
159 GPIO113_USB_P3_3,
Stefan Schmidt9ab24e42008-07-09 08:08:17 +0100160};
161
Stefan Schmidt9078ac22008-12-08 15:58:08 +0100162#if defined(CONFIG_MACH_EZX_A780) || defined(CONFIG_MACH_EZX_E680)
163static unsigned long gen1_pin_config[] __initdata = {
164 /* flip / lockswitch */
Daniel Ribeiroff713382009-05-15 06:33:50 -0300165 GPIO12_GPIO | WAKEUP_ON_EDGE_BOTH,
Stefan Schmidt9078ac22008-12-08 15:58:08 +0100166
167 /* bluetooth (bcm2035) */
Daniel Ribeiroff713382009-05-15 06:33:50 -0300168 GPIO14_GPIO | WAKEUP_ON_EDGE_RISE, /* HOSTWAKE */
Stefan Schmidt9078ac22008-12-08 15:58:08 +0100169 GPIO48_GPIO, /* RESET */
170 GPIO28_GPIO, /* WAKEUP */
171
172 /* Neptune handshake */
Daniel Ribeiroff713382009-05-15 06:33:50 -0300173 GPIO0_GPIO | WAKEUP_ON_EDGE_FALL, /* BP_RDY */
174 GPIO57_GPIO | MFP_LPM_DRIVE_HIGH, /* AP_RDY */
175 GPIO13_GPIO | WAKEUP_ON_EDGE_BOTH, /* WDI */
176 GPIO3_GPIO | WAKEUP_ON_EDGE_BOTH, /* WDI2 */
177 GPIO82_GPIO | MFP_LPM_DRIVE_HIGH, /* RESET */
178 GPIO99_GPIO | MFP_LPM_DRIVE_HIGH, /* TC_MM_EN */
Stefan Schmidt9078ac22008-12-08 15:58:08 +0100179
180 /* sound */
181 GPIO52_SSP3_SCLK,
182 GPIO83_SSP3_SFRM,
183 GPIO81_SSP3_TXD,
184 GPIO89_SSP3_RXD,
185
186 /* ssp2 pins to in */
187 GPIO22_GPIO, /* SSP2_SCLK */
188 GPIO37_GPIO, /* SSP2_SFRM */
189 GPIO38_GPIO, /* SSP2_TXD */
190 GPIO88_GPIO, /* SSP2_RXD */
191
192 /* camera */
193 GPIO23_CIF_MCLK,
194 GPIO54_CIF_PCLK,
195 GPIO85_CIF_LV,
196 GPIO84_CIF_FV,
197 GPIO27_CIF_DD_0,
198 GPIO114_CIF_DD_1,
199 GPIO51_CIF_DD_2,
200 GPIO115_CIF_DD_3,
201 GPIO95_CIF_DD_4,
202 GPIO94_CIF_DD_5,
203 GPIO17_CIF_DD_6,
204 GPIO108_CIF_DD_7,
Antonio Ospite405ac402009-11-12 15:47:04 +0100205 GPIO50_GPIO | MFP_LPM_DRIVE_HIGH, /* CAM_EN */
206 GPIO19_GPIO | MFP_LPM_DRIVE_HIGH, /* CAM_RST */
Stefan Schmidt9078ac22008-12-08 15:58:08 +0100207
208 /* EMU */
209 GPIO120_GPIO, /* EMU_MUX1 */
210 GPIO119_GPIO, /* EMU_MUX2 */
211 GPIO86_GPIO, /* SNP_INT_CTL */
212 GPIO87_GPIO, /* SNP_INT_IN */
213};
214#endif
215
216#if defined(CONFIG_MACH_EZX_A1200) || defined(CONFIG_MACH_EZX_A910) || \
217 defined(CONFIG_MACH_EZX_E2) || defined(CONFIG_MACH_EZX_E6)
218static unsigned long gen2_pin_config[] __initdata = {
219 /* flip / lockswitch */
Daniel Ribeiroff713382009-05-15 06:33:50 -0300220 GPIO15_GPIO | WAKEUP_ON_EDGE_BOTH,
Stefan Schmidt9078ac22008-12-08 15:58:08 +0100221
222 /* EOC */
Daniel Ribeiroff713382009-05-15 06:33:50 -0300223 GPIO10_GPIO | WAKEUP_ON_EDGE_RISE,
Stefan Schmidt9078ac22008-12-08 15:58:08 +0100224
225 /* bluetooth (bcm2045) */
Daniel Ribeiroff713382009-05-15 06:33:50 -0300226 GPIO13_GPIO | WAKEUP_ON_EDGE_RISE, /* HOSTWAKE */
Stefan Schmidt9078ac22008-12-08 15:58:08 +0100227 GPIO37_GPIO, /* RESET */
228 GPIO57_GPIO, /* WAKEUP */
229
230 /* Neptune handshake */
Daniel Ribeiroff713382009-05-15 06:33:50 -0300231 GPIO0_GPIO | WAKEUP_ON_EDGE_FALL, /* BP_RDY */
232 GPIO96_GPIO | MFP_LPM_DRIVE_HIGH, /* AP_RDY */
233 GPIO3_GPIO | WAKEUP_ON_EDGE_FALL, /* WDI */
234 GPIO116_GPIO | MFP_LPM_DRIVE_HIGH, /* RESET */
Stefan Schmidt9078ac22008-12-08 15:58:08 +0100235 GPIO41_GPIO, /* BP_FLASH */
236
237 /* sound */
238 GPIO52_SSP3_SCLK,
239 GPIO83_SSP3_SFRM,
240 GPIO81_SSP3_TXD,
241 GPIO82_SSP3_RXD,
242
243 /* ssp2 pins to in */
244 GPIO22_GPIO, /* SSP2_SCLK */
245 GPIO14_GPIO, /* SSP2_SFRM */
246 GPIO38_GPIO, /* SSP2_TXD */
247 GPIO88_GPIO, /* SSP2_RXD */
248
249 /* camera */
250 GPIO23_CIF_MCLK,
251 GPIO54_CIF_PCLK,
252 GPIO85_CIF_LV,
253 GPIO84_CIF_FV,
254 GPIO27_CIF_DD_0,
255 GPIO114_CIF_DD_1,
256 GPIO51_CIF_DD_2,
257 GPIO115_CIF_DD_3,
258 GPIO95_CIF_DD_4,
259 GPIO48_CIF_DD_5,
260 GPIO93_CIF_DD_6,
261 GPIO12_CIF_DD_7,
Antonio Ospite405ac402009-11-12 15:47:04 +0100262 GPIO50_GPIO | MFP_LPM_DRIVE_HIGH, /* CAM_EN */
263 GPIO28_GPIO | MFP_LPM_DRIVE_HIGH, /* CAM_RST */
Stefan Schmidt9078ac22008-12-08 15:58:08 +0100264 GPIO17_GPIO, /* CAM_FLASH */
265};
266#endif
267
268#ifdef CONFIG_MACH_EZX_A780
269static unsigned long a780_pin_config[] __initdata = {
270 /* keypad */
271 GPIO93_KP_DKIN_0 | WAKEUP_ON_LEVEL_HIGH,
272 GPIO100_KP_MKIN_0 | WAKEUP_ON_LEVEL_HIGH,
273 GPIO101_KP_MKIN_1 | WAKEUP_ON_LEVEL_HIGH,
274 GPIO102_KP_MKIN_2 | WAKEUP_ON_LEVEL_HIGH,
275 GPIO97_KP_MKIN_3 | WAKEUP_ON_LEVEL_HIGH,
276 GPIO98_KP_MKIN_4 | WAKEUP_ON_LEVEL_HIGH,
277 GPIO103_KP_MKOUT_0,
278 GPIO104_KP_MKOUT_1,
279 GPIO105_KP_MKOUT_2,
280 GPIO106_KP_MKOUT_3,
281 GPIO107_KP_MKOUT_4,
282
283 /* attenuate sound */
284 GPIO96_GPIO,
285};
286#endif
287
288#ifdef CONFIG_MACH_EZX_E680
289static unsigned long e680_pin_config[] __initdata = {
290 /* keypad */
291 GPIO93_KP_DKIN_0 | WAKEUP_ON_LEVEL_HIGH,
292 GPIO96_KP_DKIN_3 | WAKEUP_ON_LEVEL_HIGH,
293 GPIO97_KP_DKIN_4 | WAKEUP_ON_LEVEL_HIGH,
294 GPIO98_KP_DKIN_5 | WAKEUP_ON_LEVEL_HIGH,
295 GPIO100_KP_MKIN_0 | WAKEUP_ON_LEVEL_HIGH,
296 GPIO101_KP_MKIN_1 | WAKEUP_ON_LEVEL_HIGH,
297 GPIO102_KP_MKIN_2 | WAKEUP_ON_LEVEL_HIGH,
298 GPIO103_KP_MKOUT_0,
299 GPIO104_KP_MKOUT_1,
300 GPIO105_KP_MKOUT_2,
301 GPIO106_KP_MKOUT_3,
302
303 /* MIDI */
304 GPIO79_GPIO, /* VA_SEL_BUL */
305 GPIO80_GPIO, /* FLT_SEL_BUL */
306 GPIO78_GPIO, /* MIDI_RESET */
307 GPIO33_GPIO, /* MIDI_CS */
308 GPIO15_GPIO, /* MIDI_IRQ */
309 GPIO49_GPIO, /* MIDI_NPWE */
310 GPIO18_GPIO, /* MIDI_RDY */
311
312 /* leds */
313 GPIO46_GPIO,
314 GPIO47_GPIO,
315};
316#endif
317
318#ifdef CONFIG_MACH_EZX_A1200
319static unsigned long a1200_pin_config[] __initdata = {
320 /* keypad */
321 GPIO100_KP_MKIN_0 | WAKEUP_ON_LEVEL_HIGH,
322 GPIO101_KP_MKIN_1 | WAKEUP_ON_LEVEL_HIGH,
323 GPIO102_KP_MKIN_2 | WAKEUP_ON_LEVEL_HIGH,
324 GPIO97_KP_MKIN_3 | WAKEUP_ON_LEVEL_HIGH,
325 GPIO98_KP_MKIN_4 | WAKEUP_ON_LEVEL_HIGH,
326 GPIO103_KP_MKOUT_0,
327 GPIO104_KP_MKOUT_1,
328 GPIO105_KP_MKOUT_2,
329 GPIO106_KP_MKOUT_3,
330 GPIO107_KP_MKOUT_4,
331 GPIO108_KP_MKOUT_5,
332};
333#endif
334
335#ifdef CONFIG_MACH_EZX_A910
336static unsigned long a910_pin_config[] __initdata = {
337 /* keypad */
338 GPIO100_KP_MKIN_0 | WAKEUP_ON_LEVEL_HIGH,
339 GPIO101_KP_MKIN_1 | WAKEUP_ON_LEVEL_HIGH,
340 GPIO102_KP_MKIN_2 | WAKEUP_ON_LEVEL_HIGH,
341 GPIO97_KP_MKIN_3 | WAKEUP_ON_LEVEL_HIGH,
342 GPIO98_KP_MKIN_4 | WAKEUP_ON_LEVEL_HIGH,
343 GPIO103_KP_MKOUT_0,
344 GPIO104_KP_MKOUT_1,
345 GPIO105_KP_MKOUT_2,
346 GPIO106_KP_MKOUT_3,
347 GPIO107_KP_MKOUT_4,
348 GPIO108_KP_MKOUT_5,
349
350 /* WLAN */
351 GPIO89_GPIO, /* RESET */
352 GPIO33_GPIO, /* WAKEUP */
353 GPIO94_GPIO | WAKEUP_ON_LEVEL_HIGH, /* HOSTWAKE */
354
355 /* MMC CS */
356 GPIO20_GPIO,
357};
358#endif
359
360#ifdef CONFIG_MACH_EZX_E2
361static unsigned long e2_pin_config[] __initdata = {
362 /* keypad */
363 GPIO100_KP_MKIN_0 | WAKEUP_ON_LEVEL_HIGH,
364 GPIO101_KP_MKIN_1 | WAKEUP_ON_LEVEL_HIGH,
365 GPIO102_KP_MKIN_2 | WAKEUP_ON_LEVEL_HIGH,
366 GPIO97_KP_MKIN_3 | WAKEUP_ON_LEVEL_HIGH,
367 GPIO98_KP_MKIN_4 | WAKEUP_ON_LEVEL_HIGH,
368 GPIO103_KP_MKOUT_0,
369 GPIO104_KP_MKOUT_1,
370 GPIO105_KP_MKOUT_2,
371 GPIO106_KP_MKOUT_3,
372 GPIO107_KP_MKOUT_4,
373 GPIO108_KP_MKOUT_5,
374};
375#endif
376
377#ifdef CONFIG_MACH_EZX_E6
378static unsigned long e6_pin_config[] __initdata = {
379 /* keypad */
380 GPIO100_KP_MKIN_0 | WAKEUP_ON_LEVEL_HIGH,
381 GPIO101_KP_MKIN_1 | WAKEUP_ON_LEVEL_HIGH,
382 GPIO102_KP_MKIN_2 | WAKEUP_ON_LEVEL_HIGH,
383 GPIO97_KP_MKIN_3 | WAKEUP_ON_LEVEL_HIGH,
384 GPIO98_KP_MKIN_4 | WAKEUP_ON_LEVEL_HIGH,
385 GPIO103_KP_MKOUT_0,
386 GPIO104_KP_MKOUT_1,
387 GPIO105_KP_MKOUT_2,
388 GPIO106_KP_MKOUT_3,
389 GPIO107_KP_MKOUT_4,
390 GPIO108_KP_MKOUT_5,
391};
392#endif
393
Stefan Schmidtfe9490c2008-12-08 15:58:09 +0100394/* KEYPAD */
395#ifdef CONFIG_MACH_EZX_A780
Chao Xie0a085a92013-05-05 20:24:58 -0700396static const unsigned int a780_key_map[] = {
Stefan Schmidtfe9490c2008-12-08 15:58:09 +0100397 KEY(0, 0, KEY_SEND),
398 KEY(0, 1, KEY_BACK),
399 KEY(0, 2, KEY_END),
400 KEY(0, 3, KEY_PAGEUP),
401 KEY(0, 4, KEY_UP),
402
403 KEY(1, 0, KEY_NUMERIC_1),
404 KEY(1, 1, KEY_NUMERIC_2),
405 KEY(1, 2, KEY_NUMERIC_3),
406 KEY(1, 3, KEY_SELECT),
407 KEY(1, 4, KEY_KPENTER),
408
409 KEY(2, 0, KEY_NUMERIC_4),
410 KEY(2, 1, KEY_NUMERIC_5),
411 KEY(2, 2, KEY_NUMERIC_6),
412 KEY(2, 3, KEY_RECORD),
413 KEY(2, 4, KEY_LEFT),
414
415 KEY(3, 0, KEY_NUMERIC_7),
416 KEY(3, 1, KEY_NUMERIC_8),
417 KEY(3, 2, KEY_NUMERIC_9),
418 KEY(3, 3, KEY_HOME),
419 KEY(3, 4, KEY_RIGHT),
420
421 KEY(4, 0, KEY_NUMERIC_STAR),
422 KEY(4, 1, KEY_NUMERIC_0),
423 KEY(4, 2, KEY_NUMERIC_POUND),
424 KEY(4, 3, KEY_PAGEDOWN),
425 KEY(4, 4, KEY_DOWN),
426};
427
Chao Xie0a085a92013-05-05 20:24:58 -0700428static struct matrix_keymap_data a780_matrix_keymap_data = {
429 .keymap = a780_key_map,
430 .keymap_size = ARRAY_SIZE(a780_key_map),
431};
432
Stefan Schmidtfe9490c2008-12-08 15:58:09 +0100433static struct pxa27x_keypad_platform_data a780_keypad_platform_data = {
434 .matrix_key_rows = 5,
435 .matrix_key_cols = 5,
Chao Xie0a085a92013-05-05 20:24:58 -0700436 .matrix_keymap_data = &a780_matrix_keymap_data,
Stefan Schmidtfe9490c2008-12-08 15:58:09 +0100437
438 .direct_key_map = { KEY_CAMERA },
439 .direct_key_num = 1,
440
441 .debounce_interval = 30,
442};
443#endif /* CONFIG_MACH_EZX_A780 */
444
445#ifdef CONFIG_MACH_EZX_E680
Chao Xie0a085a92013-05-05 20:24:58 -0700446static const unsigned int e680_key_map[] = {
Stefan Schmidtfe9490c2008-12-08 15:58:09 +0100447 KEY(0, 0, KEY_UP),
448 KEY(0, 1, KEY_RIGHT),
449 KEY(0, 2, KEY_RESERVED),
450 KEY(0, 3, KEY_SEND),
451
452 KEY(1, 0, KEY_DOWN),
453 KEY(1, 1, KEY_LEFT),
454 KEY(1, 2, KEY_PAGEUP),
455 KEY(1, 3, KEY_PAGEDOWN),
456
457 KEY(2, 0, KEY_RESERVED),
458 KEY(2, 1, KEY_RESERVED),
459 KEY(2, 2, KEY_RESERVED),
460 KEY(2, 3, KEY_KPENTER),
461};
462
Chao Xie0a085a92013-05-05 20:24:58 -0700463static struct matrix_keymap_data e680_matrix_keymap_data = {
464 .keymap = e680_key_map,
465 .keymap_size = ARRAY_SIZE(e680_key_map),
466};
467
Stefan Schmidtfe9490c2008-12-08 15:58:09 +0100468static struct pxa27x_keypad_platform_data e680_keypad_platform_data = {
469 .matrix_key_rows = 3,
470 .matrix_key_cols = 4,
Chao Xie0a085a92013-05-05 20:24:58 -0700471 .matrix_keymap_data = &e680_matrix_keymap_data,
Stefan Schmidtfe9490c2008-12-08 15:58:09 +0100472
473 .direct_key_map = {
474 KEY_CAMERA,
475 KEY_RESERVED,
476 KEY_RESERVED,
477 KEY_F1,
478 KEY_CANCEL,
479 KEY_F2,
480 },
481 .direct_key_num = 6,
482
483 .debounce_interval = 30,
484};
485#endif /* CONFIG_MACH_EZX_E680 */
486
487#ifdef CONFIG_MACH_EZX_A1200
Chao Xie0a085a92013-05-05 20:24:58 -0700488static const unsigned int a1200_key_map[] = {
Stefan Schmidtfe9490c2008-12-08 15:58:09 +0100489 KEY(0, 0, KEY_RESERVED),
490 KEY(0, 1, KEY_RIGHT),
491 KEY(0, 2, KEY_PAGEDOWN),
492 KEY(0, 3, KEY_RESERVED),
493 KEY(0, 4, KEY_RESERVED),
494 KEY(0, 5, KEY_RESERVED),
495
496 KEY(1, 0, KEY_RESERVED),
497 KEY(1, 1, KEY_DOWN),
498 KEY(1, 2, KEY_CAMERA),
499 KEY(1, 3, KEY_RESERVED),
500 KEY(1, 4, KEY_RESERVED),
501 KEY(1, 5, KEY_RESERVED),
502
503 KEY(2, 0, KEY_RESERVED),
504 KEY(2, 1, KEY_KPENTER),
505 KEY(2, 2, KEY_RECORD),
506 KEY(2, 3, KEY_RESERVED),
507 KEY(2, 4, KEY_RESERVED),
508 KEY(2, 5, KEY_SELECT),
509
510 KEY(3, 0, KEY_RESERVED),
511 KEY(3, 1, KEY_UP),
512 KEY(3, 2, KEY_SEND),
513 KEY(3, 3, KEY_RESERVED),
514 KEY(3, 4, KEY_RESERVED),
515 KEY(3, 5, KEY_RESERVED),
516
517 KEY(4, 0, KEY_RESERVED),
518 KEY(4, 1, KEY_LEFT),
519 KEY(4, 2, KEY_PAGEUP),
520 KEY(4, 3, KEY_RESERVED),
521 KEY(4, 4, KEY_RESERVED),
522 KEY(4, 5, KEY_RESERVED),
523};
524
Chao Xie0a085a92013-05-05 20:24:58 -0700525static struct matrix_keymap_data a1200_matrix_keymap_data = {
526 .keymap = a1200_key_map,
527 .keymap_size = ARRAY_SIZE(a1200_key_map),
528};
529
Stefan Schmidtfe9490c2008-12-08 15:58:09 +0100530static struct pxa27x_keypad_platform_data a1200_keypad_platform_data = {
531 .matrix_key_rows = 5,
532 .matrix_key_cols = 6,
Chao Xie0a085a92013-05-05 20:24:58 -0700533 .matrix_keymap_data = &a1200_matrix_keymap_data,
Stefan Schmidtfe9490c2008-12-08 15:58:09 +0100534
535 .debounce_interval = 30,
536};
537#endif /* CONFIG_MACH_EZX_A1200 */
538
539#ifdef CONFIG_MACH_EZX_E6
Chao Xie0a085a92013-05-05 20:24:58 -0700540static const unsigned int e6_key_map[] = {
Stefan Schmidtfe9490c2008-12-08 15:58:09 +0100541 KEY(0, 0, KEY_RESERVED),
542 KEY(0, 1, KEY_RIGHT),
543 KEY(0, 2, KEY_PAGEDOWN),
544 KEY(0, 3, KEY_RESERVED),
545 KEY(0, 4, KEY_RESERVED),
546 KEY(0, 5, KEY_NEXTSONG),
547
548 KEY(1, 0, KEY_RESERVED),
549 KEY(1, 1, KEY_DOWN),
550 KEY(1, 2, KEY_PROG1),
551 KEY(1, 3, KEY_RESERVED),
552 KEY(1, 4, KEY_RESERVED),
553 KEY(1, 5, KEY_RESERVED),
554
555 KEY(2, 0, KEY_RESERVED),
556 KEY(2, 1, KEY_ENTER),
557 KEY(2, 2, KEY_CAMERA),
558 KEY(2, 3, KEY_RESERVED),
559 KEY(2, 4, KEY_RESERVED),
560 KEY(2, 5, KEY_WWW),
561
562 KEY(3, 0, KEY_RESERVED),
563 KEY(3, 1, KEY_UP),
564 KEY(3, 2, KEY_SEND),
565 KEY(3, 3, KEY_RESERVED),
566 KEY(3, 4, KEY_RESERVED),
567 KEY(3, 5, KEY_PLAYPAUSE),
568
569 KEY(4, 0, KEY_RESERVED),
570 KEY(4, 1, KEY_LEFT),
571 KEY(4, 2, KEY_PAGEUP),
572 KEY(4, 3, KEY_RESERVED),
573 KEY(4, 4, KEY_RESERVED),
574 KEY(4, 5, KEY_PREVIOUSSONG),
575};
576
Chao Xie0a085a92013-05-05 20:24:58 -0700577static struct matrix_keymap_data e6_keymap_data = {
578 .keymap = e6_key_map,
579 .keymap_size = ARRAY_SIZE(e6_key_map),
580};
581
Stefan Schmidtfe9490c2008-12-08 15:58:09 +0100582static struct pxa27x_keypad_platform_data e6_keypad_platform_data = {
583 .matrix_key_rows = 5,
584 .matrix_key_cols = 6,
Chao Xie0a085a92013-05-05 20:24:58 -0700585 .matrix_keymap_data = &e6_keymap_data,
Stefan Schmidtfe9490c2008-12-08 15:58:09 +0100586
587 .debounce_interval = 30,
588};
589#endif /* CONFIG_MACH_EZX_E6 */
590
591#ifdef CONFIG_MACH_EZX_A910
Chao Xie0a085a92013-05-05 20:24:58 -0700592static const unsigned int a910_key_map[] = {
Stefan Schmidtfe9490c2008-12-08 15:58:09 +0100593 KEY(0, 0, KEY_NUMERIC_6),
594 KEY(0, 1, KEY_RIGHT),
595 KEY(0, 2, KEY_PAGEDOWN),
596 KEY(0, 3, KEY_KPENTER),
597 KEY(0, 4, KEY_NUMERIC_5),
598 KEY(0, 5, KEY_CAMERA),
599
600 KEY(1, 0, KEY_NUMERIC_8),
601 KEY(1, 1, KEY_DOWN),
602 KEY(1, 2, KEY_RESERVED),
603 KEY(1, 3, KEY_F1), /* Left SoftKey */
604 KEY(1, 4, KEY_NUMERIC_STAR),
605 KEY(1, 5, KEY_RESERVED),
606
607 KEY(2, 0, KEY_NUMERIC_7),
608 KEY(2, 1, KEY_NUMERIC_9),
609 KEY(2, 2, KEY_RECORD),
610 KEY(2, 3, KEY_F2), /* Right SoftKey */
611 KEY(2, 4, KEY_BACK),
612 KEY(2, 5, KEY_SELECT),
613
614 KEY(3, 0, KEY_NUMERIC_2),
615 KEY(3, 1, KEY_UP),
616 KEY(3, 2, KEY_SEND),
617 KEY(3, 3, KEY_NUMERIC_0),
618 KEY(3, 4, KEY_NUMERIC_1),
619 KEY(3, 5, KEY_RECORD),
620
621 KEY(4, 0, KEY_NUMERIC_4),
622 KEY(4, 1, KEY_LEFT),
623 KEY(4, 2, KEY_PAGEUP),
624 KEY(4, 3, KEY_NUMERIC_POUND),
625 KEY(4, 4, KEY_NUMERIC_3),
626 KEY(4, 5, KEY_RESERVED),
627};
628
Chao Xie0a085a92013-05-05 20:24:58 -0700629static struct matrix_keymap_data a910_matrix_keymap_data = {
630 .keymap = a910_key_map,
631 .keymap_size = ARRAY_SIZE(a910_key_map),
632};
633
Stefan Schmidtfe9490c2008-12-08 15:58:09 +0100634static struct pxa27x_keypad_platform_data a910_keypad_platform_data = {
635 .matrix_key_rows = 5,
636 .matrix_key_cols = 6,
Chao Xie0a085a92013-05-05 20:24:58 -0700637 .matrix_keymap_data = &a910_matrix_keymap_data,
Stefan Schmidtfe9490c2008-12-08 15:58:09 +0100638
639 .debounce_interval = 30,
640};
641#endif /* CONFIG_MACH_EZX_A910 */
642
643#ifdef CONFIG_MACH_EZX_E2
Chao Xie0a085a92013-05-05 20:24:58 -0700644static const unsigned int e2_key_map[] = {
Stefan Schmidtfe9490c2008-12-08 15:58:09 +0100645 KEY(0, 0, KEY_NUMERIC_6),
646 KEY(0, 1, KEY_RIGHT),
647 KEY(0, 2, KEY_NUMERIC_9),
648 KEY(0, 3, KEY_NEXTSONG),
649 KEY(0, 4, KEY_NUMERIC_5),
650 KEY(0, 5, KEY_F1), /* Left SoftKey */
651
652 KEY(1, 0, KEY_NUMERIC_8),
653 KEY(1, 1, KEY_DOWN),
654 KEY(1, 2, KEY_RESERVED),
655 KEY(1, 3, KEY_PAGEUP),
656 KEY(1, 4, KEY_NUMERIC_STAR),
657 KEY(1, 5, KEY_F2), /* Right SoftKey */
658
659 KEY(2, 0, KEY_NUMERIC_7),
660 KEY(2, 1, KEY_KPENTER),
661 KEY(2, 2, KEY_RECORD),
662 KEY(2, 3, KEY_PAGEDOWN),
663 KEY(2, 4, KEY_BACK),
664 KEY(2, 5, KEY_NUMERIC_0),
665
666 KEY(3, 0, KEY_NUMERIC_2),
667 KEY(3, 1, KEY_UP),
668 KEY(3, 2, KEY_SEND),
669 KEY(3, 3, KEY_PLAYPAUSE),
670 KEY(3, 4, KEY_NUMERIC_1),
671 KEY(3, 5, KEY_SOUND), /* Music SoftKey */
672
673 KEY(4, 0, KEY_NUMERIC_4),
674 KEY(4, 1, KEY_LEFT),
675 KEY(4, 2, KEY_NUMERIC_POUND),
676 KEY(4, 3, KEY_PREVIOUSSONG),
677 KEY(4, 4, KEY_NUMERIC_3),
678 KEY(4, 5, KEY_RESERVED),
679};
680
Chao Xie0a085a92013-05-05 20:24:58 -0700681static struct matrix_keymap_data e2_matrix_keymap_data = {
682 .keymap = e2_key_map,
683 .keymap_size = ARRAY_SIZE(e2_key_map),
684};
685
Stefan Schmidtfe9490c2008-12-08 15:58:09 +0100686static struct pxa27x_keypad_platform_data e2_keypad_platform_data = {
687 .matrix_key_rows = 5,
688 .matrix_key_cols = 6,
Chao Xie0a085a92013-05-05 20:24:58 -0700689 .matrix_keymap_data = &e2_matrix_keymap_data,
Stefan Schmidtfe9490c2008-12-08 15:58:09 +0100690
691 .debounce_interval = 30,
692};
693#endif /* CONFIG_MACH_EZX_E2 */
694
Stefan Schmidt9078ac22008-12-08 15:58:08 +0100695#ifdef CONFIG_MACH_EZX_A780
Antonio Ospite1ce2c512009-06-01 12:26:58 +0200696/* gpio_keys */
697static struct gpio_keys_button a780_buttons[] = {
698 [0] = {
699 .code = SW_LID,
700 .gpio = GPIO12_A780_FLIP_LID,
701 .active_low = 0,
702 .desc = "A780 flip lid",
703 .type = EV_SW,
704 .wakeup = 1,
705 },
706};
707
708static struct gpio_keys_platform_data a780_gpio_keys_platform_data = {
709 .buttons = a780_buttons,
710 .nbuttons = ARRAY_SIZE(a780_buttons),
711};
712
713static struct platform_device a780_gpio_keys = {
714 .name = "gpio-keys",
715 .id = -1,
716 .dev = {
717 .platform_data = &a780_gpio_keys_platform_data,
718 },
719};
720
Antonio Ospite405ac402009-11-12 15:47:04 +0100721/* camera */
722static int a780_camera_init(void)
723{
724 int err;
725
726 /*
727 * GPIO50_nCAM_EN is active low
728 * GPIO19_GEN1_CAM_RST is active on rising edge
729 */
730 err = gpio_request(GPIO50_nCAM_EN, "nCAM_EN");
731 if (err) {
732 pr_err("%s: Failed to request nCAM_EN\n", __func__);
733 goto fail;
734 }
735
736 err = gpio_request(GPIO19_GEN1_CAM_RST, "CAM_RST");
737 if (err) {
738 pr_err("%s: Failed to request CAM_RST\n", __func__);
739 goto fail_gpio_cam_rst;
740 }
741
742 gpio_direction_output(GPIO50_nCAM_EN, 1);
743 gpio_direction_output(GPIO19_GEN1_CAM_RST, 0);
744
745 return 0;
746
747fail_gpio_cam_rst:
748 gpio_free(GPIO50_nCAM_EN);
749fail:
750 return err;
751}
752
753static int a780_camera_power(struct device *dev, int on)
754{
755 gpio_set_value(GPIO50_nCAM_EN, !on);
756 return 0;
757}
758
759static int a780_camera_reset(struct device *dev)
760{
761 gpio_set_value(GPIO19_GEN1_CAM_RST, 0);
762 msleep(10);
763 gpio_set_value(GPIO19_GEN1_CAM_RST, 1);
764
765 return 0;
766}
767
768struct pxacamera_platform_data a780_pxacamera_platform_data = {
769 .flags = PXA_CAMERA_MASTER | PXA_CAMERA_DATAWIDTH_8 |
770 PXA_CAMERA_PCLK_EN | PXA_CAMERA_MCLK_EN,
771 .mclk_10khz = 5000,
772};
773
774static struct i2c_board_info a780_camera_i2c_board_info = {
775 I2C_BOARD_INFO("mt9m111", 0x5d),
776};
777
778static struct soc_camera_link a780_iclink = {
779 .bus_id = 0,
780 .flags = SOCAM_SENSOR_INVERT_PCLK,
781 .i2c_adapter_id = 0,
782 .board_info = &a780_camera_i2c_board_info,
Antonio Ospite405ac402009-11-12 15:47:04 +0100783 .power = a780_camera_power,
784 .reset = a780_camera_reset,
785};
786
787static struct platform_device a780_camera = {
788 .name = "soc-camera-pdrv",
789 .id = 0,
790 .dev = {
791 .platform_data = &a780_iclink,
792 },
793};
794
Antonio Ospite1ce2c512009-06-01 12:26:58 +0200795static struct platform_device *a780_devices[] __initdata = {
796 &a780_gpio_keys,
797};
798
Stefan Schmidt9078ac22008-12-08 15:58:08 +0100799static void __init a780_init(void)
Stefan Schmidt9ab24e42008-07-09 08:08:17 +0100800{
801 pxa2xx_mfp_config(ARRAY_AND_SIZE(ezx_pin_config));
Stefan Schmidt9078ac22008-12-08 15:58:08 +0100802 pxa2xx_mfp_config(ARRAY_AND_SIZE(gen1_pin_config));
803 pxa2xx_mfp_config(ARRAY_AND_SIZE(a780_pin_config));
804
Russell Kingcc155c62009-11-09 13:34:08 +0800805 pxa_set_ffuart_info(NULL);
806 pxa_set_btuart_info(NULL);
807 pxa_set_stuart_info(NULL);
808
Stefan Schmidt9ab24e42008-07-09 08:08:17 +0100809 pxa_set_i2c_info(NULL);
Stefan Schmidt9078ac22008-12-08 15:58:08 +0100810
Russell King - ARM Linux4321e1a2011-02-15 15:37:30 +0800811 pxa_set_fb_info(NULL, &ezx_fb_info_1);
Stefan Schmidt9ab24e42008-07-09 08:08:17 +0100812
Stefan Schmidtfe9490c2008-12-08 15:58:09 +0100813 pxa_set_keypad_info(&a780_keypad_platform_data);
Stefan Schmidt9ab24e42008-07-09 08:08:17 +0100814
Antonio Ospite405ac402009-11-12 15:47:04 +0100815 if (a780_camera_init() == 0) {
816 pxa_set_camera_info(&a780_pxacamera_platform_data);
817 platform_device_register(&a780_camera);
818 }
819
Antonio Ospite1ce2c512009-06-01 12:26:58 +0200820 platform_add_devices(ARRAY_AND_SIZE(ezx_devices));
821 platform_add_devices(ARRAY_AND_SIZE(a780_devices));
Stefan Schmidt9ab24e42008-07-09 08:08:17 +0100822}
823
Stefan Schmidt9ab24e42008-07-09 08:08:17 +0100824MACHINE_START(EZX_A780, "Motorola EZX A780")
Nicolas Pitre7375aba2011-07-05 22:38:15 -0400825 .atag_offset = 0x100,
Marek Vasut851982c2010-10-11 02:20:19 +0200826 .map_io = pxa27x_map_io,
Haojian Zhuang6ac6b812010-08-20 15:23:59 +0800827 .nr_irqs = EZX_NR_IRQS,
Stefan Schmidt9ab24e42008-07-09 08:08:17 +0100828 .init_irq = pxa27x_init_irq,
Eric Miao8a97ae22011-05-18 21:30:04 +0800829 .handle_irq = pxa27x_handle_irq,
Stephen Warren6bb27d72012-11-08 12:40:59 -0700830 .init_time = pxa_timer_init,
Stefan Schmidt9078ac22008-12-08 15:58:08 +0100831 .init_machine = a780_init,
Russell King271a74f2011-11-04 14:15:53 +0000832 .restart = pxa_restart,
Stefan Schmidt9ab24e42008-07-09 08:08:17 +0100833MACHINE_END
834#endif
835
836#ifdef CONFIG_MACH_EZX_E680
Antonio Ospite1ce2c512009-06-01 12:26:58 +0200837/* gpio_keys */
838static struct gpio_keys_button e680_buttons[] = {
839 [0] = {
840 .code = KEY_SCREENLOCK,
841 .gpio = GPIO12_E680_LOCK_SWITCH,
842 .active_low = 0,
843 .desc = "E680 lock switch",
844 .type = EV_KEY,
845 .wakeup = 1,
846 },
847};
848
849static struct gpio_keys_platform_data e680_gpio_keys_platform_data = {
850 .buttons = e680_buttons,
851 .nbuttons = ARRAY_SIZE(e680_buttons),
852};
853
854static struct platform_device e680_gpio_keys = {
855 .name = "gpio-keys",
856 .id = -1,
857 .dev = {
858 .platform_data = &e680_gpio_keys_platform_data,
859 },
860};
861
Stefan Schmidtbc09cf62008-12-08 15:58:10 +0100862static struct i2c_board_info __initdata e680_i2c_board_info[] = {
863 { I2C_BOARD_INFO("tea5767", 0x81) },
864};
865
Antonio Ospite1ce2c512009-06-01 12:26:58 +0200866static struct platform_device *e680_devices[] __initdata = {
867 &e680_gpio_keys,
868};
869
Stefan Schmidt9078ac22008-12-08 15:58:08 +0100870static void __init e680_init(void)
871{
872 pxa2xx_mfp_config(ARRAY_AND_SIZE(ezx_pin_config));
873 pxa2xx_mfp_config(ARRAY_AND_SIZE(gen1_pin_config));
874 pxa2xx_mfp_config(ARRAY_AND_SIZE(e680_pin_config));
875
Russell Kingcc155c62009-11-09 13:34:08 +0800876 pxa_set_ffuart_info(NULL);
877 pxa_set_btuart_info(NULL);
878 pxa_set_stuart_info(NULL);
879
Stefan Schmidt9078ac22008-12-08 15:58:08 +0100880 pxa_set_i2c_info(NULL);
Stefan Schmidtbc09cf62008-12-08 15:58:10 +0100881 i2c_register_board_info(0, ARRAY_AND_SIZE(e680_i2c_board_info));
Stefan Schmidt9078ac22008-12-08 15:58:08 +0100882
Russell King - ARM Linux4321e1a2011-02-15 15:37:30 +0800883 pxa_set_fb_info(NULL, &ezx_fb_info_1);
Stefan Schmidt9078ac22008-12-08 15:58:08 +0100884
Stefan Schmidtfe9490c2008-12-08 15:58:09 +0100885 pxa_set_keypad_info(&e680_keypad_platform_data);
886
Antonio Ospite1ce2c512009-06-01 12:26:58 +0200887 platform_add_devices(ARRAY_AND_SIZE(ezx_devices));
888 platform_add_devices(ARRAY_AND_SIZE(e680_devices));
Stefan Schmidt9078ac22008-12-08 15:58:08 +0100889}
890
Stefan Schmidt9ab24e42008-07-09 08:08:17 +0100891MACHINE_START(EZX_E680, "Motorola EZX E680")
Nicolas Pitre7375aba2011-07-05 22:38:15 -0400892 .atag_offset = 0x100,
Marek Vasut851982c2010-10-11 02:20:19 +0200893 .map_io = pxa27x_map_io,
Haojian Zhuang6ac6b812010-08-20 15:23:59 +0800894 .nr_irqs = EZX_NR_IRQS,
Stefan Schmidt9ab24e42008-07-09 08:08:17 +0100895 .init_irq = pxa27x_init_irq,
Eric Miao8a97ae22011-05-18 21:30:04 +0800896 .handle_irq = pxa27x_handle_irq,
Stephen Warren6bb27d72012-11-08 12:40:59 -0700897 .init_time = pxa_timer_init,
Stefan Schmidt9078ac22008-12-08 15:58:08 +0100898 .init_machine = e680_init,
Russell King271a74f2011-11-04 14:15:53 +0000899 .restart = pxa_restart,
Stefan Schmidt9ab24e42008-07-09 08:08:17 +0100900MACHINE_END
901#endif
902
903#ifdef CONFIG_MACH_EZX_A1200
Antonio Ospite1ce2c512009-06-01 12:26:58 +0200904/* gpio_keys */
905static struct gpio_keys_button a1200_buttons[] = {
906 [0] = {
907 .code = SW_LID,
908 .gpio = GPIO15_A1200_FLIP_LID,
909 .active_low = 0,
910 .desc = "A1200 flip lid",
911 .type = EV_SW,
912 .wakeup = 1,
913 },
914};
915
916static struct gpio_keys_platform_data a1200_gpio_keys_platform_data = {
917 .buttons = a1200_buttons,
918 .nbuttons = ARRAY_SIZE(a1200_buttons),
919};
920
921static struct platform_device a1200_gpio_keys = {
922 .name = "gpio-keys",
923 .id = -1,
924 .dev = {
925 .platform_data = &a1200_gpio_keys_platform_data,
926 },
927};
928
Stefan Schmidtbc09cf62008-12-08 15:58:10 +0100929static struct i2c_board_info __initdata a1200_i2c_board_info[] = {
930 { I2C_BOARD_INFO("tea5767", 0x81) },
931};
932
Antonio Ospite1ce2c512009-06-01 12:26:58 +0200933static struct platform_device *a1200_devices[] __initdata = {
934 &a1200_gpio_keys,
935};
936
Stefan Schmidt9078ac22008-12-08 15:58:08 +0100937static void __init a1200_init(void)
938{
939 pxa2xx_mfp_config(ARRAY_AND_SIZE(ezx_pin_config));
940 pxa2xx_mfp_config(ARRAY_AND_SIZE(gen2_pin_config));
941 pxa2xx_mfp_config(ARRAY_AND_SIZE(a1200_pin_config));
942
Russell Kingcc155c62009-11-09 13:34:08 +0800943 pxa_set_ffuart_info(NULL);
944 pxa_set_btuart_info(NULL);
945 pxa_set_stuart_info(NULL);
946
Stefan Schmidt9078ac22008-12-08 15:58:08 +0100947 pxa_set_i2c_info(NULL);
Stefan Schmidtbc09cf62008-12-08 15:58:10 +0100948 i2c_register_board_info(0, ARRAY_AND_SIZE(a1200_i2c_board_info));
Stefan Schmidt9078ac22008-12-08 15:58:08 +0100949
Russell King - ARM Linux4321e1a2011-02-15 15:37:30 +0800950 pxa_set_fb_info(NULL, &ezx_fb_info_2);
Stefan Schmidt9078ac22008-12-08 15:58:08 +0100951
Stefan Schmidtfe9490c2008-12-08 15:58:09 +0100952 pxa_set_keypad_info(&a1200_keypad_platform_data);
953
Antonio Ospite1ce2c512009-06-01 12:26:58 +0200954 platform_add_devices(ARRAY_AND_SIZE(ezx_devices));
955 platform_add_devices(ARRAY_AND_SIZE(a1200_devices));
Stefan Schmidt9078ac22008-12-08 15:58:08 +0100956}
957
Stefan Schmidt9ab24e42008-07-09 08:08:17 +0100958MACHINE_START(EZX_A1200, "Motorola EZX A1200")
Nicolas Pitre7375aba2011-07-05 22:38:15 -0400959 .atag_offset = 0x100,
Marek Vasut851982c2010-10-11 02:20:19 +0200960 .map_io = pxa27x_map_io,
Haojian Zhuang6ac6b812010-08-20 15:23:59 +0800961 .nr_irqs = EZX_NR_IRQS,
Stefan Schmidt9ab24e42008-07-09 08:08:17 +0100962 .init_irq = pxa27x_init_irq,
Eric Miao8a97ae22011-05-18 21:30:04 +0800963 .handle_irq = pxa27x_handle_irq,
Stephen Warren6bb27d72012-11-08 12:40:59 -0700964 .init_time = pxa_timer_init,
Stefan Schmidt9078ac22008-12-08 15:58:08 +0100965 .init_machine = a1200_init,
Russell King271a74f2011-11-04 14:15:53 +0000966 .restart = pxa_restart,
Stefan Schmidt9ab24e42008-07-09 08:08:17 +0100967MACHINE_END
968#endif
969
970#ifdef CONFIG_MACH_EZX_A910
Antonio Ospite1ce2c512009-06-01 12:26:58 +0200971/* gpio_keys */
972static struct gpio_keys_button a910_buttons[] = {
973 [0] = {
974 .code = SW_LID,
975 .gpio = GPIO15_A910_FLIP_LID,
976 .active_low = 0,
977 .desc = "A910 flip lid",
978 .type = EV_SW,
979 .wakeup = 1,
980 },
981};
982
983static struct gpio_keys_platform_data a910_gpio_keys_platform_data = {
984 .buttons = a910_buttons,
985 .nbuttons = ARRAY_SIZE(a910_buttons),
986};
987
988static struct platform_device a910_gpio_keys = {
989 .name = "gpio-keys",
990 .id = -1,
991 .dev = {
992 .platform_data = &a910_gpio_keys_platform_data,
993 },
994};
995
Antonio Ospite405ac402009-11-12 15:47:04 +0100996/* camera */
997static int a910_camera_init(void)
998{
999 int err;
1000
1001 /*
1002 * GPIO50_nCAM_EN is active low
1003 * GPIO28_GEN2_CAM_RST is active on rising edge
1004 */
1005 err = gpio_request(GPIO50_nCAM_EN, "nCAM_EN");
1006 if (err) {
1007 pr_err("%s: Failed to request nCAM_EN\n", __func__);
1008 goto fail;
1009 }
1010
1011 err = gpio_request(GPIO28_GEN2_CAM_RST, "CAM_RST");
1012 if (err) {
1013 pr_err("%s: Failed to request CAM_RST\n", __func__);
1014 goto fail_gpio_cam_rst;
1015 }
1016
1017 gpio_direction_output(GPIO50_nCAM_EN, 1);
1018 gpio_direction_output(GPIO28_GEN2_CAM_RST, 0);
1019
1020 return 0;
1021
1022fail_gpio_cam_rst:
1023 gpio_free(GPIO50_nCAM_EN);
1024fail:
1025 return err;
1026}
1027
1028static int a910_camera_power(struct device *dev, int on)
1029{
1030 gpio_set_value(GPIO50_nCAM_EN, !on);
1031 return 0;
1032}
1033
1034static int a910_camera_reset(struct device *dev)
1035{
1036 gpio_set_value(GPIO28_GEN2_CAM_RST, 0);
1037 msleep(10);
1038 gpio_set_value(GPIO28_GEN2_CAM_RST, 1);
1039
1040 return 0;
1041}
1042
1043struct pxacamera_platform_data a910_pxacamera_platform_data = {
1044 .flags = PXA_CAMERA_MASTER | PXA_CAMERA_DATAWIDTH_8 |
1045 PXA_CAMERA_PCLK_EN | PXA_CAMERA_MCLK_EN,
1046 .mclk_10khz = 5000,
1047};
1048
1049static struct i2c_board_info a910_camera_i2c_board_info = {
1050 I2C_BOARD_INFO("mt9m111", 0x5d),
1051};
1052
1053static struct soc_camera_link a910_iclink = {
1054 .bus_id = 0,
1055 .i2c_adapter_id = 0,
1056 .board_info = &a910_camera_i2c_board_info,
Antonio Ospite405ac402009-11-12 15:47:04 +01001057 .power = a910_camera_power,
1058 .reset = a910_camera_reset,
1059};
1060
1061static struct platform_device a910_camera = {
1062 .name = "soc-camera-pdrv",
1063 .id = 0,
1064 .dev = {
1065 .platform_data = &a910_iclink,
1066 },
1067};
1068
Antonio Ospite87303b82009-11-03 17:45:33 +01001069/* leds-lp3944 */
1070static struct lp3944_platform_data a910_lp3944_leds = {
1071 .leds_size = LP3944_LEDS_MAX,
1072 .leds = {
1073 [0] = {
1074 .name = "a910:red:",
1075 .status = LP3944_LED_STATUS_OFF,
1076 .type = LP3944_LED_TYPE_LED,
1077 },
1078 [1] = {
1079 .name = "a910:green:",
1080 .status = LP3944_LED_STATUS_OFF,
1081 .type = LP3944_LED_TYPE_LED,
1082 },
1083 [2] {
1084 .name = "a910:blue:",
1085 .status = LP3944_LED_STATUS_OFF,
1086 .type = LP3944_LED_TYPE_LED,
1087 },
1088 /* Leds 3 and 4 are used as display power switches */
1089 [3] = {
1090 .name = "a910::cli_display",
1091 .status = LP3944_LED_STATUS_OFF,
1092 .type = LP3944_LED_TYPE_LED_INVERTED
1093 },
1094 [4] = {
1095 .name = "a910::main_display",
1096 .status = LP3944_LED_STATUS_ON,
1097 .type = LP3944_LED_TYPE_LED_INVERTED
1098 },
1099 [5] = { .type = LP3944_LED_TYPE_NONE },
1100 [6] = {
1101 .name = "a910::torch",
1102 .status = LP3944_LED_STATUS_OFF,
1103 .type = LP3944_LED_TYPE_LED,
1104 },
1105 [7] = {
1106 .name = "a910::flash",
1107 .status = LP3944_LED_STATUS_OFF,
1108 .type = LP3944_LED_TYPE_LED_INVERTED,
1109 },
1110 },
1111};
1112
1113static struct i2c_board_info __initdata a910_i2c_board_info[] = {
1114 {
1115 I2C_BOARD_INFO("lp3944", 0x60),
1116 .platform_data = &a910_lp3944_leds,
1117 },
1118};
1119
Antonio Ospite1ce2c512009-06-01 12:26:58 +02001120static struct platform_device *a910_devices[] __initdata = {
1121 &a910_gpio_keys,
1122};
1123
Stefan Schmidt9078ac22008-12-08 15:58:08 +01001124static void __init a910_init(void)
1125{
1126 pxa2xx_mfp_config(ARRAY_AND_SIZE(ezx_pin_config));
1127 pxa2xx_mfp_config(ARRAY_AND_SIZE(gen2_pin_config));
1128 pxa2xx_mfp_config(ARRAY_AND_SIZE(a910_pin_config));
1129
Russell Kingcc155c62009-11-09 13:34:08 +08001130 pxa_set_ffuart_info(NULL);
1131 pxa_set_btuart_info(NULL);
1132 pxa_set_stuart_info(NULL);
1133
Stefan Schmidt9078ac22008-12-08 15:58:08 +01001134 pxa_set_i2c_info(NULL);
Antonio Ospite87303b82009-11-03 17:45:33 +01001135 i2c_register_board_info(0, ARRAY_AND_SIZE(a910_i2c_board_info));
Stefan Schmidt9078ac22008-12-08 15:58:08 +01001136
Russell King - ARM Linux4321e1a2011-02-15 15:37:30 +08001137 pxa_set_fb_info(NULL, &ezx_fb_info_2);
Stefan Schmidt9078ac22008-12-08 15:58:08 +01001138
Stefan Schmidtfe9490c2008-12-08 15:58:09 +01001139 pxa_set_keypad_info(&a910_keypad_platform_data);
1140
Antonio Ospite405ac402009-11-12 15:47:04 +01001141 if (a910_camera_init() == 0) {
1142 pxa_set_camera_info(&a910_pxacamera_platform_data);
1143 platform_device_register(&a910_camera);
1144 }
1145
Antonio Ospite1ce2c512009-06-01 12:26:58 +02001146 platform_add_devices(ARRAY_AND_SIZE(ezx_devices));
1147 platform_add_devices(ARRAY_AND_SIZE(a910_devices));
Stefan Schmidt9078ac22008-12-08 15:58:08 +01001148}
1149
Stefan Schmidt9ab24e42008-07-09 08:08:17 +01001150MACHINE_START(EZX_A910, "Motorola EZX A910")
Nicolas Pitre7375aba2011-07-05 22:38:15 -04001151 .atag_offset = 0x100,
Marek Vasut851982c2010-10-11 02:20:19 +02001152 .map_io = pxa27x_map_io,
Haojian Zhuang6ac6b812010-08-20 15:23:59 +08001153 .nr_irqs = EZX_NR_IRQS,
Stefan Schmidt9ab24e42008-07-09 08:08:17 +01001154 .init_irq = pxa27x_init_irq,
Eric Miao8a97ae22011-05-18 21:30:04 +08001155 .handle_irq = pxa27x_handle_irq,
Stephen Warren6bb27d72012-11-08 12:40:59 -07001156 .init_time = pxa_timer_init,
Stefan Schmidt9078ac22008-12-08 15:58:08 +01001157 .init_machine = a910_init,
Russell King271a74f2011-11-04 14:15:53 +00001158 .restart = pxa_restart,
Stefan Schmidt9ab24e42008-07-09 08:08:17 +01001159MACHINE_END
1160#endif
1161
1162#ifdef CONFIG_MACH_EZX_E6
Antonio Ospite1ce2c512009-06-01 12:26:58 +02001163/* gpio_keys */
1164static struct gpio_keys_button e6_buttons[] = {
1165 [0] = {
1166 .code = KEY_SCREENLOCK,
1167 .gpio = GPIO15_E6_LOCK_SWITCH,
1168 .active_low = 0,
1169 .desc = "E6 lock switch",
1170 .type = EV_KEY,
1171 .wakeup = 1,
1172 },
1173};
1174
1175static struct gpio_keys_platform_data e6_gpio_keys_platform_data = {
1176 .buttons = e6_buttons,
1177 .nbuttons = ARRAY_SIZE(e6_buttons),
1178};
1179
1180static struct platform_device e6_gpio_keys = {
1181 .name = "gpio-keys",
1182 .id = -1,
1183 .dev = {
1184 .platform_data = &e6_gpio_keys_platform_data,
1185 },
1186};
1187
Stefan Schmidtbc09cf62008-12-08 15:58:10 +01001188static struct i2c_board_info __initdata e6_i2c_board_info[] = {
1189 { I2C_BOARD_INFO("tea5767", 0x81) },
1190};
1191
Antonio Ospite1ce2c512009-06-01 12:26:58 +02001192static struct platform_device *e6_devices[] __initdata = {
1193 &e6_gpio_keys,
1194};
1195
Stefan Schmidt9078ac22008-12-08 15:58:08 +01001196static void __init e6_init(void)
1197{
1198 pxa2xx_mfp_config(ARRAY_AND_SIZE(ezx_pin_config));
1199 pxa2xx_mfp_config(ARRAY_AND_SIZE(gen2_pin_config));
1200 pxa2xx_mfp_config(ARRAY_AND_SIZE(e6_pin_config));
1201
Russell Kingcc155c62009-11-09 13:34:08 +08001202 pxa_set_ffuart_info(NULL);
1203 pxa_set_btuart_info(NULL);
1204 pxa_set_stuart_info(NULL);
1205
Stefan Schmidt9078ac22008-12-08 15:58:08 +01001206 pxa_set_i2c_info(NULL);
Stefan Schmidtbc09cf62008-12-08 15:58:10 +01001207 i2c_register_board_info(0, ARRAY_AND_SIZE(e6_i2c_board_info));
Stefan Schmidt9078ac22008-12-08 15:58:08 +01001208
Russell King - ARM Linux4321e1a2011-02-15 15:37:30 +08001209 pxa_set_fb_info(NULL, &ezx_fb_info_2);
Stefan Schmidt9078ac22008-12-08 15:58:08 +01001210
Stefan Schmidtfe9490c2008-12-08 15:58:09 +01001211 pxa_set_keypad_info(&e6_keypad_platform_data);
1212
Antonio Ospite1ce2c512009-06-01 12:26:58 +02001213 platform_add_devices(ARRAY_AND_SIZE(ezx_devices));
1214 platform_add_devices(ARRAY_AND_SIZE(e6_devices));
Stefan Schmidt9078ac22008-12-08 15:58:08 +01001215}
1216
Stefan Schmidt9ab24e42008-07-09 08:08:17 +01001217MACHINE_START(EZX_E6, "Motorola EZX E6")
Nicolas Pitre7375aba2011-07-05 22:38:15 -04001218 .atag_offset = 0x100,
Marek Vasut851982c2010-10-11 02:20:19 +02001219 .map_io = pxa27x_map_io,
Haojian Zhuang6ac6b812010-08-20 15:23:59 +08001220 .nr_irqs = EZX_NR_IRQS,
Stefan Schmidt9ab24e42008-07-09 08:08:17 +01001221 .init_irq = pxa27x_init_irq,
Eric Miao8a97ae22011-05-18 21:30:04 +08001222 .handle_irq = pxa27x_handle_irq,
Stephen Warren6bb27d72012-11-08 12:40:59 -07001223 .init_time = pxa_timer_init,
Stefan Schmidt9078ac22008-12-08 15:58:08 +01001224 .init_machine = e6_init,
Russell King271a74f2011-11-04 14:15:53 +00001225 .restart = pxa_restart,
Stefan Schmidt9ab24e42008-07-09 08:08:17 +01001226MACHINE_END
1227#endif
1228
1229#ifdef CONFIG_MACH_EZX_E2
Stefan Schmidtbc09cf62008-12-08 15:58:10 +01001230static struct i2c_board_info __initdata e2_i2c_board_info[] = {
1231 { I2C_BOARD_INFO("tea5767", 0x81) },
1232};
1233
Antonio Ospite1ce2c512009-06-01 12:26:58 +02001234static struct platform_device *e2_devices[] __initdata = {
1235};
1236
Stefan Schmidt9078ac22008-12-08 15:58:08 +01001237static void __init e2_init(void)
1238{
1239 pxa2xx_mfp_config(ARRAY_AND_SIZE(ezx_pin_config));
1240 pxa2xx_mfp_config(ARRAY_AND_SIZE(gen2_pin_config));
1241 pxa2xx_mfp_config(ARRAY_AND_SIZE(e2_pin_config));
1242
Russell Kingcc155c62009-11-09 13:34:08 +08001243 pxa_set_ffuart_info(NULL);
1244 pxa_set_btuart_info(NULL);
1245 pxa_set_stuart_info(NULL);
1246
Stefan Schmidt9078ac22008-12-08 15:58:08 +01001247 pxa_set_i2c_info(NULL);
Stefan Schmidtbc09cf62008-12-08 15:58:10 +01001248 i2c_register_board_info(0, ARRAY_AND_SIZE(e2_i2c_board_info));
Stefan Schmidt9078ac22008-12-08 15:58:08 +01001249
Russell King - ARM Linux4321e1a2011-02-15 15:37:30 +08001250 pxa_set_fb_info(NULL, &ezx_fb_info_2);
Stefan Schmidt9078ac22008-12-08 15:58:08 +01001251
Stefan Schmidtfe9490c2008-12-08 15:58:09 +01001252 pxa_set_keypad_info(&e2_keypad_platform_data);
1253
Antonio Ospite1ce2c512009-06-01 12:26:58 +02001254 platform_add_devices(ARRAY_AND_SIZE(ezx_devices));
1255 platform_add_devices(ARRAY_AND_SIZE(e2_devices));
Stefan Schmidt9078ac22008-12-08 15:58:08 +01001256}
1257
Stefan Schmidt9ab24e42008-07-09 08:08:17 +01001258MACHINE_START(EZX_E2, "Motorola EZX E2")
Nicolas Pitre7375aba2011-07-05 22:38:15 -04001259 .atag_offset = 0x100,
Marek Vasut851982c2010-10-11 02:20:19 +02001260 .map_io = pxa27x_map_io,
Haojian Zhuang6ac6b812010-08-20 15:23:59 +08001261 .nr_irqs = EZX_NR_IRQS,
Stefan Schmidt9ab24e42008-07-09 08:08:17 +01001262 .init_irq = pxa27x_init_irq,
Eric Miao8a97ae22011-05-18 21:30:04 +08001263 .handle_irq = pxa27x_handle_irq,
Stephen Warren6bb27d72012-11-08 12:40:59 -07001264 .init_time = pxa_timer_init,
Stefan Schmidt9078ac22008-12-08 15:58:08 +01001265 .init_machine = e2_init,
Russell King271a74f2011-11-04 14:15:53 +00001266 .restart = pxa_restart,
Stefan Schmidt9ab24e42008-07-09 08:08:17 +01001267MACHINE_END
1268#endif