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>
28 #include <mach/hardware.h>
29 #include <mach/pxa3xx-regs.h>
30 #include <mach/mfp-pxa930.h>
32 #include <mach/regs-lcd.h>
33 #include <mach/pxafb.h>
38 #define GPIO_LCD_RESET (16)
40 /* SAAR MFP configurations */
41 static mfp_cfg_t saar_mfp_cfg
[] __initdata
= {
56 GPIO16_GPIO
, /* LCD reset */
63 #define SAAR_ETH_PHYS (0x14000000)
65 static struct resource smc91x_resources
[] = {
67 .start
= (SAAR_ETH_PHYS
+ 0x300),
68 .end
= (SAAR_ETH_PHYS
+ 0xfffff),
69 .flags
= IORESOURCE_MEM
,
72 .start
= gpio_to_irq(mfp_to_gpio(MFP_PIN_GPIO97
)),
73 .end
= gpio_to_irq(mfp_to_gpio(MFP_PIN_GPIO97
)),
74 .flags
= IORESOURCE_IRQ
| IORESOURCE_IRQ_HIGHEDGE
,
78 static struct smc91x_platdata saar_smc91x_info
= {
79 .flags
= SMC91X_USE_16BIT
| SMC91X_NOWAIT
| SMC91X_USE_DMA
,
82 static struct platform_device smc91x_device
= {
85 .num_resources
= ARRAY_SIZE(smc91x_resources
),
86 .resource
= smc91x_resources
,
88 .platform_data
= &saar_smc91x_info
,
92 #if defined(CONFIG_FB_PXA) || (CONFIG_FB_PXA_MODULE)
93 static uint16_t lcd_power_on
[] = {
111 /* calibration control */
118 /*Power-On Init sequence*/
119 SMART_CMD(0x00), /* output ctrl */
123 SMART_CMD(0x00), /* wave ctrl */
128 SMART_CMD(0x03), /* entry mode */
132 SMART_CMD(0x08), /* display ctrl 2 */
136 SMART_CMD(0x09), /* display ctrl 3 */
140 SMART_CMD(0x0A), /* display ctrl 4 */
144 SMART_CMD(0x0D), /* Frame Marker position */
148 SMART_CMD(0x60), /* Driver output control */
152 SMART_CMD(0x61), /* Base image display control */
156 SMART_CMD(0x30), /* Y settings 30h-3Dh */
164 SMART_CMD(0x32), /* Timing(3), ASW HOLD=0.5CLK */
168 SMART_CMD(0x33), /* Timing(4), CKV ST=0CLK, CKV ED=1CLK */
211 SMART_CMD(0x00), /* Display control 1 */
215 SMART_CMD(0x00), /* Power control 5 */
219 SMART_CMD(0x00), /* Power control 1 */
223 SMART_CMD(0x00), /* Power control 2 */
227 SMART_CMD(0x00), /* Power control 3 */
231 SMART_CMD(0x00), /* Power control 4 */
235 SMART_CMD(0x00), /* Power control 3 */
241 /* display mode : 240*320 */
242 SMART_CMD(0x00), /* RAM address set(H) 0*/
246 SMART_CMD(0x00), /* RAM address set(V) 4*/
250 SMART_CMD(0x00), /* Start of Window RAM address set(H) 8*/
254 SMART_CMD(0x00), /* End of Window RAM address set(H) 12*/
258 SMART_CMD(0x00), /* Start of Window RAM address set(V) 16*/
262 SMART_CMD(0x00), /* End of Window RAM address set(V) 20*/
266 SMART_CMD(0x00), /* Panel interface control 1 */
270 SMART_CMD(0x00), /* Panel interface control 2 */
274 SMART_CMD(0x00), /* Panel interface control 3 */
281 static uint16_t lcd_panel_on
[] = {
301 static uint16_t lcd_panel_off
[] = {
321 static uint16_t lcd_power_off
[] = {
344 static uint16_t update_framedata
[] = {
345 /* set display ram: 240*320 */
346 SMART_CMD(0x00), /* RAM address set(H) 0*/
350 SMART_CMD(0x00), /* RAM address set(V) 4*/
354 SMART_CMD(0x00), /* Start of Window RAM address set(H) 8 */
358 SMART_CMD(0x00), /* End of Window RAM address set(H) 12 */
362 SMART_CMD(0x00), /* Start of Window RAM address set(V) 16 */
366 SMART_CMD(0x00), /* End of Window RAM address set(V) 20 */
371 /* wait for vsync cmd before transferring frame data */
372 SMART_CMD_WAIT_FOR_VSYNC
,
378 /* write frame data */
379 SMART_CMD_WRITE_FRAME
,
382 static void ltm022a97a_lcd_power(int on
, struct fb_var_screeninfo
*var
)
384 static int pin_requested
= 0;
385 struct fb_info
*info
= container_of(var
, struct fb_info
, var
);
388 if (!pin_requested
) {
389 err
= gpio_request(GPIO_LCD_RESET
, "lcd reset");
391 pr_err("failed to request gpio for LCD reset\n");
395 gpio_direction_output(GPIO_LCD_RESET
, 0);
400 gpio_set_value(GPIO_LCD_RESET
, 0); msleep(100);
401 gpio_set_value(GPIO_LCD_RESET
, 1); msleep(10);
403 pxafb_smart_queue(info
, ARRAY_AND_SIZE(lcd_power_on
));
404 pxafb_smart_queue(info
, ARRAY_AND_SIZE(lcd_panel_on
));
406 pxafb_smart_queue(info
, ARRAY_AND_SIZE(lcd_panel_off
));
407 pxafb_smart_queue(info
, ARRAY_AND_SIZE(lcd_power_off
));
410 err
= pxafb_smart_flush(info
);
412 pr_err("%s: timed out\n", __func__
);
415 static void ltm022a97a_update(struct fb_info
*info
)
417 pxafb_smart_queue(info
, ARRAY_AND_SIZE(update_framedata
));
418 pxafb_smart_flush(info
);
421 static struct pxafb_mode_info toshiba_ltm022a97a_modes
[] = {
426 .a0csrd_set_hld
= 30,
427 .a0cswr_set_hld
= 30,
428 .wr_pulse_width
= 30,
429 .rd_pulse_width
= 30,
433 /* L_LCLK_A0 and L_LCLK_RD active low */
434 .sync
= FB_SYNC_HOR_HIGH_ACT
|
435 FB_SYNC_VERT_HIGH_ACT
,
439 static struct pxafb_mach_info saar_lcd_info
= {
440 .modes
= toshiba_ltm022a97a_modes
,
442 .lcd_conn
= LCD_SMART_PANEL_8BPP
| LCD_PCLK_EDGE_FALL
,
443 .pxafb_lcd_power
= ltm022a97a_lcd_power
,
444 .smart_update
= ltm022a97a_update
,
447 static void __init
saar_init_lcd(void)
449 set_pxa_fb_info(&saar_lcd_info
);
452 static inline void saar_init_lcd(void) {}
455 #if defined(CONFIG_I2C_PXA) || defined(CONFIG_I2C_PXA_MODULE)
456 static struct da903x_subdev_info saar_da9034_subdevs
[] = {
458 .name
= "da903x-backlight",
459 .id
= DA9034_ID_WLED
,
463 static struct da903x_platform_data saar_da9034_info
= {
464 .num_subdevs
= ARRAY_SIZE(saar_da9034_subdevs
),
465 .subdevs
= saar_da9034_subdevs
,
468 static struct i2c_board_info saar_i2c_info
[] = {
472 .platform_data
= &saar_da9034_info
,
473 .irq
= gpio_to_irq(mfp_to_gpio(MFP_PIN_GPIO83
)),
477 static void __init
saar_init_i2c(void)
479 pxa_set_i2c_info(NULL
);
480 i2c_register_board_info(0, ARRAY_AND_SIZE(saar_i2c_info
));
483 static inline void saar_init_i2c(void) {}
485 static void __init
saar_init(void)
487 /* initialize MFP configurations */
488 pxa3xx_mfp_config(ARRAY_AND_SIZE(saar_mfp_cfg
));
490 platform_device_register(&smc91x_device
);
496 MACHINE_START(SAAR
, "PXA930 Handheld Platform (aka SAAR)")
497 /* Maintainer: Eric Miao <eric.miao@marvell.com> */
498 .phys_io
= 0x40000000,
499 .boot_params
= 0xa0000100,
500 .io_pg_offst
= (io_p2v(0x40000000) >> 18) & 0xfffc,
501 .map_io
= pxa_map_io
,
502 .init_irq
= pxa3xx_init_irq
,
504 .init_machine
= saar_init
,