Marek Vasut | 0f6ff0f | 2008-11-20 00:58:38 +0100 | [diff] [blame] | 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> |
Russell King | 8d717a5 | 2010-05-22 19:47:18 +0100 | [diff] [blame] | 24 | #include <linux/memblock.h> |
Marek Vasut | 0f6ff0f | 2008-11-20 00:58:38 +0100 | [diff] [blame] | 25 | #include <linux/pda_power.h> |
| 26 | #include <linux/pwm_backlight.h> |
| 27 | #include <linux/gpio.h> |
Marek Vasut | 241cf47 | 2010-06-04 03:07:33 +0200 | [diff] [blame] | 28 | #include <linux/wm97xx.h> |
Marek Vasut | 0f6ff0f | 2008-11-20 00:58:38 +0100 | [diff] [blame] | 29 | #include <linux/power_supply.h> |
Marek Vasut | 8768dc9 | 2009-04-23 11:12:37 +0200 | [diff] [blame] | 30 | #include <linux/usb/gpio_vbus.h> |
Marek Vasut | 0f6ff0f | 2008-11-20 00:58:38 +0100 | [diff] [blame] | 31 | |
| 32 | #include <asm/mach-types.h> |
| 33 | #include <asm/mach/arch.h> |
| 34 | #include <asm/mach/map.h> |
| 35 | |
Eric Miao | 51c6298 | 2009-01-02 23:17:22 +0800 | [diff] [blame] | 36 | #include <mach/pxa27x.h> |
Marek Vasut | 0f6ff0f | 2008-11-20 00:58:38 +0100 | [diff] [blame] | 37 | #include <mach/audio.h> |
| 38 | #include <mach/palmt5.h> |
| 39 | #include <mach/mmc.h> |
| 40 | #include <mach/pxafb.h> |
Marek Vasut | 0f6ff0f | 2008-11-20 00:58:38 +0100 | [diff] [blame] | 41 | #include <mach/irda.h> |
Mark F. Brown | 4a2490e | 2010-09-03 18:28:06 -0400 | [diff] [blame] | 42 | #include <plat/pxa27x_keypad.h> |
Marek Vasut | 0f6ff0f | 2008-11-20 00:58:38 +0100 | [diff] [blame] | 43 | #include <mach/udc.h> |
| 44 | #include <mach/palmasoc.h> |
Marek Vasut | 31620e2 | 2010-07-13 08:16:45 +0200 | [diff] [blame] | 45 | #include <mach/palm27x.h> |
Marek Vasut | 0f6ff0f | 2008-11-20 00:58:38 +0100 | [diff] [blame] | 46 | |
| 47 | #include "generic.h" |
| 48 | #include "devices.h" |
| 49 | |
| 50 | /****************************************************************************** |
| 51 | * Pin configuration |
| 52 | ******************************************************************************/ |
| 53 | static 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, |
Marek Vasut | 6ec04f4 | 2009-05-22 01:39:10 +0200 | [diff] [blame] | 70 | GPIO89_AC97_SYSCLK, |
Marek Vasut | efb12cd | 2009-04-12 16:37:23 +0200 | [diff] [blame] | 71 | GPIO95_AC97_nRESET, |
Marek Vasut | 0f6ff0f | 2008-11-20 00:58:38 +0100 | [diff] [blame] | 72 | |
| 73 | /* IrDA */ |
| 74 | GPIO40_GPIO, /* ir disable */ |
| 75 | GPIO46_FICP_RXD, |
| 76 | GPIO47_FICP_TXD, |
| 77 | |
| 78 | /* USB */ |
| 79 | GPIO15_GPIO, /* usb detect */ |
Marek Vasut | efb12cd | 2009-04-12 16:37:23 +0200 | [diff] [blame] | 80 | GPIO93_GPIO, /* usb power */ |
Marek Vasut | 0f6ff0f | 2008-11-20 00:58:38 +0100 | [diff] [blame] | 81 | |
| 82 | /* MATRIX KEYPAD */ |
Marek Vasut | 81854f8 | 2009-03-28 12:37:42 +0100 | [diff] [blame] | 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, |
Marek Vasut | 0f6ff0f | 2008-11-20 00:58:38 +0100 | [diff] [blame] | 87 | GPIO103_KP_MKOUT_0, |
| 88 | GPIO104_KP_MKOUT_1, |
| 89 | GPIO105_KP_MKOUT_2, |
| 90 | |
| 91 | /* LCD */ |
Eric Miao | bedbda9 | 2010-01-04 11:37:14 +0800 | [diff] [blame] | 92 | GPIOxx_LCD_TFT_16BPP, |
Marek Vasut | 0f6ff0f | 2008-11-20 00:58:38 +0100 | [diff] [blame] | 93 | |
| 94 | /* PWM */ |
| 95 | GPIO16_PWM0_OUT, |
| 96 | |
Marek Vasut | ecf763c | 2009-07-16 19:37:29 +0200 | [diff] [blame] | 97 | /* FFUART */ |
| 98 | GPIO34_FFUART_RXD, |
| 99 | GPIO39_FFUART_TXD, |
| 100 | |
Marek Vasut | 0f6ff0f | 2008-11-20 00:58:38 +0100 | [diff] [blame] | 101 | /* MISC */ |
| 102 | GPIO10_GPIO, /* hotsync button */ |
| 103 | GPIO90_GPIO, /* power detect */ |
| 104 | GPIO107_GPIO, /* earphone detect */ |
| 105 | }; |
| 106 | |
| 107 | /****************************************************************************** |
Marek Vasut | 0f6ff0f | 2008-11-20 00:58:38 +0100 | [diff] [blame] | 108 | * GPIO keyboard |
| 109 | ******************************************************************************/ |
Marek Vasut | 31620e2 | 2010-07-13 08:16:45 +0200 | [diff] [blame] | 110 | #if defined(CONFIG_KEYBOARD_PXA27x) || defined(CONFIG_KEYBOARD_PXA27x_MODULE) |
Marek Vasut | 0f6ff0f | 2008-11-20 00:58:38 +0100 | [diff] [blame] | 111 | static unsigned int palmt5_matrix_keys[] = { |
| 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 | |
| 127 | static struct pxa27x_keypad_platform_data palmt5_keypad_platform_data = { |
| 128 | .matrix_key_rows = 4, |
| 129 | .matrix_key_cols = 3, |
| 130 | .matrix_key_map = palmt5_matrix_keys, |
| 131 | .matrix_key_map_size = ARRAY_SIZE(palmt5_matrix_keys), |
| 132 | |
| 133 | .debounce_interval = 30, |
| 134 | }; |
| 135 | |
Marek Vasut | 31620e2 | 2010-07-13 08:16:45 +0200 | [diff] [blame] | 136 | static void __init palmt5_kpc_init(void) |
| 137 | { |
| 138 | pxa_set_keypad_info(&palmt5_keypad_platform_data); |
| 139 | } |
| 140 | #else |
| 141 | static inline void palmt5_kpc_init(void) {} |
| 142 | #endif |
| 143 | |
Marek Vasut | 0f6ff0f | 2008-11-20 00:58:38 +0100 | [diff] [blame] | 144 | /****************************************************************************** |
| 145 | * GPIO keys |
| 146 | ******************************************************************************/ |
Marek Vasut | 31620e2 | 2010-07-13 08:16:45 +0200 | [diff] [blame] | 147 | #if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE) |
Marek Vasut | 0f6ff0f | 2008-11-20 00:58:38 +0100 | [diff] [blame] | 148 | static struct gpio_keys_button palmt5_pxa_buttons[] = { |
| 149 | {KEY_F8, GPIO_NR_PALMT5_HOTSYNC_BUTTON_N, 1, "HotSync Button" }, |
| 150 | }; |
| 151 | |
| 152 | static struct gpio_keys_platform_data palmt5_pxa_keys_data = { |
| 153 | .buttons = palmt5_pxa_buttons, |
| 154 | .nbuttons = ARRAY_SIZE(palmt5_pxa_buttons), |
| 155 | }; |
| 156 | |
| 157 | static struct platform_device palmt5_pxa_keys = { |
| 158 | .name = "gpio-keys", |
| 159 | .id = -1, |
| 160 | .dev = { |
| 161 | .platform_data = &palmt5_pxa_keys_data, |
| 162 | }, |
| 163 | }; |
| 164 | |
Marek Vasut | 31620e2 | 2010-07-13 08:16:45 +0200 | [diff] [blame] | 165 | static void __init palmt5_keys_init(void) |
Marek Vasut | 0f6ff0f | 2008-11-20 00:58:38 +0100 | [diff] [blame] | 166 | { |
Marek Vasut | 31620e2 | 2010-07-13 08:16:45 +0200 | [diff] [blame] | 167 | platform_device_register(&palmt5_pxa_keys); |
Marek Vasut | 0f6ff0f | 2008-11-20 00:58:38 +0100 | [diff] [blame] | 168 | } |
Marek Vasut | 31620e2 | 2010-07-13 08:16:45 +0200 | [diff] [blame] | 169 | #else |
| 170 | static inline void palmt5_keys_init(void) {} |
| 171 | #endif |
Marek Vasut | 81854f8 | 2009-03-28 12:37:42 +0100 | [diff] [blame] | 172 | |
Marek Vasut | 81854f8 | 2009-03-28 12:37:42 +0100 | [diff] [blame] | 173 | /****************************************************************************** |
Marek Vasut | 0f6ff0f | 2008-11-20 00:58:38 +0100 | [diff] [blame] | 174 | * Machine init |
| 175 | ******************************************************************************/ |
Russell King | 98c672c | 2010-05-22 18:18:57 +0100 | [diff] [blame] | 176 | static void __init palmt5_reserve(void) |
| 177 | { |
Russell King | 8d717a5 | 2010-05-22 19:47:18 +0100 | [diff] [blame] | 178 | memblock_reserve(0xa0200000, 0x1000); |
Russell King | 98c672c | 2010-05-22 18:18:57 +0100 | [diff] [blame] | 179 | } |
| 180 | |
Marek Vasut | 0f6ff0f | 2008-11-20 00:58:38 +0100 | [diff] [blame] | 181 | static void __init palmt5_init(void) |
| 182 | { |
| 183 | pxa2xx_mfp_config(ARRAY_AND_SIZE(palmt5_pin_config)); |
Russell King | cc155c6 | 2009-11-09 13:34:08 +0800 | [diff] [blame] | 184 | pxa_set_ffuart_info(NULL); |
| 185 | pxa_set_btuart_info(NULL); |
| 186 | pxa_set_stuart_info(NULL); |
| 187 | |
Marek Vasut | 31620e2 | 2010-07-13 08:16:45 +0200 | [diff] [blame] | 188 | palm27x_mmc_init(GPIO_NR_PALMT5_SD_DETECT_N, GPIO_NR_PALMT5_SD_READONLY, |
| 189 | GPIO_NR_PALMT5_SD_POWER, 0); |
| 190 | palm27x_pm_init(PALMT5_STR_BASE); |
| 191 | palm27x_lcd_init(-1, &palm_320x480_lcd_mode); |
| 192 | palm27x_udc_init(GPIO_NR_PALMT5_USB_DETECT_N, |
| 193 | GPIO_NR_PALMT5_USB_PULLUP, 1); |
| 194 | palm27x_irda_init(GPIO_NR_PALMT5_IR_DISABLE); |
| 195 | palm27x_ac97_init(PALMT5_BAT_MIN_VOLTAGE, PALMT5_BAT_MAX_VOLTAGE, |
| 196 | GPIO_NR_PALMT5_EARPHONE_DETECT, 95); |
| 197 | palm27x_pwm_init(GPIO_NR_PALMT5_BL_POWER, GPIO_NR_PALMT5_LCD_POWER); |
| 198 | palm27x_power_init(GPIO_NR_PALMT5_POWER_DETECT, -1); |
| 199 | palm27x_pmic_init(); |
| 200 | palmt5_kpc_init(); |
| 201 | palmt5_keys_init(); |
Marek Vasut | 0f6ff0f | 2008-11-20 00:58:38 +0100 | [diff] [blame] | 202 | } |
| 203 | |
| 204 | MACHINE_START(PALMT5, "Palm Tungsten|T5") |
Nicolas Pitre | 7375aba | 2011-07-05 22:38:15 -0400 | [diff] [blame] | 205 | .atag_offset = 0x100, |
Marek Vasut | 851982c | 2010-10-11 02:20:19 +0200 | [diff] [blame] | 206 | .map_io = pxa27x_map_io, |
Russell King | 98c672c | 2010-05-22 18:18:57 +0100 | [diff] [blame] | 207 | .reserve = palmt5_reserve, |
Marek Vasut | 0f6ff0f | 2008-11-20 00:58:38 +0100 | [diff] [blame] | 208 | .init_irq = pxa27x_init_irq, |
Eric Miao | 8a97ae2 | 2011-05-18 21:30:04 +0800 | [diff] [blame] | 209 | .handle_irq = pxa27x_handle_irq, |
Marek Vasut | 0f6ff0f | 2008-11-20 00:58:38 +0100 | [diff] [blame] | 210 | .timer = &pxa_timer, |
Russell King | 271a74f | 2011-11-04 14:15:53 +0000 | [diff] [blame] | 211 | .init_machine = palmt5_init, |
| 212 | .restart = pxa_restart, |
Marek Vasut | 0f6ff0f | 2008-11-20 00:58:38 +0100 | [diff] [blame] | 213 | MACHINE_END |