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