blob: 5e66028d2911d6bce3012f3a915f93063f2b8ecf [file] [log] [blame]
Tomas 'Sleep_Walker' Ceche6c3f4b2009-05-18 15:24:14 +02001/*
Tomáš Čechbb2ae8f2009-09-11 13:57:01 +02002 * Hardware definitions for Palm Treo smartphones
3 *
4 * currently supported:
5 * Palm Treo 680 (GSM)
Tomas 'Sleep_Walker' Ceche6c3f4b2009-05-18 15:24:14 +02006 *
7 * Author: Tomas Cech <sleep_walker@suse.cz>
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License version 2 as
11 * published by the Free Software Foundation.
12 *
13 * (find more info at www.hackndev.com)
14 *
15 */
16
17#include <linux/platform_device.h>
18#include <linux/delay.h>
19#include <linux/irq.h>
20#include <linux/gpio_keys.h>
21#include <linux/input.h>
22#include <linux/pda_power.h>
23#include <linux/pwm_backlight.h>
24#include <linux/gpio.h>
25#include <linux/wm97xx_batt.h>
26#include <linux/power_supply.h>
27#include <linux/sysdev.h>
28#include <linux/w1-gpio.h>
29
30#include <asm/mach-types.h>
31#include <asm/mach/arch.h>
32#include <asm/mach/map.h>
33
34#include <mach/pxa27x.h>
35#include <mach/pxa27x-udc.h>
36#include <mach/audio.h>
Tomáš Čechbb2ae8f2009-09-11 13:57:01 +020037#include <mach/palmtreo.h>
Tomas 'Sleep_Walker' Ceche6c3f4b2009-05-18 15:24:14 +020038#include <mach/mmc.h>
39#include <mach/pxafb.h>
40#include <mach/irda.h>
41#include <mach/pxa27x_keypad.h>
42#include <mach/udc.h>
43#include <mach/ohci.h>
44#include <mach/pxa2xx-regs.h>
45#include <mach/palmasoc.h>
46#include <mach/camera.h>
47
48#include <sound/pxa2xx-lib.h>
49
50#include "generic.h"
51#include "devices.h"
52
53/******************************************************************************
54 * Pin configuration
55 ******************************************************************************/
Tomáš Čechbb2ae8f2009-09-11 13:57:01 +020056static unsigned long treo_pin_config[] __initdata = {
Tomas 'Sleep_Walker' Ceche6c3f4b2009-05-18 15:24:14 +020057 /* MMC */
58 GPIO32_MMC_CLK,
59 GPIO92_MMC_DAT_0,
60 GPIO109_MMC_DAT_1,
61 GPIO110_MMC_DAT_2,
62 GPIO111_MMC_DAT_3,
63 GPIO112_MMC_CMD,
Tomas 'Sleep_Walker' Ceche6c3f4b2009-05-18 15:24:14 +020064 GPIO113_GPIO, /* SD detect */
65
66 /* AC97 */
67 GPIO28_AC97_BITCLK,
68 GPIO29_AC97_SDATA_IN_0,
69 GPIO30_AC97_SDATA_OUT,
70 GPIO31_AC97_SYNC,
71 GPIO89_AC97_SYSCLK,
72 GPIO95_AC97_nRESET,
73
74 /* IrDA */
75 GPIO46_FICP_RXD,
76 GPIO47_FICP_TXD,
77
78 /* PWM */
79 GPIO16_PWM0_OUT,
80
81 /* USB */
82 GPIO1_GPIO | WAKEUP_ON_EDGE_BOTH, /* usb detect */
83
84 /* MATRIX KEYPAD */
Tomas 'Sleep_Walker' Ceche6c3f4b2009-05-18 15:24:14 +020085 GPIO101_KP_MKIN_1,
86 GPIO102_KP_MKIN_2,
87 GPIO97_KP_MKIN_3,
88 GPIO98_KP_MKIN_4,
Tomas 'Sleep_Walker' Ceche6c3f4b2009-05-18 15:24:14 +020089 GPIO91_KP_MKIN_6,
90 GPIO13_KP_MKIN_7,
91 GPIO103_KP_MKOUT_0 | MFP_LPM_DRIVE_HIGH,
92 GPIO104_KP_MKOUT_1,
93 GPIO105_KP_MKOUT_2,
94 GPIO106_KP_MKOUT_3,
95 GPIO107_KP_MKOUT_4,
96 GPIO108_KP_MKOUT_5,
97 GPIO96_KP_MKOUT_6,
98 GPIO93_KP_DKIN_0 | WAKEUP_ON_LEVEL_HIGH, /* Hotsync button */
99
100 /* LCD */
101 GPIO58_LCD_LDD_0,
102 GPIO59_LCD_LDD_1,
103 GPIO60_LCD_LDD_2,
104 GPIO61_LCD_LDD_3,
105 GPIO62_LCD_LDD_4,
106 GPIO63_LCD_LDD_5,
107 GPIO64_LCD_LDD_6,
108 GPIO65_LCD_LDD_7,
109 GPIO66_LCD_LDD_8,
110 GPIO67_LCD_LDD_9,
111 GPIO68_LCD_LDD_10,
112 GPIO69_LCD_LDD_11,
113 GPIO70_LCD_LDD_12,
114 GPIO71_LCD_LDD_13,
115 GPIO72_LCD_LDD_14,
116 GPIO73_LCD_LDD_15,
117 GPIO74_LCD_FCLK,
118 GPIO75_LCD_LCLK,
119 GPIO76_LCD_PCLK,
120
121 /* Quick Capture Interface */
122 GPIO84_CIF_FV,
123 GPIO85_CIF_LV,
124 GPIO53_CIF_MCLK,
125 GPIO54_CIF_PCLK,
126 GPIO81_CIF_DD_0,
127 GPIO55_CIF_DD_1,
128 GPIO51_CIF_DD_2,
129 GPIO50_CIF_DD_3,
130 GPIO52_CIF_DD_4,
131 GPIO48_CIF_DD_5,
132 GPIO17_CIF_DD_6,
133 GPIO12_CIF_DD_7,
134
135 /* I2C */
136 GPIO117_I2C_SCL,
137 GPIO118_I2C_SDA,
138
139 /* GSM */
140 GPIO14_GPIO | WAKEUP_ON_EDGE_BOTH, /* GSM host wake up */
141 GPIO34_FFUART_RXD,
142 GPIO35_FFUART_CTS,
143 GPIO39_FFUART_TXD,
144 GPIO41_FFUART_RTS,
145
146 /* MISC. */
147 GPIO0_GPIO | WAKEUP_ON_EDGE_BOTH, /* external power detect */
148 GPIO15_GPIO | WAKEUP_ON_EDGE_BOTH, /* silent switch */
149 GPIO116_GPIO, /* headphone detect */
150 GPIO11_GPIO | WAKEUP_ON_EDGE_BOTH, /* bluetooth host wake up */
151};
152
Tomáš Čechbb2ae8f2009-09-11 13:57:01 +0200153#ifdef CONFIG_MACH_TREO680
154static unsigned long treo680_pin_config[] __initdata = {
155 GPIO33_GPIO, /* SD read only */
156
157 /* MATRIX KEYPAD - different wake up source */
158 GPIO100_KP_MKIN_0 | WAKEUP_ON_LEVEL_HIGH,
159 GPIO99_KP_MKIN_5,
160};
161#endif /* CONFIG_MACH_TREO680 */
162
Tomas 'Sleep_Walker' Ceche6c3f4b2009-05-18 15:24:14 +0200163/******************************************************************************
164 * SD/MMC card controller
165 ******************************************************************************/
Tomáš Čechbb2ae8f2009-09-11 13:57:01 +0200166#ifdef CONFIG_MACH_TREO680
Tomas 'Sleep_Walker' Ceche6c3f4b2009-05-18 15:24:14 +0200167static struct pxamci_platform_data treo680_mci_platform_data = {
walker@suse.cz7dafdf32009-08-31 19:25:57 +0200168 .ocr_mask = MMC_VDD_32_33 | MMC_VDD_33_34,
Tomáš Čechbb2ae8f2009-09-11 13:57:01 +0200169 .gpio_card_detect = GPIO_NR_TREO_SD_DETECT_N,
walker@suse.cz7dafdf32009-08-31 19:25:57 +0200170 .gpio_card_ro = GPIO_NR_TREO680_SD_READONLY,
171 .gpio_power = GPIO_NR_TREO680_SD_POWER,
Tomas 'Sleep_Walker' Ceche6c3f4b2009-05-18 15:24:14 +0200172};
Tomáš Čechbb2ae8f2009-09-11 13:57:01 +0200173#endif /* CONFIG_MACH_TREO680 */
Tomas 'Sleep_Walker' Ceche6c3f4b2009-05-18 15:24:14 +0200174
175/******************************************************************************
176 * GPIO keyboard
177 ******************************************************************************/
Tomáš Čechbb2ae8f2009-09-11 13:57:01 +0200178#ifdef CONFIG_MACH_TREO680
Tomas 'Sleep_Walker' Ceche6c3f4b2009-05-18 15:24:14 +0200179static unsigned int treo680_matrix_keys[] = {
180 KEY(0, 0, KEY_F8), /* Red/Off/Power */
181 KEY(0, 1, KEY_LEFT),
182 KEY(0, 2, KEY_LEFTCTRL), /* Alternate */
183 KEY(0, 3, KEY_L),
184 KEY(0, 4, KEY_A),
185 KEY(0, 5, KEY_Q),
186 KEY(0, 6, KEY_P),
187
188 KEY(1, 0, KEY_RIGHTCTRL), /* Menu */
189 KEY(1, 1, KEY_RIGHT),
190 KEY(1, 2, KEY_LEFTSHIFT), /* Left shift */
191 KEY(1, 3, KEY_Z),
192 KEY(1, 4, KEY_S),
193 KEY(1, 5, KEY_W),
194
195 KEY(2, 0, KEY_F1), /* Phone */
196 KEY(2, 1, KEY_UP),
197 KEY(2, 2, KEY_0),
198 KEY(2, 3, KEY_X),
199 KEY(2, 4, KEY_D),
200 KEY(2, 5, KEY_E),
201
202 KEY(3, 0, KEY_F10), /* Calendar */
203 KEY(3, 1, KEY_DOWN),
204 KEY(3, 2, KEY_SPACE),
205 KEY(3, 3, KEY_C),
206 KEY(3, 4, KEY_F),
207 KEY(3, 5, KEY_R),
208
209 KEY(4, 0, KEY_F12), /* Mail */
210 KEY(4, 1, KEY_KPENTER),
211 KEY(4, 2, KEY_RIGHTALT), /* Alt */
212 KEY(4, 3, KEY_V),
213 KEY(4, 4, KEY_G),
214 KEY(4, 5, KEY_T),
215
216 KEY(5, 0, KEY_F9), /* Home */
217 KEY(5, 1, KEY_PAGEUP), /* Side up */
218 KEY(5, 2, KEY_DOT),
219 KEY(5, 3, KEY_B),
220 KEY(5, 4, KEY_H),
221 KEY(5, 5, KEY_Y),
222
223 KEY(6, 0, KEY_TAB), /* Side Activate */
224 KEY(6, 1, KEY_PAGEDOWN), /* Side down */
225 KEY(6, 2, KEY_ENTER),
226 KEY(6, 3, KEY_N),
227 KEY(6, 4, KEY_J),
228 KEY(6, 5, KEY_U),
229
230 KEY(7, 0, KEY_F6), /* Green/Call */
231 KEY(7, 1, KEY_O),
232 KEY(7, 2, KEY_BACKSPACE),
233 KEY(7, 3, KEY_M),
234 KEY(7, 4, KEY_K),
235 KEY(7, 5, KEY_I),
236};
237
238static struct pxa27x_keypad_platform_data treo680_keypad_platform_data = {
239 .matrix_key_rows = 8,
240 .matrix_key_cols = 7,
241 .matrix_key_map = treo680_matrix_keys,
242 .matrix_key_map_size = ARRAY_SIZE(treo680_matrix_keys),
243 .direct_key_map = { KEY_CONNECT },
244 .direct_key_num = 1,
245
246 .debounce_interval = 30,
247};
Tomáš Čechbb2ae8f2009-09-11 13:57:01 +0200248#endif /* CONFIG_MACH_TREO680 */
Tomas 'Sleep_Walker' Ceche6c3f4b2009-05-18 15:24:14 +0200249
250/******************************************************************************
251 * aSoC audio
252 ******************************************************************************/
253
Tomáš Čechbb2ae8f2009-09-11 13:57:01 +0200254static pxa2xx_audio_ops_t treo_ac97_pdata = {
Tomas 'Sleep_Walker' Ceche6c3f4b2009-05-18 15:24:14 +0200255 .reset_gpio = 95,
256};
257
258/******************************************************************************
259 * Backlight
260 ******************************************************************************/
Tomáš Čechbb2ae8f2009-09-11 13:57:01 +0200261static int treo_backlight_init(struct device *dev)
Tomas 'Sleep_Walker' Ceche6c3f4b2009-05-18 15:24:14 +0200262{
263 int ret;
264
Tomáš Čechbb2ae8f2009-09-11 13:57:01 +0200265 ret = gpio_request(GPIO_NR_TREO_BL_POWER, "BL POWER");
Tomas 'Sleep_Walker' Ceche6c3f4b2009-05-18 15:24:14 +0200266 if (ret)
267 goto err;
Tomáš Čechbb2ae8f2009-09-11 13:57:01 +0200268 ret = gpio_direction_output(GPIO_NR_TREO_BL_POWER, 0);
Tomas 'Sleep_Walker' Ceche6c3f4b2009-05-18 15:24:14 +0200269 if (ret)
270 goto err2;
Tomas 'Sleep_Walker' Ceche6c3f4b2009-05-18 15:24:14 +0200271
272 return 0;
Tomáš Čech28d7a942009-09-03 16:55:47 +0200273
Tomas 'Sleep_Walker' Ceche6c3f4b2009-05-18 15:24:14 +0200274err2:
Tomáš Čechbb2ae8f2009-09-11 13:57:01 +0200275 gpio_free(GPIO_NR_TREO_BL_POWER);
Tomas 'Sleep_Walker' Ceche6c3f4b2009-05-18 15:24:14 +0200276err:
277 return ret;
278}
279
Tomáš Čechbb2ae8f2009-09-11 13:57:01 +0200280static int treo_backlight_notify(int brightness)
Tomas 'Sleep_Walker' Ceche6c3f4b2009-05-18 15:24:14 +0200281{
Tomáš Čechbb2ae8f2009-09-11 13:57:01 +0200282 gpio_set_value(GPIO_NR_TREO_BL_POWER, brightness);
283 return TREO_MAX_INTENSITY - brightness;
Tomas 'Sleep_Walker' Ceche6c3f4b2009-05-18 15:24:14 +0200284};
285
Tomáš Čechbb2ae8f2009-09-11 13:57:01 +0200286static void treo_backlight_exit(struct device *dev)
Tomas 'Sleep_Walker' Ceche6c3f4b2009-05-18 15:24:14 +0200287{
Tomáš Čechbb2ae8f2009-09-11 13:57:01 +0200288 gpio_free(GPIO_NR_TREO_BL_POWER);
Tomas 'Sleep_Walker' Ceche6c3f4b2009-05-18 15:24:14 +0200289}
290
Tomáš Čechbb2ae8f2009-09-11 13:57:01 +0200291static struct platform_pwm_backlight_data treo_backlight_data = {
Tomas 'Sleep_Walker' Ceche6c3f4b2009-05-18 15:24:14 +0200292 .pwm_id = 0,
Tomáš Čechbb2ae8f2009-09-11 13:57:01 +0200293 .max_brightness = TREO_MAX_INTENSITY,
294 .dft_brightness = TREO_DEFAULT_INTENSITY,
295 .pwm_period_ns = TREO_PERIOD_NS,
296 .init = treo_backlight_init,
297 .notify = treo_backlight_notify,
298 .exit = treo_backlight_exit,
Tomas 'Sleep_Walker' Ceche6c3f4b2009-05-18 15:24:14 +0200299};
300
Tomáš Čechbb2ae8f2009-09-11 13:57:01 +0200301static struct platform_device treo_backlight = {
Tomas 'Sleep_Walker' Ceche6c3f4b2009-05-18 15:24:14 +0200302 .name = "pwm-backlight",
303 .dev = {
304 .parent = &pxa27x_device_pwm0.dev,
Tomáš Čechbb2ae8f2009-09-11 13:57:01 +0200305 .platform_data = &treo_backlight_data,
Tomas 'Sleep_Walker' Ceche6c3f4b2009-05-18 15:24:14 +0200306 },
307};
308
309/******************************************************************************
310 * IrDA
311 ******************************************************************************/
Tomáš Čechbb2ae8f2009-09-11 13:57:01 +0200312static struct pxaficp_platform_data treo_ficp_info = {
313 .gpio_pwdown = GPIO_NR_TREO_IR_EN,
Marek Vasutc4bd0172009-07-17 12:50:43 +0200314 .transceiver_cap = IR_SIRMODE | IR_OFF,
Tomas 'Sleep_Walker' Ceche6c3f4b2009-05-18 15:24:14 +0200315};
316
317/******************************************************************************
318 * UDC
319 ******************************************************************************/
Tomáš Čechbb2ae8f2009-09-11 13:57:01 +0200320static struct pxa2xx_udc_mach_info treo_udc_info __initdata = {
321 .gpio_vbus = GPIO_NR_TREO_USB_DETECT,
Tomas 'Sleep_Walker' Ceche6c3f4b2009-05-18 15:24:14 +0200322 .gpio_vbus_inverted = 1,
Tomáš Čechbb2ae8f2009-09-11 13:57:01 +0200323 .gpio_pullup = GPIO_NR_TREO_USB_PULLUP,
Tomas 'Sleep_Walker' Ceche6c3f4b2009-05-18 15:24:14 +0200324};
325
326
327/******************************************************************************
328 * USB host
329 ******************************************************************************/
Tomáš Čechbb2ae8f2009-09-11 13:57:01 +0200330#ifdef CONFIG_MACH_TREO680
Tomas 'Sleep_Walker' Ceche6c3f4b2009-05-18 15:24:14 +0200331static struct pxaohci_platform_data treo680_ohci_info = {
332 .port_mode = PMM_PERPORT_MODE,
333 .flags = ENABLE_PORT1 | ENABLE_PORT3,
334 .power_budget = 0,
335};
Tomáš Čechbb2ae8f2009-09-11 13:57:01 +0200336#endif /* CONFIG_MACH_TREO680 */
Tomas 'Sleep_Walker' Ceche6c3f4b2009-05-18 15:24:14 +0200337
338/******************************************************************************
339 * Power supply
340 ******************************************************************************/
341static int power_supply_init(struct device *dev)
342{
343 int ret;
344
Tomáš Čechbb2ae8f2009-09-11 13:57:01 +0200345 ret = gpio_request(GPIO_NR_TREO_POWER_DETECT, "CABLE_STATE_AC");
Tomas 'Sleep_Walker' Ceche6c3f4b2009-05-18 15:24:14 +0200346 if (ret)
347 goto err1;
Tomáš Čechbb2ae8f2009-09-11 13:57:01 +0200348 ret = gpio_direction_input(GPIO_NR_TREO_POWER_DETECT);
Tomas 'Sleep_Walker' Ceche6c3f4b2009-05-18 15:24:14 +0200349 if (ret)
350 goto err2;
351
352 return 0;
353
354err2:
Tomáš Čechbb2ae8f2009-09-11 13:57:01 +0200355 gpio_free(GPIO_NR_TREO_POWER_DETECT);
Tomas 'Sleep_Walker' Ceche6c3f4b2009-05-18 15:24:14 +0200356err1:
357 return ret;
358}
359
Tomáš Čechbb2ae8f2009-09-11 13:57:01 +0200360static int treo_is_ac_online(void)
Tomas 'Sleep_Walker' Ceche6c3f4b2009-05-18 15:24:14 +0200361{
Tomáš Čechbb2ae8f2009-09-11 13:57:01 +0200362 return gpio_get_value(GPIO_NR_TREO_POWER_DETECT);
Tomas 'Sleep_Walker' Ceche6c3f4b2009-05-18 15:24:14 +0200363}
364
365static void power_supply_exit(struct device *dev)
366{
Tomáš Čechbb2ae8f2009-09-11 13:57:01 +0200367 gpio_free(GPIO_NR_TREO_POWER_DETECT);
Tomas 'Sleep_Walker' Ceche6c3f4b2009-05-18 15:24:14 +0200368}
369
Tomáš Čechbb2ae8f2009-09-11 13:57:01 +0200370static char *treo_supplicants[] = {
Tomas 'Sleep_Walker' Ceche6c3f4b2009-05-18 15:24:14 +0200371 "main-battery",
372};
373
374static struct pda_power_pdata power_supply_info = {
375 .init = power_supply_init,
Tomáš Čechbb2ae8f2009-09-11 13:57:01 +0200376 .is_ac_online = treo_is_ac_online,
Tomas 'Sleep_Walker' Ceche6c3f4b2009-05-18 15:24:14 +0200377 .exit = power_supply_exit,
Tomáš Čechbb2ae8f2009-09-11 13:57:01 +0200378 .supplied_to = treo_supplicants,
379 .num_supplicants = ARRAY_SIZE(treo_supplicants),
Tomas 'Sleep_Walker' Ceche6c3f4b2009-05-18 15:24:14 +0200380};
381
382static struct platform_device power_supply = {
383 .name = "pda-power",
384 .id = -1,
385 .dev = {
386 .platform_data = &power_supply_info,
387 },
388};
389
390/******************************************************************************
391 * Vibra and LEDs
392 ******************************************************************************/
Tomáš Čechbb2ae8f2009-09-11 13:57:01 +0200393#ifdef CONFIG_MACH_TREO680
394static struct gpio_led treo680_gpio_leds[] = {
Tomas 'Sleep_Walker' Ceche6c3f4b2009-05-18 15:24:14 +0200395 {
396 .name = "treo680:vibra:vibra",
397 .default_trigger = "none",
398 .gpio = GPIO_NR_TREO680_VIBRATE_EN,
399 },
400 {
401 .name = "treo680:green:led",
402 .default_trigger = "mmc0",
Tomáš Čechbb2ae8f2009-09-11 13:57:01 +0200403 .gpio = GPIO_NR_TREO_GREEN_LED,
Tomas 'Sleep_Walker' Ceche6c3f4b2009-05-18 15:24:14 +0200404 },
405 {
Tomáš Čechbb2ae8f2009-09-11 13:57:01 +0200406 .name = "treo680:white:keybbl",
Tomas 'Sleep_Walker' Ceche6c3f4b2009-05-18 15:24:14 +0200407 .default_trigger = "none",
408 .gpio = GPIO_NR_TREO680_KEYB_BL,
409 },
410};
411
Tomáš Čechbb2ae8f2009-09-11 13:57:01 +0200412static struct gpio_led_platform_data treo680_gpio_led_info = {
413 .leds = treo680_gpio_leds,
414 .num_leds = ARRAY_SIZE(treo680_gpio_leds),
Tomas 'Sleep_Walker' Ceche6c3f4b2009-05-18 15:24:14 +0200415};
416
417static struct platform_device treo680_leds = {
418 .name = "leds-gpio",
419 .id = -1,
420 .dev = {
Tomáš Čechbb2ae8f2009-09-11 13:57:01 +0200421 .platform_data = &treo680_gpio_led_info,
Tomas 'Sleep_Walker' Ceche6c3f4b2009-05-18 15:24:14 +0200422 }
423};
Tomáš Čechbb2ae8f2009-09-11 13:57:01 +0200424#endif /* CONFIG_MACH_TREO680 */
Tomas 'Sleep_Walker' Ceche6c3f4b2009-05-18 15:24:14 +0200425
426/******************************************************************************
427 * Framebuffer
428 ******************************************************************************/
429/* TODO: add support for 324x324 */
Tomáš Čechbb2ae8f2009-09-11 13:57:01 +0200430static struct pxafb_mode_info treo_lcd_modes[] = {
Tomas 'Sleep_Walker' Ceche6c3f4b2009-05-18 15:24:14 +0200431{
432 .pixclock = 86538,
433 .xres = 320,
434 .yres = 320,
435 .bpp = 16,
436
437 .left_margin = 20,
438 .right_margin = 8,
439 .upper_margin = 8,
440 .lower_margin = 5,
441
442 .hsync_len = 4,
443 .vsync_len = 1,
444},
445};
446
Tomáš Čechbb2ae8f2009-09-11 13:57:01 +0200447static void treo_lcd_power(int on, struct fb_var_screeninfo *info)
Tomáš Čech28d7a942009-09-03 16:55:47 +0200448{
Tomáš Čechbb2ae8f2009-09-11 13:57:01 +0200449 gpio_set_value(GPIO_NR_TREO_BL_POWER, on);
Tomáš Čech28d7a942009-09-03 16:55:47 +0200450}
451
Tomáš Čechbb2ae8f2009-09-11 13:57:01 +0200452static struct pxafb_mach_info treo_lcd_screen = {
453 .modes = treo_lcd_modes,
454 .num_modes = ARRAY_SIZE(treo_lcd_modes),
Tomas 'Sleep_Walker' Ceche6c3f4b2009-05-18 15:24:14 +0200455 .lcd_conn = LCD_COLOR_TFT_16BPP | LCD_PCLK_EDGE_FALL,
456};
457
458/******************************************************************************
459 * Power management - standby
460 ******************************************************************************/
Tomáš Čechbb2ae8f2009-09-11 13:57:01 +0200461static void __init treo_pm_init(void)
Tomas 'Sleep_Walker' Ceche6c3f4b2009-05-18 15:24:14 +0200462{
463 static u32 resume[] = {
464 0xe3a00101, /* mov r0, #0x40000000 */
465 0xe380060f, /* orr r0, r0, #0x00f00000 */
466 0xe590f008, /* ldr pc, [r0, #0x08] */
467 };
468
469 /* this is where the bootloader jumps */
Tomáš Čechbb2ae8f2009-09-11 13:57:01 +0200470 memcpy(phys_to_virt(TREO_STR_BASE), resume, sizeof(resume));
Tomas 'Sleep_Walker' Ceche6c3f4b2009-05-18 15:24:14 +0200471}
472
473/******************************************************************************
474 * Machine init
475 ******************************************************************************/
Tomáš Čechbb2ae8f2009-09-11 13:57:01 +0200476static struct platform_device *treo_devices[] __initdata = {
477 &treo_backlight,
Tomas 'Sleep_Walker' Ceche6c3f4b2009-05-18 15:24:14 +0200478 &power_supply,
479};
480
Tomáš Čechbb2ae8f2009-09-11 13:57:01 +0200481#ifdef CONFIG_MACH_TREO680
482static struct platform_device *treo680_devices[] __initdata = {
483 &treo680_leds,
484};
485#endif /* CONFIG_MACH_TREO680 */
486
Tomas 'Sleep_Walker' Ceche6c3f4b2009-05-18 15:24:14 +0200487/* setup udc GPIOs initial state */
Tomáš Čechbb2ae8f2009-09-11 13:57:01 +0200488static void __init treo_udc_init(void)
Tomas 'Sleep_Walker' Ceche6c3f4b2009-05-18 15:24:14 +0200489{
Tomáš Čechbb2ae8f2009-09-11 13:57:01 +0200490 if (!gpio_request(GPIO_NR_TREO_USB_PULLUP, "UDC Vbus")) {
491 gpio_direction_output(GPIO_NR_TREO_USB_PULLUP, 1);
492 gpio_free(GPIO_NR_TREO_USB_PULLUP);
Tomas 'Sleep_Walker' Ceche6c3f4b2009-05-18 15:24:14 +0200493 }
494}
495
Tomáš Čechbb2ae8f2009-09-11 13:57:01 +0200496static void __init treo_lcd_power_init(void)
Tomáš Čech28d7a942009-09-03 16:55:47 +0200497{
498 int ret;
499
Tomáš Čechbb2ae8f2009-09-11 13:57:01 +0200500 ret = gpio_request(GPIO_NR_TREO_LCD_POWER, "LCD POWER");
Tomáš Čech28d7a942009-09-03 16:55:47 +0200501 if (ret) {
502 pr_err("Treo680: LCD power GPIO request failed!\n");
503 return;
504 }
505
Tomáš Čechbb2ae8f2009-09-11 13:57:01 +0200506 ret = gpio_direction_output(GPIO_NR_TREO_LCD_POWER, 0);
Tomáš Čech28d7a942009-09-03 16:55:47 +0200507 if (ret) {
508 pr_err("Treo680: setting LCD power GPIO direction failed!\n");
Tomáš Čechbb2ae8f2009-09-11 13:57:01 +0200509 gpio_free(GPIO_NR_TREO_LCD_POWER);
Tomáš Čech28d7a942009-09-03 16:55:47 +0200510 return;
511 }
512
Tomáš Čechbb2ae8f2009-09-11 13:57:01 +0200513 treo_lcd_screen.pxafb_lcd_power = treo_lcd_power;
Tomáš Čech28d7a942009-09-03 16:55:47 +0200514}
515
Tomáš Čechbb2ae8f2009-09-11 13:57:01 +0200516static void __init treo_init(void)
517{
518 treo_pm_init();
519 pxa2xx_mfp_config(ARRAY_AND_SIZE(treo_pin_config));
520 treo_lcd_power_init();
521 set_pxa_fb_info(&treo_lcd_screen);
522 treo_udc_init();
523 pxa_set_udc_info(&treo_udc_info);
524 pxa_set_ac97_info(&treo_ac97_pdata);
525 pxa_set_ficp_info(&treo_ficp_info);
526
527 platform_add_devices(ARRAY_AND_SIZE(treo_devices));
528}
529
530#ifdef CONFIG_MACH_TREO680
Tomas 'Sleep_Walker' Ceche6c3f4b2009-05-18 15:24:14 +0200531static void __init treo680_init(void)
532{
Tomáš Čechbb2ae8f2009-09-11 13:57:01 +0200533 treo_init();
Tomas 'Sleep_Walker' Ceche6c3f4b2009-05-18 15:24:14 +0200534 pxa2xx_mfp_config(ARRAY_AND_SIZE(treo680_pin_config));
Tomas 'Sleep_Walker' Ceche6c3f4b2009-05-18 15:24:14 +0200535 pxa_set_mci_info(&treo680_mci_platform_data);
Tomáš Čechbb2ae8f2009-09-11 13:57:01 +0200536 pxa_set_keypad_info(&treo680_keypad_platform_data);
Tomas 'Sleep_Walker' Ceche6c3f4b2009-05-18 15:24:14 +0200537 pxa_set_ohci_info(&treo680_ohci_info);
538
Tomáš Čechbb2ae8f2009-09-11 13:57:01 +0200539 platform_add_devices(ARRAY_AND_SIZE(treo680_devices));
Tomas 'Sleep_Walker' Ceche6c3f4b2009-05-18 15:24:14 +0200540}
541
542MACHINE_START(TREO680, "Palm Treo 680")
Tomáš Čechbb2ae8f2009-09-11 13:57:01 +0200543 .phys_io = TREO_PHYS_IO_START,
544 .io_pg_offst = io_p2v(0x40000000),
545 .boot_params = 0xa0000100,
546 .map_io = pxa_map_io,
547 .init_irq = pxa27x_init_irq,
548 .timer = &pxa_timer,
549 .init_machine = treo680_init,
Tomas 'Sleep_Walker' Ceche6c3f4b2009-05-18 15:24:14 +0200550MACHINE_END
Tomáš Čechbb2ae8f2009-09-11 13:57:01 +0200551#endif /* CONFIG_MACH_TREO680 */