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