aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarek Vasut <marek.vasut@gmail.com>2008-11-20 16:50:46 -0500
committerEric Miao <eric.miao@marvell.com>2009-01-21 02:06:34 -0500
commita645072a608356990b2737a48ecc1bfb66981599 (patch)
tree78cfe0a8a1148dc97ec462123ae4300a1db4c166
parent0f6ff0f06cc126e8dfaa20c8c6da53537e352378 (diff)
[ARM] pxa: PalmLD initial support
Signed-off-by: Marek Vasut <marek.vasut@gmail.com> Signed-off-by: Eric Miao <eric.miao@marvell.com>
-rw-r--r--MAINTAINERS2
-rw-r--r--arch/arm/mach-pxa/Kconfig10
-rw-r--r--arch/arm/mach-pxa/Makefile1
-rw-r--r--arch/arm/mach-pxa/include/mach/palmld.h109
-rw-r--r--arch/arm/mach-pxa/palmld.c566
5 files changed, 687 insertions, 1 deletions
diff --git a/MAINTAINERS b/MAINTAINERS
index a267659552ca..1a142b8cc1be 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -622,7 +622,7 @@ P: Dirk Opfer
622M: dirk@opfer-online.de 622M: dirk@opfer-online.de
623S: Maintained 623S: Maintained
624 624
625ARM/PALMTX,PALMT5 SUPPORT 625ARM/PALMTX,PALMT5,PALMLD SUPPORT
626P: Marek Vasut 626P: Marek Vasut
627M: marek.vasut@gmail.com 627M: marek.vasut@gmail.com
628W: http://hackndev.com 628W: http://hackndev.com
diff --git a/arch/arm/mach-pxa/Kconfig b/arch/arm/mach-pxa/Kconfig
index 9223ba607a71..af5b5b463a27 100644
--- a/arch/arm/mach-pxa/Kconfig
+++ b/arch/arm/mach-pxa/Kconfig
@@ -349,6 +349,16 @@ config MACH_PALMZ72
349 Say Y here if you intend to run this kernel on Palm Zire 72 349 Say Y here if you intend to run this kernel on Palm Zire 72
350 handheld computer. 350 handheld computer.
351 351
352config MACH_PALMLD
353 bool "Palm LifeDrive"
354 default y
355 depends on ARCH_PXA_PALM
356 select PXA27x
357 select IWMMXT
358 help
359 Say Y here if you intend to run this kernel on a Palm LifeDrive
360 handheld computer.
361
352config MACH_PCM990_BASEBOARD 362config MACH_PCM990_BASEBOARD
353 bool "PHYTEC PCM-990 development board" 363 bool "PHYTEC PCM-990 development board"
354 select HAVE_PWM 364 select HAVE_PWM
diff --git a/arch/arm/mach-pxa/Makefile b/arch/arm/mach-pxa/Makefile
index 0d0afe84ec54..146aba72fa22 100644
--- a/arch/arm/mach-pxa/Makefile
+++ b/arch/arm/mach-pxa/Makefile
@@ -55,6 +55,7 @@ obj-$(CONFIG_MACH_E400) += e400.o
55obj-$(CONFIG_MACH_E800) += e800.o 55obj-$(CONFIG_MACH_E800) += e800.o
56obj-$(CONFIG_MACH_PALMT5) += palmt5.o 56obj-$(CONFIG_MACH_PALMT5) += palmt5.o
57obj-$(CONFIG_MACH_PALMTX) += palmtx.o 57obj-$(CONFIG_MACH_PALMTX) += palmtx.o
58obj-$(CONFIG_MACH_PALMLD) += palmld.o
58obj-$(CONFIG_MACH_PALMZ72) += palmz72.o 59obj-$(CONFIG_MACH_PALMZ72) += palmz72.o
59obj-$(CONFIG_ARCH_VIPER) += viper.o 60obj-$(CONFIG_ARCH_VIPER) += viper.o
60 61
diff --git a/arch/arm/mach-pxa/include/mach/palmld.h b/arch/arm/mach-pxa/include/mach/palmld.h
new file mode 100644
index 000000000000..7c295a48d784
--- /dev/null
+++ b/arch/arm/mach-pxa/include/mach/palmld.h
@@ -0,0 +1,109 @@
1/*
2 * GPIOs and interrupts for Palm LifeDrive Handheld Computer
3 *
4 * Authors: Alex Osborne <ato@meshy.org>
5 * Marek Vasut <marek.vasut@gmail.com>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
10 *
11 */
12
13#ifndef _INCLUDE_PALMLD_H_
14#define _INCLUDE_PALMLD_H_
15
16/** HERE ARE GPIOs **/
17
18/* GPIOs */
19#define GPIO_NR_PALMLD_GPIO_RESET 1
20#define GPIO_NR_PALMLD_POWER_DETECT 4
21#define GPIO_NR_PALMLD_HOTSYNC_BUTTON_N 10
22#define GPIO_NR_PALMLD_POWER_SWITCH 12
23#define GPIO_NR_PALMLD_EARPHONE_DETECT 13
24#define GPIO_NR_PALMLD_LOCK_SWITCH 15
25
26/* SD/MMC */
27#define GPIO_NR_PALMLD_SD_DETECT_N 14
28#define GPIO_NR_PALMLD_SD_POWER 114
29#define GPIO_NR_PALMLD_SD_READONLY 116
30
31/* TOUCHSCREEN */
32#define GPIO_NR_PALMLD_WM9712_IRQ 27
33
34/* IRDA */
35#define GPIO_NR_PALMLD_IR_DISABLE 108
36
37/* LCD/BACKLIGHT */
38#define GPIO_NR_PALMLD_BL_POWER 19
39#define GPIO_NR_PALMLD_LCD_POWER 96
40
41/* LCD BORDER */
42#define GPIO_NR_PALMLD_BORDER_SWITCH 21
43#define GPIO_NR_PALMLD_BORDER_SELECT 22
44
45/* BLUETOOTH */
46#define GPIO_NR_PALMLD_BT_POWER 17
47#define GPIO_NR_PALMLD_BT_RESET 83
48
49/* PCMCIA (WiFi) */
50#define GPIO_NR_PALMLD_PCMCIA_READY 38
51#define GPIO_NR_PALMLD_PCMCIA_POWER 36
52#define GPIO_NR_PALMLD_PCMCIA_RESET 81
53
54/* LEDs */
55#define GPIO_NR_PALMLD_LED_GREEN 52
56#define GPIO_NR_PALMLD_LED_AMBER 94
57
58/* IDE */
59#define GPIO_NR_PALMLD_IDE_IRQ 95
60#define GPIO_NR_PALMLD_IDE_RESET 98
61#define GPIO_NR_PALMLD_IDE_PWEN 115
62
63/* USB */
64#define GPIO_NR_PALMLD_USB_DETECT_N 3
65#define GPIO_NR_PALMLD_USB_READY 86
66#define GPIO_NR_PALMLD_USB_RESET 88
67#define GPIO_NR_PALMLD_USB_INT 106
68#define GPIO_NR_PALMLD_USB_POWER 118
69/* 20, 53 and 86 are usb related too */
70
71/* INTERRUPTS */
72#define IRQ_GPIO_PALMLD_GPIO_RESET IRQ_GPIO(GPIO_NR_PALMLD_GPIO_RESET)
73#define IRQ_GPIO_PALMLD_SD_DETECT_N IRQ_GPIO(GPIO_NR_PALMLD_SD_DETECT_N)
74#define IRQ_GPIO_PALMLD_WM9712_IRQ IRQ_GPIO(GPIO_NR_PALMLD_WM9712_IRQ)
75#define IRQ_GPIO_PALMLD_IDE_IRQ IRQ_GPIO(GPIO_NR_PALMLD_IDE_IRQ)
76
77
78/** HERE ARE INIT VALUES **/
79
80/* IO mappings */
81#define PALMLD_USB_PHYS PXA_CS2_PHYS
82#define PALMLD_USB_VIRT 0xf0000000
83#define PALMLD_USB_SIZE 0x00100000
84
85#define PALMLD_IDE_PHYS 0x20000000
86#define PALMLD_IDE_VIRT 0xf1000000
87#define PALMLD_IDE_SIZE 0x00100000
88
89#define PALMLD_PHYS_IO_START 0x40000000
90
91/* BATTERY */
92#define PALMLD_BAT_MAX_VOLTAGE 4000 /* 4.00V maximum voltage */
93#define PALMLD_BAT_MIN_VOLTAGE 3550 /* 3.55V critical voltage */
94#define PALMLD_BAT_MAX_CURRENT 0 /* unknokn */
95#define PALMLD_BAT_MIN_CURRENT 0 /* unknown */
96#define PALMLD_BAT_MAX_CHARGE 1 /* unknown */
97#define PALMLD_BAT_MIN_CHARGE 1 /* unknown */
98#define PALMLD_MAX_LIFE_MINS 240 /* on-life in minutes */
99
100#define PALMLD_BAT_MEASURE_DELAY (HZ * 1)
101
102/* BACKLIGHT */
103#define PALMLD_MAX_INTENSITY 0xFE
104#define PALMLD_DEFAULT_INTENSITY 0x7E
105#define PALMLD_LIMIT_MASK 0x7F
106#define PALMLD_PRESCALER 0x3F
107#define PALMLD_PERIOD_NS 3500
108
109#endif
diff --git a/arch/arm/mach-pxa/palmld.c b/arch/arm/mach-pxa/palmld.c
new file mode 100644
index 000000000000..55a2c40b6f26
--- /dev/null
+++ b/arch/arm/mach-pxa/palmld.c
@@ -0,0 +1,566 @@
1/*
2 * Hardware definitions for Palm LifeDrive
3 *
4 * Author: Marek Vasut <marek.vasut@gmail.com>
5 *
6 * Based on work of:
7 * Alex Osborne <ato@meshy.org>
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License version 2 as
11 * published by the Free Software Foundation.
12 *
13 * (find more info at www.hackndev.com)
14 *
15 */
16
17#include <linux/platform_device.h>
18#include <linux/delay.h>
19#include <linux/irq.h>
20#include <linux/gpio_keys.h>
21#include <linux/input.h>
22#include <linux/pda_power.h>
23#include <linux/pwm_backlight.h>
24#include <linux/gpio.h>
25#include <linux/wm97xx_batt.h>
26#include <linux/power_supply.h>
27
28#include <asm/mach-types.h>
29#include <asm/mach/arch.h>
30#include <asm/mach/map.h>
31
32#include <mach/audio.h>
33#include <mach/palmld.h>
34#include <mach/mmc.h>
35#include <mach/pxafb.h>
36#include <mach/pxa-regs.h>
37#include <mach/mfp-pxa27x.h>
38#include <mach/irda.h>
39#include <mach/pxa27x_keypad.h>
40#include <mach/palmasoc.h>
41
42#include "generic.h"
43#include "devices.h"
44
45/******************************************************************************
46 * Pin configuration
47 ******************************************************************************/
48static unsigned long palmld_pin_config[] __initdata = {
49 /* MMC */
50 GPIO32_MMC_CLK,
51 GPIO92_MMC_DAT_0,
52 GPIO109_MMC_DAT_1,
53 GPIO110_MMC_DAT_2,
54 GPIO111_MMC_DAT_3,
55 GPIO112_MMC_CMD,
56 GPIO14_GPIO, /* SD detect */
57 GPIO114_GPIO, /* SD power */
58 GPIO116_GPIO, /* SD r/o switch */
59
60 /* AC97 */
61 GPIO28_AC97_BITCLK,
62 GPIO29_AC97_SDATA_IN_0,
63 GPIO30_AC97_SDATA_OUT,
64 GPIO31_AC97_SYNC,
65
66 /* IrDA */
67 GPIO108_GPIO, /* ir disable */
68 GPIO46_FICP_RXD,
69 GPIO47_FICP_TXD,
70
71 /* MATRIX KEYPAD */
72 GPIO100_KP_MKIN_0,
73 GPIO101_KP_MKIN_1,
74 GPIO102_KP_MKIN_2,
75 GPIO97_KP_MKIN_3,
76 GPIO103_KP_MKOUT_0,
77 GPIO104_KP_MKOUT_1,
78 GPIO105_KP_MKOUT_2,
79
80 /* LCD */
81 GPIO58_LCD_LDD_0,
82 GPIO59_LCD_LDD_1,
83 GPIO60_LCD_LDD_2,
84 GPIO61_LCD_LDD_3,
85 GPIO62_LCD_LDD_4,
86 GPIO63_LCD_LDD_5,
87 GPIO64_LCD_LDD_6,
88 GPIO65_LCD_LDD_7,
89 GPIO66_LCD_LDD_8,
90 GPIO67_LCD_LDD_9,
91 GPIO68_LCD_LDD_10,
92 GPIO69_LCD_LDD_11,
93 GPIO70_LCD_LDD_12,
94 GPIO71_LCD_LDD_13,
95 GPIO72_LCD_LDD_14,
96 GPIO73_LCD_LDD_15,
97 GPIO74_LCD_FCLK,
98 GPIO75_LCD_LCLK,
99 GPIO76_LCD_PCLK,
100 GPIO77_LCD_BIAS,
101
102 /* PWM */
103 GPIO16_PWM0_OUT,
104
105 /* GPIO KEYS */
106 GPIO10_GPIO, /* hotsync button */
107 GPIO12_GPIO, /* power switch */
108 GPIO15_GPIO, /* lock switch */
109
110 /* LEDs */
111 GPIO52_GPIO, /* green led */
112 GPIO94_GPIO, /* orange led */
113
114 /* PCMCIA */
115 GPIO48_nPOE,
116 GPIO49_nPWE,
117 GPIO50_nPIOR,
118 GPIO51_nPIOW,
119 GPIO85_nPCE_1,
120 GPIO54_nPCE_2,
121 GPIO79_PSKTSEL,
122 GPIO55_nPREG,
123 GPIO56_nPWAIT,
124 GPIO57_nIOIS16,
125 GPIO36_GPIO, /* wifi power */
126 GPIO38_GPIO, /* wifi ready */
127 GPIO81_GPIO, /* wifi reset */
128
129 /* HDD */
130 GPIO95_GPIO, /* HDD irq */
131 GPIO115_GPIO, /* HDD power */
132
133 /* MISC */
134 GPIO13_GPIO, /* earphone detect */
135};
136
137/******************************************************************************
138 * SD/MMC card controller
139 ******************************************************************************/
140static int palmld_mci_init(struct device *dev, irq_handler_t palmld_detect_int,
141 void *data)
142{
143 int err = 0;
144
145 /* Setup an interrupt for detecting card insert/remove events */
146 err = gpio_request(GPIO_NR_PALMLD_SD_DETECT_N, "SD IRQ");
147 if (err)
148 goto err;
149 err = gpio_direction_input(GPIO_NR_PALMLD_SD_DETECT_N);
150 if (err)
151 goto err2;
152 err = request_irq(gpio_to_irq(GPIO_NR_PALMLD_SD_DETECT_N),
153 palmld_detect_int, IRQF_DISABLED | IRQF_SAMPLE_RANDOM |
154 IRQF_TRIGGER_FALLING | IRQF_TRIGGER_RISING,
155 "SD/MMC card detect", data);
156 if (err) {
157 printk(KERN_ERR "%s: cannot request SD/MMC card detect IRQ\n",
158 __func__);
159 goto err2;
160 }
161
162 err = gpio_request(GPIO_NR_PALMLD_SD_POWER, "SD_POWER");
163 if (err)
164 goto err3;
165 err = gpio_direction_output(GPIO_NR_PALMLD_SD_POWER, 0);
166 if (err)
167 goto err4;
168
169 err = gpio_request(GPIO_NR_PALMLD_SD_READONLY, "SD_READONLY");
170 if (err)
171 goto err4;
172 err = gpio_direction_input(GPIO_NR_PALMLD_SD_READONLY);
173 if (err)
174 goto err5;
175
176 printk(KERN_DEBUG "%s: irq registered\n", __func__);
177
178 return 0;
179
180err5:
181 gpio_free(GPIO_NR_PALMLD_SD_READONLY);
182err4:
183 gpio_free(GPIO_NR_PALMLD_SD_POWER);
184err3:
185 free_irq(gpio_to_irq(GPIO_NR_PALMLD_SD_DETECT_N), data);
186err2:
187 gpio_free(GPIO_NR_PALMLD_SD_DETECT_N);
188err:
189 return err;
190}
191
192static void palmld_mci_exit(struct device *dev, void *data)
193{
194 gpio_free(GPIO_NR_PALMLD_SD_READONLY);
195 gpio_free(GPIO_NR_PALMLD_SD_POWER);
196 free_irq(gpio_to_irq(GPIO_NR_PALMLD_SD_DETECT_N), data);
197 gpio_free(GPIO_NR_PALMLD_SD_DETECT_N);
198}
199
200static void palmld_mci_power(struct device *dev, unsigned int vdd)
201{
202 struct pxamci_platform_data *p_d = dev->platform_data;
203 gpio_set_value(GPIO_NR_PALMLD_SD_POWER, p_d->ocr_mask & (1 << vdd));
204}
205
206static int palmld_mci_get_ro(struct device *dev)
207{
208 return gpio_get_value(GPIO_NR_PALMLD_SD_READONLY);
209}
210
211static struct pxamci_platform_data palmld_mci_platform_data = {
212 .ocr_mask = MMC_VDD_32_33 | MMC_VDD_33_34,
213 .setpower = palmld_mci_power,
214 .get_ro = palmld_mci_get_ro,
215 .init = palmld_mci_init,
216 .exit = palmld_mci_exit,
217};
218
219/******************************************************************************
220 * GPIO keyboard
221 ******************************************************************************/
222static unsigned int palmld_matrix_keys[] = {
223 KEY(0, 1, KEY_F2),
224 KEY(0, 2, KEY_UP),
225
226 KEY(1, 0, KEY_F3),
227 KEY(1, 1, KEY_F4),
228 KEY(1, 2, KEY_RIGHT),
229
230 KEY(2, 0, KEY_F1),
231 KEY(2, 1, KEY_F5),
232 KEY(2, 2, KEY_DOWN),
233
234 KEY(3, 0, KEY_F6),
235 KEY(3, 1, KEY_ENTER),
236 KEY(3, 2, KEY_LEFT),
237};
238
239static struct pxa27x_keypad_platform_data palmld_keypad_platform_data = {
240 .matrix_key_rows = 4,
241 .matrix_key_cols = 3,
242 .matrix_key_map = palmld_matrix_keys,
243 .matrix_key_map_size = ARRAY_SIZE(palmld_matrix_keys),
244
245 .debounce_interval = 30,
246};
247
248/******************************************************************************
249 * GPIO keys
250 ******************************************************************************/
251static struct gpio_keys_button palmld_pxa_buttons[] = {
252 {KEY_F8, GPIO_NR_PALMLD_HOTSYNC_BUTTON_N, 1, "HotSync Button" },
253 {KEY_F9, GPIO_NR_PALMLD_LOCK_SWITCH, 0, "Lock Switch" },
254 {KEY_POWER, GPIO_NR_PALMLD_POWER_SWITCH, 0, "Power Switch" },
255};
256
257static struct gpio_keys_platform_data palmld_pxa_keys_data = {
258 .buttons = palmld_pxa_buttons,
259 .nbuttons = ARRAY_SIZE(palmld_pxa_buttons),
260};
261
262static struct platform_device palmld_pxa_keys = {
263 .name = "gpio-keys",
264 .id = -1,
265 .dev = {
266 .platform_data = &palmld_pxa_keys_data,
267 },
268};
269
270/******************************************************************************
271 * Backlight
272 ******************************************************************************/
273static int palmld_backlight_init(struct device *dev)
274{
275 int ret;
276
277 ret = gpio_request(GPIO_NR_PALMLD_BL_POWER, "BL POWER");
278 if (ret)
279 goto err;
280 ret = gpio_direction_output(GPIO_NR_PALMLD_BL_POWER, 0);
281 if (ret)
282 goto err2;
283 ret = gpio_request(GPIO_NR_PALMLD_LCD_POWER, "LCD POWER");
284 if (ret)
285 goto err2;
286 ret = gpio_direction_output(GPIO_NR_PALMLD_LCD_POWER, 0);
287 if (ret)
288 goto err3;
289
290 return 0;
291err3:
292 gpio_free(GPIO_NR_PALMLD_LCD_POWER);
293err2:
294 gpio_free(GPIO_NR_PALMLD_BL_POWER);
295err:
296 return ret;
297}
298
299static int palmld_backlight_notify(int brightness)
300{
301 gpio_set_value(GPIO_NR_PALMLD_BL_POWER, brightness);
302 gpio_set_value(GPIO_NR_PALMLD_LCD_POWER, brightness);
303 return brightness;
304}
305
306static void palmld_backlight_exit(struct device *dev)
307{
308 gpio_free(GPIO_NR_PALMLD_BL_POWER);
309 gpio_free(GPIO_NR_PALMLD_LCD_POWER);
310}
311
312static struct platform_pwm_backlight_data palmld_backlight_data = {
313 .pwm_id = 0,
314 .max_brightness = PALMLD_MAX_INTENSITY,
315 .dft_brightness = PALMLD_MAX_INTENSITY,
316 .pwm_period_ns = PALMLD_PERIOD_NS,
317 .init = palmld_backlight_init,
318 .notify = palmld_backlight_notify,
319 .exit = palmld_backlight_exit,
320};
321
322static struct platform_device palmld_backlight = {
323 .name = "pwm-backlight",
324 .dev = {
325 .parent = &pxa27x_device_pwm0.dev,
326 .platform_data = &palmld_backlight_data,
327 },
328};
329
330/******************************************************************************
331 * IrDA
332 ******************************************************************************/
333static int palmld_irda_startup(struct device *dev)
334{
335 int err;
336 err = gpio_request(GPIO_NR_PALMLD_IR_DISABLE, "IR DISABLE");
337 if (err)
338 goto err;
339 err = gpio_direction_output(GPIO_NR_PALMLD_IR_DISABLE, 1);
340 if (err)
341 gpio_free(GPIO_NR_PALMLD_IR_DISABLE);
342err:
343 return err;
344}
345
346static void palmld_irda_shutdown(struct device *dev)
347{
348 gpio_free(GPIO_NR_PALMLD_IR_DISABLE);
349}
350
351static void palmld_irda_transceiver_mode(struct device *dev, int mode)
352{
353 gpio_set_value(GPIO_NR_PALMLD_IR_DISABLE, mode & IR_OFF);
354 pxa2xx_transceiver_mode(dev, mode);
355}
356
357static struct pxaficp_platform_data palmld_ficp_platform_data = {
358 .startup = palmld_irda_startup,
359 .shutdown = palmld_irda_shutdown,
360 .transceiver_cap = IR_SIRMODE | IR_FIRMODE | IR_OFF,
361 .transceiver_mode = palmld_irda_transceiver_mode,
362};
363
364/******************************************************************************
365 * LEDs
366 ******************************************************************************/
367struct gpio_led gpio_leds[] = {
368{
369 .name = "palmld:green:led",
370 .default_trigger = "none",
371 .gpio = GPIO_NR_PALMLD_LED_GREEN,
372}, {
373 .name = "palmld:amber:led",
374 .default_trigger = "none",
375 .gpio = GPIO_NR_PALMLD_LED_AMBER,
376},
377};
378
379static struct gpio_led_platform_data gpio_led_info = {
380 .leds = gpio_leds,
381 .num_leds = ARRAY_SIZE(gpio_leds),
382};
383
384static struct platform_device palmld_leds = {
385 .name = "leds-gpio",
386 .id = -1,
387 .dev = {
388 .platform_data = &gpio_led_info,
389 }
390};
391
392/******************************************************************************
393 * Power supply
394 ******************************************************************************/
395static int power_supply_init(struct device *dev)
396{
397 int ret;
398
399 ret = gpio_request(GPIO_NR_PALMLD_POWER_DETECT, "CABLE_STATE_AC");
400 if (ret)
401 goto err1;
402 ret = gpio_direction_input(GPIO_NR_PALMLD_POWER_DETECT);
403 if (ret)
404 goto err2;
405
406 ret = gpio_request(GPIO_NR_PALMLD_USB_DETECT_N, "CABLE_STATE_USB");
407 if (ret)
408 goto err2;
409 ret = gpio_direction_input(GPIO_NR_PALMLD_USB_DETECT_N);
410 if (ret)
411 goto err3;
412
413 return 0;
414
415err3:
416 gpio_free(GPIO_NR_PALMLD_USB_DETECT_N);
417err2:
418 gpio_free(GPIO_NR_PALMLD_POWER_DETECT);
419err1:
420 return ret;
421}
422
423static int palmld_is_ac_online(void)
424{
425 return gpio_get_value(GPIO_NR_PALMLD_POWER_DETECT);
426}
427
428static int palmld_is_usb_online(void)
429{
430 return !gpio_get_value(GPIO_NR_PALMLD_USB_DETECT_N);
431}
432
433static void power_supply_exit(struct device *dev)
434{
435 gpio_free(GPIO_NR_PALMLD_USB_DETECT_N);
436 gpio_free(GPIO_NR_PALMLD_POWER_DETECT);
437}
438
439static char *palmld_supplicants[] = {
440 "main-battery",
441};
442
443static struct pda_power_pdata power_supply_info = {
444 .init = power_supply_init,
445 .is_ac_online = palmld_is_ac_online,
446 .is_usb_online = palmld_is_usb_online,
447 .exit = power_supply_exit,
448 .supplied_to = palmld_supplicants,
449 .num_supplicants = ARRAY_SIZE(palmld_supplicants),
450};
451
452static struct platform_device power_supply = {
453 .name = "pda-power",
454 .id = -1,
455 .dev = {
456 .platform_data = &power_supply_info,
457 },
458};
459
460/******************************************************************************
461 * WM97xx battery
462 ******************************************************************************/
463static struct wm97xx_batt_info wm97xx_batt_pdata = {
464 .batt_aux = WM97XX_AUX_ID3,
465 .temp_aux = WM97XX_AUX_ID2,
466 .charge_gpio = -1,
467 .max_voltage = PALMLD_BAT_MAX_VOLTAGE,
468 .min_voltage = PALMLD_BAT_MIN_VOLTAGE,
469 .batt_mult = 1000,
470 .batt_div = 414,
471 .temp_mult = 1,
472 .temp_div = 1,
473 .batt_tech = POWER_SUPPLY_TECHNOLOGY_LIPO,
474 .batt_name = "main-batt",
475};
476
477/******************************************************************************
478 * aSoC audio
479 ******************************************************************************/
480static struct palm27x_asoc_info palm27x_asoc_pdata = {
481 .jack_gpio = GPIO_NR_PALMLD_EARPHONE_DETECT,
482};
483
484/******************************************************************************
485 * Framebuffer
486 ******************************************************************************/
487static struct pxafb_mode_info palmld_lcd_modes[] = {
488{
489 .pixclock = 57692,
490 .xres = 320,
491 .yres = 480,
492 .bpp = 16,
493
494 .left_margin = 32,
495 .right_margin = 1,
496 .upper_margin = 7,
497 .lower_margin = 1,
498
499 .hsync_len = 4,
500 .vsync_len = 1,
501},
502};
503
504static struct pxafb_mach_info palmld_lcd_screen = {
505 .modes = palmld_lcd_modes,
506 .num_modes = ARRAY_SIZE(palmld_lcd_modes),
507 .lcd_conn = LCD_COLOR_TFT_16BPP | LCD_PCLK_EDGE_FALL,
508};
509
510/******************************************************************************
511 * Machine init
512 ******************************************************************************/
513static struct platform_device *devices[] __initdata = {
514#if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
515 &palmld_pxa_keys,
516#endif
517 &palmld_backlight,
518 &palmld_leds,
519 &power_supply,
520};
521
522static struct map_desc palmld_io_desc[] __initdata = {
523{
524 .virtual = PALMLD_IDE_VIRT,
525 .pfn = __phys_to_pfn(PALMLD_IDE_PHYS),
526 .length = PALMLD_IDE_SIZE,
527 .type = MT_DEVICE
528},
529{
530 .virtual = PALMLD_USB_VIRT,
531 .pfn = __phys_to_pfn(PALMLD_USB_PHYS),
532 .length = PALMLD_USB_SIZE,
533 .type = MT_DEVICE
534},
535};
536
537static void __init palmld_map_io(void)
538{
539 pxa_map_io();
540 iotable_init(palmld_io_desc, ARRAY_SIZE(palmld_io_desc));
541}
542
543static void __init palmld_init(void)
544{
545 pxa2xx_mfp_config(ARRAY_AND_SIZE(palmld_pin_config));
546
547 set_pxa_fb_info(&palmld_lcd_screen);
548 pxa_set_mci_info(&palmld_mci_platform_data);
549 pxa_set_ac97_info(NULL);
550 pxa_set_ficp_info(&palmld_ficp_platform_data);
551 pxa_set_keypad_info(&palmld_keypad_platform_data);
552 wm97xx_bat_set_pdata(&wm97xx_batt_pdata);
553 palm27x_asoc_set_pdata(&palm27x_asoc_pdata);
554
555 platform_add_devices(devices, ARRAY_SIZE(devices));
556}
557
558MACHINE_START(PALMLD, "Palm LifeDrive")
559 .phys_io = PALMLD_PHYS_IO_START,
560 .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc,
561 .boot_params = 0xa0000100,
562 .map_io = palmld_map_io,
563 .init_irq = pxa27x_init_irq,
564 .timer = &pxa_timer,
565 .init_machine = palmld_init
566MACHINE_END