aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm
diff options
context:
space:
mode:
Diffstat (limited to 'arch/arm')
-rw-r--r--arch/arm/mach-pxa/Kconfig4
-rw-r--r--arch/arm/mach-pxa/palmld.c291
-rw-r--r--arch/arm/mach-pxa/palmt5.c282
-rw-r--r--arch/arm/mach-pxa/palmtreo.c353
-rw-r--r--arch/arm/mach-pxa/palmtx.c298
-rw-r--r--arch/arm/mach-pxa/palmz72.c266
6 files changed, 214 insertions, 1280 deletions
diff --git a/arch/arm/mach-pxa/Kconfig b/arch/arm/mach-pxa/Kconfig
index 6f04f21f998f..7aefb9074852 100644
--- a/arch/arm/mach-pxa/Kconfig
+++ b/arch/arm/mach-pxa/Kconfig
@@ -374,6 +374,7 @@ config MACH_PALMT5
374 depends on ARCH_PXA_PALM 374 depends on ARCH_PXA_PALM
375 select PXA27x 375 select PXA27x
376 select IWMMXT 376 select IWMMXT
377 select MACH_PALM27X
377 help 378 help
378 Say Y here if you intend to run this kernel on a Palm Tungsten|T5 379 Say Y here if you intend to run this kernel on a Palm Tungsten|T5
379 handheld computer. 380 handheld computer.
@@ -384,6 +385,7 @@ config MACH_PALMTX
384 depends on ARCH_PXA_PALM 385 depends on ARCH_PXA_PALM
385 select PXA27x 386 select PXA27x
386 select IWMMXT 387 select IWMMXT
388 select MACH_PALM27X
387 help 389 help
388 Say Y here if you intend to run this kernel on a Palm T|X 390 Say Y here if you intend to run this kernel on a Palm T|X
389 handheld computer. 391 handheld computer.
@@ -394,6 +396,7 @@ config MACH_PALMZ72
394 depends on ARCH_PXA_PALM 396 depends on ARCH_PXA_PALM
395 select PXA27x 397 select PXA27x
396 select IWMMXT 398 select IWMMXT
399 select MACH_PALM27X
397 help 400 help
398 Say Y here if you intend to run this kernel on Palm Zire 72 401 Say Y here if you intend to run this kernel on Palm Zire 72
399 handheld computer. 402 handheld computer.
@@ -404,6 +407,7 @@ config MACH_PALMLD
404 depends on ARCH_PXA_PALM 407 depends on ARCH_PXA_PALM
405 select PXA27x 408 select PXA27x
406 select IWMMXT 409 select IWMMXT
410 select MACH_PALM27X
407 help 411 help
408 Say Y here if you intend to run this kernel on a Palm LifeDrive 412 Say Y here if you intend to run this kernel on a Palm LifeDrive
409 handheld computer. 413 handheld computer.
diff --git a/arch/arm/mach-pxa/palmld.c b/arch/arm/mach-pxa/palmld.c
index 83a1a552cce4..91038eeafe44 100644
--- a/arch/arm/mach-pxa/palmld.c
+++ b/arch/arm/mach-pxa/palmld.c
@@ -41,6 +41,7 @@
41#include <mach/irda.h> 41#include <mach/irda.h>
42#include <mach/pxa27x_keypad.h> 42#include <mach/pxa27x_keypad.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"
@@ -127,6 +128,7 @@ static unsigned long palmld_pin_config[] __initdata = {
127/****************************************************************************** 128/******************************************************************************
128 * NOR Flash 129 * NOR Flash
129 ******************************************************************************/ 130 ******************************************************************************/
131#if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE)
130static struct mtd_partition palmld_partitions[] = { 132static struct mtd_partition palmld_partitions[] = {
131 { 133 {
132 .name = "Flash", 134 .name = "Flash",
@@ -160,20 +162,18 @@ static struct platform_device palmld_flash = {
160 }, 162 },
161}; 163};
162 164
163/****************************************************************************** 165static void __init palmld_nor_init(void)
164 * SD/MMC card controller 166{
165 ******************************************************************************/ 167 platform_device_register(&palmld_flash);
166static struct pxamci_platform_data palmld_mci_platform_data = { 168}
167 .ocr_mask = MMC_VDD_32_33 | MMC_VDD_33_34, 169#else
168 .gpio_card_detect = GPIO_NR_PALMLD_SD_DETECT_N, 170static inline void palmld_nor_init(void) {}
169 .gpio_card_ro = GPIO_NR_PALMLD_SD_READONLY, 171#endif
170 .gpio_power = GPIO_NR_PALMLD_SD_POWER,
171 .detect_delay_ms = 200,
172};
173 172
174/****************************************************************************** 173/******************************************************************************
175 * GPIO keyboard 174 * GPIO keyboard
176 ******************************************************************************/ 175 ******************************************************************************/
176#if defined(CONFIG_KEYBOARD_PXA27x) || defined(CONFIG_KEYBOARD_PXA27x_MODULE)
177static unsigned int palmld_matrix_keys[] = { 177static unsigned int palmld_matrix_keys[] = {
178 KEY(0, 1, KEY_F2), 178 KEY(0, 1, KEY_F2),
179 KEY(0, 2, KEY_UP), 179 KEY(0, 2, KEY_UP),
@@ -200,9 +200,18 @@ static struct pxa27x_keypad_platform_data palmld_keypad_platform_data = {
200 .debounce_interval = 30, 200 .debounce_interval = 30,
201}; 201};
202 202
203static void __init palmld_kpc_init(void)
204{
205 pxa_set_keypad_info(&palmld_keypad_platform_data);
206}
207#else
208static inline void palmld_kpc_init(void) {}
209#endif
210
203/****************************************************************************** 211/******************************************************************************
204 * GPIO keys 212 * GPIO keys
205 ******************************************************************************/ 213 ******************************************************************************/
214#if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
206static struct gpio_keys_button palmld_pxa_buttons[] = { 215static struct gpio_keys_button palmld_pxa_buttons[] = {
207 {KEY_F8, GPIO_NR_PALMLD_HOTSYNC_BUTTON_N, 1, "HotSync Button" }, 216 {KEY_F8, GPIO_NR_PALMLD_HOTSYNC_BUTTON_N, 1, "HotSync Button" },
208 {KEY_F9, GPIO_NR_PALMLD_LOCK_SWITCH, 0, "Lock Switch" }, 217 {KEY_F9, GPIO_NR_PALMLD_LOCK_SWITCH, 0, "Lock Switch" },
@@ -222,77 +231,18 @@ static struct platform_device palmld_pxa_keys = {
222 }, 231 },
223}; 232};
224 233
225/****************************************************************************** 234static void __init palmld_keys_init(void)
226 * Backlight
227 ******************************************************************************/
228static int palmld_backlight_init(struct device *dev)
229{
230 int ret;
231
232 ret = gpio_request(GPIO_NR_PALMLD_BL_POWER, "BL POWER");
233 if (ret)
234 goto err;
235 ret = gpio_direction_output(GPIO_NR_PALMLD_BL_POWER, 0);
236 if (ret)
237 goto err2;
238 ret = gpio_request(GPIO_NR_PALMLD_LCD_POWER, "LCD POWER");
239 if (ret)
240 goto err2;
241 ret = gpio_direction_output(GPIO_NR_PALMLD_LCD_POWER, 0);
242 if (ret)
243 goto err3;
244
245 return 0;
246err3:
247 gpio_free(GPIO_NR_PALMLD_LCD_POWER);
248err2:
249 gpio_free(GPIO_NR_PALMLD_BL_POWER);
250err:
251 return ret;
252}
253
254static int palmld_backlight_notify(struct device *dev, int brightness)
255{ 235{
256 gpio_set_value(GPIO_NR_PALMLD_BL_POWER, brightness); 236 platform_device_register(&palmld_pxa_keys);
257 gpio_set_value(GPIO_NR_PALMLD_LCD_POWER, brightness);
258 return brightness;
259} 237}
260 238#else
261static void palmld_backlight_exit(struct device *dev) 239static inline void palmld_keys_init(void) {}
262{ 240#endif
263 gpio_free(GPIO_NR_PALMLD_BL_POWER);
264 gpio_free(GPIO_NR_PALMLD_LCD_POWER);
265}
266
267static struct platform_pwm_backlight_data palmld_backlight_data = {
268 .pwm_id = 0,
269 .max_brightness = PALMLD_MAX_INTENSITY,
270 .dft_brightness = PALMLD_MAX_INTENSITY,
271 .pwm_period_ns = PALMLD_PERIOD_NS,
272 .init = palmld_backlight_init,
273 .notify = palmld_backlight_notify,
274 .exit = palmld_backlight_exit,
275};
276
277static struct platform_device palmld_backlight = {
278 .name = "pwm-backlight",
279 .dev = {
280 .parent = &pxa27x_device_pwm0.dev,
281 .platform_data = &palmld_backlight_data,
282 },
283};
284
285/******************************************************************************
286 * IrDA
287 ******************************************************************************/
288static struct pxaficp_platform_data palmld_ficp_platform_data = {
289 .gpio_pwdown = GPIO_NR_PALMLD_IR_DISABLE,
290 .transceiver_cap = IR_SIRMODE | IR_OFF,
291};
292 241
293/****************************************************************************** 242/******************************************************************************
294 * LEDs 243 * LEDs
295 ******************************************************************************/ 244 ******************************************************************************/
245#if defined(CONFIG_LEDS_GPIO) || defined(CONFIG_LEDS_GPIO_MODULE)
296struct gpio_led gpio_leds[] = { 246struct gpio_led gpio_leds[] = {
297{ 247{
298 .name = "palmld:green:led", 248 .name = "palmld:green:led",
@@ -318,176 +268,34 @@ static struct platform_device palmld_leds = {
318 } 268 }
319}; 269};
320 270
321/****************************************************************************** 271static void __init palmld_leds_init(void)
322 * Power supply
323 ******************************************************************************/
324static int power_supply_init(struct device *dev)
325{
326 int ret;
327
328 ret = gpio_request(GPIO_NR_PALMLD_POWER_DETECT, "CABLE_STATE_AC");
329 if (ret)
330 goto err1;
331 ret = gpio_direction_input(GPIO_NR_PALMLD_POWER_DETECT);
332 if (ret)
333 goto err2;
334
335 ret = gpio_request(GPIO_NR_PALMLD_USB_DETECT_N, "CABLE_STATE_USB");
336 if (ret)
337 goto err2;
338 ret = gpio_direction_input(GPIO_NR_PALMLD_USB_DETECT_N);
339 if (ret)
340 goto err3;
341
342 return 0;
343
344err3:
345 gpio_free(GPIO_NR_PALMLD_USB_DETECT_N);
346err2:
347 gpio_free(GPIO_NR_PALMLD_POWER_DETECT);
348err1:
349 return ret;
350}
351
352static int palmld_is_ac_online(void)
353{ 272{
354 return gpio_get_value(GPIO_NR_PALMLD_POWER_DETECT); 273 platform_device_register(&palmld_leds);
355} 274}
356 275#else
357static int palmld_is_usb_online(void) 276static inline void palmld_leds_init(void) {}
358{ 277#endif
359 return !gpio_get_value(GPIO_NR_PALMLD_USB_DETECT_N);
360}
361
362static void power_supply_exit(struct device *dev)
363{
364 gpio_free(GPIO_NR_PALMLD_USB_DETECT_N);
365 gpio_free(GPIO_NR_PALMLD_POWER_DETECT);
366}
367
368static char *palmld_supplicants[] = {
369 "main-battery",
370};
371
372static struct pda_power_pdata power_supply_info = {
373 .init = power_supply_init,
374 .is_ac_online = palmld_is_ac_online,
375 .is_usb_online = palmld_is_usb_online,
376 .exit = power_supply_exit,
377 .supplied_to = palmld_supplicants,
378 .num_supplicants = ARRAY_SIZE(palmld_supplicants),
379};
380
381static struct platform_device power_supply = {
382 .name = "pda-power",
383 .id = -1,
384 .dev = {
385 .platform_data = &power_supply_info,
386 },
387};
388
389/******************************************************************************
390 * WM97xx audio, battery
391 ******************************************************************************/
392static struct wm97xx_batt_pdata palmld_batt_pdata = {
393 .batt_aux = WM97XX_AUX_ID3,
394 .temp_aux = WM97XX_AUX_ID2,
395 .charge_gpio = -1,
396 .max_voltage = PALMLD_BAT_MAX_VOLTAGE,
397 .min_voltage = PALMLD_BAT_MIN_VOLTAGE,
398 .batt_mult = 1000,
399 .batt_div = 414,
400 .temp_mult = 1,
401 .temp_div = 1,
402 .batt_tech = POWER_SUPPLY_TECHNOLOGY_LIPO,
403 .batt_name = "main-batt",
404};
405
406static struct wm97xx_pdata palmld_wm97xx_pdata = {
407 .batt_pdata = &palmld_batt_pdata,
408};
409
410static pxa2xx_audio_ops_t palmld_ac97_pdata = {
411 .reset_gpio = 95,
412 .codec_pdata = { &palmld_wm97xx_pdata, },
413};
414
415static struct palm27x_asoc_info palmld_asoc_pdata = {
416 .jack_gpio = GPIO_NR_PALMLD_EARPHONE_DETECT,
417};
418
419static struct platform_device palmld_asoc = {
420 .name = "palm27x-asoc",
421 .id = -1,
422 .dev = {
423 .platform_data = &palmld_asoc_pdata,
424 },
425};
426 278
427/****************************************************************************** 279/******************************************************************************
428 * HDD 280 * HDD
429 ******************************************************************************/ 281 ******************************************************************************/
430static struct platform_device palmld_hdd = { 282#if defined(CONFIG_PATA_PALMLD) || defined(CONFIG_PATA_PALMLD_MODULE)
283static struct platform_device palmld_ide_device = {
431 .name = "pata_palmld", 284 .name = "pata_palmld",
432 .id = -1, 285 .id = -1,
433}; 286};
434 287
435/****************************************************************************** 288static void __init palmld_ide_init(void)
436 * Framebuffer
437 ******************************************************************************/
438static struct pxafb_mode_info palmld_lcd_modes[] = {
439{
440 .pixclock = 57692,
441 .xres = 320,
442 .yres = 480,
443 .bpp = 16,
444
445 .left_margin = 32,
446 .right_margin = 1,
447 .upper_margin = 7,
448 .lower_margin = 1,
449
450 .hsync_len = 4,
451 .vsync_len = 1,
452},
453};
454
455static struct pxafb_mach_info palmld_lcd_screen = {
456 .modes = palmld_lcd_modes,
457 .num_modes = ARRAY_SIZE(palmld_lcd_modes),
458 .lcd_conn = LCD_COLOR_TFT_16BPP | LCD_PCLK_EDGE_FALL,
459};
460
461/******************************************************************************
462 * Power management - standby
463 ******************************************************************************/
464static void __init palmld_pm_init(void)
465{ 289{
466 static u32 resume[] = { 290 platform_device_register(&palmld_ide_device);
467 0xe3a00101, /* mov r0, #0x40000000 */
468 0xe380060f, /* orr r0, r0, #0x00f00000 */
469 0xe590f008, /* ldr pc, [r0, #0x08] */
470 };
471
472 /* copy the bootloader */
473 memcpy(phys_to_virt(PALMLD_STR_BASE), resume, sizeof(resume));
474} 291}
292#else
293static inline void palmld_ide_init(void) {}
294#endif
475 295
476/****************************************************************************** 296/******************************************************************************
477 * Machine init 297 * Machine init
478 ******************************************************************************/ 298 ******************************************************************************/
479static struct platform_device *devices[] __initdata = {
480#if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
481 &palmld_pxa_keys,
482#endif
483 &palmld_backlight,
484 &palmld_leds,
485 &power_supply,
486 &palmld_asoc,
487 &palmld_hdd,
488 &palmld_flash,
489};
490
491static struct map_desc palmld_io_desc[] __initdata = { 299static struct map_desc palmld_io_desc[] __initdata = {
492{ 300{
493 .virtual = PALMLD_IDE_VIRT, 301 .virtual = PALMLD_IDE_VIRT,
@@ -512,19 +320,26 @@ static void __init palmld_map_io(void)
512static void __init palmld_init(void) 320static void __init palmld_init(void)
513{ 321{
514 pxa2xx_mfp_config(ARRAY_AND_SIZE(palmld_pin_config)); 322 pxa2xx_mfp_config(ARRAY_AND_SIZE(palmld_pin_config));
515
516 pxa_set_ffuart_info(NULL); 323 pxa_set_ffuart_info(NULL);
517 pxa_set_btuart_info(NULL); 324 pxa_set_btuart_info(NULL);
518 pxa_set_stuart_info(NULL); 325 pxa_set_stuart_info(NULL);
519 326
520 palmld_pm_init(); 327 palm27x_mmc_init(GPIO_NR_PALMLD_SD_DETECT_N, GPIO_NR_PALMLD_SD_READONLY,
521 set_pxa_fb_info(&palmld_lcd_screen); 328 GPIO_NR_PALMLD_SD_POWER, 0);
522 pxa_set_mci_info(&palmld_mci_platform_data); 329 palm27x_pm_init(PALMLD_STR_BASE);
523 pxa_set_ac97_info(&palmld_ac97_pdata); 330 palm27x_lcd_init(-1, &palm_320x480_lcd_mode);
524 pxa_set_ficp_info(&palmld_ficp_platform_data); 331 palm27x_irda_init(GPIO_NR_PALMLD_IR_DISABLE);
525 pxa_set_keypad_info(&palmld_keypad_platform_data); 332 palm27x_ac97_init(PALMLD_BAT_MIN_VOLTAGE, PALMLD_BAT_MAX_VOLTAGE,
526 333 GPIO_NR_PALMLD_EARPHONE_DETECT, 95);
527 platform_add_devices(devices, ARRAY_SIZE(devices)); 334 palm27x_pwm_init(GPIO_NR_PALMLD_BL_POWER, GPIO_NR_PALMLD_LCD_POWER);
335 palm27x_power_init(GPIO_NR_PALMLD_POWER_DETECT,
336 GPIO_NR_PALMLD_USB_DETECT_N);
337 palm27x_pmic_init();
338 palmld_kpc_init();
339 palmld_keys_init();
340 palmld_nor_init();
341 palmld_leds_init();
342 palmld_ide_init();
528} 343}
529 344
530MACHINE_START(PALMLD, "Palm LifeDrive") 345MACHINE_START(PALMLD, "Palm LifeDrive")
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 ******************************************************************************/
108static 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)
119static unsigned int palmt5_matrix_keys[] = { 110static 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
135static void __init palmt5_kpc_init(void)
136{
137 pxa_set_keypad_info(&palmt5_keypad_platform_data);
138}
139#else
140static 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)
147static struct gpio_keys_button palmt5_pxa_buttons[] = { 147static 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/****************************************************************************** 164static void __init palmt5_keys_init(void)
165 * Backlight
166 ******************************************************************************/
167static 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;
185err3:
186 gpio_free(GPIO_NR_PALMT5_LCD_POWER);
187err2:
188 gpio_free(GPIO_NR_PALMT5_BL_POWER);
189err:
190 return ret;
191}
192
193static 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
200static 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
206static 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
216static 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 ******************************************************************************/
227static 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 ******************************************************************************/
235static 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
241static 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 ******************************************************************************/
252static 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;
264err2:
265 gpio_free(GPIO_NR_PALMT5_POWER_DETECT);
266err1:
267 return ret;
268}
269
270static int palmt5_is_ac_online(void)
271{
272 return gpio_get_value(GPIO_NR_PALMT5_POWER_DETECT);
273}
274
275static void power_supply_exit(struct device *dev)
276{
277 gpio_free(GPIO_NR_PALMT5_POWER_DETECT);
278}
279
280static char *palmt5_supplicants[] = {
281 "main-battery",
282};
283
284static 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
292static 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 ******************************************************************************/
303static 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
317static struct wm97xx_pdata palmt5_wm97xx_pdata = {
318 .batt_pdata = &palmt5_batt_pdata,
319};
320
321static pxa2xx_audio_ops_t palmt5_ac97_pdata = {
322 .reset_gpio = 95,
323 .codec_pdata = { &palmt5_wm97xx_pdata, },
324};
325
326static struct palm27x_asoc_info palmt5_asoc_pdata = {
327 .jack_gpio = GPIO_NR_PALMT5_EARPHONE_DETECT,
328};
329
330static 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 ******************************************************************************/
341static 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
358static 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 ******************************************************************************/
367static 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
169static inline void palmt5_keys_init(void) {}
170#endif
378 171
379/****************************************************************************** 172/******************************************************************************
380 * Machine init 173 * Machine init
381 ******************************************************************************/ 174 ******************************************************************************/
382static 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 */
393static 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
401static void __init palmt5_init(void) 175static 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
420MACHINE_START(PALMT5, "Palm Tungsten|T5") 198MACHINE_START(PALMT5, "Palm Tungsten|T5")
diff --git a/arch/arm/mach-pxa/palmtreo.c b/arch/arm/mach-pxa/palmtreo.c
index 4eb0258675fb..da592dcf5eef 100644
--- a/arch/arm/mach-pxa/palmtreo.c
+++ b/arch/arm/mach-pxa/palmtreo.c
@@ -44,6 +44,7 @@
44#include <mach/pxa2xx-regs.h> 44#include <mach/pxa2xx-regs.h>
45#include <mach/palmasoc.h> 45#include <mach/palmasoc.h>
46#include <mach/camera.h> 46#include <mach/camera.h>
47#include <mach/palm27x.h>
47 48
48#include <sound/pxa2xx-lib.h> 49#include <sound/pxa2xx-lib.h>
49 50
@@ -158,31 +159,9 @@ static unsigned long centro685_pin_config[] __initdata = {
158#endif /* CONFIG_MACH_CENTRO */ 159#endif /* CONFIG_MACH_CENTRO */
159 160
160/****************************************************************************** 161/******************************************************************************
161 * SD/MMC card controller
162 ******************************************************************************/
163#ifdef CONFIG_MACH_TREO680
164static struct pxamci_platform_data treo680_mci_platform_data = {
165 .ocr_mask = MMC_VDD_32_33 | MMC_VDD_33_34,
166 .gpio_card_detect = GPIO_NR_TREO_SD_DETECT_N,
167 .gpio_card_ro = GPIO_NR_TREO680_SD_READONLY,
168 .gpio_power = GPIO_NR_TREO680_SD_POWER,
169};
170#endif /* CONFIG_MACH_TREO680 */
171
172#ifdef CONFIG_MACH_CENTRO
173static struct pxamci_platform_data centro_mci_platform_data = {
174 .ocr_mask = MMC_VDD_32_33 | MMC_VDD_33_34,
175 .gpio_card_detect = GPIO_NR_TREO_SD_DETECT_N,
176 .gpio_card_ro = -1,
177 .gpio_power = GPIO_NR_CENTRO_SD_POWER,
178 .gpio_power_invert = 1,
179};
180#endif /* CONFIG_MACH_CENTRO */
181
182/******************************************************************************
183 * GPIO keyboard 162 * GPIO keyboard
184 ******************************************************************************/ 163 ******************************************************************************/
185#ifdef CONFIG_MACH_TREO680 164#if defined(CONFIG_KEYBOARD_PXA27x) || defined(CONFIG_KEYBOARD_PXA27x_MODULE)
186static unsigned int treo680_matrix_keys[] = { 165static unsigned int treo680_matrix_keys[] = {
187 KEY(0, 0, KEY_F8), /* Red/Off/Power */ 166 KEY(0, 0, KEY_F8), /* Red/Off/Power */
188 KEY(0, 1, KEY_LEFT), 167 KEY(0, 1, KEY_LEFT),
@@ -242,19 +221,6 @@ static unsigned int treo680_matrix_keys[] = {
242 KEY(7, 5, KEY_I), 221 KEY(7, 5, KEY_I),
243}; 222};
244 223
245static struct pxa27x_keypad_platform_data treo680_keypad_platform_data = {
246 .matrix_key_rows = 8,
247 .matrix_key_cols = 7,
248 .matrix_key_map = treo680_matrix_keys,
249 .matrix_key_map_size = ARRAY_SIZE(treo680_matrix_keys),
250 .direct_key_map = { KEY_CONNECT },
251 .direct_key_num = 1,
252
253 .debounce_interval = 30,
254};
255#endif /* CONFIG_MACH_TREO680 */
256
257#ifdef CONFIG_MACH_CENTRO
258static unsigned int centro_matrix_keys[] = { 224static unsigned int centro_matrix_keys[] = {
259 KEY(0, 0, KEY_F9), /* Home */ 225 KEY(0, 0, KEY_F9), /* Home */
260 KEY(0, 1, KEY_LEFT), 226 KEY(0, 1, KEY_LEFT),
@@ -314,157 +280,50 @@ static unsigned int centro_matrix_keys[] = {
314 KEY(7, 5, KEY_I), 280 KEY(7, 5, KEY_I),
315}; 281};
316 282
317static struct pxa27x_keypad_platform_data centro_keypad_platform_data = { 283static struct pxa27x_keypad_platform_data treo680_keypad_pdata = {
318 .matrix_key_rows = 8, 284 .matrix_key_rows = 8,
319 .matrix_key_cols = 7, 285 .matrix_key_cols = 7,
320 .matrix_key_map = centro_matrix_keys, 286 .matrix_key_map = treo680_matrix_keys,
321 .matrix_key_map_size = ARRAY_SIZE(centro_matrix_keys), 287 .matrix_key_map_size = ARRAY_SIZE(treo680_matrix_keys),
322 .direct_key_map = { KEY_CONNECT }, 288 .direct_key_map = { KEY_CONNECT },
323 .direct_key_num = 1, 289 .direct_key_num = 1,
324 290
325 .debounce_interval = 30, 291 .debounce_interval = 30,
326}; 292};
327#endif /* CONFIG_MACH_CENTRO */
328 293
329/****************************************************************************** 294static void __init palmtreo_kpc_init(void)
330 * aSoC audio
331 ******************************************************************************/
332
333static pxa2xx_audio_ops_t treo_ac97_pdata = {
334 .reset_gpio = 95,
335};
336
337/******************************************************************************
338 * Backlight
339 ******************************************************************************/
340static int treo_backlight_init(struct device *dev)
341{ 295{
342 int ret; 296 static struct pxa27x_keypad_platform_data *data = &treo680_keypad_pdata;
343
344 ret = gpio_request(GPIO_NR_TREO_BL_POWER, "BL POWER");
345 if (ret)
346 goto err;
347 ret = gpio_direction_output(GPIO_NR_TREO_BL_POWER, 0);
348 if (ret)
349 goto err2;
350
351 return 0;
352 297
353err2: 298 if (machine_is_centro()) {
354 gpio_free(GPIO_NR_TREO_BL_POWER); 299 data->matrix_key_map = centro_matrix_keys;
355err: 300 data->matrix_key_map_size = ARRAY_SIZE(centro_matrix_keys);
356 return ret; 301 }
357}
358
359static int treo_backlight_notify(struct device *dev, int brightness)
360{
361 gpio_set_value(GPIO_NR_TREO_BL_POWER, brightness);
362 return TREO_MAX_INTENSITY - brightness;
363};
364 302
365static void treo_backlight_exit(struct device *dev) 303 pxa_set_keypad_info(&treo680_keypad_pdata);
366{
367 gpio_free(GPIO_NR_TREO_BL_POWER);
368} 304}
369 305#else
370static struct platform_pwm_backlight_data treo_backlight_data = { 306static inline void palmtreo_kpc_init(void) {}
371 .pwm_id = 0, 307#endif
372 .max_brightness = TREO_MAX_INTENSITY,
373 .dft_brightness = TREO_DEFAULT_INTENSITY,
374 .pwm_period_ns = TREO_PERIOD_NS,
375 .init = treo_backlight_init,
376 .notify = treo_backlight_notify,
377 .exit = treo_backlight_exit,
378};
379
380static struct platform_device treo_backlight = {
381 .name = "pwm-backlight",
382 .dev = {
383 .parent = &pxa27x_device_pwm0.dev,
384 .platform_data = &treo_backlight_data,
385 },
386};
387
388/******************************************************************************
389 * IrDA
390 ******************************************************************************/
391static struct pxaficp_platform_data treo_ficp_info = {
392 .gpio_pwdown = GPIO_NR_TREO_IR_EN,
393 .transceiver_cap = IR_SIRMODE | IR_OFF,
394};
395
396/******************************************************************************
397 * UDC
398 ******************************************************************************/
399static struct pxa2xx_udc_mach_info treo_udc_info __initdata = {
400 .gpio_vbus = GPIO_NR_TREO_USB_DETECT,
401 .gpio_vbus_inverted = 1,
402 .gpio_pullup = GPIO_NR_TREO_USB_PULLUP,
403};
404
405 308
406/****************************************************************************** 309/******************************************************************************
407 * USB host 310 * USB host
408 ******************************************************************************/ 311 ******************************************************************************/
409#ifdef CONFIG_MACH_TREO680 312#if defined(CONFIG_USB_OHCI_HCD) || defined(CONFIG_USB_OHCI_HCD_MODULE)
410static struct pxaohci_platform_data treo680_ohci_info = { 313static struct pxaohci_platform_data treo680_ohci_info = {
411 .port_mode = PMM_PERPORT_MODE, 314 .port_mode = PMM_PERPORT_MODE,
412 .flags = ENABLE_PORT1 | ENABLE_PORT3, 315 .flags = ENABLE_PORT1 | ENABLE_PORT3,
413 .power_budget = 0, 316 .power_budget = 0,
414}; 317};
415#endif /* CONFIG_MACH_TREO680 */
416 318
417/****************************************************************************** 319static void __init palmtreo_uhc_init(void)
418 * Power supply
419 ******************************************************************************/
420static int power_supply_init(struct device *dev)
421{ 320{
422 int ret; 321 if (machine_is_treo680())
423 322 pxa_set_ohci_info(&treo680_ohci_info);
424 ret = gpio_request(GPIO_NR_TREO_POWER_DETECT, "CABLE_STATE_AC");
425 if (ret)
426 goto err1;
427 ret = gpio_direction_input(GPIO_NR_TREO_POWER_DETECT);
428 if (ret)
429 goto err2;
430
431 return 0;
432
433err2:
434 gpio_free(GPIO_NR_TREO_POWER_DETECT);
435err1:
436 return ret;
437}
438
439static int treo_is_ac_online(void)
440{
441 return gpio_get_value(GPIO_NR_TREO_POWER_DETECT);
442} 323}
443 324#else
444static void power_supply_exit(struct device *dev) 325static inline void palmtreo_uhc_init(void) {}
445{ 326#endif
446 gpio_free(GPIO_NR_TREO_POWER_DETECT);
447}
448
449static char *treo_supplicants[] = {
450 "main-battery",
451};
452
453static struct pda_power_pdata power_supply_info = {
454 .init = power_supply_init,
455 .is_ac_online = treo_is_ac_online,
456 .exit = power_supply_exit,
457 .supplied_to = treo_supplicants,
458 .num_supplicants = ARRAY_SIZE(treo_supplicants),
459};
460
461static struct platform_device power_supply = {
462 .name = "pda-power",
463 .id = -1,
464 .dev = {
465 .platform_data = &power_supply_info,
466 },
467};
468 327
469/****************************************************************************** 328/******************************************************************************
470 * Vibra and LEDs 329 * Vibra and LEDs
@@ -493,16 +352,6 @@ static struct gpio_led_platform_data treo680_gpio_led_info = {
493 .num_leds = ARRAY_SIZE(treo680_gpio_leds), 352 .num_leds = ARRAY_SIZE(treo680_gpio_leds),
494}; 353};
495 354
496static struct platform_device treo680_leds = {
497 .name = "leds-gpio",
498 .id = -1,
499 .dev = {
500 .platform_data = &treo680_gpio_led_info,
501 }
502};
503#endif /* CONFIG_MACH_TREO680 */
504
505#ifdef CONFIG_MACH_CENTRO
506static struct gpio_led centro_gpio_leds[] = { 355static struct gpio_led centro_gpio_leds[] = {
507 { 356 {
508 .name = "centro:vibra:vibra", 357 .name = "centro:vibra:vibra",
@@ -527,139 +376,61 @@ static struct gpio_led_platform_data centro_gpio_led_info = {
527 .num_leds = ARRAY_SIZE(centro_gpio_leds), 376 .num_leds = ARRAY_SIZE(centro_gpio_leds),
528}; 377};
529 378
530static struct platform_device centro_leds = { 379static struct platform_device palmtreo_leds = {
531 .name = "leds-gpio", 380 .name = "leds-gpio",
532 .id = -1, 381 .id = -1,
533 .dev = { 382 .dev = {
534 .platform_data = &centro_gpio_led_info, 383 .platform_data = &treo680_gpio_led_info,
535 } 384 }
536}; 385};
537#endif /* CONFIG_MACH_CENTRO */
538
539/******************************************************************************
540 * Framebuffer
541 ******************************************************************************/
542/* TODO: add support for 324x324 */
543static struct pxafb_mode_info treo_lcd_modes[] = {
544{
545 .pixclock = 86538,
546 .xres = 320,
547 .yres = 320,
548 .bpp = 16,
549
550 .left_margin = 20,
551 .right_margin = 8,
552 .upper_margin = 8,
553 .lower_margin = 5,
554
555 .hsync_len = 4,
556 .vsync_len = 1,
557},
558};
559 386
560static void treo_lcd_power(int on, struct fb_var_screeninfo *info) 387static void __init palmtreo_leds_init(void)
561{ 388{
562 gpio_set_value(GPIO_NR_TREO_BL_POWER, on); 389 if (machine_is_centro())
563} 390 palmtreo_leds.dev.platform_data = &centro_gpio_led_info;
564
565static struct pxafb_mach_info treo_lcd_screen = {
566 .modes = treo_lcd_modes,
567 .num_modes = ARRAY_SIZE(treo_lcd_modes),
568 .lcd_conn = LCD_COLOR_TFT_16BPP | LCD_PCLK_EDGE_FALL,
569};
570 391
571/****************************************************************************** 392 platform_device_register(&palmtreo_leds);
572 * Power management - standby
573 ******************************************************************************/
574static void __init treo_pm_init(void)
575{
576 static u32 resume[] = {
577 0xe3a00101, /* mov r0, #0x40000000 */
578 0xe380060f, /* orr r0, r0, #0x00f00000 */
579 0xe590f008, /* ldr pc, [r0, #0x08] */
580 };
581
582 /* this is where the bootloader jumps */
583 memcpy(phys_to_virt(TREO_STR_BASE), resume, sizeof(resume));
584} 393}
394#else
395static inline void palmtreo_leds_init(void) {}
396#endif
585 397
586/****************************************************************************** 398/******************************************************************************
587 * Machine init 399 * Machine init
588 ******************************************************************************/ 400 ******************************************************************************/
589static struct platform_device *treo_devices[] __initdata = { 401static void __init palmphone_common_init(void)
590 &treo_backlight,
591 &power_supply,
592};
593
594#ifdef CONFIG_MACH_TREO680
595static struct platform_device *treo680_devices[] __initdata = {
596 &treo680_leds,
597};
598#endif /* CONFIG_MACH_TREO680 */
599
600#ifdef CONFIG_MACH_CENTRO
601static struct platform_device *centro_devices[] __initdata = {
602 &centro_leds,
603};
604#endif /* CONFIG_MACH_CENTRO */
605
606/* setup udc GPIOs initial state */
607static void __init treo_udc_init(void)
608{
609 if (!gpio_request(GPIO_NR_TREO_USB_PULLUP, "UDC Vbus")) {
610 gpio_direction_output(GPIO_NR_TREO_USB_PULLUP, 1);
611 gpio_free(GPIO_NR_TREO_USB_PULLUP);
612 }
613}
614
615static void __init treo_lcd_power_init(void)
616{
617 int ret;
618
619 ret = gpio_request(GPIO_NR_TREO_LCD_POWER, "LCD POWER");
620 if (ret) {
621 pr_err("Treo680: LCD power GPIO request failed!\n");
622 return;
623 }
624
625 ret = gpio_direction_output(GPIO_NR_TREO_LCD_POWER, 0);
626 if (ret) {
627 pr_err("Treo680: setting LCD power GPIO direction failed!\n");
628 gpio_free(GPIO_NR_TREO_LCD_POWER);
629 return;
630 }
631
632 treo_lcd_screen.pxafb_lcd_power = treo_lcd_power;
633}
634
635static void __init treo_init(void)
636{ 402{
403 pxa2xx_mfp_config(ARRAY_AND_SIZE(treo_pin_config));
637 pxa_set_ffuart_info(NULL); 404 pxa_set_ffuart_info(NULL);
638 pxa_set_btuart_info(NULL); 405 pxa_set_btuart_info(NULL);
639 pxa_set_stuart_info(NULL); 406 pxa_set_stuart_info(NULL);
640 407 palm27x_pm_init(TREO_STR_BASE);
641 treo_pm_init(); 408 palm27x_lcd_init(GPIO_NR_TREO_BL_POWER, &palm_320x320_new_lcd_mode);
642 pxa2xx_mfp_config(ARRAY_AND_SIZE(treo_pin_config)); 409 palm27x_udc_init(GPIO_NR_TREO_USB_DETECT, GPIO_NR_TREO_USB_PULLUP, 1);
643 treo_lcd_power_init(); 410 palm27x_irda_init(GPIO_NR_TREO_IR_EN);
644 set_pxa_fb_info(&treo_lcd_screen); 411 palm27x_ac97_init(-1, -1, -1, 95);
645 treo_udc_init(); 412 palm27x_pwm_init(GPIO_NR_TREO_BL_POWER, -1);
646 pxa_set_udc_info(&treo_udc_info); 413 palm27x_power_init(GPIO_NR_TREO_POWER_DETECT, -1);
647 pxa_set_ac97_info(&treo_ac97_pdata); 414 palm27x_pmic_init();
648 pxa_set_ficp_info(&treo_ficp_info); 415 palmtreo_kpc_init();
649 416 palmtreo_uhc_init();
650 platform_add_devices(ARRAY_AND_SIZE(treo_devices)); 417 palmtreo_leds_init();
651} 418}
652 419
653#ifdef CONFIG_MACH_TREO680
654static void __init treo680_init(void) 420static void __init treo680_init(void)
655{ 421{
656 treo_init();
657 pxa2xx_mfp_config(ARRAY_AND_SIZE(treo680_pin_config)); 422 pxa2xx_mfp_config(ARRAY_AND_SIZE(treo680_pin_config));
658 pxa_set_mci_info(&treo680_mci_platform_data); 423 palmphone_common_init();
659 pxa_set_keypad_info(&treo680_keypad_platform_data); 424 palm27x_mmc_init(GPIO_NR_TREO_SD_DETECT_N, GPIO_NR_TREO680_SD_READONLY,
660 pxa_set_ohci_info(&treo680_ohci_info); 425 GPIO_NR_TREO680_SD_POWER, 0);
426}
661 427
662 platform_add_devices(ARRAY_AND_SIZE(treo680_devices)); 428static void __init centro_init(void)
429{
430 pxa2xx_mfp_config(ARRAY_AND_SIZE(centro685_pin_config));
431 palmphone_common_init();
432 palm27x_mmc_init(GPIO_NR_TREO_SD_DETECT_N, -1,
433 GPIO_NR_CENTRO_SD_POWER, 1);
663} 434}
664 435
665MACHINE_START(TREO680, "Palm Treo 680") 436MACHINE_START(TREO680, "Palm Treo 680")
@@ -671,19 +442,6 @@ MACHINE_START(TREO680, "Palm Treo 680")
671 .timer = &pxa_timer, 442 .timer = &pxa_timer,
672 .init_machine = treo680_init, 443 .init_machine = treo680_init,
673MACHINE_END 444MACHINE_END
674#endif /* CONFIG_MACH_TREO680 */
675
676#ifdef CONFIG_MACH_CENTRO
677static void __init centro_init(void)
678{
679 treo_init();
680 pxa2xx_mfp_config(ARRAY_AND_SIZE(centro685_pin_config));
681 pxa_set_mci_info(&centro_mci_platform_data);
682
683 pxa_set_keypad_info(&centro_keypad_platform_data);
684
685 platform_add_devices(ARRAY_AND_SIZE(centro_devices));
686}
687 445
688MACHINE_START(CENTRO, "Palm Centro 685") 446MACHINE_START(CENTRO, "Palm Centro 685")
689 .phys_io = TREO_PHYS_IO_START, 447 .phys_io = TREO_PHYS_IO_START,
@@ -692,6 +450,5 @@ MACHINE_START(CENTRO, "Palm Centro 685")
692 .map_io = pxa_map_io, 450 .map_io = pxa_map_io,
693 .init_irq = pxa27x_init_irq, 451 .init_irq = pxa27x_init_irq,
694 .timer = &pxa_timer, 452 .timer = &pxa_timer,
695 .init_machine = centro_init, 453 .init_machine = centro_init,
696MACHINE_END 454MACHINE_END
697#endif /* CONFIG_MACH_CENTRO */
diff --git a/arch/arm/mach-pxa/palmtx.c b/arch/arm/mach-pxa/palmtx.c
index a5429cdddad5..144dc2b6911f 100644
--- a/arch/arm/mach-pxa/palmtx.c
+++ b/arch/arm/mach-pxa/palmtx.c
@@ -46,6 +46,7 @@
46#include <mach/pxa27x_keypad.h> 46#include <mach/pxa27x_keypad.h>
47#include <mach/udc.h> 47#include <mach/udc.h>
48#include <mach/palmasoc.h> 48#include <mach/palmasoc.h>
49#include <mach/palm27x.h>
49 50
50#include "generic.h" 51#include "generic.h"
51#include "devices.h" 52#include "devices.h"
@@ -129,6 +130,7 @@ static unsigned long palmtx_pin_config[] __initdata = {
129/****************************************************************************** 130/******************************************************************************
130 * NOR Flash 131 * NOR Flash
131 ******************************************************************************/ 132 ******************************************************************************/
133#if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE)
132static struct mtd_partition palmtx_partitions[] = { 134static struct mtd_partition palmtx_partitions[] = {
133 { 135 {
134 .name = "Flash", 136 .name = "Flash",
@@ -162,20 +164,18 @@ static struct platform_device palmtx_flash = {
162 }, 164 },
163}; 165};
164 166
165/****************************************************************************** 167static void __init palmtx_nor_init(void)
166 * SD/MMC card controller 168{
167 ******************************************************************************/ 169 platform_device_register(&palmtx_flash);
168static struct pxamci_platform_data palmtx_mci_platform_data = { 170}
169 .ocr_mask = MMC_VDD_32_33 | MMC_VDD_33_34, 171#else
170 .gpio_card_detect = GPIO_NR_PALMTX_SD_DETECT_N, 172static inline void palmtx_nor_init(void) {}
171 .gpio_card_ro = GPIO_NR_PALMTX_SD_READONLY, 173#endif
172 .gpio_power = GPIO_NR_PALMTX_SD_POWER,
173 .detect_delay_ms = 200,
174};
175 174
176/****************************************************************************** 175/******************************************************************************
177 * GPIO keyboard 176 * GPIO keyboard
178 ******************************************************************************/ 177 ******************************************************************************/
178#if defined(CONFIG_KEYBOARD_PXA27x) || defined(CONFIG_KEYBOARD_PXA27x_MODULE)
179static unsigned int palmtx_matrix_keys[] = { 179static unsigned int palmtx_matrix_keys[] = {
180 KEY(0, 0, KEY_POWER), 180 KEY(0, 0, KEY_POWER),
181 KEY(0, 1, KEY_F1), 181 KEY(0, 1, KEY_F1),
@@ -201,9 +201,18 @@ static struct pxa27x_keypad_platform_data palmtx_keypad_platform_data = {
201 .debounce_interval = 30, 201 .debounce_interval = 30,
202}; 202};
203 203
204static void __init palmtx_kpc_init(void)
205{
206 pxa_set_keypad_info(&palmtx_keypad_platform_data);
207}
208#else
209static inline void palmtx_kpc_init(void) {}
210#endif
211
204/****************************************************************************** 212/******************************************************************************
205 * GPIO keys 213 * GPIO keys
206 ******************************************************************************/ 214 ******************************************************************************/
215#if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
207static struct gpio_keys_button palmtx_pxa_buttons[] = { 216static struct gpio_keys_button palmtx_pxa_buttons[] = {
208 {KEY_F8, GPIO_NR_PALMTX_HOTSYNC_BUTTON_N, 1, "HotSync Button" }, 217 {KEY_F8, GPIO_NR_PALMTX_HOTSYNC_BUTTON_N, 1, "HotSync Button" },
209}; 218};
@@ -221,210 +230,18 @@ static struct platform_device palmtx_pxa_keys = {
221 }, 230 },
222}; 231};
223 232
224/****************************************************************************** 233static void __init palmtx_keys_init(void)
225 * Backlight
226 ******************************************************************************/
227static int palmtx_backlight_init(struct device *dev)
228{
229 int ret;
230
231 ret = gpio_request(GPIO_NR_PALMTX_BL_POWER, "BL POWER");
232 if (ret)
233 goto err;
234 ret = gpio_direction_output(GPIO_NR_PALMTX_BL_POWER, 0);
235 if (ret)
236 goto err2;
237 ret = gpio_request(GPIO_NR_PALMTX_LCD_POWER, "LCD POWER");
238 if (ret)
239 goto err2;
240 ret = gpio_direction_output(GPIO_NR_PALMTX_LCD_POWER, 0);
241 if (ret)
242 goto err3;
243
244 return 0;
245err3:
246 gpio_free(GPIO_NR_PALMTX_LCD_POWER);
247err2:
248 gpio_free(GPIO_NR_PALMTX_BL_POWER);
249err:
250 return ret;
251}
252
253static int palmtx_backlight_notify(struct device *dev, int brightness)
254{
255 gpio_set_value(GPIO_NR_PALMTX_BL_POWER, brightness);
256 gpio_set_value(GPIO_NR_PALMTX_LCD_POWER, brightness);
257 return brightness;
258}
259
260static void palmtx_backlight_exit(struct device *dev)
261{
262 gpio_free(GPIO_NR_PALMTX_BL_POWER);
263 gpio_free(GPIO_NR_PALMTX_LCD_POWER);
264}
265
266static struct platform_pwm_backlight_data palmtx_backlight_data = {
267 .pwm_id = 0,
268 .max_brightness = PALMTX_MAX_INTENSITY,
269 .dft_brightness = PALMTX_MAX_INTENSITY,
270 .pwm_period_ns = PALMTX_PERIOD_NS,
271 .init = palmtx_backlight_init,
272 .notify = palmtx_backlight_notify,
273 .exit = palmtx_backlight_exit,
274};
275
276static struct platform_device palmtx_backlight = {
277 .name = "pwm-backlight",
278 .dev = {
279 .parent = &pxa27x_device_pwm0.dev,
280 .platform_data = &palmtx_backlight_data,
281 },
282};
283
284/******************************************************************************
285 * IrDA
286 ******************************************************************************/
287static struct pxaficp_platform_data palmtx_ficp_platform_data = {
288 .gpio_pwdown = GPIO_NR_PALMTX_IR_DISABLE,
289 .transceiver_cap = IR_SIRMODE | IR_OFF,
290};
291
292/******************************************************************************
293 * UDC
294 ******************************************************************************/
295static struct gpio_vbus_mach_info palmtx_udc_info = {
296 .gpio_vbus = GPIO_NR_PALMTX_USB_DETECT_N,
297 .gpio_vbus_inverted = 1,
298 .gpio_pullup = GPIO_NR_PALMTX_USB_PULLUP,
299};
300
301static struct platform_device palmtx_gpio_vbus = {
302 .name = "gpio-vbus",
303 .id = -1,
304 .dev = {
305 .platform_data = &palmtx_udc_info,
306 },
307};
308
309/******************************************************************************
310 * Power supply
311 ******************************************************************************/
312static int power_supply_init(struct device *dev)
313{
314 int ret;
315
316 ret = gpio_request(GPIO_NR_PALMTX_POWER_DETECT, "CABLE_STATE_AC");
317 if (ret)
318 goto err1;
319 ret = gpio_direction_input(GPIO_NR_PALMTX_POWER_DETECT);
320 if (ret)
321 goto err2;
322
323 return 0;
324
325err2:
326 gpio_free(GPIO_NR_PALMTX_POWER_DETECT);
327err1:
328 return ret;
329}
330
331static int palmtx_is_ac_online(void)
332{
333 return gpio_get_value(GPIO_NR_PALMTX_POWER_DETECT);
334}
335
336static void power_supply_exit(struct device *dev)
337{ 234{
338 gpio_free(GPIO_NR_PALMTX_POWER_DETECT); 235 platform_device_register(&palmtx_pxa_keys);
339} 236}
340 237#else
341static char *palmtx_supplicants[] = { 238static inline void palmtx_keys_init(void) {}
342 "main-battery", 239#endif
343};
344
345static struct pda_power_pdata power_supply_info = {
346 .init = power_supply_init,
347 .is_ac_online = palmtx_is_ac_online,
348 .exit = power_supply_exit,
349 .supplied_to = palmtx_supplicants,
350 .num_supplicants = ARRAY_SIZE(palmtx_supplicants),
351};
352
353static struct platform_device power_supply = {
354 .name = "pda-power",
355 .id = -1,
356 .dev = {
357 .platform_data = &power_supply_info,
358 },
359};
360
361/******************************************************************************
362 * WM97xx audio, battery
363 ******************************************************************************/
364static struct wm97xx_batt_pdata palmtx_batt_pdata = {
365 .batt_aux = WM97XX_AUX_ID3,
366 .temp_aux = WM97XX_AUX_ID2,
367 .charge_gpio = -1,
368 .max_voltage = PALMTX_BAT_MAX_VOLTAGE,
369 .min_voltage = PALMTX_BAT_MIN_VOLTAGE,
370 .batt_mult = 1000,
371 .batt_div = 414,
372 .temp_mult = 1,
373 .temp_div = 1,
374 .batt_tech = POWER_SUPPLY_TECHNOLOGY_LIPO,
375 .batt_name = "main-batt",
376};
377
378static struct wm97xx_pdata palmtx_wm97xx_pdata = {
379 .batt_pdata = &palmtx_batt_pdata,
380};
381
382static pxa2xx_audio_ops_t palmtx_ac97_pdata = {
383 .reset_gpio = 95,
384 .codec_pdata = { &palmtx_wm97xx_pdata, },
385};
386
387static struct palm27x_asoc_info palmtx_asoc_pdata = {
388 .jack_gpio = GPIO_NR_PALMTX_EARPHONE_DETECT,
389};
390
391static struct platform_device palmtx_asoc = {
392 .name = "palm27x-asoc",
393 .id = -1,
394 .dev = {
395 .platform_data = &palmtx_asoc_pdata,
396 },
397};
398
399/******************************************************************************
400 * Framebuffer
401 ******************************************************************************/
402static struct pxafb_mode_info palmtx_lcd_modes[] = {
403{
404 .pixclock = 57692,
405 .xres = 320,
406 .yres = 480,
407 .bpp = 16,
408
409 .left_margin = 32,
410 .right_margin = 1,
411 .upper_margin = 7,
412 .lower_margin = 1,
413
414 .hsync_len = 4,
415 .vsync_len = 1,
416},
417};
418
419static struct pxafb_mach_info palmtx_lcd_screen = {
420 .modes = palmtx_lcd_modes,
421 .num_modes = ARRAY_SIZE(palmtx_lcd_modes),
422 .lcd_conn = LCD_COLOR_TFT_16BPP | LCD_PCLK_EDGE_FALL,
423};
424 240
425/****************************************************************************** 241/******************************************************************************
426 * NAND Flash 242 * NAND Flash
427 ******************************************************************************/ 243 ******************************************************************************/
244#if defined(CONFIG_MTD_NAND_GPIO) || defined(CONFIG_MTD_NAND_GPIO_MODULE)
428static void palmtx_nand_cmd_ctl(struct mtd_info *mtd, int cmd, 245static void palmtx_nand_cmd_ctl(struct mtd_info *mtd, int cmd,
429 unsigned int ctrl) 246 unsigned int ctrl)
430{ 247{
@@ -484,36 +301,17 @@ static struct platform_device palmtx_nand = {
484 } 301 }
485}; 302};
486 303
487/****************************************************************************** 304static void __init palmtx_nand_init(void)
488 * Power management - standby
489 ******************************************************************************/
490static void __init palmtx_pm_init(void)
491{ 305{
492 static u32 resume[] = { 306 platform_device_register(&palmtx_nand);
493 0xe3a00101, /* mov r0, #0x40000000 */
494 0xe380060f, /* orr r0, r0, #0x00f00000 */
495 0xe590f008, /* ldr pc, [r0, #0x08] */
496 };
497
498 /* copy the bootloader */
499 memcpy(phys_to_virt(PALMTX_STR_BASE), resume, sizeof(resume));
500} 307}
308#else
309static inline void palmtx_nand_init(void) {}
310#endif
501 311
502/****************************************************************************** 312/******************************************************************************
503 * Machine init 313 * Machine init
504 ******************************************************************************/ 314 ******************************************************************************/
505static struct platform_device *devices[] __initdata = {
506#if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
507 &palmtx_pxa_keys,
508#endif
509 &palmtx_backlight,
510 &power_supply,
511 &palmtx_asoc,
512 &palmtx_gpio_vbus,
513 &palmtx_flash,
514 &palmtx_nand,
515};
516
517static struct map_desc palmtx_io_desc[] __initdata = { 315static struct map_desc palmtx_io_desc[] __initdata = {
518{ 316{
519 .virtual = PALMTX_PCMCIA_VIRT, 317 .virtual = PALMTX_PCMCIA_VIRT,
@@ -539,33 +337,29 @@ static void __init palmtx_map_io(void)
539 iotable_init(palmtx_io_desc, ARRAY_SIZE(palmtx_io_desc)); 337 iotable_init(palmtx_io_desc, ARRAY_SIZE(palmtx_io_desc));
540} 338}
541 339
542/* setup udc GPIOs initial state */
543static void __init palmtx_udc_init(void)
544{
545 if (!gpio_request(GPIO_NR_PALMTX_USB_PULLUP, "UDC Vbus")) {
546 gpio_direction_output(GPIO_NR_PALMTX_USB_PULLUP, 1);
547 gpio_free(GPIO_NR_PALMTX_USB_PULLUP);
548 }
549}
550
551
552static void __init palmtx_init(void) 340static void __init palmtx_init(void)
553{ 341{
554 pxa2xx_mfp_config(ARRAY_AND_SIZE(palmtx_pin_config)); 342 pxa2xx_mfp_config(ARRAY_AND_SIZE(palmtx_pin_config));
555
556 pxa_set_ffuart_info(NULL); 343 pxa_set_ffuart_info(NULL);
557 pxa_set_btuart_info(NULL); 344 pxa_set_btuart_info(NULL);
558 pxa_set_stuart_info(NULL); 345 pxa_set_stuart_info(NULL);
559 346
560 palmtx_pm_init(); 347 palm27x_mmc_init(GPIO_NR_PALMTX_SD_DETECT_N, GPIO_NR_PALMTX_SD_READONLY,
561 set_pxa_fb_info(&palmtx_lcd_screen); 348 GPIO_NR_PALMTX_SD_POWER, 0);
562 pxa_set_mci_info(&palmtx_mci_platform_data); 349 palm27x_pm_init(PALMTX_STR_BASE);
563 palmtx_udc_init(); 350 palm27x_lcd_init(-1, &palm_320x480_lcd_mode);
564 pxa_set_ac97_info(&palmtx_ac97_pdata); 351 palm27x_udc_init(GPIO_NR_PALMTX_USB_DETECT_N,
565 pxa_set_ficp_info(&palmtx_ficp_platform_data); 352 GPIO_NR_PALMTX_USB_PULLUP, 1);
566 pxa_set_keypad_info(&palmtx_keypad_platform_data); 353 palm27x_irda_init(GPIO_NR_PALMTX_IR_DISABLE);
567 354 palm27x_ac97_init(PALMTX_BAT_MIN_VOLTAGE, PALMTX_BAT_MAX_VOLTAGE,
568 platform_add_devices(devices, ARRAY_SIZE(devices)); 355 GPIO_NR_PALMTX_EARPHONE_DETECT, 95);
356 palm27x_pwm_init(GPIO_NR_PALMTX_BL_POWER, GPIO_NR_PALMTX_LCD_POWER);
357 palm27x_power_init(GPIO_NR_PALMTX_POWER_DETECT, -1);
358 palm27x_pmic_init();
359 palmtx_kpc_init();
360 palmtx_keys_init();
361 palmtx_nor_init();
362 palmtx_nand_init();
569} 363}
570 364
571MACHINE_START(PALMTX, "Palm T|X") 365MACHINE_START(PALMTX, "Palm T|X")
diff --git a/arch/arm/mach-pxa/palmz72.c b/arch/arm/mach-pxa/palmz72.c
index b78c6b4625e8..87e4b1044e0b 100644
--- a/arch/arm/mach-pxa/palmz72.c
+++ b/arch/arm/mach-pxa/palmz72.c
@@ -44,6 +44,7 @@
44#include <mach/pxa27x_keypad.h> 44#include <mach/pxa27x_keypad.h>
45#include <mach/udc.h> 45#include <mach/udc.h>
46#include <mach/palmasoc.h> 46#include <mach/palmasoc.h>
47#include <mach/palm27x.h>
47 48
48#include <mach/pm.h> 49#include <mach/pm.h>
49 50
@@ -109,21 +110,9 @@ static unsigned long palmz72_pin_config[] __initdata = {
109}; 110};
110 111
111/****************************************************************************** 112/******************************************************************************
112 * SD/MMC card controller
113 ******************************************************************************/
114/* SD_POWER is not actually power, but it is more like chip
115 * select, i.e. it is inverted */
116static struct pxamci_platform_data palmz72_mci_platform_data = {
117 .ocr_mask = MMC_VDD_32_33 | MMC_VDD_33_34,
118 .gpio_card_detect = GPIO_NR_PALMZ72_SD_DETECT_N,
119 .gpio_card_ro = GPIO_NR_PALMZ72_SD_RO,
120 .gpio_power = GPIO_NR_PALMZ72_SD_POWER_N,
121 .gpio_power_invert = 1,
122};
123
124/******************************************************************************
125 * GPIO keyboard 113 * GPIO keyboard
126 ******************************************************************************/ 114 ******************************************************************************/
115#if defined(CONFIG_KEYBOARD_PXA27x) || defined(CONFIG_KEYBOARD_PXA27x_MODULE)
127static unsigned int palmz72_matrix_keys[] = { 116static unsigned int palmz72_matrix_keys[] = {
128 KEY(0, 0, KEY_POWER), 117 KEY(0, 0, KEY_POWER),
129 KEY(0, 1, KEY_F1), 118 KEY(0, 1, KEY_F1),
@@ -149,77 +138,18 @@ static struct pxa27x_keypad_platform_data palmz72_keypad_platform_data = {
149 .debounce_interval = 30, 138 .debounce_interval = 30,
150}; 139};
151 140
152/****************************************************************************** 141static void __init palmz72_kpc_init(void)
153 * Backlight
154 ******************************************************************************/
155static int palmz72_backlight_init(struct device *dev)
156{ 142{
157 int ret; 143 pxa_set_keypad_info(&palmz72_keypad_platform_data);
158
159 ret = gpio_request(GPIO_NR_PALMZ72_BL_POWER, "BL POWER");
160 if (ret)
161 goto err;
162 ret = gpio_direction_output(GPIO_NR_PALMZ72_BL_POWER, 0);
163 if (ret)
164 goto err2;
165 ret = gpio_request(GPIO_NR_PALMZ72_LCD_POWER, "LCD POWER");
166 if (ret)
167 goto err2;
168 ret = gpio_direction_output(GPIO_NR_PALMZ72_LCD_POWER, 0);
169 if (ret)
170 goto err3;
171
172 return 0;
173err3:
174 gpio_free(GPIO_NR_PALMZ72_LCD_POWER);
175err2:
176 gpio_free(GPIO_NR_PALMZ72_BL_POWER);
177err:
178 return ret;
179}
180
181static int palmz72_backlight_notify(struct device *dev, int brightness)
182{
183 gpio_set_value(GPIO_NR_PALMZ72_BL_POWER, brightness);
184 gpio_set_value(GPIO_NR_PALMZ72_LCD_POWER, brightness);
185 return brightness;
186}
187
188static void palmz72_backlight_exit(struct device *dev)
189{
190 gpio_free(GPIO_NR_PALMZ72_BL_POWER);
191 gpio_free(GPIO_NR_PALMZ72_LCD_POWER);
192} 144}
193 145#else
194static struct platform_pwm_backlight_data palmz72_backlight_data = { 146static inline void palmz72_kpc_init(void) {}
195 .pwm_id = 0, 147#endif
196 .max_brightness = PALMZ72_MAX_INTENSITY,
197 .dft_brightness = PALMZ72_MAX_INTENSITY,
198 .pwm_period_ns = PALMZ72_PERIOD_NS,
199 .init = palmz72_backlight_init,
200 .notify = palmz72_backlight_notify,
201 .exit = palmz72_backlight_exit,
202};
203
204static struct platform_device palmz72_backlight = {
205 .name = "pwm-backlight",
206 .dev = {
207 .parent = &pxa27x_device_pwm0.dev,
208 .platform_data = &palmz72_backlight_data,
209 },
210};
211
212/******************************************************************************
213 * IrDA
214 ******************************************************************************/
215static struct pxaficp_platform_data palmz72_ficp_platform_data = {
216 .gpio_pwdown = GPIO_NR_PALMZ72_IR_DISABLE,
217 .transceiver_cap = IR_SIRMODE | IR_OFF,
218};
219 148
220/****************************************************************************** 149/******************************************************************************
221 * LEDs 150 * LEDs
222 ******************************************************************************/ 151 ******************************************************************************/
152#if defined(CONFIG_LEDS_GPIO) || defined(CONFIG_LEDS_GPIO_MODULE)
223static struct gpio_led gpio_leds[] = { 153static struct gpio_led gpio_leds[] = {
224 { 154 {
225 .name = "palmz72:green:led", 155 .name = "palmz72:green:led",
@@ -241,144 +171,13 @@ static struct platform_device palmz72_leds = {
241 } 171 }
242}; 172};
243 173
244/****************************************************************************** 174static void __init palmz72_leds_init(void)
245 * UDC
246 ******************************************************************************/
247static struct gpio_vbus_mach_info palmz72_udc_info = {
248 .gpio_vbus = GPIO_NR_PALMZ72_USB_DETECT_N,
249 .gpio_pullup = GPIO_NR_PALMZ72_USB_PULLUP,
250};
251
252static struct platform_device palmz72_gpio_vbus = {
253 .name = "gpio-vbus",
254 .id = -1,
255 .dev = {
256 .platform_data = &palmz72_udc_info,
257 },
258};
259
260/******************************************************************************
261 * Power supply
262 ******************************************************************************/
263static int power_supply_init(struct device *dev)
264{
265 int ret;
266
267 ret = gpio_request(GPIO_NR_PALMZ72_POWER_DETECT, "CABLE_STATE_AC");
268 if (ret)
269 goto err1;
270 ret = gpio_direction_input(GPIO_NR_PALMZ72_POWER_DETECT);
271 if (ret)
272 goto err2;
273
274 ret = gpio_request(GPIO_NR_PALMZ72_USB_DETECT_N, "CABLE_STATE_USB");
275 if (ret)
276 goto err2;
277 ret = gpio_direction_input(GPIO_NR_PALMZ72_USB_DETECT_N);
278 if (ret)
279 goto err3;
280
281 return 0;
282err3:
283 gpio_free(GPIO_NR_PALMZ72_USB_DETECT_N);
284err2:
285 gpio_free(GPIO_NR_PALMZ72_POWER_DETECT);
286err1:
287 return ret;
288}
289
290static int palmz72_is_ac_online(void)
291{
292 return gpio_get_value(GPIO_NR_PALMZ72_POWER_DETECT);
293}
294
295static int palmz72_is_usb_online(void)
296{ 175{
297 return !gpio_get_value(GPIO_NR_PALMZ72_USB_DETECT_N); 176 platform_device_register(&palmz72_leds);
298} 177}
299 178#else
300static void power_supply_exit(struct device *dev) 179static inline void palmz72_leds_init(void) {}
301{ 180#endif
302 gpio_free(GPIO_NR_PALMZ72_USB_DETECT_N);
303 gpio_free(GPIO_NR_PALMZ72_POWER_DETECT);
304}
305
306static char *palmz72_supplicants[] = {
307 "main-battery",
308};
309
310static struct pda_power_pdata power_supply_info = {
311 .init = power_supply_init,
312 .is_ac_online = palmz72_is_ac_online,
313 .is_usb_online = palmz72_is_usb_online,
314 .exit = power_supply_exit,
315 .supplied_to = palmz72_supplicants,
316 .num_supplicants = ARRAY_SIZE(palmz72_supplicants),
317};
318
319static struct platform_device power_supply = {
320 .name = "pda-power",
321 .id = -1,
322 .dev = {
323 .platform_data = &power_supply_info,
324 },
325};
326
327/******************************************************************************
328 * WM97xx audio, battery
329 ******************************************************************************/
330static struct wm97xx_batt_pdata palmz72_batt_pdata = {
331 .batt_aux = WM97XX_AUX_ID3,
332 .temp_aux = WM97XX_AUX_ID2,
333 .charge_gpio = -1,
334 .max_voltage = PALMZ72_BAT_MAX_VOLTAGE,
335 .min_voltage = PALMZ72_BAT_MIN_VOLTAGE,
336 .batt_mult = 1000,
337 .batt_div = 414,
338 .temp_mult = 1,
339 .temp_div = 1,
340 .batt_tech = POWER_SUPPLY_TECHNOLOGY_LIPO,
341 .batt_name = "main-batt",
342};
343
344static struct wm97xx_pdata palmz72_wm97xx_pdata = {
345 .batt_pdata = &palmz72_batt_pdata,
346};
347
348static pxa2xx_audio_ops_t palmz72_ac97_pdata = {
349 .codec_pdata = { &palmz72_wm97xx_pdata, },
350};
351
352static struct platform_device palmz72_asoc = {
353 .name = "palm27x-asoc",
354 .id = -1,
355};
356
357/******************************************************************************
358 * Framebuffer
359 ******************************************************************************/
360static struct pxafb_mode_info palmz72_lcd_modes[] = {
361{
362 .pixclock = 115384,
363 .xres = 320,
364 .yres = 320,
365 .bpp = 16,
366
367 .left_margin = 27,
368 .right_margin = 7,
369 .upper_margin = 7,
370 .lower_margin = 8,
371
372 .hsync_len = 6,
373 .vsync_len = 1,
374},
375};
376
377static struct pxafb_mach_info palmz72_lcd_screen = {
378 .modes = palmz72_lcd_modes,
379 .num_modes = ARRAY_SIZE(palmz72_lcd_modes),
380 .lcd_conn = LCD_COLOR_TFT_16BPP | LCD_PCLK_EDGE_FALL,
381};
382 181
383#ifdef CONFIG_PM 182#ifdef CONFIG_PM
384 183
@@ -457,39 +256,26 @@ device_initcall(palmz72_pm_init);
457/****************************************************************************** 256/******************************************************************************
458 * Machine init 257 * Machine init
459 ******************************************************************************/ 258 ******************************************************************************/
460static struct platform_device *devices[] __initdata = {
461 &palmz72_backlight,
462 &palmz72_leds,
463 &palmz72_asoc,
464 &power_supply,
465 &palmz72_gpio_vbus,
466};
467
468/* setup udc GPIOs initial state */
469static void __init palmz72_udc_init(void)
470{
471 if (!gpio_request(GPIO_NR_PALMZ72_USB_PULLUP, "USB Pullup")) {
472 gpio_direction_output(GPIO_NR_PALMZ72_USB_PULLUP, 0);
473 gpio_free(GPIO_NR_PALMZ72_USB_PULLUP);
474 }
475}
476
477static void __init palmz72_init(void) 259static void __init palmz72_init(void)
478{ 260{
479 pxa2xx_mfp_config(ARRAY_AND_SIZE(palmz72_pin_config)); 261 pxa2xx_mfp_config(ARRAY_AND_SIZE(palmz72_pin_config));
480
481 pxa_set_ffuart_info(NULL); 262 pxa_set_ffuart_info(NULL);
482 pxa_set_btuart_info(NULL); 263 pxa_set_btuart_info(NULL);
483 pxa_set_stuart_info(NULL); 264 pxa_set_stuart_info(NULL);
484 265
485 set_pxa_fb_info(&palmz72_lcd_screen); 266 palm27x_mmc_init(GPIO_NR_PALMZ72_SD_DETECT_N, GPIO_NR_PALMZ72_SD_RO,
486 pxa_set_mci_info(&palmz72_mci_platform_data); 267 GPIO_NR_PALMZ72_SD_POWER_N, 1);
487 palmz72_udc_init(); 268 palm27x_lcd_init(-1, &palm_320x320_lcd_mode);
488 pxa_set_ac97_info(&palmz72_ac97_pdata); 269 palm27x_udc_init(GPIO_NR_PALMZ72_USB_DETECT_N,
489 pxa_set_ficp_info(&palmz72_ficp_platform_data); 270 GPIO_NR_PALMZ72_USB_PULLUP, 0);
490 pxa_set_keypad_info(&palmz72_keypad_platform_data); 271 palm27x_irda_init(GPIO_NR_PALMZ72_IR_DISABLE);
491 272 palm27x_ac97_init(PALMZ72_BAT_MIN_VOLTAGE, PALMZ72_BAT_MAX_VOLTAGE,
492 platform_add_devices(devices, ARRAY_SIZE(devices)); 273 -1, 113);
274 palm27x_pwm_init(-1, -1);
275 palm27x_power_init(-1, -1);
276 palm27x_pmic_init();
277 palmz72_kpc_init();
278 palmz72_leds_init();
493} 279}
494 280
495MACHINE_START(PALMZ72, "Palm Zire72") 281MACHINE_START(PALMZ72, "Palm Zire72")