aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-pxa/palmtx.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/arm/mach-pxa/palmtx.c')
-rw-r--r--arch/arm/mach-pxa/palmtx.c299
1 files changed, 47 insertions, 252 deletions
diff --git a/arch/arm/mach-pxa/palmtx.c b/arch/arm/mach-pxa/palmtx.c
index ecc1a401598..144dc2b6911 100644
--- a/arch/arm/mach-pxa/palmtx.c
+++ b/arch/arm/mach-pxa/palmtx.c
@@ -25,7 +25,7 @@
25#include <linux/pda_power.h> 25#include <linux/pda_power.h>
26#include <linux/pwm_backlight.h> 26#include <linux/pwm_backlight.h>
27#include <linux/gpio.h> 27#include <linux/gpio.h>
28#include <linux/wm97xx_batt.h> 28#include <linux/wm97xx.h>
29#include <linux/power_supply.h> 29#include <linux/power_supply.h>
30#include <linux/usb/gpio_vbus.h> 30#include <linux/usb/gpio_vbus.h>
31#include <linux/mtd/nand.h> 31#include <linux/mtd/nand.h>
@@ -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,208 +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 battery
363 ******************************************************************************/
364static struct wm97xx_batt_info wm97xx_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
378/******************************************************************************
379 * aSoC audio
380 ******************************************************************************/
381static struct palm27x_asoc_info palmtx_asoc_pdata = {
382 .jack_gpio = GPIO_NR_PALMTX_EARPHONE_DETECT,
383};
384
385static pxa2xx_audio_ops_t palmtx_ac97_pdata = {
386 .reset_gpio = 95,
387};
388
389static struct platform_device palmtx_asoc = {
390 .name = "palm27x-asoc",
391 .id = -1,
392 .dev = {
393 .platform_data = &palmtx_asoc_pdata,
394 },
395};
396
397/******************************************************************************
398 * Framebuffer
399 ******************************************************************************/
400static struct pxafb_mode_info palmtx_lcd_modes[] = {
401{
402 .pixclock = 57692,
403 .xres = 320,
404 .yres = 480,
405 .bpp = 16,
406
407 .left_margin = 32,
408 .right_margin = 1,
409 .upper_margin = 7,
410 .lower_margin = 1,
411
412 .hsync_len = 4,
413 .vsync_len = 1,
414},
415};
416
417static struct pxafb_mach_info palmtx_lcd_screen = {
418 .modes = palmtx_lcd_modes,
419 .num_modes = ARRAY_SIZE(palmtx_lcd_modes),
420 .lcd_conn = LCD_COLOR_TFT_16BPP | LCD_PCLK_EDGE_FALL,
421};
422 240
423/****************************************************************************** 241/******************************************************************************
424 * NAND Flash 242 * NAND Flash
425 ******************************************************************************/ 243 ******************************************************************************/
244#if defined(CONFIG_MTD_NAND_GPIO) || defined(CONFIG_MTD_NAND_GPIO_MODULE)
426static void palmtx_nand_cmd_ctl(struct mtd_info *mtd, int cmd, 245static void palmtx_nand_cmd_ctl(struct mtd_info *mtd, int cmd,
427 unsigned int ctrl) 246 unsigned int ctrl)
428{ 247{
@@ -482,36 +301,17 @@ static struct platform_device palmtx_nand = {
482 } 301 }
483}; 302};
484 303
485/****************************************************************************** 304static void __init palmtx_nand_init(void)
486 * Power management - standby
487 ******************************************************************************/
488static void __init palmtx_pm_init(void)
489{ 305{
490 static u32 resume[] = { 306 platform_device_register(&palmtx_nand);
491 0xe3a00101, /* mov r0, #0x40000000 */
492 0xe380060f, /* orr r0, r0, #0x00f00000 */
493 0xe590f008, /* ldr pc, [r0, #0x08] */
494 };
495
496 /* copy the bootloader */
497 memcpy(phys_to_virt(PALMTX_STR_BASE), resume, sizeof(resume));
498} 307}
308#else
309static inline void palmtx_nand_init(void) {}
310#endif
499 311
500/****************************************************************************** 312/******************************************************************************
501 * Machine init 313 * Machine init
502 ******************************************************************************/ 314 ******************************************************************************/
503static struct platform_device *devices[] __initdata = {
504#if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
505 &palmtx_pxa_keys,
506#endif
507 &palmtx_backlight,
508 &power_supply,
509 &palmtx_asoc,
510 &palmtx_gpio_vbus,
511 &palmtx_flash,
512 &palmtx_nand,
513};
514
515static struct map_desc palmtx_io_desc[] __initdata = { 315static struct map_desc palmtx_io_desc[] __initdata = {
516{ 316{
517 .virtual = PALMTX_PCMCIA_VIRT, 317 .virtual = PALMTX_PCMCIA_VIRT,
@@ -537,34 +337,29 @@ static void __init palmtx_map_io(void)
537 iotable_init(palmtx_io_desc, ARRAY_SIZE(palmtx_io_desc)); 337 iotable_init(palmtx_io_desc, ARRAY_SIZE(palmtx_io_desc));
538} 338}
539 339
540/* setup udc GPIOs initial state */
541static void __init palmtx_udc_init(void)
542{
543 if (!gpio_request(GPIO_NR_PALMTX_USB_PULLUP, "UDC Vbus")) {
544 gpio_direction_output(GPIO_NR_PALMTX_USB_PULLUP, 1);
545 gpio_free(GPIO_NR_PALMTX_USB_PULLUP);
546 }
547}
548
549
550static void __init palmtx_init(void) 340static void __init palmtx_init(void)
551{ 341{
552 pxa2xx_mfp_config(ARRAY_AND_SIZE(palmtx_pin_config)); 342 pxa2xx_mfp_config(ARRAY_AND_SIZE(palmtx_pin_config));
553
554 pxa_set_ffuart_info(NULL); 343 pxa_set_ffuart_info(NULL);
555 pxa_set_btuart_info(NULL); 344 pxa_set_btuart_info(NULL);
556 pxa_set_stuart_info(NULL); 345 pxa_set_stuart_info(NULL);
557 346
558 palmtx_pm_init(); 347 palm27x_mmc_init(GPIO_NR_PALMTX_SD_DETECT_N, GPIO_NR_PALMTX_SD_READONLY,
559 set_pxa_fb_info(&palmtx_lcd_screen); 348 GPIO_NR_PALMTX_SD_POWER, 0);
560 pxa_set_mci_info(&palmtx_mci_platform_data); 349 palm27x_pm_init(PALMTX_STR_BASE);
561 palmtx_udc_init(); 350 palm27x_lcd_init(-1, &palm_320x480_lcd_mode);
562 pxa_set_ac97_info(&palmtx_ac97_pdata); 351 palm27x_udc_init(GPIO_NR_PALMTX_USB_DETECT_N,
563 pxa_set_ficp_info(&palmtx_ficp_platform_data); 352 GPIO_NR_PALMTX_USB_PULLUP, 1);
564 pxa_set_keypad_info(&palmtx_keypad_platform_data); 353 palm27x_irda_init(GPIO_NR_PALMTX_IR_DISABLE);
565 wm97xx_bat_set_pdata(&wm97xx_batt_pdata); 354 palm27x_ac97_init(PALMTX_BAT_MIN_VOLTAGE, PALMTX_BAT_MAX_VOLTAGE,
566 355 GPIO_NR_PALMTX_EARPHONE_DETECT, 95);
567 platform_add_devices(devices, ARRAY_SIZE(devices)); 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();
568} 363}
569 364
570MACHINE_START(PALMTX, "Palm T|X") 365MACHINE_START(PALMTX, "Palm T|X")