2 * Hardware definitions for PalmTX
4 * Author: Marek Vasut <marek.vasut@gmail.com>
7 * Alex Osborne <ato@meshy.org>
8 * Cristiano P. <cristianop@users.sourceforge.net>
9 * Jan Herman <2hp@seznam.cz>
12 * This program is free software; you can redistribute it and/or modify
13 * it under the terms of the GNU General Public License version 2 as
14 * published by the Free Software Foundation.
16 * (find more info at www.hackndev.com)
20 #include <linux/platform_device.h>
21 #include <linux/delay.h>
22 #include <linux/irq.h>
23 #include <linux/gpio_keys.h>
24 #include <linux/input.h>
25 #include <linux/pda_power.h>
26 #include <linux/pwm_backlight.h>
27 #include <linux/gpio.h>
28 #include <linux/wm97xx.h>
29 #include <linux/power_supply.h>
30 #include <linux/usb/gpio_vbus.h>
31 #include <linux/mtd/platnand.h>
32 #include <linux/mtd/mtd.h>
33 #include <linux/mtd/physmap.h>
35 #include <asm/mach-types.h>
36 #include <asm/mach/arch.h>
37 #include <asm/mach/map.h>
40 #include <mach/audio.h>
41 #include <mach/palmtx.h>
42 #include <linux/platform_data/mmc-pxamci.h>
43 #include <linux/platform_data/video-pxafb.h>
44 #include <linux/platform_data/irda-pxaficp.h>
45 #include <linux/platform_data/keypad-pxa27x.h>
47 #include <linux/platform_data/asoc-palm27x.h>
53 /******************************************************************************
55 ******************************************************************************/
56 static unsigned long palmtx_pin_config[] __initdata = {
64 GPIO14_GPIO, /* SD detect */
65 GPIO114_GPIO, /* SD power */
66 GPIO115_GPIO, /* SD r/o switch */
70 GPIO29_AC97_SDATA_IN_0,
71 GPIO30_AC97_SDATA_OUT,
77 GPIO40_GPIO, /* ir disable */
85 GPIO13_GPIO, /* usb detect */
86 GPIO93_GPIO, /* usb power */
99 GPIO94_GPIO, /* wifi power 1 */
100 GPIO108_GPIO, /* wifi power 2 */
101 GPIO116_GPIO, /* wifi ready */
104 GPIO100_KP_MKIN_0 | WAKEUP_ON_LEVEL_HIGH,
105 GPIO101_KP_MKIN_1 | WAKEUP_ON_LEVEL_HIGH,
106 GPIO102_KP_MKIN_2 | WAKEUP_ON_LEVEL_HIGH,
107 GPIO97_KP_MKIN_3 | WAKEUP_ON_LEVEL_HIGH,
113 GPIOxx_LCD_TFT_16BPP,
124 GPIO10_GPIO, /* hotsync button */
125 GPIO12_GPIO, /* power detect */
126 GPIO107_GPIO, /* earphone detect */
129 /******************************************************************************
131 ******************************************************************************/
132 #if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE)
133 static struct mtd_partition palmtx_partitions[] = {
136 .offset = 0x00000000,
137 .size = MTDPART_SIZ_FULL,
142 static struct physmap_flash_data palmtx_flash_data[] = {
144 .width = 2, /* bankwidth in bytes */
145 .parts = palmtx_partitions,
146 .nr_parts = ARRAY_SIZE(palmtx_partitions)
150 static struct resource palmtx_flash_resource = {
151 .start = PXA_CS0_PHYS,
152 .end = PXA_CS0_PHYS + SZ_8M - 1,
153 .flags = IORESOURCE_MEM,
156 static struct platform_device palmtx_flash = {
157 .name = "physmap-flash",
159 .resource = &palmtx_flash_resource,
162 .platform_data = palmtx_flash_data,
166 static void __init palmtx_nor_init(void)
168 platform_device_register(&palmtx_flash);
171 static inline void palmtx_nor_init(void) {}
174 /******************************************************************************
176 ******************************************************************************/
177 #if defined(CONFIG_KEYBOARD_PXA27x) || defined(CONFIG_KEYBOARD_PXA27x_MODULE)
178 static const unsigned int palmtx_matrix_keys[] = {
179 KEY(0, 0, KEY_POWER),
181 KEY(0, 2, KEY_ENTER),
190 KEY(3, 0, KEY_RIGHT),
194 static struct matrix_keymap_data palmtx_matrix_keymap_data = {
195 .keymap = palmtx_matrix_keys,
196 .keymap_size = ARRAY_SIZE(palmtx_matrix_keys),
199 static struct pxa27x_keypad_platform_data palmtx_keypad_platform_data = {
200 .matrix_key_rows = 4,
201 .matrix_key_cols = 3,
202 .matrix_keymap_data = &palmtx_matrix_keymap_data,
204 .debounce_interval = 30,
207 static void __init palmtx_kpc_init(void)
209 pxa_set_keypad_info(&palmtx_keypad_platform_data);
212 static inline void palmtx_kpc_init(void) {}
215 /******************************************************************************
217 ******************************************************************************/
218 #if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
219 static struct gpio_keys_button palmtx_pxa_buttons[] = {
220 {KEY_F8, GPIO_NR_PALMTX_HOTSYNC_BUTTON_N, 1, "HotSync Button" },
223 static struct gpio_keys_platform_data palmtx_pxa_keys_data = {
224 .buttons = palmtx_pxa_buttons,
225 .nbuttons = ARRAY_SIZE(palmtx_pxa_buttons),
228 static struct platform_device palmtx_pxa_keys = {
232 .platform_data = &palmtx_pxa_keys_data,
236 static void __init palmtx_keys_init(void)
238 platform_device_register(&palmtx_pxa_keys);
241 static inline void palmtx_keys_init(void) {}
244 /******************************************************************************
246 ******************************************************************************/
247 #if defined(CONFIG_MTD_NAND_PLATFORM) || \
248 defined(CONFIG_MTD_NAND_PLATFORM_MODULE)
249 static void palmtx_nand_cmd_ctl(struct nand_chip *this, int cmd,
252 char __iomem *nandaddr = this->legacy.IO_ADDR_W;
254 if (cmd == NAND_CMD_NONE)
258 writeb(cmd, PALMTX_NAND_CLE_VIRT);
259 else if (ctrl & NAND_ALE)
260 writeb(cmd, PALMTX_NAND_ALE_VIRT);
262 writeb(cmd, nandaddr);
265 static struct mtd_partition palmtx_partition_info[] = {
269 .size = MTDPART_SIZ_FULL
273 struct platform_nand_data palmtx_nand_platdata = {
277 .nr_partitions = ARRAY_SIZE(palmtx_partition_info),
278 .partitions = palmtx_partition_info,
282 .cmd_ctrl = palmtx_nand_cmd_ctl,
286 static struct resource palmtx_nand_resource[] = {
288 .start = PXA_CS1_PHYS,
289 .end = PXA_CS1_PHYS + SZ_1M - 1,
290 .flags = IORESOURCE_MEM,
294 static struct platform_device palmtx_nand = {
296 .num_resources = ARRAY_SIZE(palmtx_nand_resource),
297 .resource = palmtx_nand_resource,
300 .platform_data = &palmtx_nand_platdata,
304 static void __init palmtx_nand_init(void)
306 platform_device_register(&palmtx_nand);
309 static inline void palmtx_nand_init(void) {}
312 /******************************************************************************
314 ******************************************************************************/
315 static struct map_desc palmtx_io_desc[] __initdata = {
317 .virtual = (unsigned long)PALMTX_PCMCIA_VIRT,
318 .pfn = __phys_to_pfn(PALMTX_PCMCIA_PHYS),
319 .length = PALMTX_PCMCIA_SIZE,
322 .virtual = (unsigned long)PALMTX_NAND_ALE_VIRT,
323 .pfn = __phys_to_pfn(PALMTX_NAND_ALE_PHYS),
327 .virtual = (unsigned long)PALMTX_NAND_CLE_VIRT,
328 .pfn = __phys_to_pfn(PALMTX_NAND_CLE_PHYS),
334 static void __init palmtx_map_io(void)
337 iotable_init(palmtx_io_desc, ARRAY_SIZE(palmtx_io_desc));
340 static void __init palmtx_init(void)
342 pxa2xx_mfp_config(ARRAY_AND_SIZE(palmtx_pin_config));
343 pxa_set_ffuart_info(NULL);
344 pxa_set_btuart_info(NULL);
345 pxa_set_stuart_info(NULL);
347 palm27x_mmc_init(GPIO_NR_PALMTX_SD_DETECT_N, GPIO_NR_PALMTX_SD_READONLY,
348 GPIO_NR_PALMTX_SD_POWER, 0);
349 palm27x_pm_init(PALMTX_STR_BASE);
350 palm27x_lcd_init(-1, &palm_320x480_lcd_mode);
351 palm27x_udc_init(GPIO_NR_PALMTX_USB_DETECT_N,
352 GPIO_NR_PALMTX_USB_PULLUP, 1);
353 palm27x_irda_init(GPIO_NR_PALMTX_IR_DISABLE);
354 palm27x_ac97_init(PALMTX_BAT_MIN_VOLTAGE, PALMTX_BAT_MAX_VOLTAGE,
355 GPIO_NR_PALMTX_EARPHONE_DETECT, 95);
356 palm27x_pwm_init(GPIO_NR_PALMTX_BL_POWER, GPIO_NR_PALMTX_LCD_POWER);
357 palm27x_power_init(GPIO_NR_PALMTX_POWER_DETECT, -1);
365 MACHINE_START(PALMTX, "Palm T|X")
366 .atag_offset = 0x100,
367 .map_io = palmtx_map_io,
368 .nr_irqs = PXA_NR_IRQS,
369 .init_irq = pxa27x_init_irq,
370 .handle_irq = pxa27x_handle_irq,
371 .init_time = pxa_timer_init,
372 .init_machine = palmtx_init,
373 .restart = pxa_restart,