blob: a3084125aee729adadcde02f38a5f493bb788256 [file] [log] [blame]
Stefan Schmidt9ab24e42008-07-09 08:08:17 +01001/*
2 * ezx.c - Common code for the EZX platform.
3 *
4 * Copyright (C) 2005-2006 Harald Welte <laforge@openezx.org>,
5 * 2007-2008 Daniel Ribeiro <drwyrm@gmail.com>,
6 * 2007-2008 Stefan Schmidt <stefan@datenfreihafen.org>
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11 *
12 */
13
14#include <linux/kernel.h>
15#include <linux/init.h>
16#include <linux/platform_device.h>
17#include <linux/delay.h>
18#include <linux/pwm_backlight.h>
19
20#include <asm/setup.h>
Russell Kinga09e64f2008-08-05 16:14:15 +010021#include <mach/pxafb.h>
22#include <mach/ohci.h>
23#include <mach/i2c.h>
Stefan Schmidt9ab24e42008-07-09 08:08:17 +010024
Russell Kinga09e64f2008-08-05 16:14:15 +010025#include <mach/mfp-pxa27x.h>
26#include <mach/pxa-regs.h>
27#include <mach/pxa2xx-regs.h>
Stefan Schmidt9ab24e42008-07-09 08:08:17 +010028#include <asm/mach-types.h>
29#include <asm/mach/arch.h>
30
31#include "devices.h"
32#include "generic.h"
33
34static struct platform_pwm_backlight_data ezx_backlight_data = {
35 .pwm_id = 0,
36 .max_brightness = 1023,
37 .dft_brightness = 1023,
38 .pwm_period_ns = 78770,
39};
40
41static struct platform_device ezx_backlight_device = {
42 .name = "pwm-backlight",
43 .dev = {
44 .parent = &pxa27x_device_pwm0.dev,
45 .platform_data = &ezx_backlight_data,
46 },
47};
48
49static struct pxafb_mode_info mode_ezx_old = {
50 .pixclock = 150000,
51 .xres = 240,
52 .yres = 320,
53 .bpp = 16,
54 .hsync_len = 10,
55 .left_margin = 20,
56 .right_margin = 10,
57 .vsync_len = 2,
58 .upper_margin = 3,
59 .lower_margin = 2,
60 .sync = 0,
61};
62
63static struct pxafb_mach_info ezx_fb_info_1 = {
64 .modes = &mode_ezx_old,
65 .num_modes = 1,
66 .lcd_conn = LCD_COLOR_TFT_16BPP,
67};
68
69static struct pxafb_mode_info mode_72r89803y01 = {
70 .pixclock = 192308,
71 .xres = 240,
72 .yres = 320,
73 .bpp = 32,
74 .depth = 18,
75 .hsync_len = 10,
76 .left_margin = 20,
77 .right_margin = 10,
78 .vsync_len = 2,
79 .upper_margin = 3,
80 .lower_margin = 2,
81 .sync = 0,
82};
83
84static struct pxafb_mach_info ezx_fb_info_2 = {
85 .modes = &mode_72r89803y01,
86 .num_modes = 1,
87 .lcd_conn = LCD_COLOR_TFT_18BPP,
88};
89
90static struct platform_device *devices[] __initdata = {
91 &ezx_backlight_device,
92};
93
94static unsigned long ezx_pin_config[] __initdata = {
95 /* PWM backlight */
96 GPIO16_PWM0_OUT,
97
98 /* BTUART */
99 GPIO42_BTUART_RXD,
100 GPIO43_BTUART_TXD,
101 GPIO44_BTUART_CTS,
102 GPIO45_BTUART_RTS,
103
104 /* STUART */
105 GPIO46_STUART_RXD,
106 GPIO47_STUART_TXD,
107
108 /* For A780 support (connected with Neptune GSM chip) */
109 GPIO30_USB_P3_2, /* ICL_TXENB */
110 GPIO31_USB_P3_6, /* ICL_VPOUT */
111 GPIO90_USB_P3_5, /* ICL_VPIN */
112 GPIO91_USB_P3_1, /* ICL_XRXD */
113 GPIO56_USB_P3_4, /* ICL_VMOUT */
114 GPIO113_USB_P3_3, /* /ICL_VMIN */
Eric Miao6f584cf2008-11-28 16:00:24 +0800115
116 /* I2C */
117 GPIO117_I2C_SCL,
118 GPIO118_I2C_SDA,
Stefan Schmidt9ab24e42008-07-09 08:08:17 +0100119};
120
121static void __init ezx_init(void)
122{
123 pxa2xx_mfp_config(ARRAY_AND_SIZE(ezx_pin_config));
124 pxa_set_i2c_info(NULL);
125 if (machine_is_ezx_a780() || machine_is_ezx_e680())
126 set_pxa_fb_info(&ezx_fb_info_1);
127 else
128 set_pxa_fb_info(&ezx_fb_info_2);
129
130 platform_add_devices(devices, ARRAY_SIZE(devices));
131}
132
133static void __init ezx_fixup(struct machine_desc *desc, struct tag *tags,
134 char **cmdline, struct meminfo *mi)
135{
136 /* We have two ram chips. First one with 32MB at 0xA0000000 and a second
137 * 16MB one at 0xAC000000
138 */
139 mi->nr_banks = 2;
140 mi->bank[0].start = 0xa0000000;
141 mi->bank[0].node = 0;
142 mi->bank[0].size = (32*1024*1024);
143 mi->bank[1].start = 0xac000000;
144 mi->bank[1].node = 1;
145 mi->bank[1].size = (16*1024*1024);
146}
147
148#ifdef CONFIG_MACH_EZX_A780
149MACHINE_START(EZX_A780, "Motorola EZX A780")
150 .phys_io = 0x40000000,
151 .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc,
152 .fixup = ezx_fixup,
153 .boot_params = 0xa0000100,
154 .map_io = pxa_map_io,
155 .init_irq = pxa27x_init_irq,
156 .timer = &pxa_timer,
157 .init_machine = &ezx_init,
158MACHINE_END
159#endif
160
161#ifdef CONFIG_MACH_EZX_E680
162MACHINE_START(EZX_E680, "Motorola EZX E680")
163 .phys_io = 0x40000000,
164 .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc,
165 .fixup = ezx_fixup,
166 .boot_params = 0xa0000100,
167 .map_io = pxa_map_io,
168 .init_irq = pxa27x_init_irq,
169 .timer = &pxa_timer,
170 .init_machine = &ezx_init,
171MACHINE_END
172#endif
173
174#ifdef CONFIG_MACH_EZX_A1200
175MACHINE_START(EZX_A1200, "Motorola EZX A1200")
176 .phys_io = 0x40000000,
177 .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc,
178 .fixup = ezx_fixup,
179 .boot_params = 0xa0000100,
180 .map_io = pxa_map_io,
181 .init_irq = pxa27x_init_irq,
182 .timer = &pxa_timer,
183 .init_machine = &ezx_init,
184MACHINE_END
185#endif
186
187#ifdef CONFIG_MACH_EZX_A910
188MACHINE_START(EZX_A910, "Motorola EZX A910")
189 .phys_io = 0x40000000,
190 .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc,
191 .fixup = ezx_fixup,
192 .boot_params = 0xa0000100,
193 .map_io = pxa_map_io,
194 .init_irq = pxa27x_init_irq,
195 .timer = &pxa_timer,
196 .init_machine = &ezx_init,
197MACHINE_END
198#endif
199
200#ifdef CONFIG_MACH_EZX_E6
201MACHINE_START(EZX_E6, "Motorola EZX E6")
202 .phys_io = 0x40000000,
203 .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc,
204 .fixup = ezx_fixup,
205 .boot_params = 0xa0000100,
206 .map_io = pxa_map_io,
207 .init_irq = pxa27x_init_irq,
208 .timer = &pxa_timer,
209 .init_machine = &ezx_init,
210MACHINE_END
211#endif
212
213#ifdef CONFIG_MACH_EZX_E2
214MACHINE_START(EZX_E2, "Motorola EZX E2")
215 .phys_io = 0x40000000,
216 .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc,
217 .fixup = ezx_fixup,
218 .boot_params = 0xa0000100,
219 .map_io = pxa_map_io,
220 .init_irq = pxa27x_init_irq,
221 .timer = &pxa_timer,
222 .init_machine = &ezx_init,
223MACHINE_END
224#endif