1 // SPDX-License-Identifier: GPL-2.0-only
3 * Hardware definitions for Palm Tungsten|T5
5 * Author: Marek Vasut <marek.vasut@gmail.com>
8 * Ales Snuparek <snuparek@atlas.cz>
9 * Justin Kendrick <twilightsentry@gmail.com>
10 * RichardT5 <richard_t5@users.sourceforge.net>
12 * (find more info at www.hackndev.com)
15 #include <linux/platform_device.h>
16 #include <linux/delay.h>
17 #include <linux/irq.h>
18 #include <linux/gpio_keys.h>
19 #include <linux/input.h>
20 #include <linux/memblock.h>
21 #include <linux/pda_power.h>
22 #include <linux/pwm_backlight.h>
23 #include <linux/gpio.h>
24 #include <linux/wm97xx.h>
25 #include <linux/power_supply.h>
27 #include <asm/mach-types.h>
28 #include <asm/mach/arch.h>
29 #include <asm/mach/map.h>
32 #include <mach/audio.h>
34 #include <linux/platform_data/mmc-pxamci.h>
35 #include <linux/platform_data/video-pxafb.h>
36 #include <linux/platform_data/irda-pxaficp.h>
37 #include <linux/platform_data/keypad-pxa27x.h>
39 #include <linux/platform_data/asoc-palm27x.h>
45 /******************************************************************************
47 ******************************************************************************/
48 static unsigned long palmt5_pin_config
[] __initdata
= {
56 GPIO14_GPIO
, /* SD detect */
57 GPIO114_GPIO
, /* SD power */
58 GPIO115_GPIO
, /* SD r/o switch */
62 GPIO29_AC97_SDATA_IN_0
,
63 GPIO30_AC97_SDATA_OUT
,
69 GPIO40_GPIO
, /* ir disable */
74 GPIO15_GPIO
, /* usb detect */
75 GPIO93_GPIO
, /* usb power */
78 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
,
97 GPIO10_GPIO
, /* hotsync button */
98 GPIO90_GPIO
, /* power detect */
99 GPIO107_GPIO
, /* earphone detect */
102 /******************************************************************************
104 ******************************************************************************/
105 #if defined(CONFIG_KEYBOARD_PXA27x) || defined(CONFIG_KEYBOARD_PXA27x_MODULE)
106 static const unsigned int palmt5_matrix_keys
[] = {
107 KEY(0, 0, KEY_POWER
),
109 KEY(0, 2, KEY_ENTER
),
118 KEY(3, 0, KEY_RIGHT
),
122 static struct matrix_keymap_data palmt5_matrix_keymap_data
= {
123 .keymap
= palmt5_matrix_keys
,
124 .keymap_size
= ARRAY_SIZE(palmt5_matrix_keys
),
127 static struct pxa27x_keypad_platform_data palmt5_keypad_platform_data
= {
128 .matrix_key_rows
= 4,
129 .matrix_key_cols
= 3,
130 .matrix_keymap_data
= &palmt5_matrix_keymap_data
,
132 .debounce_interval
= 30,
135 static void __init
palmt5_kpc_init(void)
137 pxa_set_keypad_info(&palmt5_keypad_platform_data
);
140 static inline void palmt5_kpc_init(void) {}
143 /******************************************************************************
145 ******************************************************************************/
146 #if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
147 static struct gpio_keys_button palmt5_pxa_buttons
[] = {
148 {KEY_F8
, GPIO_NR_PALMT5_HOTSYNC_BUTTON_N
, 1, "HotSync Button" },
151 static struct gpio_keys_platform_data palmt5_pxa_keys_data
= {
152 .buttons
= palmt5_pxa_buttons
,
153 .nbuttons
= ARRAY_SIZE(palmt5_pxa_buttons
),
156 static struct platform_device palmt5_pxa_keys
= {
160 .platform_data
= &palmt5_pxa_keys_data
,
164 static void __init
palmt5_keys_init(void)
166 platform_device_register(&palmt5_pxa_keys
);
169 static inline void palmt5_keys_init(void) {}
172 /******************************************************************************
174 ******************************************************************************/
175 static void __init
palmt5_reserve(void)
177 memblock_reserve(0xa0200000, 0x1000);
180 static struct gpiod_lookup_table palmt5_mci_gpio_table
= {
181 .dev_id
= "pxa2xx-mci.0",
183 GPIO_LOOKUP("gpio-pxa", GPIO_NR_PALMT5_SD_DETECT_N
,
184 "cd", GPIO_ACTIVE_LOW
),
185 GPIO_LOOKUP("gpio-pxa", GPIO_NR_PALMT5_SD_READONLY
,
186 "wp", GPIO_ACTIVE_LOW
),
187 GPIO_LOOKUP("gpio-pxa", GPIO_NR_PALMT5_SD_POWER
,
188 "power", GPIO_ACTIVE_HIGH
),
193 static void __init
palmt5_init(void)
195 pxa2xx_mfp_config(ARRAY_AND_SIZE(palmt5_pin_config
));
196 pxa_set_ffuart_info(NULL
);
197 pxa_set_btuart_info(NULL
);
198 pxa_set_stuart_info(NULL
);
200 palm27x_mmc_init(&palmt5_mci_gpio_table
);
201 palm27x_pm_init(PALMT5_STR_BASE
);
202 palm27x_lcd_init(-1, &palm_320x480_lcd_mode
);
203 palm27x_udc_init(GPIO_NR_PALMT5_USB_DETECT_N
,
204 GPIO_NR_PALMT5_USB_PULLUP
, 1);
205 palm27x_irda_init(GPIO_NR_PALMT5_IR_DISABLE
);
206 palm27x_ac97_init(PALMT5_BAT_MIN_VOLTAGE
, PALMT5_BAT_MAX_VOLTAGE
,
207 GPIO_NR_PALMT5_EARPHONE_DETECT
, 95);
208 palm27x_pwm_init(GPIO_NR_PALMT5_BL_POWER
, GPIO_NR_PALMT5_LCD_POWER
);
209 palm27x_power_init(GPIO_NR_PALMT5_POWER_DETECT
, -1);
215 MACHINE_START(PALMT5
, "Palm Tungsten|T5")
216 .atag_offset
= 0x100,
217 .map_io
= pxa27x_map_io
,
218 .reserve
= palmt5_reserve
,
219 .nr_irqs
= PXA_NR_IRQS
,
220 .init_irq
= pxa27x_init_irq
,
221 .handle_irq
= pxa27x_handle_irq
,
222 .init_time
= pxa_timer_init
,
223 .init_machine
= palmt5_init
,
224 .restart
= pxa_restart
,