1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
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>
33
34#include <asm/mach-types.h>
35#include <asm/mach/arch.h>
36#include <asm/mach/map.h>
37
38#include <mach/pxa27x.h>
39#include <mach/audio.h>
40#include <mach/palmz72.h>
41#include <mach/mmc.h>
42#include <mach/pxafb.h>
43#include <mach/irda.h>
44#include <plat/pxa27x_keypad.h>
45#include <mach/udc.h>
46#include <mach/palmasoc.h>
47#include <mach/palm27x.h>
48
49#include <mach/pm.h>
50
51#include "generic.h"
52#include "devices.h"
53
54
55
56
57static unsigned long palmz72_pin_config[] __initdata = {
58
59 GPIO32_MMC_CLK,
60 GPIO92_MMC_DAT_0,
61 GPIO109_MMC_DAT_1,
62 GPIO110_MMC_DAT_2,
63 GPIO111_MMC_DAT_3,
64 GPIO112_MMC_CMD,
65 GPIO14_GPIO,
66 GPIO115_GPIO,
67 GPIO98_GPIO,
68
69
70 GPIO28_AC97_BITCLK,
71 GPIO29_AC97_SDATA_IN_0,
72 GPIO30_AC97_SDATA_OUT,
73 GPIO31_AC97_SYNC,
74 GPIO89_AC97_SYSCLK,
75 GPIO113_AC97_nRESET,
76
77
78 GPIO49_GPIO,
79 GPIO46_FICP_RXD,
80 GPIO47_FICP_TXD,
81
82
83 GPIO16_PWM0_OUT,
84
85
86 GPIO15_GPIO,
87 GPIO95_GPIO,
88
89
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,
94 GPIO103_KP_MKOUT_0,
95 GPIO104_KP_MKOUT_1,
96 GPIO105_KP_MKOUT_2,
97
98
99 GPIOxx_LCD_TFT_16BPP,
100
101 GPIO20_GPIO,
102 GPIO21_GPIO,
103 GPIO22_GPIO,
104 GPIO96_GPIO,
105
106
107 GPIO0_GPIO | WAKEUP_ON_LEVEL_HIGH,
108 GPIO88_GPIO,
109 GPIO27_GPIO,
110};
111
112
113
114
115#if defined(CONFIG_KEYBOARD_PXA27x) || defined(CONFIG_KEYBOARD_PXA27x_MODULE)
116static unsigned int palmz72_matrix_keys[] = {
117 KEY(0, 0, KEY_POWER),
118 KEY(0, 1, KEY_F1),
119 KEY(0, 2, KEY_ENTER),
120
121 KEY(1, 0, KEY_F2),
122 KEY(1, 1, KEY_F3),
123 KEY(1, 2, KEY_F4),
124
125 KEY(2, 0, KEY_UP),
126 KEY(2, 2, KEY_DOWN),
127
128 KEY(3, 0, KEY_RIGHT),
129 KEY(3, 2, KEY_LEFT),
130};
131
132static 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),
137
138 .debounce_interval = 30,
139};
140
141static void __init palmz72_kpc_init(void)
142{
143 pxa_set_keypad_info(&palmz72_keypad_platform_data);
144}
145#else
146static inline void palmz72_kpc_init(void) {}
147#endif
148
149
150
151
152#if defined(CONFIG_LEDS_GPIO) || defined(CONFIG_LEDS_GPIO_MODULE)
153static struct gpio_led gpio_leds[] = {
154 {
155 .name = "palmz72:green:led",
156 .default_trigger = "none",
157 .gpio = GPIO_NR_PALMZ72_LED_GREEN,
158 },
159};
160
161static struct gpio_led_platform_data gpio_led_info = {
162 .leds = gpio_leds,
163 .num_leds = ARRAY_SIZE(gpio_leds),
164};
165
166static struct platform_device palmz72_leds = {
167 .name = "leds-gpio",
168 .id = -1,
169 .dev = {
170 .platform_data = &gpio_led_info,
171 }
172};
173
174static void __init palmz72_leds_init(void)
175{
176 platform_device_register(&palmz72_leds);
177}
178#else
179static inline void palmz72_leds_init(void) {}
180#endif
181
182#ifdef CONFIG_PM
183
184
185
186
187
188
189
190
191
192
193
194#define PALMZ72_SAVE_DWORD ((unsigned long *)0xc0000050)
195
196static struct palmz72_resume_info palmz72_resume_info = {
197 .magic0 = 0xb4e6,
198 .magic1 = 1,
199
200
201 .arm_control = 0,
202 .aux_control = 0,
203 .ttb = 0,
204 .domain_access = 0,
205 .process_id = 0,
206};
207
208static unsigned long store_ptr;
209
210
211
212static int palmz72_pm_suspend(struct sys_device *dev, pm_message_t msg)
213{
214
215 palmz72_resume_info.resume_addr = (u32) pxa_cpu_resume;
216
217
218 store_ptr = *PALMZ72_SAVE_DWORD;
219
220
221 PSPR = virt_to_phys(&palmz72_resume_info);
222
223 return 0;
224}
225
226static int palmz72_pm_resume(struct sys_device *dev)
227{
228 *PALMZ72_SAVE_DWORD = store_ptr;
229 return 0;
230}
231
232static struct sysdev_class palmz72_pm_sysclass = {
233 .name = "palmz72_pm",
234 .suspend = palmz72_pm_suspend,
235 .resume = palmz72_pm_resume,
236};
237
238static struct sys_device palmz72_pm_device = {
239 .cls = &palmz72_pm_sysclass,
240};
241
242static int __init palmz72_pm_init(void)
243{
244 int ret = -ENODEV;
245 if (machine_is_palmz72()) {
246 ret = sysdev_class_register(&palmz72_pm_sysclass);
247 if (ret == 0)
248 ret = sysdev_register(&palmz72_pm_device);
249 }
250 return ret;
251}
252
253device_initcall(palmz72_pm_init);
254#endif
255
256
257
258
259static void __init palmz72_init(void)
260{
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);
265
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,
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();
279}
280
281MACHINE_START(PALMZ72, "Palm Zire72")
282 .boot_params = 0xa0000100,
283 .map_io = pxa27x_map_io,
284 .init_irq = pxa27x_init_irq,
285 .timer = &pxa_timer,
286 .init_machine = palmz72_init
287MACHINE_END
288