Merge remote-tracking branch 'crypto-current/master'
[deliverable/linux.git] / arch / arm / mach-pxa / palmt5.c
CommitLineData
0f6ff0f0
MV
1/*
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>
8d717a52 24#include <linux/memblock.h>
0f6ff0f0
MV
25#include <linux/pda_power.h>
26#include <linux/pwm_backlight.h>
27#include <linux/gpio.h>
241cf473 28#include <linux/wm97xx.h>
0f6ff0f0 29#include <linux/power_supply.h>
8768dc9b 30#include <linux/usb/gpio_vbus.h>
0f6ff0f0
MV
31
32#include <asm/mach-types.h>
33#include <asm/mach/arch.h>
34#include <asm/mach/map.h>
35
4c25c5d2 36#include "pxa27x.h"
0f6ff0f0 37#include <mach/audio.h>
4c25c5d2 38#include "palmt5.h"
293b2da1
AB
39#include <linux/platform_data/mmc-pxamci.h>
40#include <linux/platform_data/video-pxafb.h>
41#include <linux/platform_data/irda-pxaficp.h>
42#include <linux/platform_data/keypad-pxa27x.h>
4c25c5d2 43#include "udc.h"
293b2da1 44#include <linux/platform_data/asoc-palm27x.h>
4c25c5d2 45#include "palm27x.h"
0f6ff0f0
MV
46
47#include "generic.h"
48#include "devices.h"
49
50/******************************************************************************
51 * Pin configuration
52 ******************************************************************************/
53static unsigned long palmt5_pin_config[] __initdata = {
54 /* MMC */
55 GPIO32_MMC_CLK,
56 GPIO92_MMC_DAT_0,
57 GPIO109_MMC_DAT_1,
58 GPIO110_MMC_DAT_2,
59 GPIO111_MMC_DAT_3,
60 GPIO112_MMC_CMD,
61 GPIO14_GPIO, /* SD detect */
62 GPIO114_GPIO, /* SD power */
63 GPIO115_GPIO, /* SD r/o switch */
64
65 /* AC97 */
66 GPIO28_AC97_BITCLK,
67 GPIO29_AC97_SDATA_IN_0,
68 GPIO30_AC97_SDATA_OUT,
69 GPIO31_AC97_SYNC,
6ec04f43 70 GPIO89_AC97_SYSCLK,
efb12cd2 71 GPIO95_AC97_nRESET,
0f6ff0f0
MV
72
73 /* IrDA */
74 GPIO40_GPIO, /* ir disable */
75 GPIO46_FICP_RXD,
76 GPIO47_FICP_TXD,
77
78 /* USB */
79 GPIO15_GPIO, /* usb detect */
efb12cd2 80 GPIO93_GPIO, /* usb power */
0f6ff0f0
MV
81
82 /* MATRIX KEYPAD */
81854f82
MV
83 GPIO100_KP_MKIN_0 | WAKEUP_ON_LEVEL_HIGH,
84 GPIO101_KP_MKIN_1 | WAKEUP_ON_LEVEL_HIGH,
85 GPIO102_KP_MKIN_2 | WAKEUP_ON_LEVEL_HIGH,
86 GPIO97_KP_MKIN_3 | WAKEUP_ON_LEVEL_HIGH,
0f6ff0f0
MV
87 GPIO103_KP_MKOUT_0,
88 GPIO104_KP_MKOUT_1,
89 GPIO105_KP_MKOUT_2,
90
91 /* LCD */
bedbda97 92 GPIOxx_LCD_TFT_16BPP,
0f6ff0f0
MV
93
94 /* PWM */
95 GPIO16_PWM0_OUT,
96
ecf763c5
MV
97 /* FFUART */
98 GPIO34_FFUART_RXD,
99 GPIO39_FFUART_TXD,
100
0f6ff0f0
MV
101 /* MISC */
102 GPIO10_GPIO, /* hotsync button */
103 GPIO90_GPIO, /* power detect */
104 GPIO107_GPIO, /* earphone detect */
105};
106
0f6ff0f0
MV
107/******************************************************************************
108 * GPIO keyboard
109 ******************************************************************************/
31620e21 110#if defined(CONFIG_KEYBOARD_PXA27x) || defined(CONFIG_KEYBOARD_PXA27x_MODULE)
0a085a94 111static const unsigned int palmt5_matrix_keys[] = {
0f6ff0f0
MV
112 KEY(0, 0, KEY_POWER),
113 KEY(0, 1, KEY_F1),
114 KEY(0, 2, KEY_ENTER),
115
116 KEY(1, 0, KEY_F2),
117 KEY(1, 1, KEY_F3),
118 KEY(1, 2, KEY_F4),
119
120 KEY(2, 0, KEY_UP),
121 KEY(2, 2, KEY_DOWN),
122
123 KEY(3, 0, KEY_RIGHT),
124 KEY(3, 2, KEY_LEFT),
125};
126
0a085a94
CX
127static struct matrix_keymap_data palmt5_matrix_keymap_data = {
128 .keymap = palmt5_matrix_keys,
129 .keymap_size = ARRAY_SIZE(palmt5_matrix_keys),
130};
131
0f6ff0f0
MV
132static struct pxa27x_keypad_platform_data palmt5_keypad_platform_data = {
133 .matrix_key_rows = 4,
134 .matrix_key_cols = 3,
0a085a94 135 .matrix_keymap_data = &palmt5_matrix_keymap_data,
0f6ff0f0
MV
136
137 .debounce_interval = 30,
138};
139
31620e21
MV
140static void __init palmt5_kpc_init(void)
141{
142 pxa_set_keypad_info(&palmt5_keypad_platform_data);
143}
144#else
145static inline void palmt5_kpc_init(void) {}
146#endif
147
0f6ff0f0
MV
148/******************************************************************************
149 * GPIO keys
150 ******************************************************************************/
31620e21 151#if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
0f6ff0f0
MV
152static struct gpio_keys_button palmt5_pxa_buttons[] = {
153 {KEY_F8, GPIO_NR_PALMT5_HOTSYNC_BUTTON_N, 1, "HotSync Button" },
154};
155
156static struct gpio_keys_platform_data palmt5_pxa_keys_data = {
157 .buttons = palmt5_pxa_buttons,
158 .nbuttons = ARRAY_SIZE(palmt5_pxa_buttons),
159};
160
161static struct platform_device palmt5_pxa_keys = {
162 .name = "gpio-keys",
163 .id = -1,
164 .dev = {
165 .platform_data = &palmt5_pxa_keys_data,
166 },
167};
168
31620e21 169static void __init palmt5_keys_init(void)
81854f82 170{
31620e21 171 platform_device_register(&palmt5_pxa_keys);
81854f82 172}
31620e21
MV
173#else
174static inline void palmt5_keys_init(void) {}
175#endif
81854f82 176
0f6ff0f0
MV
177/******************************************************************************
178 * Machine init
179 ******************************************************************************/
98c672cf
RK
180static void __init palmt5_reserve(void)
181{
8d717a52 182 memblock_reserve(0xa0200000, 0x1000);
98c672cf
RK
183}
184
0f6ff0f0
MV
185static void __init palmt5_init(void)
186{
187 pxa2xx_mfp_config(ARRAY_AND_SIZE(palmt5_pin_config));
cc155c6f
RK
188 pxa_set_ffuart_info(NULL);
189 pxa_set_btuart_info(NULL);
190 pxa_set_stuart_info(NULL);
191
31620e21
MV
192 palm27x_mmc_init(GPIO_NR_PALMT5_SD_DETECT_N, GPIO_NR_PALMT5_SD_READONLY,
193 GPIO_NR_PALMT5_SD_POWER, 0);
194 palm27x_pm_init(PALMT5_STR_BASE);
195 palm27x_lcd_init(-1, &palm_320x480_lcd_mode);
196 palm27x_udc_init(GPIO_NR_PALMT5_USB_DETECT_N,
197 GPIO_NR_PALMT5_USB_PULLUP, 1);
198 palm27x_irda_init(GPIO_NR_PALMT5_IR_DISABLE);
199 palm27x_ac97_init(PALMT5_BAT_MIN_VOLTAGE, PALMT5_BAT_MAX_VOLTAGE,
200 GPIO_NR_PALMT5_EARPHONE_DETECT, 95);
201 palm27x_pwm_init(GPIO_NR_PALMT5_BL_POWER, GPIO_NR_PALMT5_LCD_POWER);
202 palm27x_power_init(GPIO_NR_PALMT5_POWER_DETECT, -1);
203 palm27x_pmic_init();
204 palmt5_kpc_init();
205 palmt5_keys_init();
0f6ff0f0
MV
206}
207
208MACHINE_START(PALMT5, "Palm Tungsten|T5")
7375aba6 209 .atag_offset = 0x100,
851982c1 210 .map_io = pxa27x_map_io,
98c672cf 211 .reserve = palmt5_reserve,
4e611091 212 .nr_irqs = PXA_NR_IRQS,
0f6ff0f0 213 .init_irq = pxa27x_init_irq,
8a97ae2f 214 .handle_irq = pxa27x_handle_irq,
6bb27d73 215 .init_time = pxa_timer_init,
271a74fc
RK
216 .init_machine = palmt5_init,
217 .restart = pxa_restart,
0f6ff0f0 218MACHINE_END
This page took 0.557056 seconds and 5 git commands to generate.