Tomas 'Sleep_Walker' Cech | e6c3f4b | 2009-05-18 15:24:14 +0200 | [diff] [blame] | 1 | /* |
Tomáš Čech | bb2ae8f | 2009-09-11 13:57:01 +0200 | [diff] [blame] | 2 | * Hardware definitions for Palm Treo smartphones |
| 3 | * |
| 4 | * currently supported: |
| 5 | * Palm Treo 680 (GSM) |
Tomáš Čech | d0a92fd | 2009-09-11 13:57:02 +0200 | [diff] [blame] | 6 | * Palm Centro 685 (GSM) |
Tomas 'Sleep_Walker' Cech | e6c3f4b | 2009-05-18 15:24:14 +0200 | [diff] [blame] | 7 | * |
| 8 | * Author: Tomas Cech <sleep_walker@suse.cz> |
| 9 | * |
| 10 | * This program is free software; you can redistribute it and/or modify |
| 11 | * it under the terms of the GNU General Public License version 2 as |
| 12 | * published by the Free Software Foundation. |
| 13 | * |
| 14 | * (find more info at www.hackndev.com) |
| 15 | * |
| 16 | */ |
| 17 | |
| 18 | #include <linux/platform_device.h> |
| 19 | #include <linux/delay.h> |
| 20 | #include <linux/irq.h> |
| 21 | #include <linux/gpio_keys.h> |
| 22 | #include <linux/input.h> |
Russell King | 8d717a5 | 2010-05-22 19:47:18 +0100 | [diff] [blame] | 23 | #include <linux/memblock.h> |
Tomas 'Sleep_Walker' Cech | e6c3f4b | 2009-05-18 15:24:14 +0200 | [diff] [blame] | 24 | #include <linux/pda_power.h> |
| 25 | #include <linux/pwm_backlight.h> |
| 26 | #include <linux/gpio.h> |
Tomas 'Sleep_Walker' Cech | e6c3f4b | 2009-05-18 15:24:14 +0200 | [diff] [blame] | 27 | #include <linux/power_supply.h> |
Tomas 'Sleep_Walker' Cech | e6c3f4b | 2009-05-18 15:24:14 +0200 | [diff] [blame] | 28 | #include <linux/w1-gpio.h> |
| 29 | |
| 30 | #include <asm/mach-types.h> |
| 31 | #include <asm/mach/arch.h> |
| 32 | #include <asm/mach/map.h> |
| 33 | |
| 34 | #include <mach/pxa27x.h> |
| 35 | #include <mach/pxa27x-udc.h> |
| 36 | #include <mach/audio.h> |
Tomáš Čech | bb2ae8f | 2009-09-11 13:57:01 +0200 | [diff] [blame] | 37 | #include <mach/palmtreo.h> |
Arnd Bergmann | 293b2da | 2012-08-24 15:16:48 +0200 | [diff] [blame] | 38 | #include <linux/platform_data/mmc-pxamci.h> |
| 39 | #include <linux/platform_data/video-pxafb.h> |
| 40 | #include <linux/platform_data/irda-pxaficp.h> |
| 41 | #include <linux/platform_data/keypad-pxa27x.h> |
Tomas 'Sleep_Walker' Cech | e6c3f4b | 2009-05-18 15:24:14 +0200 | [diff] [blame] | 42 | #include <mach/udc.h> |
Arnd Bergmann | 293b2da | 2012-08-24 15:16:48 +0200 | [diff] [blame] | 43 | #include <linux/platform_data/usb-ohci-pxa27x.h> |
Tomas 'Sleep_Walker' Cech | e6c3f4b | 2009-05-18 15:24:14 +0200 | [diff] [blame] | 44 | #include <mach/pxa2xx-regs.h> |
Arnd Bergmann | 293b2da | 2012-08-24 15:16:48 +0200 | [diff] [blame] | 45 | #include <linux/platform_data/asoc-palm27x.h> |
| 46 | #include <linux/platform_data/camera-pxa.h> |
Marek Vasut | 31620e2 | 2010-07-13 08:16:45 +0200 | [diff] [blame] | 47 | #include <mach/palm27x.h> |
Tomas 'Sleep_Walker' Cech | e6c3f4b | 2009-05-18 15:24:14 +0200 | [diff] [blame] | 48 | |
| 49 | #include <sound/pxa2xx-lib.h> |
| 50 | |
| 51 | #include "generic.h" |
| 52 | #include "devices.h" |
| 53 | |
| 54 | /****************************************************************************** |
| 55 | * Pin configuration |
| 56 | ******************************************************************************/ |
Tomáš Čech | bb2ae8f | 2009-09-11 13:57:01 +0200 | [diff] [blame] | 57 | static unsigned long treo_pin_config[] __initdata = { |
Tomas 'Sleep_Walker' Cech | e6c3f4b | 2009-05-18 15:24:14 +0200 | [diff] [blame] | 58 | /* MMC */ |
| 59 | GPIO32_MMC_CLK, |
| 60 | GPIO92_MMC_DAT_0, |
| 61 | GPIO109_MMC_DAT_1, |
| 62 | GPIO110_MMC_DAT_2, |
| 63 | GPIO111_MMC_DAT_3, |
| 64 | GPIO112_MMC_CMD, |
Tomas 'Sleep_Walker' Cech | e6c3f4b | 2009-05-18 15:24:14 +0200 | [diff] [blame] | 65 | GPIO113_GPIO, /* SD detect */ |
| 66 | |
| 67 | /* AC97 */ |
| 68 | GPIO28_AC97_BITCLK, |
| 69 | GPIO29_AC97_SDATA_IN_0, |
| 70 | GPIO30_AC97_SDATA_OUT, |
| 71 | GPIO31_AC97_SYNC, |
| 72 | GPIO89_AC97_SYSCLK, |
| 73 | GPIO95_AC97_nRESET, |
| 74 | |
| 75 | /* IrDA */ |
| 76 | GPIO46_FICP_RXD, |
| 77 | GPIO47_FICP_TXD, |
| 78 | |
| 79 | /* PWM */ |
| 80 | GPIO16_PWM0_OUT, |
| 81 | |
| 82 | /* USB */ |
| 83 | GPIO1_GPIO | WAKEUP_ON_EDGE_BOTH, /* usb detect */ |
| 84 | |
| 85 | /* MATRIX KEYPAD */ |
Tomas 'Sleep_Walker' Cech | e6c3f4b | 2009-05-18 15:24:14 +0200 | [diff] [blame] | 86 | GPIO101_KP_MKIN_1, |
| 87 | GPIO102_KP_MKIN_2, |
| 88 | GPIO97_KP_MKIN_3, |
| 89 | GPIO98_KP_MKIN_4, |
Tomas 'Sleep_Walker' Cech | e6c3f4b | 2009-05-18 15:24:14 +0200 | [diff] [blame] | 90 | GPIO91_KP_MKIN_6, |
| 91 | GPIO13_KP_MKIN_7, |
| 92 | GPIO103_KP_MKOUT_0 | MFP_LPM_DRIVE_HIGH, |
| 93 | GPIO104_KP_MKOUT_1, |
| 94 | GPIO105_KP_MKOUT_2, |
| 95 | GPIO106_KP_MKOUT_3, |
| 96 | GPIO107_KP_MKOUT_4, |
| 97 | GPIO108_KP_MKOUT_5, |
| 98 | GPIO96_KP_MKOUT_6, |
| 99 | GPIO93_KP_DKIN_0 | WAKEUP_ON_LEVEL_HIGH, /* Hotsync button */ |
| 100 | |
Tomas 'Sleep_Walker' Cech | e6c3f4b | 2009-05-18 15:24:14 +0200 | [diff] [blame] | 101 | /* Quick Capture Interface */ |
| 102 | GPIO84_CIF_FV, |
| 103 | GPIO85_CIF_LV, |
| 104 | GPIO53_CIF_MCLK, |
| 105 | GPIO54_CIF_PCLK, |
| 106 | GPIO81_CIF_DD_0, |
| 107 | GPIO55_CIF_DD_1, |
| 108 | GPIO51_CIF_DD_2, |
| 109 | GPIO50_CIF_DD_3, |
| 110 | GPIO52_CIF_DD_4, |
| 111 | GPIO48_CIF_DD_5, |
| 112 | GPIO17_CIF_DD_6, |
| 113 | GPIO12_CIF_DD_7, |
| 114 | |
| 115 | /* I2C */ |
| 116 | GPIO117_I2C_SCL, |
| 117 | GPIO118_I2C_SDA, |
| 118 | |
| 119 | /* GSM */ |
| 120 | GPIO14_GPIO | WAKEUP_ON_EDGE_BOTH, /* GSM host wake up */ |
| 121 | GPIO34_FFUART_RXD, |
| 122 | GPIO35_FFUART_CTS, |
| 123 | GPIO39_FFUART_TXD, |
| 124 | GPIO41_FFUART_RTS, |
| 125 | |
| 126 | /* MISC. */ |
| 127 | GPIO0_GPIO | WAKEUP_ON_EDGE_BOTH, /* external power detect */ |
| 128 | GPIO15_GPIO | WAKEUP_ON_EDGE_BOTH, /* silent switch */ |
| 129 | GPIO116_GPIO, /* headphone detect */ |
| 130 | GPIO11_GPIO | WAKEUP_ON_EDGE_BOTH, /* bluetooth host wake up */ |
| 131 | }; |
| 132 | |
Tomáš Čech | bb2ae8f | 2009-09-11 13:57:01 +0200 | [diff] [blame] | 133 | #ifdef CONFIG_MACH_TREO680 |
| 134 | static unsigned long treo680_pin_config[] __initdata = { |
| 135 | GPIO33_GPIO, /* SD read only */ |
| 136 | |
| 137 | /* MATRIX KEYPAD - different wake up source */ |
| 138 | GPIO100_KP_MKIN_0 | WAKEUP_ON_LEVEL_HIGH, |
| 139 | GPIO99_KP_MKIN_5, |
Mike Dunn | 2c33727 | 2012-12-27 10:02:17 -0800 | [diff] [blame] | 140 | |
| 141 | /* LCD... L_BIAS alt fn not configured on Treo680; is GPIO instead */ |
| 142 | GPIOxx_LCD_16BPP, |
| 143 | GPIO74_LCD_FCLK, |
| 144 | GPIO75_LCD_LCLK, |
| 145 | GPIO76_LCD_PCLK, |
Tomáš Čech | bb2ae8f | 2009-09-11 13:57:01 +0200 | [diff] [blame] | 146 | }; |
| 147 | #endif /* CONFIG_MACH_TREO680 */ |
| 148 | |
Tomáš Čech | d0a92fd | 2009-09-11 13:57:02 +0200 | [diff] [blame] | 149 | #ifdef CONFIG_MACH_CENTRO |
| 150 | static unsigned long centro685_pin_config[] __initdata = { |
| 151 | /* Bluetooth attached to BT UART*/ |
| 152 | MFP_CFG_OUT(GPIO80, AF0, DRIVE_LOW), /* power: LOW = off */ |
| 153 | GPIO42_BTUART_RXD, |
| 154 | GPIO43_BTUART_TXD, |
| 155 | GPIO44_BTUART_CTS, |
| 156 | GPIO45_BTUART_RTS, |
| 157 | |
| 158 | /* MATRIX KEYPAD - different wake up source */ |
| 159 | GPIO100_KP_MKIN_0, |
| 160 | GPIO99_KP_MKIN_5 | WAKEUP_ON_LEVEL_HIGH, |
Mike Dunn | 2c33727 | 2012-12-27 10:02:17 -0800 | [diff] [blame] | 161 | |
| 162 | /* LCD */ |
| 163 | GPIOxx_LCD_TFT_16BPP, |
Tomáš Čech | d0a92fd | 2009-09-11 13:57:02 +0200 | [diff] [blame] | 164 | }; |
| 165 | #endif /* CONFIG_MACH_CENTRO */ |
| 166 | |
Tomas 'Sleep_Walker' Cech | e6c3f4b | 2009-05-18 15:24:14 +0200 | [diff] [blame] | 167 | /****************************************************************************** |
Tomas 'Sleep_Walker' Cech | e6c3f4b | 2009-05-18 15:24:14 +0200 | [diff] [blame] | 168 | * GPIO keyboard |
| 169 | ******************************************************************************/ |
Mike Dunn | 747f344 | 2012-12-27 10:02:20 -0800 | [diff] [blame] | 170 | #if IS_ENABLED(CONFIG_KEYBOARD_PXA27x) |
Chao Xie | 0a085a9 | 2013-05-05 20:24:58 -0700 | [diff] [blame] | 171 | static const unsigned int treo680_matrix_keys[] = { |
Tomas 'Sleep_Walker' Cech | e6c3f4b | 2009-05-18 15:24:14 +0200 | [diff] [blame] | 172 | KEY(0, 0, KEY_F8), /* Red/Off/Power */ |
| 173 | KEY(0, 1, KEY_LEFT), |
| 174 | KEY(0, 2, KEY_LEFTCTRL), /* Alternate */ |
| 175 | KEY(0, 3, KEY_L), |
| 176 | KEY(0, 4, KEY_A), |
| 177 | KEY(0, 5, KEY_Q), |
| 178 | KEY(0, 6, KEY_P), |
| 179 | |
| 180 | KEY(1, 0, KEY_RIGHTCTRL), /* Menu */ |
| 181 | KEY(1, 1, KEY_RIGHT), |
| 182 | KEY(1, 2, KEY_LEFTSHIFT), /* Left shift */ |
| 183 | KEY(1, 3, KEY_Z), |
| 184 | KEY(1, 4, KEY_S), |
| 185 | KEY(1, 5, KEY_W), |
| 186 | |
| 187 | KEY(2, 0, KEY_F1), /* Phone */ |
| 188 | KEY(2, 1, KEY_UP), |
| 189 | KEY(2, 2, KEY_0), |
| 190 | KEY(2, 3, KEY_X), |
| 191 | KEY(2, 4, KEY_D), |
| 192 | KEY(2, 5, KEY_E), |
| 193 | |
| 194 | KEY(3, 0, KEY_F10), /* Calendar */ |
| 195 | KEY(3, 1, KEY_DOWN), |
| 196 | KEY(3, 2, KEY_SPACE), |
| 197 | KEY(3, 3, KEY_C), |
| 198 | KEY(3, 4, KEY_F), |
| 199 | KEY(3, 5, KEY_R), |
| 200 | |
| 201 | KEY(4, 0, KEY_F12), /* Mail */ |
| 202 | KEY(4, 1, KEY_KPENTER), |
| 203 | KEY(4, 2, KEY_RIGHTALT), /* Alt */ |
| 204 | KEY(4, 3, KEY_V), |
| 205 | KEY(4, 4, KEY_G), |
| 206 | KEY(4, 5, KEY_T), |
| 207 | |
| 208 | KEY(5, 0, KEY_F9), /* Home */ |
| 209 | KEY(5, 1, KEY_PAGEUP), /* Side up */ |
| 210 | KEY(5, 2, KEY_DOT), |
| 211 | KEY(5, 3, KEY_B), |
| 212 | KEY(5, 4, KEY_H), |
| 213 | KEY(5, 5, KEY_Y), |
| 214 | |
| 215 | KEY(6, 0, KEY_TAB), /* Side Activate */ |
| 216 | KEY(6, 1, KEY_PAGEDOWN), /* Side down */ |
| 217 | KEY(6, 2, KEY_ENTER), |
| 218 | KEY(6, 3, KEY_N), |
| 219 | KEY(6, 4, KEY_J), |
| 220 | KEY(6, 5, KEY_U), |
| 221 | |
| 222 | KEY(7, 0, KEY_F6), /* Green/Call */ |
| 223 | KEY(7, 1, KEY_O), |
| 224 | KEY(7, 2, KEY_BACKSPACE), |
| 225 | KEY(7, 3, KEY_M), |
| 226 | KEY(7, 4, KEY_K), |
| 227 | KEY(7, 5, KEY_I), |
| 228 | }; |
| 229 | |
Chao Xie | 0a085a9 | 2013-05-05 20:24:58 -0700 | [diff] [blame] | 230 | static const unsigned int centro_matrix_keys[] = { |
Tomáš Čech | d0a92fd | 2009-09-11 13:57:02 +0200 | [diff] [blame] | 231 | KEY(0, 0, KEY_F9), /* Home */ |
| 232 | KEY(0, 1, KEY_LEFT), |
| 233 | KEY(0, 2, KEY_LEFTCTRL), /* Alternate */ |
| 234 | KEY(0, 3, KEY_L), |
| 235 | KEY(0, 4, KEY_A), |
| 236 | KEY(0, 5, KEY_Q), |
| 237 | KEY(0, 6, KEY_P), |
| 238 | |
| 239 | KEY(1, 0, KEY_RIGHTCTRL), /* Menu */ |
| 240 | KEY(1, 1, KEY_RIGHT), |
| 241 | KEY(1, 2, KEY_LEFTSHIFT), /* Left shift */ |
| 242 | KEY(1, 3, KEY_Z), |
| 243 | KEY(1, 4, KEY_S), |
| 244 | KEY(1, 5, KEY_W), |
| 245 | |
| 246 | KEY(2, 0, KEY_F1), /* Phone */ |
| 247 | KEY(2, 1, KEY_UP), |
| 248 | KEY(2, 2, KEY_0), |
| 249 | KEY(2, 3, KEY_X), |
| 250 | KEY(2, 4, KEY_D), |
| 251 | KEY(2, 5, KEY_E), |
| 252 | |
| 253 | KEY(3, 0, KEY_F10), /* Calendar */ |
| 254 | KEY(3, 1, KEY_DOWN), |
| 255 | KEY(3, 2, KEY_SPACE), |
| 256 | KEY(3, 3, KEY_C), |
| 257 | KEY(3, 4, KEY_F), |
| 258 | KEY(3, 5, KEY_R), |
| 259 | |
| 260 | KEY(4, 0, KEY_F12), /* Mail */ |
| 261 | KEY(4, 1, KEY_KPENTER), |
| 262 | KEY(4, 2, KEY_RIGHTALT), /* Alt */ |
| 263 | KEY(4, 3, KEY_V), |
| 264 | KEY(4, 4, KEY_G), |
| 265 | KEY(4, 5, KEY_T), |
| 266 | |
| 267 | KEY(5, 0, KEY_F8), /* Red/Off/Power */ |
| 268 | KEY(5, 1, KEY_PAGEUP), /* Side up */ |
| 269 | KEY(5, 2, KEY_DOT), |
| 270 | KEY(5, 3, KEY_B), |
| 271 | KEY(5, 4, KEY_H), |
| 272 | KEY(5, 5, KEY_Y), |
| 273 | |
| 274 | KEY(6, 0, KEY_TAB), /* Side Activate */ |
| 275 | KEY(6, 1, KEY_PAGEDOWN), /* Side down */ |
| 276 | KEY(6, 2, KEY_ENTER), |
| 277 | KEY(6, 3, KEY_N), |
| 278 | KEY(6, 4, KEY_J), |
| 279 | KEY(6, 5, KEY_U), |
| 280 | |
| 281 | KEY(7, 0, KEY_F6), /* Green/Call */ |
| 282 | KEY(7, 1, KEY_O), |
| 283 | KEY(7, 2, KEY_BACKSPACE), |
| 284 | KEY(7, 3, KEY_M), |
| 285 | KEY(7, 4, KEY_K), |
| 286 | KEY(7, 5, KEY_I), |
| 287 | }; |
| 288 | |
Chao Xie | 0a085a9 | 2013-05-05 20:24:58 -0700 | [diff] [blame] | 289 | static struct matrix_keymap_data treo680_matrix_keymap_data = { |
| 290 | .keymap = treo680_matrix_keys, |
| 291 | .keymap_size = ARRAY_SIZE(treo680_matrix_keys), |
| 292 | }; |
| 293 | |
| 294 | static struct matrix_keymap_data centro_matrix_keymap_data = { |
| 295 | .keymap = centro_matrix_keys, |
| 296 | .keymap_size = ARRAY_SIZE(centro_matrix_keys), |
| 297 | }; |
| 298 | |
Marek Vasut | 31620e2 | 2010-07-13 08:16:45 +0200 | [diff] [blame] | 299 | static struct pxa27x_keypad_platform_data treo680_keypad_pdata = { |
Tomáš Čech | d0a92fd | 2009-09-11 13:57:02 +0200 | [diff] [blame] | 300 | .matrix_key_rows = 8, |
| 301 | .matrix_key_cols = 7, |
Chao Xie | 0a085a9 | 2013-05-05 20:24:58 -0700 | [diff] [blame] | 302 | .matrix_keymap_data = &treo680_matrix_keymap_data, |
Tomáš Čech | d0a92fd | 2009-09-11 13:57:02 +0200 | [diff] [blame] | 303 | .direct_key_map = { KEY_CONNECT }, |
| 304 | .direct_key_num = 1, |
| 305 | |
| 306 | .debounce_interval = 30, |
| 307 | }; |
Tomáš Čech | d0a92fd | 2009-09-11 13:57:02 +0200 | [diff] [blame] | 308 | |
Marek Vasut | 31620e2 | 2010-07-13 08:16:45 +0200 | [diff] [blame] | 309 | static void __init palmtreo_kpc_init(void) |
Tomas 'Sleep_Walker' Cech | e6c3f4b | 2009-05-18 15:24:14 +0200 | [diff] [blame] | 310 | { |
Marek Vasut | 31620e2 | 2010-07-13 08:16:45 +0200 | [diff] [blame] | 311 | static struct pxa27x_keypad_platform_data *data = &treo680_keypad_pdata; |
Tomas 'Sleep_Walker' Cech | e6c3f4b | 2009-05-18 15:24:14 +0200 | [diff] [blame] | 312 | |
Chao Xie | 0a085a9 | 2013-05-05 20:24:58 -0700 | [diff] [blame] | 313 | if (machine_is_centro()) |
| 314 | data->matrix_keymap_data = ¢ro_matrix_keymap_data; |
Tomas 'Sleep_Walker' Cech | e6c3f4b | 2009-05-18 15:24:14 +0200 | [diff] [blame] | 315 | |
Marek Vasut | 31620e2 | 2010-07-13 08:16:45 +0200 | [diff] [blame] | 316 | pxa_set_keypad_info(&treo680_keypad_pdata); |
Tomas 'Sleep_Walker' Cech | e6c3f4b | 2009-05-18 15:24:14 +0200 | [diff] [blame] | 317 | } |
Marek Vasut | 31620e2 | 2010-07-13 08:16:45 +0200 | [diff] [blame] | 318 | #else |
| 319 | static inline void palmtreo_kpc_init(void) {} |
| 320 | #endif |
Tomas 'Sleep_Walker' Cech | e6c3f4b | 2009-05-18 15:24:14 +0200 | [diff] [blame] | 321 | |
| 322 | /****************************************************************************** |
| 323 | * USB host |
| 324 | ******************************************************************************/ |
Mike Dunn | 747f344 | 2012-12-27 10:02:20 -0800 | [diff] [blame] | 325 | #if IS_ENABLED(CONFIG_USB_OHCI_HCD) |
Tomas 'Sleep_Walker' Cech | e6c3f4b | 2009-05-18 15:24:14 +0200 | [diff] [blame] | 326 | static struct pxaohci_platform_data treo680_ohci_info = { |
| 327 | .port_mode = PMM_PERPORT_MODE, |
| 328 | .flags = ENABLE_PORT1 | ENABLE_PORT3, |
| 329 | .power_budget = 0, |
| 330 | }; |
| 331 | |
Marek Vasut | 31620e2 | 2010-07-13 08:16:45 +0200 | [diff] [blame] | 332 | static void __init palmtreo_uhc_init(void) |
Tomas 'Sleep_Walker' Cech | e6c3f4b | 2009-05-18 15:24:14 +0200 | [diff] [blame] | 333 | { |
Marek Vasut | 31620e2 | 2010-07-13 08:16:45 +0200 | [diff] [blame] | 334 | if (machine_is_treo680()) |
| 335 | pxa_set_ohci_info(&treo680_ohci_info); |
Tomas 'Sleep_Walker' Cech | e6c3f4b | 2009-05-18 15:24:14 +0200 | [diff] [blame] | 336 | } |
Marek Vasut | 31620e2 | 2010-07-13 08:16:45 +0200 | [diff] [blame] | 337 | #else |
| 338 | static inline void palmtreo_uhc_init(void) {} |
| 339 | #endif |
Tomas 'Sleep_Walker' Cech | e6c3f4b | 2009-05-18 15:24:14 +0200 | [diff] [blame] | 340 | |
| 341 | /****************************************************************************** |
| 342 | * Vibra and LEDs |
| 343 | ******************************************************************************/ |
Tomáš Čech | bb2ae8f | 2009-09-11 13:57:01 +0200 | [diff] [blame] | 344 | static struct gpio_led treo680_gpio_leds[] = { |
Tomas 'Sleep_Walker' Cech | e6c3f4b | 2009-05-18 15:24:14 +0200 | [diff] [blame] | 345 | { |
| 346 | .name = "treo680:vibra:vibra", |
| 347 | .default_trigger = "none", |
| 348 | .gpio = GPIO_NR_TREO680_VIBRATE_EN, |
| 349 | }, |
| 350 | { |
| 351 | .name = "treo680:green:led", |
| 352 | .default_trigger = "mmc0", |
Tomáš Čech | bb2ae8f | 2009-09-11 13:57:01 +0200 | [diff] [blame] | 353 | .gpio = GPIO_NR_TREO_GREEN_LED, |
Tomas 'Sleep_Walker' Cech | e6c3f4b | 2009-05-18 15:24:14 +0200 | [diff] [blame] | 354 | }, |
| 355 | { |
Tomáš Čech | bb2ae8f | 2009-09-11 13:57:01 +0200 | [diff] [blame] | 356 | .name = "treo680:white:keybbl", |
Tomas 'Sleep_Walker' Cech | e6c3f4b | 2009-05-18 15:24:14 +0200 | [diff] [blame] | 357 | .default_trigger = "none", |
| 358 | .gpio = GPIO_NR_TREO680_KEYB_BL, |
| 359 | }, |
| 360 | }; |
| 361 | |
Tomáš Čech | bb2ae8f | 2009-09-11 13:57:01 +0200 | [diff] [blame] | 362 | static struct gpio_led_platform_data treo680_gpio_led_info = { |
| 363 | .leds = treo680_gpio_leds, |
| 364 | .num_leds = ARRAY_SIZE(treo680_gpio_leds), |
Tomas 'Sleep_Walker' Cech | e6c3f4b | 2009-05-18 15:24:14 +0200 | [diff] [blame] | 365 | }; |
| 366 | |
Tomáš Čech | d0a92fd | 2009-09-11 13:57:02 +0200 | [diff] [blame] | 367 | static struct gpio_led centro_gpio_leds[] = { |
| 368 | { |
| 369 | .name = "centro:vibra:vibra", |
| 370 | .default_trigger = "none", |
| 371 | .gpio = GPIO_NR_CENTRO_VIBRATE_EN, |
| 372 | }, |
| 373 | { |
| 374 | .name = "centro:green:led", |
| 375 | .default_trigger = "mmc0", |
| 376 | .gpio = GPIO_NR_TREO_GREEN_LED, |
| 377 | }, |
| 378 | { |
| 379 | .name = "centro:white:keybbl", |
| 380 | .default_trigger = "none", |
| 381 | .active_low = 1, |
| 382 | .gpio = GPIO_NR_CENTRO_KEYB_BL, |
| 383 | }, |
| 384 | }; |
| 385 | |
| 386 | static struct gpio_led_platform_data centro_gpio_led_info = { |
| 387 | .leds = centro_gpio_leds, |
| 388 | .num_leds = ARRAY_SIZE(centro_gpio_leds), |
| 389 | }; |
| 390 | |
Marek Vasut | 31620e2 | 2010-07-13 08:16:45 +0200 | [diff] [blame] | 391 | static struct platform_device palmtreo_leds = { |
Tomáš Čech | d0a92fd | 2009-09-11 13:57:02 +0200 | [diff] [blame] | 392 | .name = "leds-gpio", |
| 393 | .id = -1, |
Tomáš Čech | d0a92fd | 2009-09-11 13:57:02 +0200 | [diff] [blame] | 394 | }; |
Tomáš Čech | d0a92fd | 2009-09-11 13:57:02 +0200 | [diff] [blame] | 395 | |
Marek Vasut | 31620e2 | 2010-07-13 08:16:45 +0200 | [diff] [blame] | 396 | static void __init palmtreo_leds_init(void) |
Tomas 'Sleep_Walker' Cech | e6c3f4b | 2009-05-18 15:24:14 +0200 | [diff] [blame] | 397 | { |
Marek Vasut | 31620e2 | 2010-07-13 08:16:45 +0200 | [diff] [blame] | 398 | if (machine_is_centro()) |
| 399 | palmtreo_leds.dev.platform_data = ¢ro_gpio_led_info; |
Mike Dunn | 6a639bb | 2012-12-27 10:02:18 -0800 | [diff] [blame] | 400 | else if (machine_is_treo680()) |
| 401 | palmtreo_leds.dev.platform_data = &treo680_gpio_led_info; |
Tomas 'Sleep_Walker' Cech | e6c3f4b | 2009-05-18 15:24:14 +0200 | [diff] [blame] | 402 | |
Marek Vasut | 31620e2 | 2010-07-13 08:16:45 +0200 | [diff] [blame] | 403 | platform_device_register(&palmtreo_leds); |
Tomáš Čech | 28d7a94 | 2009-09-03 16:55:47 +0200 | [diff] [blame] | 404 | } |
Tomas 'Sleep_Walker' Cech | e6c3f4b | 2009-05-18 15:24:14 +0200 | [diff] [blame] | 405 | |
| 406 | /****************************************************************************** |
Mike Dunn | 8b8842b | 2012-12-27 10:02:19 -0800 | [diff] [blame] | 407 | * diskonchip docg4 flash |
| 408 | ******************************************************************************/ |
| 409 | #if defined(CONFIG_MACH_TREO680) |
| 410 | /* REVISIT: does the centro have this device also? */ |
| 411 | #if IS_ENABLED(CONFIG_MTD_NAND_DOCG4) |
| 412 | static struct resource docg4_resources[] = { |
| 413 | { |
| 414 | .start = 0x00000000, |
| 415 | .end = 0x00001FFF, |
| 416 | .flags = IORESOURCE_MEM, |
| 417 | }, |
| 418 | }; |
| 419 | |
| 420 | static struct platform_device treo680_docg4_flash = { |
| 421 | .name = "docg4", |
| 422 | .id = -1, |
| 423 | .resource = docg4_resources, |
| 424 | .num_resources = ARRAY_SIZE(docg4_resources), |
| 425 | }; |
| 426 | |
| 427 | static void __init treo680_docg4_flash_init(void) |
| 428 | { |
| 429 | platform_device_register(&treo680_docg4_flash); |
| 430 | } |
| 431 | #else |
| 432 | static inline void treo680_docg4_flash_init(void) {} |
| 433 | #endif |
| 434 | #endif |
| 435 | |
| 436 | /****************************************************************************** |
Tomas 'Sleep_Walker' Cech | e6c3f4b | 2009-05-18 15:24:14 +0200 | [diff] [blame] | 437 | * Machine init |
| 438 | ******************************************************************************/ |
Russell King | 98c672c | 2010-05-22 18:18:57 +0100 | [diff] [blame] | 439 | static void __init treo_reserve(void) |
| 440 | { |
Russell King | 8d717a5 | 2010-05-22 19:47:18 +0100 | [diff] [blame] | 441 | memblock_reserve(0xa0000000, 0x1000); |
| 442 | memblock_reserve(0xa2000000, 0x1000); |
Russell King | 98c672c | 2010-05-22 18:18:57 +0100 | [diff] [blame] | 443 | } |
| 444 | |
Marek Vasut | 31620e2 | 2010-07-13 08:16:45 +0200 | [diff] [blame] | 445 | static void __init palmphone_common_init(void) |
Tomáš Čech | bb2ae8f | 2009-09-11 13:57:01 +0200 | [diff] [blame] | 446 | { |
Marek Vasut | 31620e2 | 2010-07-13 08:16:45 +0200 | [diff] [blame] | 447 | pxa2xx_mfp_config(ARRAY_AND_SIZE(treo_pin_config)); |
Russell King | cc155c6 | 2009-11-09 13:34:08 +0800 | [diff] [blame] | 448 | pxa_set_ffuart_info(NULL); |
| 449 | pxa_set_btuart_info(NULL); |
| 450 | pxa_set_stuart_info(NULL); |
Marek Vasut | 31620e2 | 2010-07-13 08:16:45 +0200 | [diff] [blame] | 451 | palm27x_pm_init(TREO_STR_BASE); |
| 452 | palm27x_lcd_init(GPIO_NR_TREO_BL_POWER, &palm_320x320_new_lcd_mode); |
| 453 | palm27x_udc_init(GPIO_NR_TREO_USB_DETECT, GPIO_NR_TREO_USB_PULLUP, 1); |
| 454 | palm27x_irda_init(GPIO_NR_TREO_IR_EN); |
| 455 | palm27x_ac97_init(-1, -1, -1, 95); |
| 456 | palm27x_pwm_init(GPIO_NR_TREO_BL_POWER, -1); |
| 457 | palm27x_power_init(GPIO_NR_TREO_POWER_DETECT, -1); |
| 458 | palm27x_pmic_init(); |
| 459 | palmtreo_kpc_init(); |
| 460 | palmtreo_uhc_init(); |
| 461 | palmtreo_leds_init(); |
Tomáš Čech | bb2ae8f | 2009-09-11 13:57:01 +0200 | [diff] [blame] | 462 | } |
| 463 | |
Arnd Bergmann | 0c82cc5 | 2011-10-01 22:03:42 +0200 | [diff] [blame] | 464 | #ifdef CONFIG_MACH_TREO680 |
Mike Dunn | 2c33727 | 2012-12-27 10:02:17 -0800 | [diff] [blame] | 465 | void __init treo680_gpio_init(void) |
| 466 | { |
| 467 | unsigned int gpio; |
| 468 | |
| 469 | /* drive all three lcd gpios high initially */ |
| 470 | const unsigned long lcd_flags = GPIOF_INIT_HIGH | GPIOF_DIR_OUT; |
| 471 | |
| 472 | /* |
| 473 | * LCD GPIO initialization... |
| 474 | */ |
| 475 | |
| 476 | /* |
| 477 | * This is likely the power to the lcd. Toggling it low/high appears to |
| 478 | * turn the lcd off/on. Can be toggled after lcd is initialized without |
| 479 | * any apparent adverse effects to the lcd operation. Note that this |
| 480 | * gpio line is used by the lcd controller as the L_BIAS signal, but |
| 481 | * treo680 configures it as gpio. |
| 482 | */ |
| 483 | gpio = GPIO_NR_TREO680_LCD_POWER; |
| 484 | if (gpio_request_one(gpio, lcd_flags, "LCD power") < 0) |
| 485 | goto fail; |
| 486 | |
| 487 | /* |
| 488 | * These two are called "enables", for lack of a better understanding. |
| 489 | * If either of these are toggled after the lcd is initialized, the |
| 490 | * image becomes degraded. N.B. The IPL shipped with the treo |
| 491 | * configures GPIO_NR_TREO680_LCD_EN_N as output and drives it high. If |
| 492 | * the IPL is ever reprogrammed, this initialization may be need to be |
| 493 | * revisited. |
| 494 | */ |
| 495 | gpio = GPIO_NR_TREO680_LCD_EN; |
| 496 | if (gpio_request_one(gpio, lcd_flags, "LCD enable") < 0) |
| 497 | goto fail; |
| 498 | gpio = GPIO_NR_TREO680_LCD_EN_N; |
| 499 | if (gpio_request_one(gpio, lcd_flags, "LCD enable_n") < 0) |
| 500 | goto fail; |
| 501 | |
| 502 | /* driving this low turns LCD on */ |
| 503 | gpio_set_value(GPIO_NR_TREO680_LCD_EN_N, 0); |
| 504 | |
| 505 | return; |
| 506 | fail: |
| 507 | pr_err("gpio %d initialization failed\n", gpio); |
| 508 | gpio_free(GPIO_NR_TREO680_LCD_POWER); |
| 509 | gpio_free(GPIO_NR_TREO680_LCD_EN); |
| 510 | gpio_free(GPIO_NR_TREO680_LCD_EN_N); |
| 511 | } |
| 512 | |
Tomas 'Sleep_Walker' Cech | e6c3f4b | 2009-05-18 15:24:14 +0200 | [diff] [blame] | 513 | static void __init treo680_init(void) |
| 514 | { |
Tomas 'Sleep_Walker' Cech | e6c3f4b | 2009-05-18 15:24:14 +0200 | [diff] [blame] | 515 | pxa2xx_mfp_config(ARRAY_AND_SIZE(treo680_pin_config)); |
Marek Vasut | 31620e2 | 2010-07-13 08:16:45 +0200 | [diff] [blame] | 516 | palmphone_common_init(); |
Mike Dunn | 2c33727 | 2012-12-27 10:02:17 -0800 | [diff] [blame] | 517 | treo680_gpio_init(); |
Marek Vasut | 31620e2 | 2010-07-13 08:16:45 +0200 | [diff] [blame] | 518 | palm27x_mmc_init(GPIO_NR_TREO_SD_DETECT_N, GPIO_NR_TREO680_SD_READONLY, |
| 519 | GPIO_NR_TREO680_SD_POWER, 0); |
Mike Dunn | 8b8842b | 2012-12-27 10:02:19 -0800 | [diff] [blame] | 520 | treo680_docg4_flash_init(); |
Marek Vasut | 31620e2 | 2010-07-13 08:16:45 +0200 | [diff] [blame] | 521 | } |
Arnd Bergmann | 0c82cc5 | 2011-10-01 22:03:42 +0200 | [diff] [blame] | 522 | #endif |
Tomas 'Sleep_Walker' Cech | e6c3f4b | 2009-05-18 15:24:14 +0200 | [diff] [blame] | 523 | |
Arnd Bergmann | 0c82cc5 | 2011-10-01 22:03:42 +0200 | [diff] [blame] | 524 | #ifdef CONFIG_MACH_CENTRO |
Marek Vasut | 31620e2 | 2010-07-13 08:16:45 +0200 | [diff] [blame] | 525 | static void __init centro_init(void) |
| 526 | { |
| 527 | pxa2xx_mfp_config(ARRAY_AND_SIZE(centro685_pin_config)); |
| 528 | palmphone_common_init(); |
| 529 | palm27x_mmc_init(GPIO_NR_TREO_SD_DETECT_N, -1, |
| 530 | GPIO_NR_CENTRO_SD_POWER, 1); |
Tomas 'Sleep_Walker' Cech | e6c3f4b | 2009-05-18 15:24:14 +0200 | [diff] [blame] | 531 | } |
Arnd Bergmann | 0c82cc5 | 2011-10-01 22:03:42 +0200 | [diff] [blame] | 532 | #endif |
Tomas 'Sleep_Walker' Cech | e6c3f4b | 2009-05-18 15:24:14 +0200 | [diff] [blame] | 533 | |
Arnd Bergmann | 0c82cc5 | 2011-10-01 22:03:42 +0200 | [diff] [blame] | 534 | #ifdef CONFIG_MACH_TREO680 |
Tomas 'Sleep_Walker' Cech | e6c3f4b | 2009-05-18 15:24:14 +0200 | [diff] [blame] | 535 | MACHINE_START(TREO680, "Palm Treo 680") |
Nicolas Pitre | 7375aba | 2011-07-05 22:38:15 -0400 | [diff] [blame] | 536 | .atag_offset = 0x100, |
Marek Vasut | 851982c | 2010-10-11 02:20:19 +0200 | [diff] [blame] | 537 | .map_io = pxa27x_map_io, |
Russell King | 98c672c | 2010-05-22 18:18:57 +0100 | [diff] [blame] | 538 | .reserve = treo_reserve, |
Rob Herring | 4e61109 | 2012-01-03 16:53:48 -0600 | [diff] [blame] | 539 | .nr_irqs = PXA_NR_IRQS, |
Tomáš Čech | bb2ae8f | 2009-09-11 13:57:01 +0200 | [diff] [blame] | 540 | .init_irq = pxa27x_init_irq, |
Eric Miao | 8a97ae2 | 2011-05-18 21:30:04 +0800 | [diff] [blame] | 541 | .handle_irq = pxa27x_handle_irq, |
Stephen Warren | 6bb27d7 | 2012-11-08 12:40:59 -0700 | [diff] [blame] | 542 | .init_time = pxa_timer_init, |
Tomáš Čech | bb2ae8f | 2009-09-11 13:57:01 +0200 | [diff] [blame] | 543 | .init_machine = treo680_init, |
Russell King | 271a74f | 2011-11-04 14:15:53 +0000 | [diff] [blame] | 544 | .restart = pxa_restart, |
Tomas 'Sleep_Walker' Cech | e6c3f4b | 2009-05-18 15:24:14 +0200 | [diff] [blame] | 545 | MACHINE_END |
Arnd Bergmann | 0c82cc5 | 2011-10-01 22:03:42 +0200 | [diff] [blame] | 546 | #endif |
Tomáš Čech | d0a92fd | 2009-09-11 13:57:02 +0200 | [diff] [blame] | 547 | |
Arnd Bergmann | 0c82cc5 | 2011-10-01 22:03:42 +0200 | [diff] [blame] | 548 | #ifdef CONFIG_MACH_CENTRO |
Tomáš Čech | d0a92fd | 2009-09-11 13:57:02 +0200 | [diff] [blame] | 549 | MACHINE_START(CENTRO, "Palm Centro 685") |
Nicolas Pitre | 7375aba | 2011-07-05 22:38:15 -0400 | [diff] [blame] | 550 | .atag_offset = 0x100, |
Marek Vasut | 851982c | 2010-10-11 02:20:19 +0200 | [diff] [blame] | 551 | .map_io = pxa27x_map_io, |
Russell King | 98c672c | 2010-05-22 18:18:57 +0100 | [diff] [blame] | 552 | .reserve = treo_reserve, |
Rob Herring | 4e61109 | 2012-01-03 16:53:48 -0600 | [diff] [blame] | 553 | .nr_irqs = PXA_NR_IRQS, |
Tomáš Čech | d0a92fd | 2009-09-11 13:57:02 +0200 | [diff] [blame] | 554 | .init_irq = pxa27x_init_irq, |
Eric Miao | 8a97ae2 | 2011-05-18 21:30:04 +0800 | [diff] [blame] | 555 | .handle_irq = pxa27x_handle_irq, |
Stephen Warren | 6bb27d7 | 2012-11-08 12:40:59 -0700 | [diff] [blame] | 556 | .init_time = pxa_timer_init, |
Russell King | f165eb7 | 2010-08-06 18:10:25 +0100 | [diff] [blame] | 557 | .init_machine = centro_init, |
Russell King | 271a74f | 2011-11-04 14:15:53 +0000 | [diff] [blame] | 558 | .restart = pxa_restart, |
Tomáš Čech | d0a92fd | 2009-09-11 13:57:02 +0200 | [diff] [blame] | 559 | MACHINE_END |
Arnd Bergmann | 0c82cc5 | 2011-10-01 22:03:42 +0200 | [diff] [blame] | 560 | #endif |