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