diff options
Diffstat (limited to 'arch/arm/mach-pxa/palmt5.c')
-rw-r--r-- | arch/arm/mach-pxa/palmt5.c | 282 |
1 files changed, 30 insertions, 252 deletions
diff --git a/arch/arm/mach-pxa/palmt5.c b/arch/arm/mach-pxa/palmt5.c index 0b36d7ddff25..731ee7bc361c 100644 --- a/arch/arm/mach-pxa/palmt5.c +++ b/arch/arm/mach-pxa/palmt5.c | |||
@@ -41,6 +41,7 @@ | |||
41 | #include <mach/pxa27x_keypad.h> | 41 | #include <mach/pxa27x_keypad.h> |
42 | #include <mach/udc.h> | 42 | #include <mach/udc.h> |
43 | #include <mach/palmasoc.h> | 43 | #include <mach/palmasoc.h> |
44 | #include <mach/palm27x.h> | ||
44 | 45 | ||
45 | #include "generic.h" | 46 | #include "generic.h" |
46 | #include "devices.h" | 47 | #include "devices.h" |
@@ -103,19 +104,9 @@ static unsigned long palmt5_pin_config[] __initdata = { | |||
103 | }; | 104 | }; |
104 | 105 | ||
105 | /****************************************************************************** | 106 | /****************************************************************************** |
106 | * SD/MMC card controller | ||
107 | ******************************************************************************/ | ||
108 | static struct pxamci_platform_data palmt5_mci_platform_data = { | ||
109 | .ocr_mask = MMC_VDD_32_33 | MMC_VDD_33_34, | ||
110 | .gpio_card_detect = GPIO_NR_PALMT5_SD_DETECT_N, | ||
111 | .gpio_card_ro = GPIO_NR_PALMT5_SD_READONLY, | ||
112 | .gpio_power = GPIO_NR_PALMT5_SD_POWER, | ||
113 | .detect_delay_ms = 200, | ||
114 | }; | ||
115 | |||
116 | /****************************************************************************** | ||
117 | * GPIO keyboard | 107 | * GPIO keyboard |
118 | ******************************************************************************/ | 108 | ******************************************************************************/ |
109 | #if defined(CONFIG_KEYBOARD_PXA27x) || defined(CONFIG_KEYBOARD_PXA27x_MODULE) | ||
119 | static unsigned int palmt5_matrix_keys[] = { | 110 | static unsigned int palmt5_matrix_keys[] = { |
120 | KEY(0, 0, KEY_POWER), | 111 | KEY(0, 0, KEY_POWER), |
121 | KEY(0, 1, KEY_F1), | 112 | KEY(0, 1, KEY_F1), |
@@ -141,9 +132,18 @@ static struct pxa27x_keypad_platform_data palmt5_keypad_platform_data = { | |||
141 | .debounce_interval = 30, | 132 | .debounce_interval = 30, |
142 | }; | 133 | }; |
143 | 134 | ||
135 | static void __init palmt5_kpc_init(void) | ||
136 | { | ||
137 | pxa_set_keypad_info(&palmt5_keypad_platform_data); | ||
138 | } | ||
139 | #else | ||
140 | static inline void palmt5_kpc_init(void) {} | ||
141 | #endif | ||
142 | |||
144 | /****************************************************************************** | 143 | /****************************************************************************** |
145 | * GPIO keys | 144 | * GPIO keys |
146 | ******************************************************************************/ | 145 | ******************************************************************************/ |
146 | #if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE) | ||
147 | static struct gpio_keys_button palmt5_pxa_buttons[] = { | 147 | static struct gpio_keys_button palmt5_pxa_buttons[] = { |
148 | {KEY_F8, GPIO_NR_PALMT5_HOTSYNC_BUTTON_N, 1, "HotSync Button" }, | 148 | {KEY_F8, GPIO_NR_PALMT5_HOTSYNC_BUTTON_N, 1, "HotSync Button" }, |
149 | }; | 149 | }; |
@@ -161,260 +161,38 @@ static struct platform_device palmt5_pxa_keys = { | |||
161 | }, | 161 | }, |
162 | }; | 162 | }; |
163 | 163 | ||
164 | /****************************************************************************** | 164 | static void __init palmt5_keys_init(void) |
165 | * Backlight | ||
166 | ******************************************************************************/ | ||
167 | static int palmt5_backlight_init(struct device *dev) | ||
168 | { | ||
169 | int ret; | ||
170 | |||
171 | ret = gpio_request(GPIO_NR_PALMT5_BL_POWER, "BL POWER"); | ||
172 | if (ret) | ||
173 | goto err; | ||
174 | ret = gpio_direction_output(GPIO_NR_PALMT5_BL_POWER, 0); | ||
175 | if (ret) | ||
176 | goto err2; | ||
177 | ret = gpio_request(GPIO_NR_PALMT5_LCD_POWER, "LCD POWER"); | ||
178 | if (ret) | ||
179 | goto err2; | ||
180 | ret = gpio_direction_output(GPIO_NR_PALMT5_LCD_POWER, 0); | ||
181 | if (ret) | ||
182 | goto err3; | ||
183 | |||
184 | return 0; | ||
185 | err3: | ||
186 | gpio_free(GPIO_NR_PALMT5_LCD_POWER); | ||
187 | err2: | ||
188 | gpio_free(GPIO_NR_PALMT5_BL_POWER); | ||
189 | err: | ||
190 | return ret; | ||
191 | } | ||
192 | |||
193 | static int palmt5_backlight_notify(struct device *dev, int brightness) | ||
194 | { | ||
195 | gpio_set_value(GPIO_NR_PALMT5_BL_POWER, brightness); | ||
196 | gpio_set_value(GPIO_NR_PALMT5_LCD_POWER, brightness); | ||
197 | return brightness; | ||
198 | } | ||
199 | |||
200 | static void palmt5_backlight_exit(struct device *dev) | ||
201 | { | ||
202 | gpio_free(GPIO_NR_PALMT5_BL_POWER); | ||
203 | gpio_free(GPIO_NR_PALMT5_LCD_POWER); | ||
204 | } | ||
205 | |||
206 | static struct platform_pwm_backlight_data palmt5_backlight_data = { | ||
207 | .pwm_id = 0, | ||
208 | .max_brightness = PALMT5_MAX_INTENSITY, | ||
209 | .dft_brightness = PALMT5_MAX_INTENSITY, | ||
210 | .pwm_period_ns = PALMT5_PERIOD_NS, | ||
211 | .init = palmt5_backlight_init, | ||
212 | .notify = palmt5_backlight_notify, | ||
213 | .exit = palmt5_backlight_exit, | ||
214 | }; | ||
215 | |||
216 | static struct platform_device palmt5_backlight = { | ||
217 | .name = "pwm-backlight", | ||
218 | .dev = { | ||
219 | .parent = &pxa27x_device_pwm0.dev, | ||
220 | .platform_data = &palmt5_backlight_data, | ||
221 | }, | ||
222 | }; | ||
223 | |||
224 | /****************************************************************************** | ||
225 | * IrDA | ||
226 | ******************************************************************************/ | ||
227 | static struct pxaficp_platform_data palmt5_ficp_platform_data = { | ||
228 | .gpio_pwdown = GPIO_NR_PALMT5_IR_DISABLE, | ||
229 | .transceiver_cap = IR_SIRMODE | IR_OFF, | ||
230 | }; | ||
231 | |||
232 | /****************************************************************************** | ||
233 | * UDC | ||
234 | ******************************************************************************/ | ||
235 | static struct gpio_vbus_mach_info palmt5_udc_info = { | ||
236 | .gpio_vbus = GPIO_NR_PALMT5_USB_DETECT_N, | ||
237 | .gpio_vbus_inverted = 1, | ||
238 | .gpio_pullup = GPIO_NR_PALMT5_USB_PULLUP, | ||
239 | }; | ||
240 | |||
241 | static struct platform_device palmt5_gpio_vbus = { | ||
242 | .name = "gpio-vbus", | ||
243 | .id = -1, | ||
244 | .dev = { | ||
245 | .platform_data = &palmt5_udc_info, | ||
246 | }, | ||
247 | }; | ||
248 | |||
249 | /****************************************************************************** | ||
250 | * Power supply | ||
251 | ******************************************************************************/ | ||
252 | static int power_supply_init(struct device *dev) | ||
253 | { | ||
254 | int ret; | ||
255 | |||
256 | ret = gpio_request(GPIO_NR_PALMT5_POWER_DETECT, "CABLE_STATE_AC"); | ||
257 | if (ret) | ||
258 | goto err1; | ||
259 | ret = gpio_direction_input(GPIO_NR_PALMT5_POWER_DETECT); | ||
260 | if (ret) | ||
261 | goto err2; | ||
262 | |||
263 | return 0; | ||
264 | err2: | ||
265 | gpio_free(GPIO_NR_PALMT5_POWER_DETECT); | ||
266 | err1: | ||
267 | return ret; | ||
268 | } | ||
269 | |||
270 | static int palmt5_is_ac_online(void) | ||
271 | { | ||
272 | return gpio_get_value(GPIO_NR_PALMT5_POWER_DETECT); | ||
273 | } | ||
274 | |||
275 | static void power_supply_exit(struct device *dev) | ||
276 | { | ||
277 | gpio_free(GPIO_NR_PALMT5_POWER_DETECT); | ||
278 | } | ||
279 | |||
280 | static char *palmt5_supplicants[] = { | ||
281 | "main-battery", | ||
282 | }; | ||
283 | |||
284 | static struct pda_power_pdata power_supply_info = { | ||
285 | .init = power_supply_init, | ||
286 | .is_ac_online = palmt5_is_ac_online, | ||
287 | .exit = power_supply_exit, | ||
288 | .supplied_to = palmt5_supplicants, | ||
289 | .num_supplicants = ARRAY_SIZE(palmt5_supplicants), | ||
290 | }; | ||
291 | |||
292 | static struct platform_device power_supply = { | ||
293 | .name = "pda-power", | ||
294 | .id = -1, | ||
295 | .dev = { | ||
296 | .platform_data = &power_supply_info, | ||
297 | }, | ||
298 | }; | ||
299 | |||
300 | /****************************************************************************** | ||
301 | * WM97xx audio, battery | ||
302 | ******************************************************************************/ | ||
303 | static struct wm97xx_batt_pdata palmt5_batt_pdata = { | ||
304 | .batt_aux = WM97XX_AUX_ID3, | ||
305 | .temp_aux = WM97XX_AUX_ID2, | ||
306 | .charge_gpio = -1, | ||
307 | .max_voltage = PALMT5_BAT_MAX_VOLTAGE, | ||
308 | .min_voltage = PALMT5_BAT_MIN_VOLTAGE, | ||
309 | .batt_mult = 1000, | ||
310 | .batt_div = 414, | ||
311 | .temp_mult = 1, | ||
312 | .temp_div = 1, | ||
313 | .batt_tech = POWER_SUPPLY_TECHNOLOGY_LIPO, | ||
314 | .batt_name = "main-batt", | ||
315 | }; | ||
316 | |||
317 | static struct wm97xx_pdata palmt5_wm97xx_pdata = { | ||
318 | .batt_pdata = &palmt5_batt_pdata, | ||
319 | }; | ||
320 | |||
321 | static pxa2xx_audio_ops_t palmt5_ac97_pdata = { | ||
322 | .reset_gpio = 95, | ||
323 | .codec_pdata = { &palmt5_wm97xx_pdata, }, | ||
324 | }; | ||
325 | |||
326 | static struct palm27x_asoc_info palmt5_asoc_pdata = { | ||
327 | .jack_gpio = GPIO_NR_PALMT5_EARPHONE_DETECT, | ||
328 | }; | ||
329 | |||
330 | static struct platform_device palmt5_asoc = { | ||
331 | .name = "palm27x-asoc", | ||
332 | .id = -1, | ||
333 | .dev = { | ||
334 | .platform_data = &palmt5_asoc_pdata, | ||
335 | }, | ||
336 | }; | ||
337 | |||
338 | /****************************************************************************** | ||
339 | * Framebuffer | ||
340 | ******************************************************************************/ | ||
341 | static struct pxafb_mode_info palmt5_lcd_modes[] = { | ||
342 | { | ||
343 | .pixclock = 57692, | ||
344 | .xres = 320, | ||
345 | .yres = 480, | ||
346 | .bpp = 16, | ||
347 | |||
348 | .left_margin = 32, | ||
349 | .right_margin = 1, | ||
350 | .upper_margin = 7, | ||
351 | .lower_margin = 1, | ||
352 | |||
353 | .hsync_len = 4, | ||
354 | .vsync_len = 1, | ||
355 | }, | ||
356 | }; | ||
357 | |||
358 | static struct pxafb_mach_info palmt5_lcd_screen = { | ||
359 | .modes = palmt5_lcd_modes, | ||
360 | .num_modes = ARRAY_SIZE(palmt5_lcd_modes), | ||
361 | .lcd_conn = LCD_COLOR_TFT_16BPP | LCD_PCLK_EDGE_FALL, | ||
362 | }; | ||
363 | |||
364 | /****************************************************************************** | ||
365 | * Power management - standby | ||
366 | ******************************************************************************/ | ||
367 | static void __init palmt5_pm_init(void) | ||
368 | { | 165 | { |
369 | static u32 resume[] = { | 166 | platform_device_register(&palmt5_pxa_keys); |
370 | 0xe3a00101, /* mov r0, #0x40000000 */ | ||
371 | 0xe380060f, /* orr r0, r0, #0x00f00000 */ | ||
372 | 0xe590f008, /* ldr pc, [r0, #0x08] */ | ||
373 | }; | ||
374 | |||
375 | /* copy the bootloader */ | ||
376 | memcpy(phys_to_virt(PALMT5_STR_BASE), resume, sizeof(resume)); | ||
377 | } | 167 | } |
168 | #else | ||
169 | static inline void palmt5_keys_init(void) {} | ||
170 | #endif | ||
378 | 171 | ||
379 | /****************************************************************************** | 172 | /****************************************************************************** |
380 | * Machine init | 173 | * Machine init |
381 | ******************************************************************************/ | 174 | ******************************************************************************/ |
382 | static struct platform_device *devices[] __initdata = { | ||
383 | #if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE) | ||
384 | &palmt5_pxa_keys, | ||
385 | #endif | ||
386 | &palmt5_backlight, | ||
387 | &power_supply, | ||
388 | &palmt5_asoc, | ||
389 | &palmt5_gpio_vbus, | ||
390 | }; | ||
391 | |||
392 | /* setup udc GPIOs initial state */ | ||
393 | static void __init palmt5_udc_init(void) | ||
394 | { | ||
395 | if (!gpio_request(GPIO_NR_PALMT5_USB_PULLUP, "UDC Vbus")) { | ||
396 | gpio_direction_output(GPIO_NR_PALMT5_USB_PULLUP, 1); | ||
397 | gpio_free(GPIO_NR_PALMT5_USB_PULLUP); | ||
398 | } | ||
399 | } | ||
400 | |||
401 | static void __init palmt5_init(void) | 175 | static void __init palmt5_init(void) |
402 | { | 176 | { |
403 | pxa2xx_mfp_config(ARRAY_AND_SIZE(palmt5_pin_config)); | 177 | pxa2xx_mfp_config(ARRAY_AND_SIZE(palmt5_pin_config)); |
404 | |||
405 | pxa_set_ffuart_info(NULL); | 178 | pxa_set_ffuart_info(NULL); |
406 | pxa_set_btuart_info(NULL); | 179 | pxa_set_btuart_info(NULL); |
407 | pxa_set_stuart_info(NULL); | 180 | pxa_set_stuart_info(NULL); |
408 | 181 | ||
409 | palmt5_pm_init(); | 182 | palm27x_mmc_init(GPIO_NR_PALMT5_SD_DETECT_N, GPIO_NR_PALMT5_SD_READONLY, |
410 | set_pxa_fb_info(&palmt5_lcd_screen); | 183 | GPIO_NR_PALMT5_SD_POWER, 0); |
411 | pxa_set_mci_info(&palmt5_mci_platform_data); | 184 | palm27x_pm_init(PALMT5_STR_BASE); |
412 | palmt5_udc_init(); | 185 | palm27x_lcd_init(-1, &palm_320x480_lcd_mode); |
413 | pxa_set_ac97_info(&palmt5_ac97_pdata); | 186 | palm27x_udc_init(GPIO_NR_PALMT5_USB_DETECT_N, |
414 | pxa_set_ficp_info(&palmt5_ficp_platform_data); | 187 | GPIO_NR_PALMT5_USB_PULLUP, 1); |
415 | pxa_set_keypad_info(&palmt5_keypad_platform_data); | 188 | palm27x_irda_init(GPIO_NR_PALMT5_IR_DISABLE); |
416 | 189 | palm27x_ac97_init(PALMT5_BAT_MIN_VOLTAGE, PALMT5_BAT_MAX_VOLTAGE, | |
417 | platform_add_devices(devices, ARRAY_SIZE(devices)); | 190 | GPIO_NR_PALMT5_EARPHONE_DETECT, 95); |
191 | palm27x_pwm_init(GPIO_NR_PALMT5_BL_POWER, GPIO_NR_PALMT5_LCD_POWER); | ||
192 | palm27x_power_init(GPIO_NR_PALMT5_POWER_DETECT, -1); | ||
193 | palm27x_pmic_init(); | ||
194 | palmt5_kpc_init(); | ||
195 | palmt5_keys_init(); | ||
418 | } | 196 | } |
419 | 197 | ||
420 | MACHINE_START(PALMT5, "Palm Tungsten|T5") | 198 | MACHINE_START(PALMT5, "Palm Tungsten|T5") |