blob: a6f898cbfac91b30b0f82d95a4b9fe5dcb94ea43 [file] [log] [blame]
Marek Vasuta6450722008-11-20 22:50:46 +01001/*
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>
Marek Vasut241cf472010-06-04 03:07:33 +020025#include <linux/wm97xx.h>
Marek Vasuta6450722008-11-20 22:50:46 +010026#include <linux/power_supply.h>
Marek Vasut81854f82009-03-28 12:37:42 +010027#include <linux/sysdev.h>
Marek Vasutd7c307c2009-07-17 19:46:58 +020028#include <linux/mtd/mtd.h>
29#include <linux/mtd/partitions.h>
30#include <linux/mtd/physmap.h>
Marek Vasuta6450722008-11-20 22:50:46 +010031
32#include <asm/mach-types.h>
33#include <asm/mach/arch.h>
34#include <asm/mach/map.h>
35
Eric Miao51c62982009-01-02 23:17:22 +080036#include <mach/pxa27x.h>
Marek Vasuta6450722008-11-20 22:50:46 +010037#include <mach/audio.h>
38#include <mach/palmld.h>
39#include <mach/mmc.h>
40#include <mach/pxafb.h>
Marek Vasuta6450722008-11-20 22:50:46 +010041#include <mach/irda.h>
Mark F. Brown4a2490e2010-09-03 18:28:06 -040042#include <plat/pxa27x_keypad.h>
Marek Vasuta6450722008-11-20 22:50:46 +010043#include <mach/palmasoc.h>
Marek Vasut31620e22010-07-13 08:16:45 +020044#include <mach/palm27x.h>
Marek Vasuta6450722008-11-20 22:50:46 +010045
46#include "generic.h"
47#include "devices.h"
48
49/******************************************************************************
50 * Pin configuration
51 ******************************************************************************/
52static unsigned long palmld_pin_config[] __initdata = {
53 /* MMC */
54 GPIO32_MMC_CLK,
55 GPIO92_MMC_DAT_0,
56 GPIO109_MMC_DAT_1,
57 GPIO110_MMC_DAT_2,
58 GPIO111_MMC_DAT_3,
59 GPIO112_MMC_CMD,
60 GPIO14_GPIO, /* SD detect */
61 GPIO114_GPIO, /* SD power */
62 GPIO116_GPIO, /* SD r/o switch */
63
64 /* AC97 */
65 GPIO28_AC97_BITCLK,
66 GPIO29_AC97_SDATA_IN_0,
67 GPIO30_AC97_SDATA_OUT,
68 GPIO31_AC97_SYNC,
Marek Vasut6ec04f42009-05-22 01:39:10 +020069 GPIO89_AC97_SYSCLK,
70 GPIO95_AC97_nRESET,
Marek Vasuta6450722008-11-20 22:50:46 +010071
72 /* IrDA */
73 GPIO108_GPIO, /* ir disable */
74 GPIO46_FICP_RXD,
75 GPIO47_FICP_TXD,
76
77 /* MATRIX KEYPAD */
Marek Vasut81854f82009-03-28 12:37:42 +010078 GPIO100_KP_MKIN_0 | WAKEUP_ON_LEVEL_HIGH,
79 GPIO101_KP_MKIN_1 | WAKEUP_ON_LEVEL_HIGH,
80 GPIO102_KP_MKIN_2 | WAKEUP_ON_LEVEL_HIGH,
81 GPIO97_KP_MKIN_3 | WAKEUP_ON_LEVEL_HIGH,
Marek Vasuta6450722008-11-20 22:50:46 +010082 GPIO103_KP_MKOUT_0,
83 GPIO104_KP_MKOUT_1,
84 GPIO105_KP_MKOUT_2,
85
86 /* LCD */
Eric Miaobedbda92010-01-04 11:37:14 +080087 GPIOxx_LCD_TFT_16BPP,
Marek Vasuta6450722008-11-20 22:50:46 +010088
89 /* PWM */
90 GPIO16_PWM0_OUT,
91
92 /* GPIO KEYS */
93 GPIO10_GPIO, /* hotsync button */
94 GPIO12_GPIO, /* power switch */
95 GPIO15_GPIO, /* lock switch */
96
97 /* LEDs */
98 GPIO52_GPIO, /* green led */
99 GPIO94_GPIO, /* orange led */
100
101 /* PCMCIA */
102 GPIO48_nPOE,
103 GPIO49_nPWE,
104 GPIO50_nPIOR,
105 GPIO51_nPIOW,
106 GPIO85_nPCE_1,
107 GPIO54_nPCE_2,
108 GPIO79_PSKTSEL,
109 GPIO55_nPREG,
110 GPIO56_nPWAIT,
111 GPIO57_nIOIS16,
112 GPIO36_GPIO, /* wifi power */
113 GPIO38_GPIO, /* wifi ready */
114 GPIO81_GPIO, /* wifi reset */
115
Marek Vasutecf763c2009-07-16 19:37:29 +0200116 /* FFUART */
117 GPIO34_FFUART_RXD,
118 GPIO39_FFUART_TXD,
119
Marek Vasuta6450722008-11-20 22:50:46 +0100120 /* HDD */
Marek Vašut5a9d2512009-05-21 13:11:05 +0100121 GPIO98_GPIO, /* HDD reset */
Marek Vasuta6450722008-11-20 22:50:46 +0100122 GPIO115_GPIO, /* HDD power */
123
124 /* MISC */
125 GPIO13_GPIO, /* earphone detect */
126};
127
128/******************************************************************************
Marek Vasutd7c307c2009-07-17 19:46:58 +0200129 * NOR Flash
130 ******************************************************************************/
Marek Vasut31620e22010-07-13 08:16:45 +0200131#if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE)
Marek Vasutd7c307c2009-07-17 19:46:58 +0200132static struct mtd_partition palmld_partitions[] = {
133 {
134 .name = "Flash",
135 .offset = 0x00000000,
136 .size = MTDPART_SIZ_FULL,
137 .mask_flags = 0
138 }
139};
140
141static struct physmap_flash_data palmld_flash_data[] = {
142 {
143 .width = 2, /* bankwidth in bytes */
144 .parts = palmld_partitions,
145 .nr_parts = ARRAY_SIZE(palmld_partitions)
146 }
147};
148
149static struct resource palmld_flash_resource = {
150 .start = PXA_CS0_PHYS,
151 .end = PXA_CS0_PHYS + SZ_4M - 1,
152 .flags = IORESOURCE_MEM,
153};
154
155static struct platform_device palmld_flash = {
156 .name = "physmap-flash",
157 .id = 0,
158 .resource = &palmld_flash_resource,
159 .num_resources = 1,
160 .dev = {
161 .platform_data = palmld_flash_data,
162 },
163};
164
Marek Vasut31620e22010-07-13 08:16:45 +0200165static void __init palmld_nor_init(void)
166{
167 platform_device_register(&palmld_flash);
168}
169#else
170static inline void palmld_nor_init(void) {}
171#endif
Marek Vasuta6450722008-11-20 22:50:46 +0100172
173/******************************************************************************
174 * GPIO keyboard
175 ******************************************************************************/
Marek Vasut31620e22010-07-13 08:16:45 +0200176#if defined(CONFIG_KEYBOARD_PXA27x) || defined(CONFIG_KEYBOARD_PXA27x_MODULE)
Marek Vasuta6450722008-11-20 22:50:46 +0100177static unsigned int palmld_matrix_keys[] = {
178 KEY(0, 1, KEY_F2),
179 KEY(0, 2, KEY_UP),
180
181 KEY(1, 0, KEY_F3),
182 KEY(1, 1, KEY_F4),
183 KEY(1, 2, KEY_RIGHT),
184
185 KEY(2, 0, KEY_F1),
186 KEY(2, 1, KEY_F5),
187 KEY(2, 2, KEY_DOWN),
188
189 KEY(3, 0, KEY_F6),
190 KEY(3, 1, KEY_ENTER),
191 KEY(3, 2, KEY_LEFT),
192};
193
194static struct pxa27x_keypad_platform_data palmld_keypad_platform_data = {
195 .matrix_key_rows = 4,
196 .matrix_key_cols = 3,
197 .matrix_key_map = palmld_matrix_keys,
198 .matrix_key_map_size = ARRAY_SIZE(palmld_matrix_keys),
199
200 .debounce_interval = 30,
201};
202
Marek Vasut31620e22010-07-13 08:16:45 +0200203static void __init palmld_kpc_init(void)
204{
205 pxa_set_keypad_info(&palmld_keypad_platform_data);
206}
207#else
208static inline void palmld_kpc_init(void) {}
209#endif
210
Marek Vasuta6450722008-11-20 22:50:46 +0100211/******************************************************************************
212 * GPIO keys
213 ******************************************************************************/
Marek Vasut31620e22010-07-13 08:16:45 +0200214#if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
Marek Vasuta6450722008-11-20 22:50:46 +0100215static struct gpio_keys_button palmld_pxa_buttons[] = {
216 {KEY_F8, GPIO_NR_PALMLD_HOTSYNC_BUTTON_N, 1, "HotSync Button" },
217 {KEY_F9, GPIO_NR_PALMLD_LOCK_SWITCH, 0, "Lock Switch" },
218 {KEY_POWER, GPIO_NR_PALMLD_POWER_SWITCH, 0, "Power Switch" },
219};
220
221static struct gpio_keys_platform_data palmld_pxa_keys_data = {
222 .buttons = palmld_pxa_buttons,
223 .nbuttons = ARRAY_SIZE(palmld_pxa_buttons),
224};
225
226static struct platform_device palmld_pxa_keys = {
227 .name = "gpio-keys",
228 .id = -1,
229 .dev = {
230 .platform_data = &palmld_pxa_keys_data,
231 },
232};
233
Marek Vasut31620e22010-07-13 08:16:45 +0200234static void __init palmld_keys_init(void)
Marek Vasuta6450722008-11-20 22:50:46 +0100235{
Marek Vasut31620e22010-07-13 08:16:45 +0200236 platform_device_register(&palmld_pxa_keys);
Marek Vasuta6450722008-11-20 22:50:46 +0100237}
Marek Vasut31620e22010-07-13 08:16:45 +0200238#else
239static inline void palmld_keys_init(void) {}
240#endif
Marek Vasuta6450722008-11-20 22:50:46 +0100241
242/******************************************************************************
243 * LEDs
244 ******************************************************************************/
Marek Vasut31620e22010-07-13 08:16:45 +0200245#if defined(CONFIG_LEDS_GPIO) || defined(CONFIG_LEDS_GPIO_MODULE)
Marek Vasuta6450722008-11-20 22:50:46 +0100246struct gpio_led gpio_leds[] = {
247{
248 .name = "palmld:green:led",
249 .default_trigger = "none",
250 .gpio = GPIO_NR_PALMLD_LED_GREEN,
251}, {
252 .name = "palmld:amber:led",
253 .default_trigger = "none",
254 .gpio = GPIO_NR_PALMLD_LED_AMBER,
255},
256};
257
258static struct gpio_led_platform_data gpio_led_info = {
259 .leds = gpio_leds,
260 .num_leds = ARRAY_SIZE(gpio_leds),
261};
262
263static struct platform_device palmld_leds = {
264 .name = "leds-gpio",
265 .id = -1,
266 .dev = {
267 .platform_data = &gpio_led_info,
268 }
269};
270
Marek Vasut31620e22010-07-13 08:16:45 +0200271static void __init palmld_leds_init(void)
Marek Vasuta6450722008-11-20 22:50:46 +0100272{
Marek Vasut31620e22010-07-13 08:16:45 +0200273 platform_device_register(&palmld_leds);
Marek Vasuta6450722008-11-20 22:50:46 +0100274}
Marek Vasut31620e22010-07-13 08:16:45 +0200275#else
276static inline void palmld_leds_init(void) {}
277#endif
Marek Vasute91fb912009-04-17 11:37:35 +0200278
Marek Vasuta6450722008-11-20 22:50:46 +0100279/******************************************************************************
Marek Vašut5a9d2512009-05-21 13:11:05 +0100280 * HDD
281 ******************************************************************************/
Marek Vasut31620e22010-07-13 08:16:45 +0200282#if defined(CONFIG_PATA_PALMLD) || defined(CONFIG_PATA_PALMLD_MODULE)
283static struct platform_device palmld_ide_device = {
Marek Vašut5a9d2512009-05-21 13:11:05 +0100284 .name = "pata_palmld",
285 .id = -1,
286};
287
Marek Vasut31620e22010-07-13 08:16:45 +0200288static void __init palmld_ide_init(void)
Marek Vasuta6450722008-11-20 22:50:46 +0100289{
Marek Vasut31620e22010-07-13 08:16:45 +0200290 platform_device_register(&palmld_ide_device);
Marek Vasut81854f82009-03-28 12:37:42 +0100291}
Marek Vasut31620e22010-07-13 08:16:45 +0200292#else
293static inline void palmld_ide_init(void) {}
294#endif
Marek Vasut81854f82009-03-28 12:37:42 +0100295
Marek Vasut81854f82009-03-28 12:37:42 +0100296/******************************************************************************
Marek Vasuta6450722008-11-20 22:50:46 +0100297 * Machine init
298 ******************************************************************************/
Marek Vasuta6450722008-11-20 22:50:46 +0100299static struct map_desc palmld_io_desc[] __initdata = {
300{
301 .virtual = PALMLD_IDE_VIRT,
302 .pfn = __phys_to_pfn(PALMLD_IDE_PHYS),
303 .length = PALMLD_IDE_SIZE,
304 .type = MT_DEVICE
305},
306{
307 .virtual = PALMLD_USB_VIRT,
308 .pfn = __phys_to_pfn(PALMLD_USB_PHYS),
309 .length = PALMLD_USB_SIZE,
310 .type = MT_DEVICE
311},
312};
313
314static void __init palmld_map_io(void)
315{
Marek Vasut851982c2010-10-11 02:20:19 +0200316 pxa27x_map_io();
Marek Vasuta6450722008-11-20 22:50:46 +0100317 iotable_init(palmld_io_desc, ARRAY_SIZE(palmld_io_desc));
318}
319
320static void __init palmld_init(void)
321{
322 pxa2xx_mfp_config(ARRAY_AND_SIZE(palmld_pin_config));
Russell Kingcc155c62009-11-09 13:34:08 +0800323 pxa_set_ffuart_info(NULL);
324 pxa_set_btuart_info(NULL);
325 pxa_set_stuart_info(NULL);
326
Marek Vasut31620e22010-07-13 08:16:45 +0200327 palm27x_mmc_init(GPIO_NR_PALMLD_SD_DETECT_N, GPIO_NR_PALMLD_SD_READONLY,
328 GPIO_NR_PALMLD_SD_POWER, 0);
329 palm27x_pm_init(PALMLD_STR_BASE);
330 palm27x_lcd_init(-1, &palm_320x480_lcd_mode);
331 palm27x_irda_init(GPIO_NR_PALMLD_IR_DISABLE);
332 palm27x_ac97_init(PALMLD_BAT_MIN_VOLTAGE, PALMLD_BAT_MAX_VOLTAGE,
333 GPIO_NR_PALMLD_EARPHONE_DETECT, 95);
334 palm27x_pwm_init(GPIO_NR_PALMLD_BL_POWER, GPIO_NR_PALMLD_LCD_POWER);
335 palm27x_power_init(GPIO_NR_PALMLD_POWER_DETECT,
336 GPIO_NR_PALMLD_USB_DETECT_N);
337 palm27x_pmic_init();
338 palmld_kpc_init();
339 palmld_keys_init();
340 palmld_nor_init();
341 palmld_leds_init();
342 palmld_ide_init();
Marek Vasuta6450722008-11-20 22:50:46 +0100343}
344
345MACHINE_START(PALMLD, "Palm LifeDrive")
Marek Vasuta6450722008-11-20 22:50:46 +0100346 .boot_params = 0xa0000100,
347 .map_io = palmld_map_io,
348 .init_irq = pxa27x_init_irq,
349 .timer = &pxa_timer,
350 .init_machine = palmld_init
351MACHINE_END