2 * Hardware definitions for Palm Zire72
5 * Vladimir "Farcaller" Pouzanov <farcaller@gmail.com>
6 * Sergey Lapin <slapin@ossfans.org>
7 * Alex Osborne <bobofdoom@gmail.com>
8 * Jan Herman <2hp@seznam.cz>
10 * Rewrite for mainline:
11 * Marek Vasut <marek.vasut@gmail.com>
13 * This program is free software; you can redistribute it and/or modify
14 * it under the terms of the GNU General Public License version 2 as
15 * published by the Free Software Foundation.
17 * (find more info at www.hackndev.com)
21 #include <linux/platform_device.h>
22 #include <linux/sysdev.h>
23 #include <linux/delay.h>
24 #include <linux/irq.h>
25 #include <linux/gpio_keys.h>
26 #include <linux/input.h>
27 #include <linux/pda_power.h>
28 #include <linux/pwm_backlight.h>
29 #include <linux/gpio.h>
30 #include <linux/wm97xx.h>
31 #include <linux/power_supply.h>
32 #include <linux/usb/gpio_vbus.h>
34 #include <asm/mach-types.h>
35 #include <asm/mach/arch.h>
36 #include <asm/mach/map.h>
38 #include <mach/pxa27x.h>
39 #include <mach/audio.h>
40 #include <mach/palmz72.h>
42 #include <mach/pxafb.h>
43 #include <mach/irda.h>
44 #include <plat/pxa27x_keypad.h>
46 #include <mach/palmasoc.h>
47 #include <mach/palm27x.h>
54 /******************************************************************************
56 ******************************************************************************/
57 static unsigned long palmz72_pin_config
[] __initdata
= {
65 GPIO14_GPIO
, /* SD detect */
66 GPIO115_GPIO
, /* SD RO */
67 GPIO98_GPIO
, /* SD power */
71 GPIO29_AC97_SDATA_IN_0
,
72 GPIO30_AC97_SDATA_OUT
,
78 GPIO49_GPIO
, /* ir disable */
86 GPIO15_GPIO
, /* usb detect */
87 GPIO95_GPIO
, /* usb pullup */
90 GPIO100_KP_MKIN_0
| WAKEUP_ON_LEVEL_HIGH
,
91 GPIO101_KP_MKIN_1
| WAKEUP_ON_LEVEL_HIGH
,
92 GPIO102_KP_MKIN_2
| WAKEUP_ON_LEVEL_HIGH
,
93 GPIO97_KP_MKIN_3
| WAKEUP_ON_LEVEL_HIGH
,
101 GPIO20_GPIO
, /* bl power */
102 GPIO21_GPIO
, /* LCD border switch */
103 GPIO22_GPIO
, /* LCD border color */
104 GPIO96_GPIO
, /* lcd power */
107 GPIO0_GPIO
| WAKEUP_ON_LEVEL_HIGH
, /* power detect */
108 GPIO88_GPIO
, /* green led */
109 GPIO27_GPIO
, /* WM9712 IRQ */
112 /******************************************************************************
114 ******************************************************************************/
115 #if defined(CONFIG_KEYBOARD_PXA27x) || defined(CONFIG_KEYBOARD_PXA27x_MODULE)
116 static unsigned int palmz72_matrix_keys
[] = {
117 KEY(0, 0, KEY_POWER
),
119 KEY(0, 2, KEY_ENTER
),
128 KEY(3, 0, KEY_RIGHT
),
132 static struct pxa27x_keypad_platform_data palmz72_keypad_platform_data
= {
133 .matrix_key_rows
= 4,
134 .matrix_key_cols
= 3,
135 .matrix_key_map
= palmz72_matrix_keys
,
136 .matrix_key_map_size
= ARRAY_SIZE(palmz72_matrix_keys
),
138 .debounce_interval
= 30,
141 static void __init
palmz72_kpc_init(void)
143 pxa_set_keypad_info(&palmz72_keypad_platform_data
);
146 static inline void palmz72_kpc_init(void) {}
149 /******************************************************************************
151 ******************************************************************************/
152 #if defined(CONFIG_LEDS_GPIO) || defined(CONFIG_LEDS_GPIO_MODULE)
153 static struct gpio_led gpio_leds
[] = {
155 .name
= "palmz72:green:led",
156 .default_trigger
= "none",
157 .gpio
= GPIO_NR_PALMZ72_LED_GREEN
,
161 static struct gpio_led_platform_data gpio_led_info
= {
163 .num_leds
= ARRAY_SIZE(gpio_leds
),
166 static struct platform_device palmz72_leds
= {
170 .platform_data
= &gpio_led_info
,
174 static void __init
palmz72_leds_init(void)
176 platform_device_register(&palmz72_leds
);
179 static inline void palmz72_leds_init(void) {}
184 /* We have some black magic here
185 * PalmOS ROM on recover expects special struct physical address
186 * to be transferred via PSPR. Using this struct PalmOS restores
187 * its state after sleep. As for Linux, we need to setup it the
188 * same way. More than that, PalmOS ROM changes some values in memory.
189 * For now only one location is found, which needs special treatment.
190 * Thanks to Alex Osborne, Andrzej Zaborowski, and lots of other people
191 * for reading backtraces for me :)
194 #define PALMZ72_SAVE_DWORD ((unsigned long *)0xc0000050)
196 static struct palmz72_resume_info palmz72_resume_info
= {
200 /* reset state, MMU off etc */
208 static unsigned long store_ptr
;
210 /* sys_device for Palm Zire 72 PM */
212 static int palmz72_pm_suspend(struct sys_device
*dev
, pm_message_t msg
)
214 /* setup the resume_info struct for the original bootloader */
215 palmz72_resume_info
.resume_addr
= (u32
) cpu_resume
;
217 /* Storing memory touched by ROM */
218 store_ptr
= *PALMZ72_SAVE_DWORD
;
220 /* Setting PSPR to a proper value */
221 PSPR
= virt_to_phys(&palmz72_resume_info
);
226 static int palmz72_pm_resume(struct sys_device
*dev
)
228 *PALMZ72_SAVE_DWORD
= store_ptr
;
232 static struct sysdev_class palmz72_pm_sysclass
= {
233 .name
= "palmz72_pm",
234 .suspend
= palmz72_pm_suspend
,
235 .resume
= palmz72_pm_resume
,
238 static struct sys_device palmz72_pm_device
= {
239 .cls
= &palmz72_pm_sysclass
,
242 static int __init
palmz72_pm_init(void)
245 if (machine_is_palmz72()) {
246 ret
= sysdev_class_register(&palmz72_pm_sysclass
);
248 ret
= sysdev_register(&palmz72_pm_device
);
253 device_initcall(palmz72_pm_init
);
256 /******************************************************************************
258 ******************************************************************************/
259 static void __init
palmz72_init(void)
261 pxa2xx_mfp_config(ARRAY_AND_SIZE(palmz72_pin_config
));
262 pxa_set_ffuart_info(NULL
);
263 pxa_set_btuart_info(NULL
);
264 pxa_set_stuart_info(NULL
);
266 palm27x_mmc_init(GPIO_NR_PALMZ72_SD_DETECT_N
, GPIO_NR_PALMZ72_SD_RO
,
267 GPIO_NR_PALMZ72_SD_POWER_N
, 1);
268 palm27x_lcd_init(-1, &palm_320x320_lcd_mode
);
269 palm27x_udc_init(GPIO_NR_PALMZ72_USB_DETECT_N
,
270 GPIO_NR_PALMZ72_USB_PULLUP
, 0);
271 palm27x_irda_init(GPIO_NR_PALMZ72_IR_DISABLE
);
272 palm27x_ac97_init(PALMZ72_BAT_MIN_VOLTAGE
, PALMZ72_BAT_MAX_VOLTAGE
,
274 palm27x_pwm_init(-1, -1);
275 palm27x_power_init(-1, -1);
281 MACHINE_START(PALMZ72
, "Palm Zire72")
282 .boot_params
= 0xa0000100,
283 .map_io
= pxa27x_map_io
,
284 .init_irq
= pxa27x_init_irq
,
286 .init_machine
= palmz72_init