diff options
Diffstat (limited to 'arch/arm/mach-pxa/tavorevb.c')
-rw-r--r-- | arch/arm/mach-pxa/tavorevb.c | 412 |
1 files changed, 412 insertions, 0 deletions
diff --git a/arch/arm/mach-pxa/tavorevb.c b/arch/arm/mach-pxa/tavorevb.c index 589d32b4fc46..58ef08a5224b 100644 --- a/arch/arm/mach-pxa/tavorevb.c +++ b/arch/arm/mach-pxa/tavorevb.c | |||
@@ -18,12 +18,15 @@ | |||
18 | #include <linux/clk.h> | 18 | #include <linux/clk.h> |
19 | #include <linux/gpio.h> | 19 | #include <linux/gpio.h> |
20 | #include <linux/smc91x.h> | 20 | #include <linux/smc91x.h> |
21 | #include <linux/pwm_backlight.h> | ||
21 | 22 | ||
22 | #include <asm/mach-types.h> | 23 | #include <asm/mach-types.h> |
23 | #include <asm/mach/arch.h> | 24 | #include <asm/mach/arch.h> |
24 | #include <mach/hardware.h> | 25 | #include <mach/hardware.h> |
25 | #include <mach/pxa3xx-regs.h> | 26 | #include <mach/pxa3xx-regs.h> |
26 | #include <mach/mfp-pxa930.h> | 27 | #include <mach/mfp-pxa930.h> |
28 | #include <mach/pxafb.h> | ||
29 | #include <mach/pxa27x_keypad.h> | ||
27 | 30 | ||
28 | #include "devices.h" | 31 | #include "devices.h" |
29 | #include "generic.h" | 32 | #include "generic.h" |
@@ -33,6 +36,45 @@ static mfp_cfg_t tavorevb_mfp_cfg[] __initdata = { | |||
33 | /* Ethernet */ | 36 | /* Ethernet */ |
34 | DF_nCS1_nCS3, | 37 | DF_nCS1_nCS3, |
35 | GPIO47_GPIO, | 38 | GPIO47_GPIO, |
39 | |||
40 | /* LCD */ | ||
41 | GPIO23_LCD_DD0, | ||
42 | GPIO24_LCD_DD1, | ||
43 | GPIO25_LCD_DD2, | ||
44 | GPIO26_LCD_DD3, | ||
45 | GPIO27_LCD_DD4, | ||
46 | GPIO28_LCD_DD5, | ||
47 | GPIO29_LCD_DD6, | ||
48 | GPIO44_LCD_DD7, | ||
49 | GPIO21_LCD_CS, | ||
50 | GPIO22_LCD_CS2, | ||
51 | |||
52 | GPIO17_LCD_FCLK_RD, | ||
53 | GPIO18_LCD_LCLK_A0, | ||
54 | GPIO19_LCD_PCLK_WR, | ||
55 | |||
56 | /* LCD Backlight */ | ||
57 | GPIO43_PWM3, /* primary backlight */ | ||
58 | GPIO32_PWM0, /* secondary backlight */ | ||
59 | |||
60 | /* Keypad */ | ||
61 | GPIO0_KP_MKIN_0, | ||
62 | GPIO2_KP_MKIN_1, | ||
63 | GPIO4_KP_MKIN_2, | ||
64 | GPIO6_KP_MKIN_3, | ||
65 | GPIO8_KP_MKIN_4, | ||
66 | GPIO10_KP_MKIN_5, | ||
67 | GPIO12_KP_MKIN_6, | ||
68 | GPIO1_KP_MKOUT_0, | ||
69 | GPIO3_KP_MKOUT_1, | ||
70 | GPIO5_KP_MKOUT_2, | ||
71 | GPIO7_KP_MKOUT_3, | ||
72 | GPIO9_KP_MKOUT_4, | ||
73 | GPIO11_KP_MKOUT_5, | ||
74 | GPIO13_KP_MKOUT_6, | ||
75 | |||
76 | GPIO14_KP_DKIN_2, | ||
77 | GPIO15_KP_DKIN_3, | ||
36 | }; | 78 | }; |
37 | 79 | ||
38 | #define TAVOREVB_ETH_PHYS (0x14000000) | 80 | #define TAVOREVB_ETH_PHYS (0x14000000) |
@@ -64,12 +106,382 @@ static struct platform_device smc91x_device = { | |||
64 | }, | 106 | }, |
65 | }; | 107 | }; |
66 | 108 | ||
109 | #if defined(CONFIG_KEYBOARD_PXA27x) || defined(CONFIG_KEYBOARD_PXA27x_MODULE) | ||
110 | static unsigned int tavorevb_matrix_key_map[] = { | ||
111 | /* KEY(row, col, key_code) */ | ||
112 | KEY(0, 4, KEY_A), KEY(0, 5, KEY_B), KEY(0, 6, KEY_C), | ||
113 | KEY(1, 4, KEY_E), KEY(1, 5, KEY_F), KEY(1, 6, KEY_G), | ||
114 | KEY(2, 4, KEY_I), KEY(2, 5, KEY_J), KEY(2, 6, KEY_K), | ||
115 | KEY(3, 4, KEY_M), KEY(3, 5, KEY_N), KEY(3, 6, KEY_O), | ||
116 | KEY(4, 5, KEY_R), KEY(4, 6, KEY_S), | ||
117 | KEY(5, 4, KEY_U), KEY(5, 4, KEY_V), KEY(5, 6, KEY_W), | ||
118 | |||
119 | KEY(6, 4, KEY_Y), KEY(6, 5, KEY_Z), | ||
120 | |||
121 | KEY(0, 3, KEY_0), KEY(2, 0, KEY_1), KEY(2, 1, KEY_2), KEY(2, 2, KEY_3), | ||
122 | KEY(2, 3, KEY_4), KEY(1, 0, KEY_5), KEY(1, 1, KEY_6), KEY(1, 2, KEY_7), | ||
123 | KEY(1, 3, KEY_8), KEY(0, 2, KEY_9), | ||
124 | |||
125 | KEY(6, 6, KEY_SPACE), | ||
126 | KEY(0, 0, KEY_KPASTERISK), /* * */ | ||
127 | KEY(0, 1, KEY_KPDOT), /* # */ | ||
128 | |||
129 | KEY(4, 1, KEY_UP), | ||
130 | KEY(4, 3, KEY_DOWN), | ||
131 | KEY(4, 0, KEY_LEFT), | ||
132 | KEY(4, 2, KEY_RIGHT), | ||
133 | KEY(6, 0, KEY_HOME), | ||
134 | KEY(3, 2, KEY_END), | ||
135 | KEY(6, 1, KEY_DELETE), | ||
136 | KEY(5, 2, KEY_BACK), | ||
137 | KEY(6, 3, KEY_CAPSLOCK), /* KEY_LEFTSHIFT), */ | ||
138 | |||
139 | KEY(4, 4, KEY_ENTER), /* scroll push */ | ||
140 | KEY(6, 2, KEY_ENTER), /* keypad action */ | ||
141 | |||
142 | KEY(3, 1, KEY_SEND), | ||
143 | KEY(5, 3, KEY_RECORD), | ||
144 | KEY(5, 0, KEY_VOLUMEUP), | ||
145 | KEY(5, 1, KEY_VOLUMEDOWN), | ||
146 | |||
147 | KEY(3, 0, KEY_F22), /* soft1 */ | ||
148 | KEY(3, 3, KEY_F23), /* soft2 */ | ||
149 | }; | ||
150 | |||
151 | static struct pxa27x_keypad_platform_data tavorevb_keypad_info = { | ||
152 | .matrix_key_rows = 7, | ||
153 | .matrix_key_cols = 7, | ||
154 | .matrix_key_map = tavorevb_matrix_key_map, | ||
155 | .matrix_key_map_size = ARRAY_SIZE(tavorevb_matrix_key_map), | ||
156 | .debounce_interval = 30, | ||
157 | }; | ||
158 | |||
159 | static void __init tavorevb_init_keypad(void) | ||
160 | { | ||
161 | pxa_set_keypad_info(&tavorevb_keypad_info); | ||
162 | } | ||
163 | #else | ||
164 | static inline void tavorevb_init_keypad(void) {} | ||
165 | #endif /* CONFIG_KEYBOARD_PXA27x || CONFIG_KEYBOARD_PXA27x_MODULE */ | ||
166 | |||
167 | #if defined(CONFIG_FB_PXA) || defined(CONFIG_FB_PXA_MODULE) | ||
168 | static struct platform_pwm_backlight_data tavorevb_backlight_data[] = { | ||
169 | [0] = { | ||
170 | /* primary backlight */ | ||
171 | .pwm_id = 2, | ||
172 | .max_brightness = 100, | ||
173 | .dft_brightness = 100, | ||
174 | .pwm_period_ns = 100000, | ||
175 | }, | ||
176 | [1] = { | ||
177 | /* secondary backlight */ | ||
178 | .pwm_id = 0, | ||
179 | .max_brightness = 100, | ||
180 | .dft_brightness = 100, | ||
181 | .pwm_period_ns = 100000, | ||
182 | }, | ||
183 | }; | ||
184 | |||
185 | static struct platform_device tavorevb_backlight_devices[] = { | ||
186 | [0] = { | ||
187 | .name = "pwm-backlight", | ||
188 | .id = 0, | ||
189 | .dev = { | ||
190 | .platform_data = &tavorevb_backlight_data[0], | ||
191 | }, | ||
192 | }, | ||
193 | [1] = { | ||
194 | .name = "pwm-backlight", | ||
195 | .id = 1, | ||
196 | .dev = { | ||
197 | .platform_data = &tavorevb_backlight_data[1], | ||
198 | }, | ||
199 | }, | ||
200 | }; | ||
201 | |||
202 | static uint16_t panel_init[] = { | ||
203 | /* DSTB OUT */ | ||
204 | SMART_CMD(0x00), | ||
205 | SMART_CMD_NOOP, | ||
206 | SMART_DELAY(1), | ||
207 | |||
208 | SMART_CMD(0x00), | ||
209 | SMART_CMD_NOOP, | ||
210 | SMART_DELAY(1), | ||
211 | |||
212 | SMART_CMD(0x00), | ||
213 | SMART_CMD_NOOP, | ||
214 | SMART_DELAY(1), | ||
215 | |||
216 | /* STB OUT */ | ||
217 | SMART_CMD(0x00), | ||
218 | SMART_CMD(0x1D), | ||
219 | SMART_DAT(0x00), | ||
220 | SMART_DAT(0x05), | ||
221 | SMART_DELAY(1), | ||
222 | |||
223 | /* P-ON Init sequence */ | ||
224 | SMART_CMD(0x00), /* OSC ON */ | ||
225 | SMART_CMD(0x00), | ||
226 | SMART_DAT(0x00), | ||
227 | SMART_DAT(0x01), | ||
228 | SMART_CMD(0x00), | ||
229 | SMART_CMD(0x01), /* SOURCE DRIVER SHIFT DIRECTION and display RAM setting */ | ||
230 | SMART_DAT(0x01), | ||
231 | SMART_DAT(0x27), | ||
232 | SMART_CMD(0x00), | ||
233 | SMART_CMD(0x02), /* LINE INV */ | ||
234 | SMART_DAT(0x02), | ||
235 | SMART_DAT(0x00), | ||
236 | SMART_CMD(0x00), | ||
237 | SMART_CMD(0x03), /* IF mode(1) */ | ||
238 | SMART_DAT(0x01), /* 8bit smart mode(8-8),high speed write mode */ | ||
239 | SMART_DAT(0x30), | ||
240 | SMART_CMD(0x07), | ||
241 | SMART_CMD(0x00), /* RAM Write Mode */ | ||
242 | SMART_DAT(0x00), | ||
243 | SMART_DAT(0x03), | ||
244 | SMART_CMD(0x00), | ||
245 | |||
246 | /* DISPLAY Setting, 262K, fixed(NO scroll), no split screen */ | ||
247 | SMART_CMD(0x07), | ||
248 | SMART_DAT(0x40), /* 16/18/19 BPP */ | ||
249 | SMART_DAT(0x00), | ||
250 | SMART_CMD(0x00), | ||
251 | SMART_CMD(0x08), /* BP, FP Seting, BP=2H, FP=3H */ | ||
252 | SMART_DAT(0x03), | ||
253 | SMART_DAT(0x02), | ||
254 | SMART_CMD(0x00), | ||
255 | SMART_CMD(0x0C), /* IF mode(2), using internal clock & MPU */ | ||
256 | SMART_DAT(0x00), | ||
257 | SMART_DAT(0x00), | ||
258 | SMART_CMD(0x00), | ||
259 | SMART_CMD(0x0D), /* Frame setting, 1Min. Frequence, 16CLK */ | ||
260 | SMART_DAT(0x00), | ||
261 | SMART_DAT(0x10), | ||
262 | SMART_CMD(0x00), | ||
263 | SMART_CMD(0x12), /* Timing(1),ASW W=4CLK, ASW ST=1CLK */ | ||
264 | SMART_DAT(0x03), | ||
265 | SMART_DAT(0x02), | ||
266 | SMART_CMD(0x00), | ||
267 | SMART_CMD(0x13), /* Timing(2),OEV ST=0.5CLK, OEV ED=1CLK */ | ||
268 | SMART_DAT(0x01), | ||
269 | SMART_DAT(0x02), | ||
270 | SMART_CMD(0x00), | ||
271 | SMART_CMD(0x14), /* Timing(3), ASW HOLD=0.5CLK */ | ||
272 | SMART_DAT(0x00), | ||
273 | SMART_DAT(0x00), | ||
274 | SMART_CMD(0x00), | ||
275 | SMART_CMD(0x15), /* Timing(4), CKV ST=0CLK, CKV ED=1CLK */ | ||
276 | SMART_DAT(0x20), | ||
277 | SMART_DAT(0x00), | ||
278 | SMART_CMD(0x00), | ||
279 | SMART_CMD(0x1C), | ||
280 | SMART_DAT(0x00), | ||
281 | SMART_DAT(0x00), | ||
282 | SMART_CMD(0x03), | ||
283 | SMART_CMD(0x00), | ||
284 | SMART_DAT(0x04), | ||
285 | SMART_DAT(0x03), | ||
286 | SMART_CMD(0x03), | ||
287 | SMART_CMD(0x01), | ||
288 | SMART_DAT(0x03), | ||
289 | SMART_DAT(0x04), | ||
290 | SMART_CMD(0x03), | ||
291 | SMART_CMD(0x02), | ||
292 | SMART_DAT(0x04), | ||
293 | SMART_DAT(0x03), | ||
294 | SMART_CMD(0x03), | ||
295 | SMART_CMD(0x03), | ||
296 | SMART_DAT(0x03), | ||
297 | SMART_DAT(0x03), | ||
298 | SMART_CMD(0x03), | ||
299 | SMART_CMD(0x04), | ||
300 | SMART_DAT(0x01), | ||
301 | SMART_DAT(0x01), | ||
302 | SMART_CMD(0x03), | ||
303 | SMART_CMD(0x05), | ||
304 | SMART_DAT(0x00), | ||
305 | SMART_DAT(0x00), | ||
306 | SMART_CMD(0x04), | ||
307 | SMART_CMD(0x02), | ||
308 | SMART_DAT(0x00), | ||
309 | SMART_DAT(0x00), | ||
310 | SMART_CMD(0x04), | ||
311 | SMART_CMD(0x03), | ||
312 | SMART_DAT(0x01), | ||
313 | SMART_DAT(0x3F), | ||
314 | SMART_DELAY(0), | ||
315 | |||
316 | /* DISP RAM setting: 240*320 */ | ||
317 | SMART_CMD(0x04), /* HADDR, START 0 */ | ||
318 | SMART_CMD(0x06), | ||
319 | SMART_DAT(0x00), | ||
320 | SMART_DAT(0x00), /* x1,3 */ | ||
321 | SMART_CMD(0x04), /* HADDR, END 4 */ | ||
322 | SMART_CMD(0x07), | ||
323 | SMART_DAT(0x00), | ||
324 | SMART_DAT(0xEF), /* x2, 7 */ | ||
325 | SMART_CMD(0x04), /* VADDR, START 8 */ | ||
326 | SMART_CMD(0x08), | ||
327 | SMART_DAT(0x00), /* y1, 10 */ | ||
328 | SMART_DAT(0x00), /* y1, 11 */ | ||
329 | SMART_CMD(0x04), /* VADDR, END 12 */ | ||
330 | SMART_CMD(0x09), | ||
331 | SMART_DAT(0x01), /* y2, 14 */ | ||
332 | SMART_DAT(0x3F), /* y2, 15 */ | ||
333 | SMART_CMD(0x02), /* RAM ADDR SETTING 16 */ | ||
334 | SMART_CMD(0x00), | ||
335 | SMART_DAT(0x00), | ||
336 | SMART_DAT(0x00), /* x1, 19 */ | ||
337 | SMART_CMD(0x02), /* RAM ADDR SETTING 20 */ | ||
338 | SMART_CMD(0x01), | ||
339 | SMART_DAT(0x00), /* y1, 22 */ | ||
340 | SMART_DAT(0x00), /* y1, 23 */ | ||
341 | }; | ||
342 | |||
343 | static uint16_t panel_on[] = { | ||
344 | /* Power-IC ON */ | ||
345 | SMART_CMD(0x01), | ||
346 | SMART_CMD(0x02), | ||
347 | SMART_DAT(0x07), | ||
348 | SMART_DAT(0x7D), | ||
349 | SMART_CMD(0x01), | ||
350 | SMART_CMD(0x03), | ||
351 | SMART_DAT(0x00), | ||
352 | SMART_DAT(0x05), | ||
353 | SMART_CMD(0x01), | ||
354 | SMART_CMD(0x04), | ||
355 | SMART_DAT(0x00), | ||
356 | SMART_DAT(0x00), | ||
357 | SMART_CMD(0x01), | ||
358 | SMART_CMD(0x05), | ||
359 | SMART_DAT(0x00), | ||
360 | SMART_DAT(0x15), | ||
361 | SMART_CMD(0x01), | ||
362 | SMART_CMD(0x00), | ||
363 | SMART_DAT(0xC0), | ||
364 | SMART_DAT(0x10), | ||
365 | SMART_DELAY(30), | ||
366 | |||
367 | /* DISP ON */ | ||
368 | SMART_CMD(0x01), | ||
369 | SMART_CMD(0x01), | ||
370 | SMART_DAT(0x00), | ||
371 | SMART_DAT(0x01), | ||
372 | SMART_CMD(0x01), | ||
373 | SMART_CMD(0x00), | ||
374 | SMART_DAT(0xFF), | ||
375 | SMART_DAT(0xFE), | ||
376 | SMART_DELAY(150), | ||
377 | }; | ||
378 | |||
379 | static uint16_t panel_off[] = { | ||
380 | SMART_CMD(0x00), | ||
381 | SMART_CMD(0x1E), | ||
382 | SMART_DAT(0x00), | ||
383 | SMART_DAT(0x0A), | ||
384 | SMART_CMD(0x01), | ||
385 | SMART_CMD(0x00), | ||
386 | SMART_DAT(0xFF), | ||
387 | SMART_DAT(0xEE), | ||
388 | SMART_CMD(0x01), | ||
389 | SMART_CMD(0x00), | ||
390 | SMART_DAT(0xF8), | ||
391 | SMART_DAT(0x12), | ||
392 | SMART_CMD(0x01), | ||
393 | SMART_CMD(0x00), | ||
394 | SMART_DAT(0xE8), | ||
395 | SMART_DAT(0x11), | ||
396 | SMART_CMD(0x01), | ||
397 | SMART_CMD(0x00), | ||
398 | SMART_DAT(0xC0), | ||
399 | SMART_DAT(0x11), | ||
400 | SMART_CMD(0x01), | ||
401 | SMART_CMD(0x00), | ||
402 | SMART_DAT(0x40), | ||
403 | SMART_DAT(0x11), | ||
404 | SMART_CMD(0x01), | ||
405 | SMART_CMD(0x00), | ||
406 | SMART_DAT(0x00), | ||
407 | SMART_DAT(0x10), | ||
408 | }; | ||
409 | |||
410 | static uint16_t update_framedata[] = { | ||
411 | /* write ram */ | ||
412 | SMART_CMD(0x02), | ||
413 | SMART_CMD(0x02), | ||
414 | |||
415 | /* write frame data */ | ||
416 | SMART_CMD_WRITE_FRAME, | ||
417 | }; | ||
418 | |||
419 | static void ltm020d550_lcd_power(int on, struct fb_var_screeninfo *var) | ||
420 | { | ||
421 | struct fb_info *info = container_of(var, struct fb_info, var); | ||
422 | |||
423 | if (on) { | ||
424 | pxafb_smart_queue(info, ARRAY_AND_SIZE(panel_init)); | ||
425 | pxafb_smart_queue(info, ARRAY_AND_SIZE(panel_on)); | ||
426 | } else { | ||
427 | pxafb_smart_queue(info, ARRAY_AND_SIZE(panel_off)); | ||
428 | } | ||
429 | |||
430 | if (pxafb_smart_flush(info)) | ||
431 | pr_err("%s: timed out\n", __func__); | ||
432 | } | ||
433 | |||
434 | static void ltm020d550_update(struct fb_info *info) | ||
435 | { | ||
436 | pxafb_smart_queue(info, ARRAY_AND_SIZE(update_framedata)); | ||
437 | pxafb_smart_flush(info); | ||
438 | } | ||
439 | |||
440 | static struct pxafb_mode_info toshiba_ltm020d550_modes[] = { | ||
441 | [0] = { | ||
442 | .xres = 240, | ||
443 | .yres = 320, | ||
444 | .bpp = 16, | ||
445 | .a0csrd_set_hld = 30, | ||
446 | .a0cswr_set_hld = 30, | ||
447 | .wr_pulse_width = 30, | ||
448 | .rd_pulse_width = 170, | ||
449 | .op_hold_time = 30, | ||
450 | .cmd_inh_time = 60, | ||
451 | |||
452 | /* L_LCLK_A0 and L_LCLK_RD active low */ | ||
453 | .sync = FB_SYNC_HOR_HIGH_ACT | | ||
454 | FB_SYNC_VERT_HIGH_ACT, | ||
455 | }, | ||
456 | }; | ||
457 | |||
458 | static struct pxafb_mach_info tavorevb_lcd_info = { | ||
459 | .modes = toshiba_ltm020d550_modes, | ||
460 | .num_modes = 1, | ||
461 | .lcd_conn = LCD_SMART_PANEL_8BPP | LCD_PCLK_EDGE_FALL, | ||
462 | .pxafb_lcd_power = ltm020d550_lcd_power, | ||
463 | .smart_update = ltm020d550_update, | ||
464 | }; | ||
465 | |||
466 | static void __init tavorevb_init_lcd(void) | ||
467 | { | ||
468 | platform_device_register(&tavorevb_backlight_devices[0]); | ||
469 | platform_device_register(&tavorevb_backlight_devices[1]); | ||
470 | set_pxa_fb_info(&tavorevb_lcd_info); | ||
471 | } | ||
472 | #else | ||
473 | static inline void tavorevb_init_lcd(void) {} | ||
474 | #endif /* CONFIG_FB_PXA || CONFIG_FB_PXA_MODULE */ | ||
475 | |||
67 | static void __init tavorevb_init(void) | 476 | static void __init tavorevb_init(void) |
68 | { | 477 | { |
69 | /* initialize MFP configurations */ | 478 | /* initialize MFP configurations */ |
70 | pxa3xx_mfp_config(ARRAY_AND_SIZE(tavorevb_mfp_cfg)); | 479 | pxa3xx_mfp_config(ARRAY_AND_SIZE(tavorevb_mfp_cfg)); |
71 | 480 | ||
72 | platform_device_register(&smc91x_device); | 481 | platform_device_register(&smc91x_device); |
482 | |||
483 | tavorevb_init_lcd(); | ||
484 | tavorevb_init_keypad(); | ||
73 | } | 485 | } |
74 | 486 | ||
75 | MACHINE_START(TAVOREVB, "PXA930 Evaluation Board (aka TavorEVB)") | 487 | MACHINE_START(TAVOREVB, "PXA930 Evaluation Board (aka TavorEVB)") |