blob: 3d4a2819cae181f4645bd249aa2ab5e7244e5ba4 [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 Vasutd7c307c2009-07-17 19:46:58 +020027#include <linux/mtd/mtd.h>
28#include <linux/mtd/partitions.h>
29#include <linux/mtd/physmap.h>
Marek Vasuta6450722008-11-20 22:50:46 +010030
31#include <asm/mach-types.h>
32#include <asm/mach/arch.h>
33#include <asm/mach/map.h>
34
Eric Miao51c62982009-01-02 23:17:22 +080035#include <mach/pxa27x.h>
Marek Vasuta6450722008-11-20 22:50:46 +010036#include <mach/audio.h>
37#include <mach/palmld.h>
38#include <mach/mmc.h>
39#include <mach/pxafb.h>
Marek Vasuta6450722008-11-20 22:50:46 +010040#include <mach/irda.h>
Mark F. Brown4a2490e2010-09-03 18:28:06 -040041#include <plat/pxa27x_keypad.h>
Marek Vasuta6450722008-11-20 22:50:46 +010042#include <mach/palmasoc.h>
Marek Vasut31620e22010-07-13 08:16:45 +020043#include <mach/palm27x.h>
Marek Vasuta6450722008-11-20 22:50:46 +010044
45#include "generic.h"
46#include "devices.h"
47
48/******************************************************************************
49 * Pin configuration
50 ******************************************************************************/
51static unsigned long palmld_pin_config[] __initdata = {
52 /* MMC */
53 GPIO32_MMC_CLK,
54 GPIO92_MMC_DAT_0,
55 GPIO109_MMC_DAT_1,
56 GPIO110_MMC_DAT_2,
57 GPIO111_MMC_DAT_3,
58 GPIO112_MMC_CMD,
59 GPIO14_GPIO, /* SD detect */
60 GPIO114_GPIO, /* SD power */
61 GPIO116_GPIO, /* SD r/o switch */
62
63 /* AC97 */
64 GPIO28_AC97_BITCLK,
65 GPIO29_AC97_SDATA_IN_0,
66 GPIO30_AC97_SDATA_OUT,
67 GPIO31_AC97_SYNC,
Marek Vasut6ec04f42009-05-22 01:39:10 +020068 GPIO89_AC97_SYSCLK,
69 GPIO95_AC97_nRESET,
Marek Vasuta6450722008-11-20 22:50:46 +010070
71 /* IrDA */
72 GPIO108_GPIO, /* ir disable */
73 GPIO46_FICP_RXD,
74 GPIO47_FICP_TXD,
75
76 /* MATRIX KEYPAD */
Marek Vasut81854f82009-03-28 12:37:42 +010077 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,
Marek Vasuta6450722008-11-20 22:50:46 +010081 GPIO103_KP_MKOUT_0,
82 GPIO104_KP_MKOUT_1,
83 GPIO105_KP_MKOUT_2,
84
85 /* LCD */
Eric Miaobedbda92010-01-04 11:37:14 +080086 GPIOxx_LCD_TFT_16BPP,
Marek Vasuta6450722008-11-20 22:50:46 +010087
88 /* PWM */
89 GPIO16_PWM0_OUT,
90
91 /* GPIO KEYS */
92 GPIO10_GPIO, /* hotsync button */
93 GPIO12_GPIO, /* power switch */
94 GPIO15_GPIO, /* lock switch */
95
96 /* LEDs */
97 GPIO52_GPIO, /* green led */
98 GPIO94_GPIO, /* orange led */
99
100 /* PCMCIA */
101 GPIO48_nPOE,
102 GPIO49_nPWE,
103 GPIO50_nPIOR,
104 GPIO51_nPIOW,
105 GPIO85_nPCE_1,
106 GPIO54_nPCE_2,
107 GPIO79_PSKTSEL,
108 GPIO55_nPREG,
109 GPIO56_nPWAIT,
110 GPIO57_nIOIS16,
111 GPIO36_GPIO, /* wifi power */
112 GPIO38_GPIO, /* wifi ready */
113 GPIO81_GPIO, /* wifi reset */
114
Marek Vasutecf763c2009-07-16 19:37:29 +0200115 /* FFUART */
116 GPIO34_FFUART_RXD,
117 GPIO39_FFUART_TXD,
118
Marek Vasuta6450722008-11-20 22:50:46 +0100119 /* HDD */
Marek Vašut5a9d2512009-05-21 13:11:05 +0100120 GPIO98_GPIO, /* HDD reset */
Marek Vasuta6450722008-11-20 22:50:46 +0100121 GPIO115_GPIO, /* HDD power */
122
123 /* MISC */
124 GPIO13_GPIO, /* earphone detect */
125};
126
127/******************************************************************************
Marek Vasutd7c307c2009-07-17 19:46:58 +0200128 * NOR Flash
129 ******************************************************************************/
Marek Vasut31620e22010-07-13 08:16:45 +0200130#if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE)
Marek Vasutd7c307c2009-07-17 19:46:58 +0200131static struct mtd_partition palmld_partitions[] = {
132 {
133 .name = "Flash",
134 .offset = 0x00000000,
135 .size = MTDPART_SIZ_FULL,
136 .mask_flags = 0
137 }
138};
139
140static struct physmap_flash_data palmld_flash_data[] = {
141 {
142 .width = 2, /* bankwidth in bytes */
143 .parts = palmld_partitions,
144 .nr_parts = ARRAY_SIZE(palmld_partitions)
145 }
146};
147
148static struct resource palmld_flash_resource = {
149 .start = PXA_CS0_PHYS,
150 .end = PXA_CS0_PHYS + SZ_4M - 1,
151 .flags = IORESOURCE_MEM,
152};
153
154static struct platform_device palmld_flash = {
155 .name = "physmap-flash",
156 .id = 0,
157 .resource = &palmld_flash_resource,
158 .num_resources = 1,
159 .dev = {
160 .platform_data = palmld_flash_data,
161 },
162};
163
Marek Vasut31620e22010-07-13 08:16:45 +0200164static void __init palmld_nor_init(void)
165{
166 platform_device_register(&palmld_flash);
167}
168#else
169static inline void palmld_nor_init(void) {}
170#endif
Marek Vasuta6450722008-11-20 22:50:46 +0100171
172/******************************************************************************
173 * GPIO keyboard
174 ******************************************************************************/
Marek Vasut31620e22010-07-13 08:16:45 +0200175#if defined(CONFIG_KEYBOARD_PXA27x) || defined(CONFIG_KEYBOARD_PXA27x_MODULE)
Marek Vasuta6450722008-11-20 22:50:46 +0100176static unsigned int palmld_matrix_keys[] = {
177 KEY(0, 1, KEY_F2),
178 KEY(0, 2, KEY_UP),
179
180 KEY(1, 0, KEY_F3),
181 KEY(1, 1, KEY_F4),
182 KEY(1, 2, KEY_RIGHT),
183
184 KEY(2, 0, KEY_F1),
185 KEY(2, 1, KEY_F5),
186 KEY(2, 2, KEY_DOWN),
187
188 KEY(3, 0, KEY_F6),
189 KEY(3, 1, KEY_ENTER),
190 KEY(3, 2, KEY_LEFT),
191};
192
193static struct pxa27x_keypad_platform_data palmld_keypad_platform_data = {
194 .matrix_key_rows = 4,
195 .matrix_key_cols = 3,
196 .matrix_key_map = palmld_matrix_keys,
197 .matrix_key_map_size = ARRAY_SIZE(palmld_matrix_keys),
198
199 .debounce_interval = 30,
200};
201
Marek Vasut31620e22010-07-13 08:16:45 +0200202static void __init palmld_kpc_init(void)
203{
204 pxa_set_keypad_info(&palmld_keypad_platform_data);
205}
206#else
207static inline void palmld_kpc_init(void) {}
208#endif
209
Marek Vasuta6450722008-11-20 22:50:46 +0100210/******************************************************************************
211 * GPIO keys
212 ******************************************************************************/
Marek Vasut31620e22010-07-13 08:16:45 +0200213#if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
Marek Vasuta6450722008-11-20 22:50:46 +0100214static struct gpio_keys_button palmld_pxa_buttons[] = {
215 {KEY_F8, GPIO_NR_PALMLD_HOTSYNC_BUTTON_N, 1, "HotSync Button" },
216 {KEY_F9, GPIO_NR_PALMLD_LOCK_SWITCH, 0, "Lock Switch" },
217 {KEY_POWER, GPIO_NR_PALMLD_POWER_SWITCH, 0, "Power Switch" },
218};
219
220static struct gpio_keys_platform_data palmld_pxa_keys_data = {
221 .buttons = palmld_pxa_buttons,
222 .nbuttons = ARRAY_SIZE(palmld_pxa_buttons),
223};
224
225static struct platform_device palmld_pxa_keys = {
226 .name = "gpio-keys",
227 .id = -1,
228 .dev = {
229 .platform_data = &palmld_pxa_keys_data,
230 },
231};
232
Marek Vasut31620e22010-07-13 08:16:45 +0200233static void __init palmld_keys_init(void)
Marek Vasuta6450722008-11-20 22:50:46 +0100234{
Marek Vasut31620e22010-07-13 08:16:45 +0200235 platform_device_register(&palmld_pxa_keys);
Marek Vasuta6450722008-11-20 22:50:46 +0100236}
Marek Vasut31620e22010-07-13 08:16:45 +0200237#else
238static inline void palmld_keys_init(void) {}
239#endif
Marek Vasuta6450722008-11-20 22:50:46 +0100240
241/******************************************************************************
242 * LEDs
243 ******************************************************************************/
Marek Vasut31620e22010-07-13 08:16:45 +0200244#if defined(CONFIG_LEDS_GPIO) || defined(CONFIG_LEDS_GPIO_MODULE)
Marek Vasuta6450722008-11-20 22:50:46 +0100245struct gpio_led gpio_leds[] = {
246{
247 .name = "palmld:green:led",
248 .default_trigger = "none",
249 .gpio = GPIO_NR_PALMLD_LED_GREEN,
250}, {
251 .name = "palmld:amber:led",
252 .default_trigger = "none",
253 .gpio = GPIO_NR_PALMLD_LED_AMBER,
254},
255};
256
257static struct gpio_led_platform_data gpio_led_info = {
258 .leds = gpio_leds,
259 .num_leds = ARRAY_SIZE(gpio_leds),
260};
261
262static struct platform_device palmld_leds = {
263 .name = "leds-gpio",
264 .id = -1,
265 .dev = {
266 .platform_data = &gpio_led_info,
267 }
268};
269
Marek Vasut31620e22010-07-13 08:16:45 +0200270static void __init palmld_leds_init(void)
Marek Vasuta6450722008-11-20 22:50:46 +0100271{
Marek Vasut31620e22010-07-13 08:16:45 +0200272 platform_device_register(&palmld_leds);
Marek Vasuta6450722008-11-20 22:50:46 +0100273}
Marek Vasut31620e22010-07-13 08:16:45 +0200274#else
275static inline void palmld_leds_init(void) {}
276#endif
Marek Vasute91fb912009-04-17 11:37:35 +0200277
Marek Vasuta6450722008-11-20 22:50:46 +0100278/******************************************************************************
Marek Vašut5a9d2512009-05-21 13:11:05 +0100279 * HDD
280 ******************************************************************************/
Marek Vasut31620e22010-07-13 08:16:45 +0200281#if defined(CONFIG_PATA_PALMLD) || defined(CONFIG_PATA_PALMLD_MODULE)
282static struct platform_device palmld_ide_device = {
Marek Vašut5a9d2512009-05-21 13:11:05 +0100283 .name = "pata_palmld",
284 .id = -1,
285};
286
Marek Vasut31620e22010-07-13 08:16:45 +0200287static void __init palmld_ide_init(void)
Marek Vasuta6450722008-11-20 22:50:46 +0100288{
Marek Vasut31620e22010-07-13 08:16:45 +0200289 platform_device_register(&palmld_ide_device);
Marek Vasut81854f82009-03-28 12:37:42 +0100290}
Marek Vasut31620e22010-07-13 08:16:45 +0200291#else
292static inline void palmld_ide_init(void) {}
293#endif
Marek Vasut81854f82009-03-28 12:37:42 +0100294
Marek Vasut81854f82009-03-28 12:37:42 +0100295/******************************************************************************
Marek Vasuta6450722008-11-20 22:50:46 +0100296 * Machine init
297 ******************************************************************************/
Marek Vasuta6450722008-11-20 22:50:46 +0100298static struct map_desc palmld_io_desc[] __initdata = {
299{
300 .virtual = PALMLD_IDE_VIRT,
301 .pfn = __phys_to_pfn(PALMLD_IDE_PHYS),
302 .length = PALMLD_IDE_SIZE,
303 .type = MT_DEVICE
304},
305{
306 .virtual = PALMLD_USB_VIRT,
307 .pfn = __phys_to_pfn(PALMLD_USB_PHYS),
308 .length = PALMLD_USB_SIZE,
309 .type = MT_DEVICE
310},
311};
312
313static void __init palmld_map_io(void)
314{
Marek Vasut851982c2010-10-11 02:20:19 +0200315 pxa27x_map_io();
Marek Vasuta6450722008-11-20 22:50:46 +0100316 iotable_init(palmld_io_desc, ARRAY_SIZE(palmld_io_desc));
317}
318
319static void __init palmld_init(void)
320{
321 pxa2xx_mfp_config(ARRAY_AND_SIZE(palmld_pin_config));
Russell Kingcc155c62009-11-09 13:34:08 +0800322 pxa_set_ffuart_info(NULL);
323 pxa_set_btuart_info(NULL);
324 pxa_set_stuart_info(NULL);
325
Marek Vasut31620e22010-07-13 08:16:45 +0200326 palm27x_mmc_init(GPIO_NR_PALMLD_SD_DETECT_N, GPIO_NR_PALMLD_SD_READONLY,
327 GPIO_NR_PALMLD_SD_POWER, 0);
328 palm27x_pm_init(PALMLD_STR_BASE);
329 palm27x_lcd_init(-1, &palm_320x480_lcd_mode);
330 palm27x_irda_init(GPIO_NR_PALMLD_IR_DISABLE);
331 palm27x_ac97_init(PALMLD_BAT_MIN_VOLTAGE, PALMLD_BAT_MAX_VOLTAGE,
332 GPIO_NR_PALMLD_EARPHONE_DETECT, 95);
333 palm27x_pwm_init(GPIO_NR_PALMLD_BL_POWER, GPIO_NR_PALMLD_LCD_POWER);
334 palm27x_power_init(GPIO_NR_PALMLD_POWER_DETECT,
335 GPIO_NR_PALMLD_USB_DETECT_N);
336 palm27x_pmic_init();
337 palmld_kpc_init();
338 palmld_keys_init();
339 palmld_nor_init();
340 palmld_leds_init();
341 palmld_ide_init();
Marek Vasuta6450722008-11-20 22:50:46 +0100342}
343
344MACHINE_START(PALMLD, "Palm LifeDrive")
Nicolas Pitre7375aba2011-07-05 22:38:15 -0400345 .atag_offset = 0x100,
Marek Vasuta6450722008-11-20 22:50:46 +0100346 .map_io = palmld_map_io,
347 .init_irq = pxa27x_init_irq,
Eric Miao8a97ae22011-05-18 21:30:04 +0800348 .handle_irq = pxa27x_handle_irq,
Marek Vasuta6450722008-11-20 22:50:46 +0100349 .timer = &pxa_timer,
350 .init_machine = palmld_init
351MACHINE_END