2 * Hardware definitions for Palm LifeDrive
4 * Author: Marek Vasut <marek.vasut@gmail.com>
7 * Alex Osborne <ato@meshy.org>
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.
13 * (find more info at www.hackndev.com)
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.h>
26 #include <linux/power_supply.h>
27 #include <linux/mtd/mtd.h>
28 #include <linux/mtd/partitions.h>
29 #include <linux/mtd/physmap.h>
31 #include <asm/mach-types.h>
32 #include <asm/mach/arch.h>
33 #include <asm/mach/map.h>
35 #include <mach/pxa27x.h>
36 #include <mach/audio.h>
37 #include <mach/palmld.h>
38 #include <linux/platform_data/mmc-pxamci.h>
39 #include <linux/platform_data/video-pxafb.h>
40 #include <linux/platform_data/irda-pxaficp.h>
41 #include <linux/platform_data/keypad-pxa27x.h>
42 #include <linux/platform_data/asoc-palm27x.h>
43 #include <mach/palm27x.h>
48 /******************************************************************************
50 ******************************************************************************/
51 static unsigned long palmld_pin_config
[] __initdata
= {
59 GPIO14_GPIO
, /* SD detect */
60 GPIO114_GPIO
, /* SD power */
61 GPIO116_GPIO
, /* SD r/o switch */
65 GPIO29_AC97_SDATA_IN_0
,
66 GPIO30_AC97_SDATA_OUT
,
72 GPIO108_GPIO
, /* ir disable */
77 GPIO100_KP_MKIN_0
| WAKEUP_ON_LEVEL_HIGH
,
78 GPIO101_KP_MKIN_1
| WAKEUP_ON_LEVEL_HIGH
,
79 GPIO102_KP_MKIN_2
| WAKEUP_ON_LEVEL_HIGH
,
80 GPIO97_KP_MKIN_3
| WAKEUP_ON_LEVEL_HIGH
,
92 GPIO10_GPIO
, /* hotsync button */
93 GPIO12_GPIO
, /* power switch */
94 GPIO15_GPIO
, /* lock switch */
97 GPIO52_GPIO
, /* green led */
98 GPIO94_GPIO
, /* orange led */
111 GPIO36_GPIO
, /* wifi power */
112 GPIO38_GPIO
, /* wifi ready */
113 GPIO81_GPIO
, /* wifi reset */
120 GPIO98_GPIO
, /* HDD reset */
121 GPIO115_GPIO
, /* HDD power */
124 GPIO13_GPIO
, /* earphone detect */
127 /******************************************************************************
129 ******************************************************************************/
130 #if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE)
131 static struct mtd_partition palmld_partitions
[] = {
134 .offset
= 0x00000000,
135 .size
= MTDPART_SIZ_FULL
,
140 static struct physmap_flash_data palmld_flash_data
[] = {
142 .width
= 2, /* bankwidth in bytes */
143 .parts
= palmld_partitions
,
144 .nr_parts
= ARRAY_SIZE(palmld_partitions
)
148 static struct resource palmld_flash_resource
= {
149 .start
= PXA_CS0_PHYS
,
150 .end
= PXA_CS0_PHYS
+ SZ_4M
- 1,
151 .flags
= IORESOURCE_MEM
,
154 static struct platform_device palmld_flash
= {
155 .name
= "physmap-flash",
157 .resource
= &palmld_flash_resource
,
160 .platform_data
= palmld_flash_data
,
164 static void __init
palmld_nor_init(void)
166 platform_device_register(&palmld_flash
);
169 static inline void palmld_nor_init(void) {}
172 /******************************************************************************
174 ******************************************************************************/
175 #if defined(CONFIG_KEYBOARD_PXA27x) || defined(CONFIG_KEYBOARD_PXA27x_MODULE)
176 static const unsigned int palmld_matrix_keys
[] = {
182 KEY(1, 2, KEY_RIGHT
),
189 KEY(3, 1, KEY_ENTER
),
193 static struct matrix_keymap_data palmld_matrix_keymap_data
= {
194 .keymap
= palmld_matrix_keys
,
195 .keymap_size
= ARRAY_SIZE(palmld_matrix_keys
),
198 static struct pxa27x_keypad_platform_data palmld_keypad_platform_data
= {
199 .matrix_key_rows
= 4,
200 .matrix_key_cols
= 3,
201 .matrix_keymap_data
= &palmld_matrix_keymap_data
,
203 .debounce_interval
= 30,
206 static void __init
palmld_kpc_init(void)
208 pxa_set_keypad_info(&palmld_keypad_platform_data
);
211 static inline void palmld_kpc_init(void) {}
214 /******************************************************************************
216 ******************************************************************************/
217 #if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
218 static struct gpio_keys_button palmld_pxa_buttons
[] = {
219 {KEY_F8
, GPIO_NR_PALMLD_HOTSYNC_BUTTON_N
, 1, "HotSync Button" },
220 {KEY_F9
, GPIO_NR_PALMLD_LOCK_SWITCH
, 0, "Lock Switch" },
221 {KEY_POWER
, GPIO_NR_PALMLD_POWER_SWITCH
, 0, "Power Switch" },
224 static struct gpio_keys_platform_data palmld_pxa_keys_data
= {
225 .buttons
= palmld_pxa_buttons
,
226 .nbuttons
= ARRAY_SIZE(palmld_pxa_buttons
),
229 static struct platform_device palmld_pxa_keys
= {
233 .platform_data
= &palmld_pxa_keys_data
,
237 static void __init
palmld_keys_init(void)
239 platform_device_register(&palmld_pxa_keys
);
242 static inline void palmld_keys_init(void) {}
245 /******************************************************************************
247 ******************************************************************************/
248 #if defined(CONFIG_LEDS_GPIO) || defined(CONFIG_LEDS_GPIO_MODULE)
249 struct gpio_led gpio_leds
[] = {
251 .name
= "palmld:green:led",
252 .default_trigger
= "none",
253 .gpio
= GPIO_NR_PALMLD_LED_GREEN
,
255 .name
= "palmld:amber:led",
256 .default_trigger
= "none",
257 .gpio
= GPIO_NR_PALMLD_LED_AMBER
,
261 static struct gpio_led_platform_data gpio_led_info
= {
263 .num_leds
= ARRAY_SIZE(gpio_leds
),
266 static struct platform_device palmld_leds
= {
270 .platform_data
= &gpio_led_info
,
274 static void __init
palmld_leds_init(void)
276 platform_device_register(&palmld_leds
);
279 static inline void palmld_leds_init(void) {}
282 /******************************************************************************
284 ******************************************************************************/
285 #if defined(CONFIG_PATA_PALMLD) || defined(CONFIG_PATA_PALMLD_MODULE)
286 static struct platform_device palmld_ide_device
= {
287 .name
= "pata_palmld",
291 static void __init
palmld_ide_init(void)
293 platform_device_register(&palmld_ide_device
);
296 static inline void palmld_ide_init(void) {}
299 /******************************************************************************
301 ******************************************************************************/
302 static struct map_desc palmld_io_desc
[] __initdata
= {
304 .virtual = PALMLD_IDE_VIRT
,
305 .pfn
= __phys_to_pfn(PALMLD_IDE_PHYS
),
306 .length
= PALMLD_IDE_SIZE
,
310 .virtual = PALMLD_USB_VIRT
,
311 .pfn
= __phys_to_pfn(PALMLD_USB_PHYS
),
312 .length
= PALMLD_USB_SIZE
,
317 static void __init
palmld_map_io(void)
320 iotable_init(palmld_io_desc
, ARRAY_SIZE(palmld_io_desc
));
323 static void __init
palmld_init(void)
325 pxa2xx_mfp_config(ARRAY_AND_SIZE(palmld_pin_config
));
326 pxa_set_ffuart_info(NULL
);
327 pxa_set_btuart_info(NULL
);
328 pxa_set_stuart_info(NULL
);
330 palm27x_mmc_init(GPIO_NR_PALMLD_SD_DETECT_N
, GPIO_NR_PALMLD_SD_READONLY
,
331 GPIO_NR_PALMLD_SD_POWER
, 0);
332 palm27x_pm_init(PALMLD_STR_BASE
);
333 palm27x_lcd_init(-1, &palm_320x480_lcd_mode
);
334 palm27x_irda_init(GPIO_NR_PALMLD_IR_DISABLE
);
335 palm27x_ac97_init(PALMLD_BAT_MIN_VOLTAGE
, PALMLD_BAT_MAX_VOLTAGE
,
336 GPIO_NR_PALMLD_EARPHONE_DETECT
, 95);
337 palm27x_pwm_init(GPIO_NR_PALMLD_BL_POWER
, GPIO_NR_PALMLD_LCD_POWER
);
338 palm27x_power_init(GPIO_NR_PALMLD_POWER_DETECT
,
339 GPIO_NR_PALMLD_USB_DETECT_N
);
348 MACHINE_START(PALMLD
, "Palm LifeDrive")
349 .atag_offset
= 0x100,
350 .map_io
= palmld_map_io
,
351 .nr_irqs
= PXA_NR_IRQS
,
352 .init_irq
= pxa27x_init_irq
,
353 .handle_irq
= pxa27x_handle_irq
,
354 .init_time
= pxa_timer_init
,
355 .init_machine
= palmld_init
,
356 .restart
= pxa_restart
,