Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound-2.6
[linux-2.6] / arch / arm / mach-pxa / e800.c
1 /*
2  * Hardware definitions for the Toshiba eseries PDAs
3  *
4  * Copyright (c) 2003 Ian Molton <spyro@f2s.com>
5  *
6  * This file is licensed under
7  * the terms of the GNU General Public License version 2. This program
8  * is licensed "as is" without any warranty of any kind, whether express
9  * or implied.
10  *
11  */
12
13 #include <linux/kernel.h>
14 #include <linux/init.h>
15 #include <linux/device.h>
16 #include <linux/platform_device.h>
17 #include <linux/fb.h>
18
19 #include <video/w100fb.h>
20
21 #include <asm/setup.h>
22 #include <asm/mach/arch.h>
23 #include <asm/mach-types.h>
24
25 #include <mach/mfp-pxa25x.h>
26 #include <mach/hardware.h>
27 #include <mach/eseries-gpio.h>
28 #include <mach/udc.h>
29
30 #include "generic.h"
31 #include "eseries.h"
32
33 /* ------------------------ e800 LCD definitions ------------------------- */
34
35 static struct w100_gen_regs e800_lcd_regs = {
36         .lcd_format =            0x00008003,
37         .lcdd_cntl1 =            0x02a00000,
38         .lcdd_cntl2 =            0x0003ffff,
39         .genlcd_cntl1 =          0x000ff2a3,
40         .genlcd_cntl2 =          0x000002a3,
41         .genlcd_cntl3 =          0x000102aa,
42 };
43
44 static struct w100_mode e800_lcd_mode[2] = {
45         [0] = {
46                 .xres            = 480,
47                 .yres            = 640,
48                 .left_margin     = 52,
49                 .right_margin    = 148,
50                 .upper_margin    = 2,
51                 .lower_margin    = 6,
52                 .crtc_ss         = 0x80350034,
53                 .crtc_ls         = 0x802b0026,
54                 .crtc_gs         = 0x80160016,
55                 .crtc_vpos_gs    = 0x00020003,
56                 .crtc_rev        = 0x0040001d,
57                 .crtc_dclk       = 0xe0000000,
58                 .crtc_gclk       = 0x82a50049,
59                 .crtc_goe        = 0x80ee001c,
60                 .crtc_ps1_active = 0x00000000,
61                 .pll_freq        = 128,
62                 .pixclk_divider         = 4,
63                 .pixclk_divider_rotated = 6,
64                 .pixclk_src     = CLK_SRC_PLL,
65                 .sysclk_divider  = 0,
66                 .sysclk_src     = CLK_SRC_PLL,
67         },
68         [1] = {
69                 .xres            = 240,
70                 .yres            = 320,
71                 .left_margin     = 15,
72                 .right_margin    = 88,
73                 .upper_margin    = 0,
74                 .lower_margin    = 7,
75                 .crtc_ss         = 0xd010000f,
76                 .crtc_ls         = 0x80070003,
77                 .crtc_gs         = 0x80000000,
78                 .crtc_vpos_gs    = 0x01460147,
79                 .crtc_rev        = 0x00400003,
80                 .crtc_dclk       = 0xa1700030,
81                 .crtc_gclk       = 0x814b0008,
82                 .crtc_goe        = 0x80cc0015,
83                 .crtc_ps1_active = 0x00000000,
84                 .pll_freq        = 100,
85                 .pixclk_divider         = 6, /* Wince uses 14 which gives a */
86                 .pixclk_divider_rotated = 6, /* 7MHz Pclk. We use a 14MHz one */
87                 .pixclk_src     = CLK_SRC_PLL,
88                 .sysclk_divider  = 0,
89                 .sysclk_src     = CLK_SRC_PLL,
90         }
91 };
92
93
94 static struct w100_gpio_regs e800_w100_gpio_info = {
95         .init_data1 = 0xc13fc019,
96         .gpio_dir1  = 0x3e40df7f,
97         .gpio_oe1   = 0x003c3000,
98         .init_data2 = 0x00000000,
99         .gpio_dir2  = 0x00000000,
100         .gpio_oe2   = 0x00000000,
101 };
102
103 static struct w100_mem_info e800_w100_mem_info = {
104         .ext_cntl        = 0x09640011,
105         .sdram_mode_reg  = 0x00600021,
106         .ext_timing_cntl = 0x10001545,
107         .io_cntl         = 0x7ddd7333,
108         .size            = 0x1fffff,
109 };
110
111 static void e800_tg_change(struct w100fb_par *par)
112 {
113         unsigned long tmp;
114
115         tmp = w100fb_gpio_read(W100_GPIO_PORT_A);
116         if (par->mode->xres == 480)
117                 tmp |= 0x100;
118         else
119                 tmp &= ~0x100;
120         w100fb_gpio_write(W100_GPIO_PORT_A, tmp);
121 }
122
123 static struct w100_tg_info e800_tg_info = {
124         .change = e800_tg_change,
125 };
126
127 static struct w100fb_mach_info e800_fb_info = {
128         .modelist   = e800_lcd_mode,
129         .num_modes  = 2,
130         .regs       = &e800_lcd_regs,
131         .gpio       = &e800_w100_gpio_info,
132         .mem        = &e800_w100_mem_info,
133         .tg         = &e800_tg_info,
134         .xtal_freq  = 16000000,
135 };
136
137 static struct resource e800_fb_resources[] = {
138         [0] = {
139                 .start          = 0x0c000000,
140                 .end            = 0x0cffffff,
141                 .flags          = IORESOURCE_MEM,
142         },
143 };
144
145 static struct platform_device e800_fb_device = {
146         .name           = "w100fb",
147         .id             = -1,
148         .dev            = {
149                 .platform_data  = &e800_fb_info,
150         },
151         .num_resources  = ARRAY_SIZE(e800_fb_resources),
152         .resource       = e800_fb_resources,
153 };
154
155 /* --------------------------- UDC definitions --------------------------- */
156
157 static struct pxa2xx_udc_mach_info e800_udc_mach_info = {
158         .gpio_vbus   = GPIO_E800_USB_DISC,
159         .gpio_pullup = GPIO_E800_USB_PULLUP,
160         .gpio_pullup_inverted = 1
161 };
162
163 /* ----------------------------------------------------------------------- */
164
165 static struct platform_device *devices[] __initdata = {
166         &e800_fb_device,
167 };
168
169 static void __init e800_init(void)
170 {
171         platform_add_devices(devices, ARRAY_SIZE(devices));
172         pxa_set_udc_info(&e800_udc_mach_info);
173 }
174
175 MACHINE_START(E800, "Toshiba e800")
176         /* Maintainer: Ian Molton (spyro@f2s.com) */
177         .phys_io        = 0x40000000,
178         .io_pg_offst    = (io_p2v(0x40000000) >> 18) & 0xfffc,
179         .boot_params    = 0xa0000100,
180         .map_io         = pxa_map_io,
181         .init_irq       = pxa25x_init_irq,
182         .fixup          = eseries_fixup,
183         .init_machine   = e800_init,
184         .timer          = &pxa_timer,
185 MACHINE_END
186