blob: 83c56d3abacbda639d19e6052217a7892cf3ee6a [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 */
116};
117
118static void __init ezx_init(void)
119{
120 pxa2xx_mfp_config(ARRAY_AND_SIZE(ezx_pin_config));
121 pxa_set_i2c_info(NULL);
122 if (machine_is_ezx_a780() || machine_is_ezx_e680())
123 set_pxa_fb_info(&ezx_fb_info_1);
124 else
125 set_pxa_fb_info(&ezx_fb_info_2);
126
127 platform_add_devices(devices, ARRAY_SIZE(devices));
128}
129
130static void __init ezx_fixup(struct machine_desc *desc, struct tag *tags,
131 char **cmdline, struct meminfo *mi)
132{
133 /* We have two ram chips. First one with 32MB at 0xA0000000 and a second
134 * 16MB one at 0xAC000000
135 */
136 mi->nr_banks = 2;
137 mi->bank[0].start = 0xa0000000;
138 mi->bank[0].node = 0;
139 mi->bank[0].size = (32*1024*1024);
140 mi->bank[1].start = 0xac000000;
141 mi->bank[1].node = 1;
142 mi->bank[1].size = (16*1024*1024);
143}
144
145#ifdef CONFIG_MACH_EZX_A780
146MACHINE_START(EZX_A780, "Motorola EZX A780")
147 .phys_io = 0x40000000,
148 .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc,
149 .fixup = ezx_fixup,
150 .boot_params = 0xa0000100,
151 .map_io = pxa_map_io,
152 .init_irq = pxa27x_init_irq,
153 .timer = &pxa_timer,
154 .init_machine = &ezx_init,
155MACHINE_END
156#endif
157
158#ifdef CONFIG_MACH_EZX_E680
159MACHINE_START(EZX_E680, "Motorola EZX E680")
160 .phys_io = 0x40000000,
161 .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc,
162 .fixup = ezx_fixup,
163 .boot_params = 0xa0000100,
164 .map_io = pxa_map_io,
165 .init_irq = pxa27x_init_irq,
166 .timer = &pxa_timer,
167 .init_machine = &ezx_init,
168MACHINE_END
169#endif
170
171#ifdef CONFIG_MACH_EZX_A1200
172MACHINE_START(EZX_A1200, "Motorola EZX A1200")
173 .phys_io = 0x40000000,
174 .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc,
175 .fixup = ezx_fixup,
176 .boot_params = 0xa0000100,
177 .map_io = pxa_map_io,
178 .init_irq = pxa27x_init_irq,
179 .timer = &pxa_timer,
180 .init_machine = &ezx_init,
181MACHINE_END
182#endif
183
184#ifdef CONFIG_MACH_EZX_A910
185MACHINE_START(EZX_A910, "Motorola EZX A910")
186 .phys_io = 0x40000000,
187 .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc,
188 .fixup = ezx_fixup,
189 .boot_params = 0xa0000100,
190 .map_io = pxa_map_io,
191 .init_irq = pxa27x_init_irq,
192 .timer = &pxa_timer,
193 .init_machine = &ezx_init,
194MACHINE_END
195#endif
196
197#ifdef CONFIG_MACH_EZX_E6
198MACHINE_START(EZX_E6, "Motorola EZX E6")
199 .phys_io = 0x40000000,
200 .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc,
201 .fixup = ezx_fixup,
202 .boot_params = 0xa0000100,
203 .map_io = pxa_map_io,
204 .init_irq = pxa27x_init_irq,
205 .timer = &pxa_timer,
206 .init_machine = &ezx_init,
207MACHINE_END
208#endif
209
210#ifdef CONFIG_MACH_EZX_E2
211MACHINE_START(EZX_E2, "Motorola EZX E2")
212 .phys_io = 0x40000000,
213 .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc,
214 .fixup = ezx_fixup,
215 .boot_params = 0xa0000100,
216 .map_io = pxa_map_io,
217 .init_irq = pxa27x_init_irq,
218 .timer = &pxa_timer,
219 .init_machine = &ezx_init,
220MACHINE_END
221#endif