Merge branch 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab...
[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 #include <linux/mfd/tc6393xb.h>
19
20 #include <video/w100fb.h>
21
22 #include <asm/setup.h>
23 #include <asm/mach/arch.h>
24 #include <asm/mach-types.h>
25
26 #include <mach/pxa25x.h>
27 #include <mach/eseries-gpio.h>
28 #include <mach/udc.h>
29 #include <mach/irqs.h>
30
31 #include "generic.h"
32 #include "eseries.h"
33 #include "clock.h"
34
35 /* ------------------------ e800 LCD definitions ------------------------- */
36
37 static struct w100_gen_regs e800_lcd_regs = {
38         .lcd_format =            0x00008003,
39         .lcdd_cntl1 =            0x02a00000,
40         .lcdd_cntl2 =            0x0003ffff,
41         .genlcd_cntl1 =          0x000ff2a3,
42         .genlcd_cntl2 =          0x000002a3,
43         .genlcd_cntl3 =          0x000102aa,
44 };
45
46 static struct w100_mode e800_lcd_mode[2] = {
47         [0] = {
48                 .xres            = 480,
49                 .yres            = 640,
50                 .left_margin     = 52,
51                 .right_margin    = 148,
52                 .upper_margin    = 2,
53                 .lower_margin    = 6,
54                 .crtc_ss         = 0x80350034,
55                 .crtc_ls         = 0x802b0026,
56                 .crtc_gs         = 0x80160016,
57                 .crtc_vpos_gs    = 0x00020003,
58                 .crtc_rev        = 0x0040001d,
59                 .crtc_dclk       = 0xe0000000,
60                 .crtc_gclk       = 0x82a50049,
61                 .crtc_goe        = 0x80ee001c,
62                 .crtc_ps1_active = 0x00000000,
63                 .pll_freq        = 128,
64                 .pixclk_divider         = 4,
65                 .pixclk_divider_rotated = 6,
66                 .pixclk_src     = CLK_SRC_PLL,
67                 .sysclk_divider  = 0,
68                 .sysclk_src     = CLK_SRC_PLL,
69         },
70         [1] = {
71                 .xres            = 240,
72                 .yres            = 320,
73                 .left_margin     = 15,
74                 .right_margin    = 88,
75                 .upper_margin    = 0,
76                 .lower_margin    = 7,
77                 .crtc_ss         = 0xd010000f,
78                 .crtc_ls         = 0x80070003,
79                 .crtc_gs         = 0x80000000,
80                 .crtc_vpos_gs    = 0x01460147,
81                 .crtc_rev        = 0x00400003,
82                 .crtc_dclk       = 0xa1700030,
83                 .crtc_gclk       = 0x814b0008,
84                 .crtc_goe        = 0x80cc0015,
85                 .crtc_ps1_active = 0x00000000,
86                 .pll_freq        = 100,
87                 .pixclk_divider         = 6, /* Wince uses 14 which gives a */
88                 .pixclk_divider_rotated = 6, /* 7MHz Pclk. We use a 14MHz one */
89                 .pixclk_src     = CLK_SRC_PLL,
90                 .sysclk_divider  = 0,
91                 .sysclk_src     = CLK_SRC_PLL,
92         }
93 };
94
95
96 static struct w100_gpio_regs e800_w100_gpio_info = {
97         .init_data1 = 0xc13fc019,
98         .gpio_dir1  = 0x3e40df7f,
99         .gpio_oe1   = 0x003c3000,
100         .init_data2 = 0x00000000,
101         .gpio_dir2  = 0x00000000,
102         .gpio_oe2   = 0x00000000,
103 };
104
105 static struct w100_mem_info e800_w100_mem_info = {
106         .ext_cntl        = 0x09640011,
107         .sdram_mode_reg  = 0x00600021,
108         .ext_timing_cntl = 0x10001545,
109         .io_cntl         = 0x7ddd7333,
110         .size            = 0x1fffff,
111 };
112
113 static void e800_tg_change(struct w100fb_par *par)
114 {
115         unsigned long tmp;
116
117         tmp = w100fb_gpio_read(W100_GPIO_PORT_A);
118         if (par->mode->xres == 480)
119                 tmp |= 0x100;
120         else
121                 tmp &= ~0x100;
122         w100fb_gpio_write(W100_GPIO_PORT_A, tmp);
123 }
124
125 static struct w100_tg_info e800_tg_info = {
126         .change = e800_tg_change,
127 };
128
129 static struct w100fb_mach_info e800_fb_info = {
130         .modelist   = e800_lcd_mode,
131         .num_modes  = 2,
132         .regs       = &e800_lcd_regs,
133         .gpio       = &e800_w100_gpio_info,
134         .mem        = &e800_w100_mem_info,
135         .tg         = &e800_tg_info,
136         .xtal_freq  = 16000000,
137 };
138
139 static struct resource e800_fb_resources[] = {
140         [0] = {
141                 .start          = 0x0c000000,
142                 .end            = 0x0cffffff,
143                 .flags          = IORESOURCE_MEM,
144         },
145 };
146
147 static struct platform_device e800_fb_device = {
148         .name           = "w100fb",
149         .id             = -1,
150         .dev            = {
151                 .platform_data  = &e800_fb_info,
152         },
153         .num_resources  = ARRAY_SIZE(e800_fb_resources),
154         .resource       = e800_fb_resources,
155 };
156
157 /* --------------------------- UDC definitions --------------------------- */
158
159 static struct pxa2xx_udc_mach_info e800_udc_mach_info = {
160         .gpio_vbus   = GPIO_E800_USB_DISC,
161         .gpio_pullup = GPIO_E800_USB_PULLUP,
162         .gpio_pullup_inverted = 1
163 };
164
165 /* ----------------- e800 tc6393xb parameters ------------------ */
166
167 static struct tc6393xb_platform_data e800_tc6393xb_info = {
168         .irq_base       = IRQ_BOARD_START,
169         .scr_pll2cr     = 0x0cc1,
170         .scr_gper       = 0,
171         .gpio_base      = -1,
172         .suspend        = &eseries_tmio_suspend,
173         .resume         = &eseries_tmio_resume,
174         .enable         = &eseries_tmio_enable,
175         .disable        = &eseries_tmio_disable,
176 };
177
178 static struct platform_device e800_tc6393xb_device = {
179         .name           = "tc6393xb",
180         .id             = -1,
181         .dev            = {
182                 .platform_data = &e800_tc6393xb_info,
183         },
184         .num_resources = 2,
185         .resource      = eseries_tmio_resources,
186 };
187
188 /* ----------------------------------------------------------------------- */
189
190 static struct platform_device *devices[] __initdata = {
191         &e800_fb_device,
192         &e800_tc6393xb_device,
193 };
194
195 static void __init e800_init(void)
196 {
197         clk_add_alias("CLK_CK3P6MI", e800_tc6393xb_device.name,
198                         "GPIO11_CLK", NULL),
199         eseries_get_tmio_gpios();
200         platform_add_devices(devices, ARRAY_SIZE(devices));
201         pxa_set_udc_info(&e800_udc_mach_info);
202 }
203
204 MACHINE_START(E800, "Toshiba e800")
205         /* Maintainer: Ian Molton (spyro@f2s.com) */
206         .phys_io        = 0x40000000,
207         .io_pg_offst    = (io_p2v(0x40000000) >> 18) & 0xfffc,
208         .boot_params    = 0xa0000100,
209         .map_io         = pxa_map_io,
210         .init_irq       = pxa25x_init_irq,
211         .fixup          = eseries_fixup,
212         .init_machine   = e800_init,
213         .timer          = &pxa_timer,
214 MACHINE_END
215