Merge branch 'topic/jack-mechanical' into to-push
[linux-2.6] / arch / arm / mach-pxa / e740.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/udc.h>
28
29 #include "generic.h"
30 #include "eseries.h"
31
32
33 /* ------------------------ e740 video support --------------------------- */
34
35 static struct w100_gen_regs e740_lcd_regs = {
36         .lcd_format =            0x00008023,
37         .lcdd_cntl1 =            0x0f000000,
38         .lcdd_cntl2 =            0x0003ffff,
39         .genlcd_cntl1 =          0x00ffff03,
40         .genlcd_cntl2 =          0x003c0f03,
41         .genlcd_cntl3 =          0x000143aa,
42 };
43
44 static struct w100_mode e740_lcd_mode = {
45         .xres            = 240,
46         .yres            = 320,
47         .left_margin     = 20,
48         .right_margin    = 28,
49         .upper_margin    = 9,
50         .lower_margin    = 8,
51         .crtc_ss         = 0x80140013,
52         .crtc_ls         = 0x81150110,
53         .crtc_gs         = 0x80050005,
54         .crtc_vpos_gs    = 0x000a0009,
55         .crtc_rev        = 0x0040010a,
56         .crtc_dclk       = 0xa906000a,
57         .crtc_gclk       = 0x80050108,
58         .crtc_goe        = 0x80050108,
59         .pll_freq        = 57,
60         .pixclk_divider         = 4,
61         .pixclk_divider_rotated = 4,
62         .pixclk_src     = CLK_SRC_XTAL,
63         .sysclk_divider  = 1,
64         .sysclk_src     = CLK_SRC_PLL,
65         .crtc_ps1_active =       0x41060010,
66 };
67
68 static struct w100_gpio_regs e740_w100_gpio_info = {
69         .init_data1 = 0x21002103,
70         .gpio_dir1  = 0xffffdeff,
71         .gpio_oe1   = 0x03c00643,
72         .init_data2 = 0x003f003f,
73         .gpio_dir2  = 0xffffffff,
74         .gpio_oe2   = 0x000000ff,
75 };
76
77 static struct w100fb_mach_info e740_fb_info = {
78         .modelist   = &e740_lcd_mode,
79         .num_modes  = 1,
80         .regs       = &e740_lcd_regs,
81         .gpio       = &e740_w100_gpio_info,
82         .xtal_freq = 14318000,
83         .xtal_dbl   = 1,
84 };
85
86 static struct resource e740_fb_resources[] = {
87         [0] = {
88                 .start          = 0x0c000000,
89                 .end            = 0x0cffffff,
90                 .flags          = IORESOURCE_MEM,
91         },
92 };
93
94 static struct platform_device e740_fb_device = {
95         .name           = "w100fb",
96         .id             = -1,
97         .dev            = {
98                 .platform_data  = &e740_fb_info,
99         },
100         .num_resources  = ARRAY_SIZE(e740_fb_resources),
101         .resource       = e740_fb_resources,
102 };
103
104 /* --------------------------- MFP Pin config -------------------------- */
105
106 static unsigned long e740_pin_config[] __initdata = {
107         /* Chip selects */
108         GPIO15_nCS_1,   /* CS1 - Flash */
109         GPIO79_nCS_3,   /* CS3 - IMAGEON */
110         GPIO80_nCS_4,   /* CS4 - TMIO */
111
112         /* Clocks */
113         GPIO12_32KHz,
114
115         /* BTUART */
116         GPIO42_BTUART_RXD,
117         GPIO43_BTUART_TXD,
118         GPIO44_BTUART_CTS,
119         GPIO45_GPIO, /* Used by TMIO for #SUSPEND */
120
121         /* PC Card */
122         GPIO8_GPIO,   /* CD0 */
123         GPIO44_GPIO,  /* CD1 */
124         GPIO11_GPIO,  /* IRQ0 */
125         GPIO6_GPIO,   /* IRQ1 */
126         GPIO27_GPIO,  /* RST0 */
127         GPIO24_GPIO,  /* RST1 */
128         GPIO20_GPIO,  /* PWR0 */
129         GPIO23_GPIO,  /* PWR1 */
130         GPIO48_nPOE,
131         GPIO49_nPWE,
132         GPIO50_nPIOR,
133         GPIO51_nPIOW,
134         GPIO52_nPCE_1,
135         GPIO53_nPCE_2,
136         GPIO54_nPSKTSEL,
137         GPIO55_nPREG,
138         GPIO56_nPWAIT,
139         GPIO57_nIOIS16,
140
141         /* wakeup */
142         GPIO0_GPIO | WAKEUP_ON_EDGE_RISE,
143 };
144
145 /* ----------------------------------------------------------------------- */
146
147 static struct platform_device *devices[] __initdata = {
148         &e740_fb_device,
149 };
150
151 static void __init e740_init(void)
152 {
153         pxa2xx_mfp_config(ARRAY_AND_SIZE(e740_pin_config));
154         platform_add_devices(devices, ARRAY_SIZE(devices));
155         pxa_set_udc_info(&e7xx_udc_mach_info);
156 }
157
158 MACHINE_START(E740, "Toshiba e740")
159         /* Maintainer: Ian Molton (spyro@f2s.com) */
160         .phys_io        = 0x40000000,
161         .io_pg_offst    = (io_p2v(0x40000000) >> 18) & 0xfffc,
162         .boot_params    = 0xa0000100,
163         .map_io         = pxa_map_io,
164         .init_irq       = pxa25x_init_irq,
165         .fixup          = eseries_fixup,
166         .init_machine   = e740_init,
167         .timer          = &pxa_timer,
168 MACHINE_END
169