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/i2c/pxa-i2c.h>
24 #include <linux/smc91x.h>
25 #include <linux/mfd/da903x.h>
26 #include <linux/mtd/mtd.h>
27 #include <linux/mtd/partitions.h>
28 #include <linux/mtd/onenand.h>
30 #include <asm/mach-types.h>
31 #include <asm/mach/arch.h>
32 #include <asm/mach/flash.h>
34 #include <mach/pxa930.h>
35 #include <mach/pxafb.h>
40 #define GPIO_LCD_RESET (16)
42 /* SAAR MFP configurations */
43 static mfp_cfg_t saar_mfp_cfg
[] __initdata
= {
58 GPIO16_GPIO
, /* LCD reset */
65 DF_INT_RnB_ND_INT_RnB
,
90 #define SAAR_ETH_PHYS (0x14000000)
92 static struct resource smc91x_resources
[] = {
94 .start
= (SAAR_ETH_PHYS
+ 0x300),
95 .end
= (SAAR_ETH_PHYS
+ 0xfffff),
96 .flags
= IORESOURCE_MEM
,
99 .start
= gpio_to_irq(mfp_to_gpio(MFP_PIN_GPIO97
)),
100 .end
= gpio_to_irq(mfp_to_gpio(MFP_PIN_GPIO97
)),
101 .flags
= IORESOURCE_IRQ
| IORESOURCE_IRQ_HIGHEDGE
,
105 static struct smc91x_platdata saar_smc91x_info
= {
106 .flags
= SMC91X_USE_16BIT
| SMC91X_NOWAIT
| SMC91X_USE_DMA
,
109 static struct platform_device smc91x_device
= {
112 .num_resources
= ARRAY_SIZE(smc91x_resources
),
113 .resource
= smc91x_resources
,
115 .platform_data
= &saar_smc91x_info
,
119 #if defined(CONFIG_FB_PXA) || defined(CONFIG_FB_PXA_MODULE)
120 static uint16_t lcd_power_on
[] = {
138 /* calibration control */
145 /*Power-On Init sequence*/
146 SMART_CMD(0x00), /* output ctrl */
150 SMART_CMD(0x00), /* wave ctrl */
155 SMART_CMD(0x03), /* entry mode */
159 SMART_CMD(0x08), /* display ctrl 2 */
163 SMART_CMD(0x09), /* display ctrl 3 */
167 SMART_CMD(0x0A), /* display ctrl 4 */
171 SMART_CMD(0x0D), /* Frame Marker position */
175 SMART_CMD(0x60), /* Driver output control */
179 SMART_CMD(0x61), /* Base image display control */
183 SMART_CMD(0x30), /* Y settings 30h-3Dh */
191 SMART_CMD(0x32), /* Timing(3), ASW HOLD=0.5CLK */
195 SMART_CMD(0x33), /* Timing(4), CKV ST=0CLK, CKV ED=1CLK */
238 SMART_CMD(0x00), /* Display control 1 */
242 SMART_CMD(0x00), /* Power control 5 */
246 SMART_CMD(0x00), /* Power control 1 */
250 SMART_CMD(0x00), /* Power control 2 */
254 SMART_CMD(0x00), /* Power control 3 */
258 SMART_CMD(0x00), /* Power control 4 */
262 SMART_CMD(0x00), /* Power control 3 */
268 /* display mode : 240*320 */
269 SMART_CMD(0x00), /* RAM address set(H) 0*/
273 SMART_CMD(0x00), /* RAM address set(V) 4*/
277 SMART_CMD(0x00), /* Start of Window RAM address set(H) 8*/
281 SMART_CMD(0x00), /* End of Window RAM address set(H) 12*/
285 SMART_CMD(0x00), /* Start of Window RAM address set(V) 16*/
289 SMART_CMD(0x00), /* End of Window RAM address set(V) 20*/
293 SMART_CMD(0x00), /* Panel interface control 1 */
297 SMART_CMD(0x00), /* Panel interface control 2 */
301 SMART_CMD(0x00), /* Panel interface control 3 */
308 static uint16_t lcd_panel_on
[] = {
328 static uint16_t lcd_panel_off
[] = {
348 static uint16_t lcd_power_off
[] = {
371 static uint16_t update_framedata
[] = {
372 /* set display ram: 240*320 */
373 SMART_CMD(0x00), /* RAM address set(H) 0*/
377 SMART_CMD(0x00), /* RAM address set(V) 4*/
381 SMART_CMD(0x00), /* Start of Window RAM address set(H) 8 */
385 SMART_CMD(0x00), /* End of Window RAM address set(H) 12 */
389 SMART_CMD(0x00), /* Start of Window RAM address set(V) 16 */
393 SMART_CMD(0x00), /* End of Window RAM address set(V) 20 */
398 /* wait for vsync cmd before transferring frame data */
399 SMART_CMD_WAIT_FOR_VSYNC
,
405 /* write frame data */
406 SMART_CMD_WRITE_FRAME
,
409 static void ltm022a97a_lcd_power(int on
, struct fb_var_screeninfo
*var
)
411 static int pin_requested
= 0;
412 struct fb_info
*info
= container_of(var
, struct fb_info
, var
);
415 if (!pin_requested
) {
416 err
= gpio_request(GPIO_LCD_RESET
, "lcd reset");
418 pr_err("failed to request gpio for LCD reset\n");
422 gpio_direction_output(GPIO_LCD_RESET
, 0);
427 gpio_set_value(GPIO_LCD_RESET
, 0); msleep(100);
428 gpio_set_value(GPIO_LCD_RESET
, 1); msleep(10);
430 pxafb_smart_queue(info
, ARRAY_AND_SIZE(lcd_power_on
));
431 pxafb_smart_queue(info
, ARRAY_AND_SIZE(lcd_panel_on
));
433 pxafb_smart_queue(info
, ARRAY_AND_SIZE(lcd_panel_off
));
434 pxafb_smart_queue(info
, ARRAY_AND_SIZE(lcd_power_off
));
437 err
= pxafb_smart_flush(info
);
439 pr_err("%s: timed out\n", __func__
);
442 static void ltm022a97a_update(struct fb_info
*info
)
444 pxafb_smart_queue(info
, ARRAY_AND_SIZE(update_framedata
));
445 pxafb_smart_flush(info
);
448 static struct pxafb_mode_info toshiba_ltm022a97a_modes
[] = {
453 .a0csrd_set_hld
= 30,
454 .a0cswr_set_hld
= 30,
455 .wr_pulse_width
= 30,
456 .rd_pulse_width
= 30,
460 /* L_LCLK_A0 and L_LCLK_RD active low */
461 .sync
= FB_SYNC_HOR_HIGH_ACT
|
462 FB_SYNC_VERT_HIGH_ACT
,
466 static struct pxafb_mach_info saar_lcd_info
= {
467 .modes
= toshiba_ltm022a97a_modes
,
469 .lcd_conn
= LCD_SMART_PANEL_8BPP
| LCD_PCLK_EDGE_FALL
,
470 .pxafb_lcd_power
= ltm022a97a_lcd_power
,
471 .smart_update
= ltm022a97a_update
,
474 static void __init
saar_init_lcd(void)
476 pxa_set_fb_info(NULL
, &saar_lcd_info
);
479 static inline void saar_init_lcd(void) {}
482 #if defined(CONFIG_I2C_PXA) || defined(CONFIG_I2C_PXA_MODULE)
483 static struct da9034_backlight_pdata saar_da9034_backlight
= {
484 .output_current
= 4, /* 4mA */
487 static struct da903x_subdev_info saar_da9034_subdevs
[] = {
489 .name
= "da903x-backlight",
490 .id
= DA9034_ID_WLED
,
491 .platform_data
= &saar_da9034_backlight
,
495 static struct da903x_platform_data saar_da9034_info
= {
496 .num_subdevs
= ARRAY_SIZE(saar_da9034_subdevs
),
497 .subdevs
= saar_da9034_subdevs
,
500 static struct i2c_board_info saar_i2c_info
[] = {
504 .platform_data
= &saar_da9034_info
,
505 .irq
= gpio_to_irq(mfp_to_gpio(MFP_PIN_GPIO83
)),
509 static void __init
saar_init_i2c(void)
511 pxa_set_i2c_info(NULL
);
512 i2c_register_board_info(0, ARRAY_AND_SIZE(saar_i2c_info
));
515 static inline void saar_init_i2c(void) {}
518 #if defined(CONFIG_MTD_ONENAND) || defined(CONFIG_MTD_ONENAND_MODULE)
519 static struct mtd_partition saar_onenand_partitions
[] = {
521 .name
= "bootloader",
524 .mask_flags
= MTD_WRITEABLE
,
527 .offset
= MTDPART_OFS_APPEND
,
529 .mask_flags
= MTD_WRITEABLE
,
532 .offset
= MTDPART_OFS_APPEND
,
534 .mask_flags
= MTD_WRITEABLE
,
537 .offset
= MTDPART_OFS_APPEND
,
538 .size
= (SZ_2M
+ SZ_1M
),
541 .name
= "filesystem",
542 .offset
= MTDPART_OFS_APPEND
,
548 static struct onenand_platform_data saar_onenand_info
= {
549 .parts
= saar_onenand_partitions
,
550 .nr_parts
= ARRAY_SIZE(saar_onenand_partitions
),
553 #define SMC_CS0_PHYS_BASE (0x10000000)
555 static struct resource saar_resource_onenand
[] = {
557 .start
= SMC_CS0_PHYS_BASE
,
558 .end
= SMC_CS0_PHYS_BASE
+ SZ_1M
,
559 .flags
= IORESOURCE_MEM
,
563 static struct platform_device saar_device_onenand
= {
564 .name
= "onenand-flash",
567 .platform_data
= &saar_onenand_info
,
569 .resource
= saar_resource_onenand
,
570 .num_resources
= ARRAY_SIZE(saar_resource_onenand
),
573 static void __init
saar_init_onenand(void)
575 platform_device_register(&saar_device_onenand
);
578 static void __init
saar_init_onenand(void) {}
581 static void __init
saar_init(void)
583 /* initialize MFP configurations */
584 pxa3xx_mfp_config(ARRAY_AND_SIZE(saar_mfp_cfg
));
586 pxa_set_ffuart_info(NULL
);
587 pxa_set_btuart_info(NULL
);
588 pxa_set_stuart_info(NULL
);
590 platform_device_register(&smc91x_device
);
597 MACHINE_START(SAAR
, "PXA930 Handheld Platform (aka SAAR)")
598 /* Maintainer: Eric Miao <eric.miao@marvell.com> */
599 .boot_params
= 0xa0000100,
600 .map_io
= pxa3xx_map_io
,
601 .init_irq
= pxa3xx_init_irq
,
603 .init_machine
= saar_init
,