blob: 731ee7bc361c37ff91c3485864040ac78836b854 [file] [log] [blame]
Marek Vasut0f6ff0f2008-11-20 00:58:38 +01001/*
2 * Hardware definitions for Palm Tungsten|T5
3 *
4 * Author: Marek Vasut <marek.vasut@gmail.com>
5 *
6 * Based on work of:
7 * Ales Snuparek <snuparek@atlas.cz>
8 * Justin Kendrick <twilightsentry@gmail.com>
9 * RichardT5 <richard_t5@users.sourceforge.net>
10 *
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License version 2 as
13 * published by the Free Software Foundation.
14 *
15 * (find more info at www.hackndev.com)
16 *
17 */
18
19#include <linux/platform_device.h>
20#include <linux/delay.h>
21#include <linux/irq.h>
22#include <linux/gpio_keys.h>
23#include <linux/input.h>
24#include <linux/pda_power.h>
25#include <linux/pwm_backlight.h>
26#include <linux/gpio.h>
Marek Vasut241cf472010-06-04 03:07:33 +020027#include <linux/wm97xx.h>
Marek Vasut0f6ff0f2008-11-20 00:58:38 +010028#include <linux/power_supply.h>
Marek Vasut8768dc92009-04-23 11:12:37 +020029#include <linux/usb/gpio_vbus.h>
Marek Vasut0f6ff0f2008-11-20 00:58:38 +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 Vasut0f6ff0f2008-11-20 00:58:38 +010036#include <mach/audio.h>
37#include <mach/palmt5.h>
38#include <mach/mmc.h>
39#include <mach/pxafb.h>
Marek Vasut0f6ff0f2008-11-20 00:58:38 +010040#include <mach/irda.h>
41#include <mach/pxa27x_keypad.h>
42#include <mach/udc.h>
43#include <mach/palmasoc.h>
Marek Vasut31620e22010-07-13 08:16:45 +020044#include <mach/palm27x.h>
Marek Vasut0f6ff0f2008-11-20 00:58:38 +010045
46#include "generic.h"
47#include "devices.h"
48
49/******************************************************************************
50 * Pin configuration
51 ******************************************************************************/
52static unsigned long palmt5_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 GPIO115_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,
Marek Vasutefb12cd2009-04-12 16:37:23 +020070 GPIO95_AC97_nRESET,
Marek Vasut0f6ff0f2008-11-20 00:58:38 +010071
72 /* IrDA */
73 GPIO40_GPIO, /* ir disable */
74 GPIO46_FICP_RXD,
75 GPIO47_FICP_TXD,
76
77 /* USB */
78 GPIO15_GPIO, /* usb detect */
Marek Vasutefb12cd2009-04-12 16:37:23 +020079 GPIO93_GPIO, /* usb power */
Marek Vasut0f6ff0f2008-11-20 00:58:38 +010080
81 /* MATRIX KEYPAD */
Marek Vasut81854f82009-03-28 12:37:42 +010082 GPIO100_KP_MKIN_0 | WAKEUP_ON_LEVEL_HIGH,
83 GPIO101_KP_MKIN_1 | WAKEUP_ON_LEVEL_HIGH,
84 GPIO102_KP_MKIN_2 | WAKEUP_ON_LEVEL_HIGH,
85 GPIO97_KP_MKIN_3 | WAKEUP_ON_LEVEL_HIGH,
Marek Vasut0f6ff0f2008-11-20 00:58:38 +010086 GPIO103_KP_MKOUT_0,
87 GPIO104_KP_MKOUT_1,
88 GPIO105_KP_MKOUT_2,
89
90 /* LCD */
Eric Miaobedbda92010-01-04 11:37:14 +080091 GPIOxx_LCD_TFT_16BPP,
Marek Vasut0f6ff0f2008-11-20 00:58:38 +010092
93 /* PWM */
94 GPIO16_PWM0_OUT,
95
Marek Vasutecf763c2009-07-16 19:37:29 +020096 /* FFUART */
97 GPIO34_FFUART_RXD,
98 GPIO39_FFUART_TXD,
99
Marek Vasut0f6ff0f2008-11-20 00:58:38 +0100100 /* MISC */
101 GPIO10_GPIO, /* hotsync button */
102 GPIO90_GPIO, /* power detect */
103 GPIO107_GPIO, /* earphone detect */
104};
105
106/******************************************************************************
Marek Vasut0f6ff0f2008-11-20 00:58:38 +0100107 * GPIO keyboard
108 ******************************************************************************/
Marek Vasut31620e22010-07-13 08:16:45 +0200109#if defined(CONFIG_KEYBOARD_PXA27x) || defined(CONFIG_KEYBOARD_PXA27x_MODULE)
Marek Vasut0f6ff0f2008-11-20 00:58:38 +0100110static unsigned int palmt5_matrix_keys[] = {
111 KEY(0, 0, KEY_POWER),
112 KEY(0, 1, KEY_F1),
113 KEY(0, 2, KEY_ENTER),
114
115 KEY(1, 0, KEY_F2),
116 KEY(1, 1, KEY_F3),
117 KEY(1, 2, KEY_F4),
118
119 KEY(2, 0, KEY_UP),
120 KEY(2, 2, KEY_DOWN),
121
122 KEY(3, 0, KEY_RIGHT),
123 KEY(3, 2, KEY_LEFT),
124};
125
126static struct pxa27x_keypad_platform_data palmt5_keypad_platform_data = {
127 .matrix_key_rows = 4,
128 .matrix_key_cols = 3,
129 .matrix_key_map = palmt5_matrix_keys,
130 .matrix_key_map_size = ARRAY_SIZE(palmt5_matrix_keys),
131
132 .debounce_interval = 30,
133};
134
Marek Vasut31620e22010-07-13 08:16:45 +0200135static void __init palmt5_kpc_init(void)
136{
137 pxa_set_keypad_info(&palmt5_keypad_platform_data);
138}
139#else
140static inline void palmt5_kpc_init(void) {}
141#endif
142
Marek Vasut0f6ff0f2008-11-20 00:58:38 +0100143/******************************************************************************
144 * GPIO keys
145 ******************************************************************************/
Marek Vasut31620e22010-07-13 08:16:45 +0200146#if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
Marek Vasut0f6ff0f2008-11-20 00:58:38 +0100147static struct gpio_keys_button palmt5_pxa_buttons[] = {
148 {KEY_F8, GPIO_NR_PALMT5_HOTSYNC_BUTTON_N, 1, "HotSync Button" },
149};
150
151static struct gpio_keys_platform_data palmt5_pxa_keys_data = {
152 .buttons = palmt5_pxa_buttons,
153 .nbuttons = ARRAY_SIZE(palmt5_pxa_buttons),
154};
155
156static struct platform_device palmt5_pxa_keys = {
157 .name = "gpio-keys",
158 .id = -1,
159 .dev = {
160 .platform_data = &palmt5_pxa_keys_data,
161 },
162};
163
Marek Vasut31620e22010-07-13 08:16:45 +0200164static void __init palmt5_keys_init(void)
Marek Vasut0f6ff0f2008-11-20 00:58:38 +0100165{
Marek Vasut31620e22010-07-13 08:16:45 +0200166 platform_device_register(&palmt5_pxa_keys);
Marek Vasut0f6ff0f2008-11-20 00:58:38 +0100167}
Marek Vasut31620e22010-07-13 08:16:45 +0200168#else
169static inline void palmt5_keys_init(void) {}
170#endif
Marek Vasut81854f82009-03-28 12:37:42 +0100171
Marek Vasut81854f82009-03-28 12:37:42 +0100172/******************************************************************************
Marek Vasut0f6ff0f2008-11-20 00:58:38 +0100173 * Machine init
174 ******************************************************************************/
Marek Vasut0f6ff0f2008-11-20 00:58:38 +0100175static void __init palmt5_init(void)
176{
177 pxa2xx_mfp_config(ARRAY_AND_SIZE(palmt5_pin_config));
Russell Kingcc155c62009-11-09 13:34:08 +0800178 pxa_set_ffuart_info(NULL);
179 pxa_set_btuart_info(NULL);
180 pxa_set_stuart_info(NULL);
181
Marek Vasut31620e22010-07-13 08:16:45 +0200182 palm27x_mmc_init(GPIO_NR_PALMT5_SD_DETECT_N, GPIO_NR_PALMT5_SD_READONLY,
183 GPIO_NR_PALMT5_SD_POWER, 0);
184 palm27x_pm_init(PALMT5_STR_BASE);
185 palm27x_lcd_init(-1, &palm_320x480_lcd_mode);
186 palm27x_udc_init(GPIO_NR_PALMT5_USB_DETECT_N,
187 GPIO_NR_PALMT5_USB_PULLUP, 1);
188 palm27x_irda_init(GPIO_NR_PALMT5_IR_DISABLE);
189 palm27x_ac97_init(PALMT5_BAT_MIN_VOLTAGE, PALMT5_BAT_MAX_VOLTAGE,
190 GPIO_NR_PALMT5_EARPHONE_DETECT, 95);
191 palm27x_pwm_init(GPIO_NR_PALMT5_BL_POWER, GPIO_NR_PALMT5_LCD_POWER);
192 palm27x_power_init(GPIO_NR_PALMT5_POWER_DETECT, -1);
193 palm27x_pmic_init();
194 palmt5_kpc_init();
195 palmt5_keys_init();
Marek Vasut0f6ff0f2008-11-20 00:58:38 +0100196}
197
198MACHINE_START(PALMT5, "Palm Tungsten|T5")
199 .phys_io = PALMT5_PHYS_IO_START,
200 .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc,
201 .boot_params = 0xa0000100,
202 .map_io = pxa_map_io,
203 .init_irq = pxa27x_init_irq,
204 .timer = &pxa_timer,
205 .init_machine = palmt5_init
206MACHINE_END