2 * linux/arch/arm/mach-pxa/saar.c
4 * Support for the Marvell PXA930 Handheld Platform (aka SAAR)
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/delay.h>
22 #include <linux/i2c.h>
23 #include <linux/smc91x.h>
24 #include <linux/mfd/da903x.h>
26 #include <asm/mach-types.h>
27 #include <asm/mach/arch.h>
29 #include <mach/pxa930.h>
31 #include <mach/pxafb.h>
36 #define GPIO_LCD_RESET (16)
38 /* SAAR MFP configurations */
39 static mfp_cfg_t saar_mfp_cfg
[] __initdata
= {
54 GPIO16_GPIO
, /* LCD reset */
61 #define SAAR_ETH_PHYS (0x14000000)
63 static struct resource smc91x_resources
[] = {
65 .start
= (SAAR_ETH_PHYS
+ 0x300),
66 .end
= (SAAR_ETH_PHYS
+ 0xfffff),
67 .flags
= IORESOURCE_MEM
,
70 .start
= gpio_to_irq(mfp_to_gpio(MFP_PIN_GPIO97
)),
71 .end
= gpio_to_irq(mfp_to_gpio(MFP_PIN_GPIO97
)),
72 .flags
= IORESOURCE_IRQ
| IORESOURCE_IRQ_HIGHEDGE
,
76 static struct smc91x_platdata saar_smc91x_info
= {
77 .flags
= SMC91X_USE_16BIT
| SMC91X_NOWAIT
| SMC91X_USE_DMA
,
80 static struct platform_device smc91x_device
= {
83 .num_resources
= ARRAY_SIZE(smc91x_resources
),
84 .resource
= smc91x_resources
,
86 .platform_data
= &saar_smc91x_info
,
90 #if defined(CONFIG_FB_PXA) || (CONFIG_FB_PXA_MODULE)
91 static uint16_t lcd_power_on
[] = {
109 /* calibration control */
116 /*Power-On Init sequence*/
117 SMART_CMD(0x00), /* output ctrl */
121 SMART_CMD(0x00), /* wave ctrl */
126 SMART_CMD(0x03), /* entry mode */
130 SMART_CMD(0x08), /* display ctrl 2 */
134 SMART_CMD(0x09), /* display ctrl 3 */
138 SMART_CMD(0x0A), /* display ctrl 4 */
142 SMART_CMD(0x0D), /* Frame Marker position */
146 SMART_CMD(0x60), /* Driver output control */
150 SMART_CMD(0x61), /* Base image display control */
154 SMART_CMD(0x30), /* Y settings 30h-3Dh */
162 SMART_CMD(0x32), /* Timing(3), ASW HOLD=0.5CLK */
166 SMART_CMD(0x33), /* Timing(4), CKV ST=0CLK, CKV ED=1CLK */
209 SMART_CMD(0x00), /* Display control 1 */
213 SMART_CMD(0x00), /* Power control 5 */
217 SMART_CMD(0x00), /* Power control 1 */
221 SMART_CMD(0x00), /* Power control 2 */
225 SMART_CMD(0x00), /* Power control 3 */
229 SMART_CMD(0x00), /* Power control 4 */
233 SMART_CMD(0x00), /* Power control 3 */
239 /* display mode : 240*320 */
240 SMART_CMD(0x00), /* RAM address set(H) 0*/
244 SMART_CMD(0x00), /* RAM address set(V) 4*/
248 SMART_CMD(0x00), /* Start of Window RAM address set(H) 8*/
252 SMART_CMD(0x00), /* End of Window RAM address set(H) 12*/
256 SMART_CMD(0x00), /* Start of Window RAM address set(V) 16*/
260 SMART_CMD(0x00), /* End of Window RAM address set(V) 20*/
264 SMART_CMD(0x00), /* Panel interface control 1 */
268 SMART_CMD(0x00), /* Panel interface control 2 */
272 SMART_CMD(0x00), /* Panel interface control 3 */
279 static uint16_t lcd_panel_on
[] = {
299 static uint16_t lcd_panel_off
[] = {
319 static uint16_t lcd_power_off
[] = {
342 static uint16_t update_framedata
[] = {
343 /* set display ram: 240*320 */
344 SMART_CMD(0x00), /* RAM address set(H) 0*/
348 SMART_CMD(0x00), /* RAM address set(V) 4*/
352 SMART_CMD(0x00), /* Start of Window RAM address set(H) 8 */
356 SMART_CMD(0x00), /* End of Window RAM address set(H) 12 */
360 SMART_CMD(0x00), /* Start of Window RAM address set(V) 16 */
364 SMART_CMD(0x00), /* End of Window RAM address set(V) 20 */
369 /* wait for vsync cmd before transferring frame data */
370 SMART_CMD_WAIT_FOR_VSYNC
,
376 /* write frame data */
377 SMART_CMD_WRITE_FRAME
,
380 static void ltm022a97a_lcd_power(int on
, struct fb_var_screeninfo
*var
)
382 static int pin_requested
= 0;
383 struct fb_info
*info
= container_of(var
, struct fb_info
, var
);
386 if (!pin_requested
) {
387 err
= gpio_request(GPIO_LCD_RESET
, "lcd reset");
389 pr_err("failed to request gpio for LCD reset\n");
393 gpio_direction_output(GPIO_LCD_RESET
, 0);
398 gpio_set_value(GPIO_LCD_RESET
, 0); msleep(100);
399 gpio_set_value(GPIO_LCD_RESET
, 1); msleep(10);
401 pxafb_smart_queue(info
, ARRAY_AND_SIZE(lcd_power_on
));
402 pxafb_smart_queue(info
, ARRAY_AND_SIZE(lcd_panel_on
));
404 pxafb_smart_queue(info
, ARRAY_AND_SIZE(lcd_panel_off
));
405 pxafb_smart_queue(info
, ARRAY_AND_SIZE(lcd_power_off
));
408 err
= pxafb_smart_flush(info
);
410 pr_err("%s: timed out\n", __func__
);
413 static void ltm022a97a_update(struct fb_info
*info
)
415 pxafb_smart_queue(info
, ARRAY_AND_SIZE(update_framedata
));
416 pxafb_smart_flush(info
);
419 static struct pxafb_mode_info toshiba_ltm022a97a_modes
[] = {
424 .a0csrd_set_hld
= 30,
425 .a0cswr_set_hld
= 30,
426 .wr_pulse_width
= 30,
427 .rd_pulse_width
= 30,
431 /* L_LCLK_A0 and L_LCLK_RD active low */
432 .sync
= FB_SYNC_HOR_HIGH_ACT
|
433 FB_SYNC_VERT_HIGH_ACT
,
437 static struct pxafb_mach_info saar_lcd_info
= {
438 .modes
= toshiba_ltm022a97a_modes
,
440 .lcd_conn
= LCD_SMART_PANEL_8BPP
| LCD_PCLK_EDGE_FALL
,
441 .pxafb_lcd_power
= ltm022a97a_lcd_power
,
442 .smart_update
= ltm022a97a_update
,
445 static void __init
saar_init_lcd(void)
447 set_pxa_fb_info(&saar_lcd_info
);
450 static inline void saar_init_lcd(void) {}
453 #if defined(CONFIG_I2C_PXA) || defined(CONFIG_I2C_PXA_MODULE)
454 static struct da903x_subdev_info saar_da9034_subdevs
[] = {
456 .name
= "da903x-backlight",
457 .id
= DA9034_ID_WLED
,
461 static struct da903x_platform_data saar_da9034_info
= {
462 .num_subdevs
= ARRAY_SIZE(saar_da9034_subdevs
),
463 .subdevs
= saar_da9034_subdevs
,
466 static struct i2c_board_info saar_i2c_info
[] = {
470 .platform_data
= &saar_da9034_info
,
471 .irq
= gpio_to_irq(mfp_to_gpio(MFP_PIN_GPIO83
)),
475 static void __init
saar_init_i2c(void)
477 pxa_set_i2c_info(NULL
);
478 i2c_register_board_info(0, ARRAY_AND_SIZE(saar_i2c_info
));
481 static inline void saar_init_i2c(void) {}
483 static void __init
saar_init(void)
485 /* initialize MFP configurations */
486 pxa3xx_mfp_config(ARRAY_AND_SIZE(saar_mfp_cfg
));
488 platform_device_register(&smc91x_device
);
494 MACHINE_START(SAAR
, "PXA930 Handheld Platform (aka SAAR)")
495 /* Maintainer: Eric Miao <eric.miao@marvell.com> */
496 .phys_io
= 0x40000000,
497 .boot_params
= 0xa0000100,
498 .io_pg_offst
= (io_p2v(0x40000000) >> 18) & 0xfffc,
499 .map_io
= pxa_map_io
,
500 .init_irq
= pxa3xx_init_irq
,
502 .init_machine
= saar_init
,