1 // SPDX-License-Identifier: GPL-2.0-only
3 * linux/arch/arm/mach-pxa/tavorevb.c
5 * Support for the Marvell PXA930 Evaluation Board
7 * Copyright (C) 2007-2008 Marvell International Ltd.
10 #include <linux/module.h>
11 #include <linux/kernel.h>
12 #include <linux/interrupt.h>
13 #include <linux/init.h>
14 #include <linux/platform_device.h>
15 #include <linux/clk.h>
16 #include <linux/gpio.h>
17 #include <linux/smc91x.h>
18 #include <linux/pwm.h>
19 #include <linux/pwm_backlight.h>
21 #include <asm/mach-types.h>
22 #include <asm/mach/arch.h>
25 #include <linux/platform_data/video-pxafb.h>
26 #include <linux/platform_data/keypad-pxa27x.h>
31 /* Tavor EVB MFP configurations */
32 static mfp_cfg_t tavorevb_mfp_cfg
[] __initdata
= {
54 GPIO43_PWM3
, /* primary backlight */
55 GPIO32_PWM0
, /* secondary backlight */
77 #define TAVOREVB_ETH_PHYS (0x14000000)
79 static struct resource smc91x_resources
[] = {
81 .start
= (TAVOREVB_ETH_PHYS
+ 0x300),
82 .end
= (TAVOREVB_ETH_PHYS
+ 0xfffff),
83 .flags
= IORESOURCE_MEM
,
86 .start
= PXA_GPIO_TO_IRQ(mfp_to_gpio(MFP_PIN_GPIO47
)),
87 .end
= PXA_GPIO_TO_IRQ(mfp_to_gpio(MFP_PIN_GPIO47
)),
88 .flags
= IORESOURCE_IRQ
| IORESOURCE_IRQ_HIGHEDGE
,
92 static struct smc91x_platdata tavorevb_smc91x_info
= {
93 .flags
= SMC91X_USE_16BIT
| SMC91X_NOWAIT
| SMC91X_USE_DMA
,
96 static struct platform_device smc91x_device
= {
99 .num_resources
= ARRAY_SIZE(smc91x_resources
),
100 .resource
= smc91x_resources
,
102 .platform_data
= &tavorevb_smc91x_info
,
106 #if defined(CONFIG_KEYBOARD_PXA27x) || defined(CONFIG_KEYBOARD_PXA27x_MODULE)
107 static const unsigned int tavorevb_matrix_key_map
[] = {
108 /* KEY(row, col, key_code) */
109 KEY(0, 4, KEY_A
), KEY(0, 5, KEY_B
), KEY(0, 6, KEY_C
),
110 KEY(1, 4, KEY_E
), KEY(1, 5, KEY_F
), KEY(1, 6, KEY_G
),
111 KEY(2, 4, KEY_I
), KEY(2, 5, KEY_J
), KEY(2, 6, KEY_K
),
112 KEY(3, 4, KEY_M
), KEY(3, 5, KEY_N
), KEY(3, 6, KEY_O
),
113 KEY(4, 5, KEY_R
), KEY(4, 6, KEY_S
),
114 KEY(5, 4, KEY_U
), KEY(5, 4, KEY_V
), KEY(5, 6, KEY_W
),
116 KEY(6, 4, KEY_Y
), KEY(6, 5, KEY_Z
),
118 KEY(0, 3, KEY_0
), KEY(2, 0, KEY_1
), KEY(2, 1, KEY_2
), KEY(2, 2, KEY_3
),
119 KEY(2, 3, KEY_4
), KEY(1, 0, KEY_5
), KEY(1, 1, KEY_6
), KEY(1, 2, KEY_7
),
120 KEY(1, 3, KEY_8
), KEY(0, 2, KEY_9
),
122 KEY(6, 6, KEY_SPACE
),
123 KEY(0, 0, KEY_KPASTERISK
), /* * */
124 KEY(0, 1, KEY_KPDOT
), /* # */
129 KEY(4, 2, KEY_RIGHT
),
132 KEY(6, 1, KEY_DELETE
),
134 KEY(6, 3, KEY_CAPSLOCK
), /* KEY_LEFTSHIFT), */
136 KEY(4, 4, KEY_ENTER
), /* scroll push */
137 KEY(6, 2, KEY_ENTER
), /* keypad action */
140 KEY(5, 3, KEY_RECORD
),
141 KEY(5, 0, KEY_VOLUMEUP
),
142 KEY(5, 1, KEY_VOLUMEDOWN
),
144 KEY(3, 0, KEY_F22
), /* soft1 */
145 KEY(3, 3, KEY_F23
), /* soft2 */
148 static struct matrix_keymap_data tavorevb_matrix_keymap_data
= {
149 .keymap
= tavorevb_matrix_key_map
,
150 .keymap_size
= ARRAY_SIZE(tavorevb_matrix_key_map
),
153 static struct pxa27x_keypad_platform_data tavorevb_keypad_info
= {
154 .matrix_key_rows
= 7,
155 .matrix_key_cols
= 7,
156 .matrix_keymap_data
= &tavorevb_matrix_keymap_data
,
157 .debounce_interval
= 30,
160 static void __init
tavorevb_init_keypad(void)
162 pxa_set_keypad_info(&tavorevb_keypad_info
);
165 static inline void tavorevb_init_keypad(void) {}
166 #endif /* CONFIG_KEYBOARD_PXA27x || CONFIG_KEYBOARD_PXA27x_MODULE */
168 #if defined(CONFIG_FB_PXA) || defined(CONFIG_FB_PXA_MODULE)
169 static struct pwm_lookup tavorevb_pwm_lookup
[] = {
170 PWM_LOOKUP("pxa27x-pwm.0", 1, "pwm-backlight.0", NULL
, 100000,
171 PWM_POLARITY_NORMAL
),
172 PWM_LOOKUP("pxa27x-pwm.0", 0, "pwm-backlight.1", NULL
, 100000,
173 PWM_POLARITY_NORMAL
),
176 static struct platform_pwm_backlight_data tavorevb_backlight_data
[] = {
178 /* primary backlight */
179 .max_brightness
= 100,
180 .dft_brightness
= 100,
183 /* secondary backlight */
184 .max_brightness
= 100,
185 .dft_brightness
= 100,
189 static struct platform_device tavorevb_backlight_devices
[] = {
191 .name
= "pwm-backlight",
194 .platform_data
= &tavorevb_backlight_data
[0],
198 .name
= "pwm-backlight",
201 .platform_data
= &tavorevb_backlight_data
[1],
206 static uint16_t panel_init
[] = {
227 /* P-ON Init sequence */
228 SMART_CMD(0x00), /* OSC ON */
233 SMART_CMD(0x01), /* SOURCE DRIVER SHIFT DIRECTION and display RAM setting */
237 SMART_CMD(0x02), /* LINE INV */
241 SMART_CMD(0x03), /* IF mode(1) */
242 SMART_DAT(0x01), /* 8bit smart mode(8-8),high speed write mode */
245 SMART_CMD(0x00), /* RAM Write Mode */
250 /* DISPLAY Setting, 262K, fixed(NO scroll), no split screen */
252 SMART_DAT(0x40), /* 16/18/19 BPP */
255 SMART_CMD(0x08), /* BP, FP Seting, BP=2H, FP=3H */
259 SMART_CMD(0x0C), /* IF mode(2), using internal clock & MPU */
263 SMART_CMD(0x0D), /* Frame setting, 1Min. Frequence, 16CLK */
267 SMART_CMD(0x12), /* Timing(1),ASW W=4CLK, ASW ST=1CLK */
271 SMART_CMD(0x13), /* Timing(2),OEV ST=0.5CLK, OEV ED=1CLK */
275 SMART_CMD(0x14), /* Timing(3), ASW HOLD=0.5CLK */
279 SMART_CMD(0x15), /* Timing(4), CKV ST=0CLK, CKV ED=1CLK */
320 /* DISP RAM setting: 240*320 */
321 SMART_CMD(0x04), /* HADDR, START 0 */
324 SMART_DAT(0x00), /* x1,3 */
325 SMART_CMD(0x04), /* HADDR, END 4 */
328 SMART_DAT(0xEF), /* x2, 7 */
329 SMART_CMD(0x04), /* VADDR, START 8 */
331 SMART_DAT(0x00), /* y1, 10 */
332 SMART_DAT(0x00), /* y1, 11 */
333 SMART_CMD(0x04), /* VADDR, END 12 */
335 SMART_DAT(0x01), /* y2, 14 */
336 SMART_DAT(0x3F), /* y2, 15 */
337 SMART_CMD(0x02), /* RAM ADDR SETTING 16 */
340 SMART_DAT(0x00), /* x1, 19 */
341 SMART_CMD(0x02), /* RAM ADDR SETTING 20 */
343 SMART_DAT(0x00), /* y1, 22 */
344 SMART_DAT(0x00), /* y1, 23 */
347 static uint16_t panel_on
[] = {
383 static uint16_t panel_off
[] = {
414 static uint16_t update_framedata
[] = {
419 /* write frame data */
420 SMART_CMD_WRITE_FRAME
,
423 static void ltm020d550_lcd_power(int on
, struct fb_var_screeninfo
*var
)
425 struct fb_info
*info
= container_of(var
, struct fb_info
, var
);
428 pxafb_smart_queue(info
, ARRAY_AND_SIZE(panel_init
));
429 pxafb_smart_queue(info
, ARRAY_AND_SIZE(panel_on
));
431 pxafb_smart_queue(info
, ARRAY_AND_SIZE(panel_off
));
434 if (pxafb_smart_flush(info
))
435 pr_err("%s: timed out\n", __func__
);
438 static void ltm020d550_update(struct fb_info
*info
)
440 pxafb_smart_queue(info
, ARRAY_AND_SIZE(update_framedata
));
441 pxafb_smart_flush(info
);
444 static struct pxafb_mode_info toshiba_ltm020d550_modes
[] = {
449 .a0csrd_set_hld
= 30,
450 .a0cswr_set_hld
= 30,
451 .wr_pulse_width
= 30,
452 .rd_pulse_width
= 170,
456 /* L_LCLK_A0 and L_LCLK_RD active low */
457 .sync
= FB_SYNC_HOR_HIGH_ACT
|
458 FB_SYNC_VERT_HIGH_ACT
,
462 static struct pxafb_mach_info tavorevb_lcd_info
= {
463 .modes
= toshiba_ltm020d550_modes
,
465 .lcd_conn
= LCD_SMART_PANEL_8BPP
| LCD_PCLK_EDGE_FALL
,
466 .pxafb_lcd_power
= ltm020d550_lcd_power
,
467 .smart_update
= ltm020d550_update
,
470 static void __init
tavorevb_init_lcd(void)
472 pwm_add_table(tavorevb_pwm_lookup
, ARRAY_SIZE(tavorevb_pwm_lookup
));
473 platform_device_register(&tavorevb_backlight_devices
[0]);
474 platform_device_register(&tavorevb_backlight_devices
[1]);
475 pxa_set_fb_info(NULL
, &tavorevb_lcd_info
);
478 static inline void tavorevb_init_lcd(void) {}
479 #endif /* CONFIG_FB_PXA || CONFIG_FB_PXA_MODULE */
481 static void __init
tavorevb_init(void)
483 /* initialize MFP configurations */
484 pxa3xx_mfp_config(ARRAY_AND_SIZE(tavorevb_mfp_cfg
));
486 pxa_set_ffuart_info(NULL
);
487 pxa_set_btuart_info(NULL
);
488 pxa_set_stuart_info(NULL
);
490 platform_device_register(&smc91x_device
);
493 tavorevb_init_keypad();
496 MACHINE_START(TAVOREVB
, "PXA930 Evaluation Board (aka TavorEVB)")
497 /* Maintainer: Eric Miao <eric.miao@marvell.com> */
498 .atag_offset
= 0x100,
499 .map_io
= pxa3xx_map_io
,
500 .nr_irqs
= PXA_NR_IRQS
,
501 .init_irq
= pxa3xx_init_irq
,
502 .handle_irq
= pxa3xx_handle_irq
,
503 .init_time
= pxa_timer_init
,
504 .init_machine
= tavorevb_init
,
505 .restart
= pxa_restart
,