1 // SPDX-License-Identifier: GPL-2.0-only
3 * Hardware definitions for Palm LifeDrive
5 * Author: Marek Vasut <marek.vasut@gmail.com>
8 * Alex Osborne <ato@meshy.org>
10 * (find more info at www.hackndev.com)
13 #include <linux/platform_device.h>
14 #include <linux/delay.h>
15 #include <linux/irq.h>
16 #include <linux/gpio_keys.h>
17 #include <linux/input.h>
18 #include <linux/pda_power.h>
19 #include <linux/pwm_backlight.h>
20 #include <linux/gpio.h>
21 #include <linux/wm97xx.h>
22 #include <linux/power_supply.h>
23 #include <linux/mtd/mtd.h>
24 #include <linux/mtd/partitions.h>
25 #include <linux/mtd/physmap.h>
27 #include <asm/mach-types.h>
28 #include <asm/mach/arch.h>
29 #include <asm/mach/map.h>
32 #include <mach/audio.h>
33 #include <mach/palmld.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>
38 #include <linux/platform_data/asoc-palm27x.h>
44 /******************************************************************************
46 ******************************************************************************/
47 static unsigned long palmld_pin_config[] __initdata = {
55 GPIO14_GPIO, /* SD detect */
56 GPIO114_GPIO, /* SD power */
57 GPIO116_GPIO, /* SD r/o switch */
61 GPIO29_AC97_SDATA_IN_0,
62 GPIO30_AC97_SDATA_OUT,
68 GPIO108_GPIO, /* ir disable */
73 GPIO100_KP_MKIN_0 | WAKEUP_ON_LEVEL_HIGH,
74 GPIO101_KP_MKIN_1 | WAKEUP_ON_LEVEL_HIGH,
75 GPIO102_KP_MKIN_2 | WAKEUP_ON_LEVEL_HIGH,
76 GPIO97_KP_MKIN_3 | WAKEUP_ON_LEVEL_HIGH,
88 GPIO10_GPIO, /* hotsync button */
89 GPIO12_GPIO, /* power switch */
90 GPIO15_GPIO, /* lock switch */
93 GPIO52_GPIO, /* green led */
94 GPIO94_GPIO, /* orange led */
107 GPIO36_GPIO, /* wifi power */
108 GPIO38_GPIO, /* wifi ready */
109 GPIO81_GPIO, /* wifi reset */
116 GPIO98_GPIO, /* HDD reset */
117 GPIO115_GPIO, /* HDD power */
120 GPIO13_GPIO, /* earphone detect */
123 /******************************************************************************
125 ******************************************************************************/
126 #if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE)
127 static struct mtd_partition palmld_partitions[] = {
130 .offset = 0x00000000,
131 .size = MTDPART_SIZ_FULL,
136 static struct physmap_flash_data palmld_flash_data[] = {
138 .width = 2, /* bankwidth in bytes */
139 .parts = palmld_partitions,
140 .nr_parts = ARRAY_SIZE(palmld_partitions)
144 static struct resource palmld_flash_resource = {
145 .start = PXA_CS0_PHYS,
146 .end = PXA_CS0_PHYS + SZ_4M - 1,
147 .flags = IORESOURCE_MEM,
150 static struct platform_device palmld_flash = {
151 .name = "physmap-flash",
153 .resource = &palmld_flash_resource,
156 .platform_data = palmld_flash_data,
160 static void __init palmld_nor_init(void)
162 platform_device_register(&palmld_flash);
165 static inline void palmld_nor_init(void) {}
168 /******************************************************************************
170 ******************************************************************************/
171 #if defined(CONFIG_KEYBOARD_PXA27x) || defined(CONFIG_KEYBOARD_PXA27x_MODULE)
172 static const unsigned int palmld_matrix_keys[] = {
178 KEY(1, 2, KEY_RIGHT),
185 KEY(3, 1, KEY_ENTER),
189 static struct matrix_keymap_data palmld_matrix_keymap_data = {
190 .keymap = palmld_matrix_keys,
191 .keymap_size = ARRAY_SIZE(palmld_matrix_keys),
194 static struct pxa27x_keypad_platform_data palmld_keypad_platform_data = {
195 .matrix_key_rows = 4,
196 .matrix_key_cols = 3,
197 .matrix_keymap_data = &palmld_matrix_keymap_data,
199 .debounce_interval = 30,
202 static void __init palmld_kpc_init(void)
204 pxa_set_keypad_info(&palmld_keypad_platform_data);
207 static inline void palmld_kpc_init(void) {}
210 /******************************************************************************
212 ******************************************************************************/
213 #if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
214 static 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" },
220 static struct gpio_keys_platform_data palmld_pxa_keys_data = {
221 .buttons = palmld_pxa_buttons,
222 .nbuttons = ARRAY_SIZE(palmld_pxa_buttons),
225 static struct platform_device palmld_pxa_keys = {
229 .platform_data = &palmld_pxa_keys_data,
233 static void __init palmld_keys_init(void)
235 platform_device_register(&palmld_pxa_keys);
238 static inline void palmld_keys_init(void) {}
241 /******************************************************************************
243 ******************************************************************************/
244 #if defined(CONFIG_LEDS_GPIO) || defined(CONFIG_LEDS_GPIO_MODULE)
245 struct gpio_led gpio_leds[] = {
247 .name = "palmld:green:led",
248 .default_trigger = "none",
249 .gpio = GPIO_NR_PALMLD_LED_GREEN,
251 .name = "palmld:amber:led",
252 .default_trigger = "none",
253 .gpio = GPIO_NR_PALMLD_LED_AMBER,
257 static struct gpio_led_platform_data gpio_led_info = {
259 .num_leds = ARRAY_SIZE(gpio_leds),
262 static struct platform_device palmld_leds = {
266 .platform_data = &gpio_led_info,
270 static void __init palmld_leds_init(void)
272 platform_device_register(&palmld_leds);
275 static inline void palmld_leds_init(void) {}
278 /******************************************************************************
280 ******************************************************************************/
281 #if defined(CONFIG_PATA_PALMLD) || defined(CONFIG_PATA_PALMLD_MODULE)
282 static struct platform_device palmld_ide_device = {
283 .name = "pata_palmld",
287 static struct gpiod_lookup_table palmld_ide_gpio_table = {
288 .dev_id = "pata_palmld",
290 GPIO_LOOKUP("gpio-pxa", GPIO_NR_PALMLD_IDE_PWEN,
291 "power", GPIO_ACTIVE_HIGH),
292 GPIO_LOOKUP("gpio-pxa", GPIO_NR_PALMLD_IDE_RESET,
293 "reset", GPIO_ACTIVE_LOW),
298 static void __init palmld_ide_init(void)
300 gpiod_add_lookup_table(&palmld_ide_gpio_table);
301 platform_device_register(&palmld_ide_device);
304 static inline void palmld_ide_init(void) {}
307 /******************************************************************************
309 ******************************************************************************/
310 static struct map_desc palmld_io_desc[] __initdata = {
312 .virtual = PALMLD_IDE_VIRT,
313 .pfn = __phys_to_pfn(PALMLD_IDE_PHYS),
314 .length = PALMLD_IDE_SIZE,
318 .virtual = PALMLD_USB_VIRT,
319 .pfn = __phys_to_pfn(PALMLD_USB_PHYS),
320 .length = PALMLD_USB_SIZE,
325 static void __init palmld_map_io(void)
328 iotable_init(palmld_io_desc, ARRAY_SIZE(palmld_io_desc));
331 static struct gpiod_lookup_table palmld_mci_gpio_table = {
332 .dev_id = "pxa2xx-mci.0",
334 GPIO_LOOKUP("gpio-pxa", GPIO_NR_PALMLD_SD_DETECT_N,
335 "cd", GPIO_ACTIVE_LOW),
336 GPIO_LOOKUP("gpio-pxa", GPIO_NR_PALMLD_SD_READONLY,
337 "wp", GPIO_ACTIVE_LOW),
338 GPIO_LOOKUP("gpio-pxa", GPIO_NR_PALMLD_SD_POWER,
339 "power", GPIO_ACTIVE_HIGH),
344 static void __init palmld_init(void)
346 pxa2xx_mfp_config(ARRAY_AND_SIZE(palmld_pin_config));
347 pxa_set_ffuart_info(NULL);
348 pxa_set_btuart_info(NULL);
349 pxa_set_stuart_info(NULL);
351 palm27x_mmc_init(&palmld_mci_gpio_table);
352 palm27x_pm_init(PALMLD_STR_BASE);
353 palm27x_lcd_init(-1, &palm_320x480_lcd_mode);
354 palm27x_irda_init(GPIO_NR_PALMLD_IR_DISABLE);
355 palm27x_ac97_init(PALMLD_BAT_MIN_VOLTAGE, PALMLD_BAT_MAX_VOLTAGE,
356 GPIO_NR_PALMLD_EARPHONE_DETECT, 95);
357 palm27x_pwm_init(GPIO_NR_PALMLD_BL_POWER, GPIO_NR_PALMLD_LCD_POWER);
358 palm27x_power_init(GPIO_NR_PALMLD_POWER_DETECT,
359 GPIO_NR_PALMLD_USB_DETECT_N);
368 MACHINE_START(PALMLD, "Palm LifeDrive")
369 .atag_offset = 0x100,
370 .map_io = palmld_map_io,
371 .nr_irqs = PXA_NR_IRQS,
372 .init_irq = pxa27x_init_irq,
373 .handle_irq = pxa27x_handle_irq,
374 .init_time = pxa_timer_init,
375 .init_machine = palmld_init,
376 .restart = pxa_restart,