2 * linux/arch/arm/mach-pxa/tavorevb.c
4 * Support for the Marvell PXA930 Evaluation Board
6 * Copyright (C) 2007-2008 Marvell International Ltd.
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 * publishhed by the Free Software Foundation.
13 #include <linux/module.h>
14 #include <linux/kernel.h>
15 #include <linux/interrupt.h>
16 #include <linux/init.h>
17 #include <linux/platform_device.h>
18 #include <linux/clk.h>
19 #include <linux/gpio.h>
20 #include <linux/smc91x.h>
21 #include <linux/pwm.h>
22 #include <linux/pwm_backlight.h>
24 #include <asm/mach-types.h>
25 #include <asm/mach/arch.h>
27 #include <mach/pxa930.h>
28 #include <linux/platform_data/video-pxafb.h>
29 #include <linux/platform_data/keypad-pxa27x.h>
34 /* Tavor EVB MFP configurations */
35 static mfp_cfg_t tavorevb_mfp_cfg
[] __initdata
= {
57 GPIO43_PWM3
, /* primary backlight */
58 GPIO32_PWM0
, /* secondary backlight */
80 #define TAVOREVB_ETH_PHYS (0x14000000)
82 static struct resource smc91x_resources
[] = {
84 .start
= (TAVOREVB_ETH_PHYS
+ 0x300),
85 .end
= (TAVOREVB_ETH_PHYS
+ 0xfffff),
86 .flags
= IORESOURCE_MEM
,
89 .start
= PXA_GPIO_TO_IRQ(mfp_to_gpio(MFP_PIN_GPIO47
)),
90 .end
= PXA_GPIO_TO_IRQ(mfp_to_gpio(MFP_PIN_GPIO47
)),
91 .flags
= IORESOURCE_IRQ
| IORESOURCE_IRQ_HIGHEDGE
,
95 static struct smc91x_platdata tavorevb_smc91x_info
= {
96 .flags
= SMC91X_USE_16BIT
| SMC91X_NOWAIT
| SMC91X_USE_DMA
,
99 static struct platform_device smc91x_device
= {
102 .num_resources
= ARRAY_SIZE(smc91x_resources
),
103 .resource
= smc91x_resources
,
105 .platform_data
= &tavorevb_smc91x_info
,
109 #if defined(CONFIG_KEYBOARD_PXA27x) || defined(CONFIG_KEYBOARD_PXA27x_MODULE)
110 static const 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
),
119 KEY(6, 4, KEY_Y
), KEY(6, 5, KEY_Z
),
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
),
125 KEY(6, 6, KEY_SPACE
),
126 KEY(0, 0, KEY_KPASTERISK
), /* * */
127 KEY(0, 1, KEY_KPDOT
), /* # */
132 KEY(4, 2, KEY_RIGHT
),
135 KEY(6, 1, KEY_DELETE
),
137 KEY(6, 3, KEY_CAPSLOCK
), /* KEY_LEFTSHIFT), */
139 KEY(4, 4, KEY_ENTER
), /* scroll push */
140 KEY(6, 2, KEY_ENTER
), /* keypad action */
143 KEY(5, 3, KEY_RECORD
),
144 KEY(5, 0, KEY_VOLUMEUP
),
145 KEY(5, 1, KEY_VOLUMEDOWN
),
147 KEY(3, 0, KEY_F22
), /* soft1 */
148 KEY(3, 3, KEY_F23
), /* soft2 */
151 static struct matrix_keymap_data tavorevb_matrix_keymap_data
= {
152 .keymap
= tavorevb_matrix_key_map
,
153 .keymap_size
= ARRAY_SIZE(tavorevb_matrix_key_map
),
156 static struct pxa27x_keypad_platform_data tavorevb_keypad_info
= {
157 .matrix_key_rows
= 7,
158 .matrix_key_cols
= 7,
159 .matrix_keymap_data
= &tavorevb_matrix_keymap_data
,
160 .debounce_interval
= 30,
163 static void __init
tavorevb_init_keypad(void)
165 pxa_set_keypad_info(&tavorevb_keypad_info
);
168 static inline void tavorevb_init_keypad(void) {}
169 #endif /* CONFIG_KEYBOARD_PXA27x || CONFIG_KEYBOARD_PXA27x_MODULE */
171 #if defined(CONFIG_FB_PXA) || defined(CONFIG_FB_PXA_MODULE)
172 static struct pwm_lookup tavorevb_pwm_lookup
[] = {
173 PWM_LOOKUP("pxa27x-pwm.0", 1, "pwm-backlight.0", NULL
, 100000,
174 PWM_POLARITY_NORMAL
),
175 PWM_LOOKUP("pxa27x-pwm.0", 0, "pwm-backlight.1", NULL
, 100000,
176 PWM_POLARITY_NORMAL
),
179 static struct platform_pwm_backlight_data tavorevb_backlight_data
[] = {
181 /* primary backlight */
182 .max_brightness
= 100,
183 .dft_brightness
= 100,
187 /* secondary backlight */
188 .max_brightness
= 100,
189 .dft_brightness
= 100,
194 static struct platform_device tavorevb_backlight_devices
[] = {
196 .name
= "pwm-backlight",
199 .platform_data
= &tavorevb_backlight_data
[0],
203 .name
= "pwm-backlight",
206 .platform_data
= &tavorevb_backlight_data
[1],
211 static uint16_t panel_init
[] = {
232 /* P-ON Init sequence */
233 SMART_CMD(0x00), /* OSC ON */
238 SMART_CMD(0x01), /* SOURCE DRIVER SHIFT DIRECTION and display RAM setting */
242 SMART_CMD(0x02), /* LINE INV */
246 SMART_CMD(0x03), /* IF mode(1) */
247 SMART_DAT(0x01), /* 8bit smart mode(8-8),high speed write mode */
250 SMART_CMD(0x00), /* RAM Write Mode */
255 /* DISPLAY Setting, 262K, fixed(NO scroll), no split screen */
257 SMART_DAT(0x40), /* 16/18/19 BPP */
260 SMART_CMD(0x08), /* BP, FP Seting, BP=2H, FP=3H */
264 SMART_CMD(0x0C), /* IF mode(2), using internal clock & MPU */
268 SMART_CMD(0x0D), /* Frame setting, 1Min. Frequence, 16CLK */
272 SMART_CMD(0x12), /* Timing(1),ASW W=4CLK, ASW ST=1CLK */
276 SMART_CMD(0x13), /* Timing(2),OEV ST=0.5CLK, OEV ED=1CLK */
280 SMART_CMD(0x14), /* Timing(3), ASW HOLD=0.5CLK */
284 SMART_CMD(0x15), /* Timing(4), CKV ST=0CLK, CKV ED=1CLK */
325 /* DISP RAM setting: 240*320 */
326 SMART_CMD(0x04), /* HADDR, START 0 */
329 SMART_DAT(0x00), /* x1,3 */
330 SMART_CMD(0x04), /* HADDR, END 4 */
333 SMART_DAT(0xEF), /* x2, 7 */
334 SMART_CMD(0x04), /* VADDR, START 8 */
336 SMART_DAT(0x00), /* y1, 10 */
337 SMART_DAT(0x00), /* y1, 11 */
338 SMART_CMD(0x04), /* VADDR, END 12 */
340 SMART_DAT(0x01), /* y2, 14 */
341 SMART_DAT(0x3F), /* y2, 15 */
342 SMART_CMD(0x02), /* RAM ADDR SETTING 16 */
345 SMART_DAT(0x00), /* x1, 19 */
346 SMART_CMD(0x02), /* RAM ADDR SETTING 20 */
348 SMART_DAT(0x00), /* y1, 22 */
349 SMART_DAT(0x00), /* y1, 23 */
352 static uint16_t panel_on
[] = {
388 static uint16_t panel_off
[] = {
419 static uint16_t update_framedata
[] = {
424 /* write frame data */
425 SMART_CMD_WRITE_FRAME
,
428 static void ltm020d550_lcd_power(int on
, struct fb_var_screeninfo
*var
)
430 struct fb_info
*info
= container_of(var
, struct fb_info
, var
);
433 pxafb_smart_queue(info
, ARRAY_AND_SIZE(panel_init
));
434 pxafb_smart_queue(info
, ARRAY_AND_SIZE(panel_on
));
436 pxafb_smart_queue(info
, ARRAY_AND_SIZE(panel_off
));
439 if (pxafb_smart_flush(info
))
440 pr_err("%s: timed out\n", __func__
);
443 static void ltm020d550_update(struct fb_info
*info
)
445 pxafb_smart_queue(info
, ARRAY_AND_SIZE(update_framedata
));
446 pxafb_smart_flush(info
);
449 static struct pxafb_mode_info toshiba_ltm020d550_modes
[] = {
454 .a0csrd_set_hld
= 30,
455 .a0cswr_set_hld
= 30,
456 .wr_pulse_width
= 30,
457 .rd_pulse_width
= 170,
461 /* L_LCLK_A0 and L_LCLK_RD active low */
462 .sync
= FB_SYNC_HOR_HIGH_ACT
|
463 FB_SYNC_VERT_HIGH_ACT
,
467 static struct pxafb_mach_info tavorevb_lcd_info
= {
468 .modes
= toshiba_ltm020d550_modes
,
470 .lcd_conn
= LCD_SMART_PANEL_8BPP
| LCD_PCLK_EDGE_FALL
,
471 .pxafb_lcd_power
= ltm020d550_lcd_power
,
472 .smart_update
= ltm020d550_update
,
475 static void __init
tavorevb_init_lcd(void)
477 pwm_add_table(tavorevb_pwm_lookup
, ARRAY_SIZE(tavorevb_pwm_lookup
));
478 platform_device_register(&tavorevb_backlight_devices
[0]);
479 platform_device_register(&tavorevb_backlight_devices
[1]);
480 pxa_set_fb_info(NULL
, &tavorevb_lcd_info
);
483 static inline void tavorevb_init_lcd(void) {}
484 #endif /* CONFIG_FB_PXA || CONFIG_FB_PXA_MODULE */
486 static void __init
tavorevb_init(void)
488 /* initialize MFP configurations */
489 pxa3xx_mfp_config(ARRAY_AND_SIZE(tavorevb_mfp_cfg
));
491 pxa_set_ffuart_info(NULL
);
492 pxa_set_btuart_info(NULL
);
493 pxa_set_stuart_info(NULL
);
495 platform_device_register(&smc91x_device
);
498 tavorevb_init_keypad();
501 MACHINE_START(TAVOREVB
, "PXA930 Evaluation Board (aka TavorEVB)")
502 /* Maintainer: Eric Miao <eric.miao@marvell.com> */
503 .atag_offset
= 0x100,
504 .map_io
= pxa3xx_map_io
,
505 .nr_irqs
= PXA_NR_IRQS
,
506 .init_irq
= pxa3xx_init_irq
,
507 .handle_irq
= pxa3xx_handle_irq
,
508 .init_time
= pxa_timer_init
,
509 .init_machine
= tavorevb_init
,
510 .restart
= pxa_restart
,