Merge branches 'sh/serial-rework' and 'sh/oprofile'
[linux-2.6] / arch / avr32 / boards / atngw100 / evklcd10x.c
1 /*
2  * Board-specific setup code for the ATEVKLCD10X addon board to the ATNGW100
3  * Network Gateway
4  *
5  * Copyright (C) 2008 Atmel Corporation
6  *
7  * This program is free software; you can redistribute it and/or modify it
8  * under the terms of the GNU General Public License version 2 as published by
9  * the Free Software Foundation.
10  */
11
12 #include <linux/init.h>
13 #include <linux/linkage.h>
14 #include <linux/fb.h>
15 #include <linux/platform_device.h>
16
17 #include <video/atmel_lcdc.h>
18
19 #include <asm/setup.h>
20
21 #include <mach/at32ap700x.h>
22 #include <mach/board.h>
23
24 static struct ac97c_platform_data __initdata ac97c0_data = {
25         .dma_rx_periph_id       = 3,
26         .dma_tx_periph_id       = 4,
27         .dma_controller_id      = 0,
28         .reset_pin              = GPIO_PIN_PB(19),
29 };
30
31 #ifdef CONFIG_BOARD_ATNGW100_EVKLCD10X_VGA
32 static struct fb_videomode __initdata tcg057vglad_modes[] = {
33         {
34                 .name           = "640x480 @ 60",
35                 .refresh        = 60,
36                 .xres           = 640,          .yres           = 480,
37                 .pixclock       = KHZ2PICOS(25180),
38
39                 .left_margin    = 64,           .right_margin   = 31,
40                 .upper_margin   = 34,           .lower_margin   = 2,
41                 .hsync_len      = 96,           .vsync_len      = 4,
42
43                 .sync           = 0,
44                 .vmode          = FB_VMODE_NONINTERLACED,
45         },
46 };
47
48 static struct fb_monspecs __initdata atevklcd10x_default_monspecs = {
49         .manufacturer           = "KYO",
50         .monitor                = "TCG057VGLAD",
51         .modedb                 = tcg057vglad_modes,
52         .modedb_len             = ARRAY_SIZE(tcg057vglad_modes),
53         .hfmin                  = 19948,
54         .hfmax                  = 31478,
55         .vfmin                  = 50,
56         .vfmax                  = 67,
57         .dclkmax                = 28330000,
58 };
59
60 static struct atmel_lcdfb_info __initdata atevklcd10x_lcdc_data = {
61         .default_bpp            = 16,
62         .default_dmacon         = ATMEL_LCDC_DMAEN | ATMEL_LCDC_DMA2DEN,
63         .default_lcdcon2        = (ATMEL_LCDC_DISTYPE_TFT
64                                    | ATMEL_LCDC_CLKMOD_ALWAYSACTIVE
65                                    | ATMEL_LCDC_MEMOR_BIG),
66         .default_monspecs       = &atevklcd10x_default_monspecs,
67         .guard_time             = 2,
68 };
69 #elif CONFIG_BOARD_ATNGW100_EVKLCD10X_QVGA
70 static struct fb_videomode __initdata tcg057qvlad_modes[] = {
71         {
72                 .name           = "320x240 @ 60",
73                 .refresh        = 60,
74                 .xres           = 320,          .yres           = 240,
75                 .pixclock       = KHZ2PICOS(6300),
76
77                 .left_margin    = 52,           .right_margin   = 28,
78                 .upper_margin   = 7,            .lower_margin   = 2,
79                 .hsync_len      = 96,           .vsync_len      = 4,
80
81                 .sync           = 0,
82                 .vmode          = FB_VMODE_NONINTERLACED,
83         },
84 };
85
86 static struct fb_monspecs __initdata atevklcd10x_default_monspecs = {
87         .manufacturer           = "KYO",
88         .monitor                = "TCG057QVLAD",
89         .modedb                 = tcg057qvlad_modes,
90         .modedb_len             = ARRAY_SIZE(tcg057qvlad_modes),
91         .hfmin                  = 19948,
92         .hfmax                  = 31478,
93         .vfmin                  = 50,
94         .vfmax                  = 67,
95         .dclkmax                = 7000000,
96 };
97
98 static struct atmel_lcdfb_info __initdata atevklcd10x_lcdc_data = {
99         .default_bpp            = 16,
100         .default_dmacon         = ATMEL_LCDC_DMAEN | ATMEL_LCDC_DMA2DEN,
101         .default_lcdcon2        = (ATMEL_LCDC_DISTYPE_TFT
102                                    | ATMEL_LCDC_CLKMOD_ALWAYSACTIVE
103                                    | ATMEL_LCDC_MEMOR_BIG),
104         .default_monspecs       = &atevklcd10x_default_monspecs,
105         .guard_time             = 2,
106 };
107 #elif CONFIG_BOARD_ATNGW100_EVKLCD10X_POW_QVGA
108 static struct fb_videomode __initdata ph320240t_modes[] = {
109         {
110                 .name           = "320x240 @ 60",
111                 .refresh        = 60,
112                 .xres           = 320,          .yres           = 240,
113                 .pixclock       = KHZ2PICOS(6300),
114
115                 .left_margin    = 38,           .right_margin   = 20,
116                 .upper_margin   = 15,           .lower_margin   = 5,
117                 .hsync_len      = 30,           .vsync_len      = 3,
118
119                 .sync           = 0,
120                 .vmode          = FB_VMODE_NONINTERLACED,
121         },
122 };
123
124 static struct fb_monspecs __initdata atevklcd10x_default_monspecs = {
125         .manufacturer           = "POW",
126         .monitor                = "PH320240T",
127         .modedb                 = ph320240t_modes,
128         .modedb_len             = ARRAY_SIZE(ph320240t_modes),
129         .hfmin                  = 14400,
130         .hfmax                  = 21600,
131         .vfmin                  = 50,
132         .vfmax                  = 90,
133         .dclkmax                = 6400000,
134 };
135
136 static struct atmel_lcdfb_info __initdata atevklcd10x_lcdc_data = {
137         .default_bpp            = 16,
138         .default_dmacon         = ATMEL_LCDC_DMAEN | ATMEL_LCDC_DMA2DEN,
139         .default_lcdcon2        = (ATMEL_LCDC_DISTYPE_TFT
140                                    | ATMEL_LCDC_CLKMOD_ALWAYSACTIVE
141                                    | ATMEL_LCDC_MEMOR_BIG),
142         .default_monspecs       = &atevklcd10x_default_monspecs,
143         .guard_time             = 2,
144 };
145 #endif
146
147 static int __init atevklcd10x_init(void)
148 {
149         at32_add_device_ac97c(0, &ac97c0_data);
150
151         at32_add_device_lcdc(0, &atevklcd10x_lcdc_data,
152                         fbmem_start, fbmem_size, 1);
153         return 0;
154 }
155 postcore_initcall(atevklcd10x_init);