Commit | Line | Data |
---|---|---|
9ab24e4e SS |
1 | /* |
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> | |
a09e64fb RK |
21 | #include <mach/pxafb.h> |
22 | #include <mach/ohci.h> | |
23 | #include <mach/i2c.h> | |
9ab24e4e | 24 | |
a09e64fb RK |
25 | #include <mach/mfp-pxa27x.h> |
26 | #include <mach/pxa-regs.h> | |
27 | #include <mach/pxa2xx-regs.h> | |
9ab24e4e SS |
28 | #include <asm/mach-types.h> |
29 | #include <asm/mach/arch.h> | |
30 | ||
31 | #include "devices.h" | |
32 | #include "generic.h" | |
33 | ||
34 | static 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 | ||
41 | static 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 | ||
49 | static 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 | ||
63 | static 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 | ||
69 | static 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 | ||
84 | static 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 | ||
90 | static struct platform_device *devices[] __initdata = { | |
91 | &ezx_backlight_device, | |
92 | }; | |
93 | ||
94 | static 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 */ | |
6f584cfa EM |
115 | |
116 | /* I2C */ | |
117 | GPIO117_I2C_SCL, | |
118 | GPIO118_I2C_SDA, | |
9ab24e4e SS |
119 | }; |
120 | ||
121 | static 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 | ||
9ab24e4e SS |
133 | #ifdef CONFIG_MACH_EZX_A780 |
134 | MACHINE_START(EZX_A780, "Motorola EZX A780") | |
135 | .phys_io = 0x40000000, | |
136 | .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc, | |
9ab24e4e SS |
137 | .boot_params = 0xa0000100, |
138 | .map_io = pxa_map_io, | |
139 | .init_irq = pxa27x_init_irq, | |
140 | .timer = &pxa_timer, | |
141 | .init_machine = &ezx_init, | |
142 | MACHINE_END | |
143 | #endif | |
144 | ||
145 | #ifdef CONFIG_MACH_EZX_E680 | |
146 | MACHINE_START(EZX_E680, "Motorola EZX E680") | |
147 | .phys_io = 0x40000000, | |
148 | .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc, | |
9ab24e4e SS |
149 | .boot_params = 0xa0000100, |
150 | .map_io = pxa_map_io, | |
151 | .init_irq = pxa27x_init_irq, | |
152 | .timer = &pxa_timer, | |
153 | .init_machine = &ezx_init, | |
154 | MACHINE_END | |
155 | #endif | |
156 | ||
157 | #ifdef CONFIG_MACH_EZX_A1200 | |
158 | MACHINE_START(EZX_A1200, "Motorola EZX A1200") | |
159 | .phys_io = 0x40000000, | |
160 | .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc, | |
9ab24e4e SS |
161 | .boot_params = 0xa0000100, |
162 | .map_io = pxa_map_io, | |
163 | .init_irq = pxa27x_init_irq, | |
164 | .timer = &pxa_timer, | |
165 | .init_machine = &ezx_init, | |
166 | MACHINE_END | |
167 | #endif | |
168 | ||
169 | #ifdef CONFIG_MACH_EZX_A910 | |
170 | MACHINE_START(EZX_A910, "Motorola EZX A910") | |
171 | .phys_io = 0x40000000, | |
172 | .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc, | |
9ab24e4e SS |
173 | .boot_params = 0xa0000100, |
174 | .map_io = pxa_map_io, | |
175 | .init_irq = pxa27x_init_irq, | |
176 | .timer = &pxa_timer, | |
177 | .init_machine = &ezx_init, | |
178 | MACHINE_END | |
179 | #endif | |
180 | ||
181 | #ifdef CONFIG_MACH_EZX_E6 | |
182 | MACHINE_START(EZX_E6, "Motorola EZX E6") | |
183 | .phys_io = 0x40000000, | |
184 | .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc, | |
9ab24e4e SS |
185 | .boot_params = 0xa0000100, |
186 | .map_io = pxa_map_io, | |
187 | .init_irq = pxa27x_init_irq, | |
188 | .timer = &pxa_timer, | |
189 | .init_machine = &ezx_init, | |
190 | MACHINE_END | |
191 | #endif | |
192 | ||
193 | #ifdef CONFIG_MACH_EZX_E2 | |
194 | MACHINE_START(EZX_E2, "Motorola EZX E2") | |
195 | .phys_io = 0x40000000, | |
196 | .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc, | |
9ab24e4e SS |
197 | .boot_params = 0xa0000100, |
198 | .map_io = pxa_map_io, | |
199 | .init_irq = pxa27x_init_irq, | |
200 | .timer = &pxa_timer, | |
201 | .init_machine = &ezx_init, | |
202 | MACHINE_END | |
203 | #endif |