Marek Vasut | a645072 | 2008-11-20 22:50:46 +0100 | [diff] [blame] | 1 | /* |
| 2 | * Hardware definitions for Palm LifeDrive |
| 3 | * |
| 4 | * Author: Marek Vasut <marek.vasut@gmail.com> |
| 5 | * |
| 6 | * Based on work of: |
| 7 | * Alex Osborne <ato@meshy.org> |
| 8 | * |
| 9 | * This program is free software; you can redistribute it and/or modify |
| 10 | * it under the terms of the GNU General Public License version 2 as |
| 11 | * published by the Free Software Foundation. |
| 12 | * |
| 13 | * (find more info at www.hackndev.com) |
| 14 | * |
| 15 | */ |
| 16 | |
| 17 | #include <linux/platform_device.h> |
| 18 | #include <linux/delay.h> |
| 19 | #include <linux/irq.h> |
| 20 | #include <linux/gpio_keys.h> |
| 21 | #include <linux/input.h> |
| 22 | #include <linux/pda_power.h> |
| 23 | #include <linux/pwm_backlight.h> |
| 24 | #include <linux/gpio.h> |
Marek Vasut | 241cf47 | 2010-06-04 03:07:33 +0200 | [diff] [blame] | 25 | #include <linux/wm97xx.h> |
Marek Vasut | a645072 | 2008-11-20 22:50:46 +0100 | [diff] [blame] | 26 | #include <linux/power_supply.h> |
Marek Vasut | d7c307c | 2009-07-17 19:46:58 +0200 | [diff] [blame] | 27 | #include <linux/mtd/mtd.h> |
| 28 | #include <linux/mtd/partitions.h> |
| 29 | #include <linux/mtd/physmap.h> |
Marek Vasut | a645072 | 2008-11-20 22:50:46 +0100 | [diff] [blame] | 30 | |
| 31 | #include <asm/mach-types.h> |
| 32 | #include <asm/mach/arch.h> |
| 33 | #include <asm/mach/map.h> |
| 34 | |
Eric Miao | 51c6298 | 2009-01-02 23:17:22 +0800 | [diff] [blame] | 35 | #include <mach/pxa27x.h> |
Marek Vasut | a645072 | 2008-11-20 22:50:46 +0100 | [diff] [blame] | 36 | #include <mach/audio.h> |
| 37 | #include <mach/palmld.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> |
| 42 | #include <linux/platform_data/asoc-palm27x.h> |
Marek Vasut | 31620e2 | 2010-07-13 08:16:45 +0200 | [diff] [blame] | 43 | #include <mach/palm27x.h> |
Marek Vasut | a645072 | 2008-11-20 22:50:46 +0100 | [diff] [blame] | 44 | |
| 45 | #include "generic.h" |
| 46 | #include "devices.h" |
| 47 | |
| 48 | /****************************************************************************** |
| 49 | * Pin configuration |
| 50 | ******************************************************************************/ |
| 51 | static unsigned long palmld_pin_config[] __initdata = { |
| 52 | /* MMC */ |
| 53 | GPIO32_MMC_CLK, |
| 54 | GPIO92_MMC_DAT_0, |
| 55 | GPIO109_MMC_DAT_1, |
| 56 | GPIO110_MMC_DAT_2, |
| 57 | GPIO111_MMC_DAT_3, |
| 58 | GPIO112_MMC_CMD, |
| 59 | GPIO14_GPIO, /* SD detect */ |
| 60 | GPIO114_GPIO, /* SD power */ |
| 61 | GPIO116_GPIO, /* SD r/o switch */ |
| 62 | |
| 63 | /* AC97 */ |
| 64 | GPIO28_AC97_BITCLK, |
| 65 | GPIO29_AC97_SDATA_IN_0, |
| 66 | GPIO30_AC97_SDATA_OUT, |
| 67 | GPIO31_AC97_SYNC, |
Marek Vasut | 6ec04f4 | 2009-05-22 01:39:10 +0200 | [diff] [blame] | 68 | GPIO89_AC97_SYSCLK, |
| 69 | GPIO95_AC97_nRESET, |
Marek Vasut | a645072 | 2008-11-20 22:50:46 +0100 | [diff] [blame] | 70 | |
| 71 | /* IrDA */ |
| 72 | GPIO108_GPIO, /* ir disable */ |
| 73 | GPIO46_FICP_RXD, |
| 74 | GPIO47_FICP_TXD, |
| 75 | |
| 76 | /* MATRIX KEYPAD */ |
Marek Vasut | 81854f8 | 2009-03-28 12:37:42 +0100 | [diff] [blame] | 77 | GPIO100_KP_MKIN_0 | WAKEUP_ON_LEVEL_HIGH, |
| 78 | GPIO101_KP_MKIN_1 | WAKEUP_ON_LEVEL_HIGH, |
| 79 | GPIO102_KP_MKIN_2 | WAKEUP_ON_LEVEL_HIGH, |
| 80 | GPIO97_KP_MKIN_3 | WAKEUP_ON_LEVEL_HIGH, |
Marek Vasut | a645072 | 2008-11-20 22:50:46 +0100 | [diff] [blame] | 81 | GPIO103_KP_MKOUT_0, |
| 82 | GPIO104_KP_MKOUT_1, |
| 83 | GPIO105_KP_MKOUT_2, |
| 84 | |
| 85 | /* LCD */ |
Eric Miao | bedbda9 | 2010-01-04 11:37:14 +0800 | [diff] [blame] | 86 | GPIOxx_LCD_TFT_16BPP, |
Marek Vasut | a645072 | 2008-11-20 22:50:46 +0100 | [diff] [blame] | 87 | |
| 88 | /* PWM */ |
| 89 | GPIO16_PWM0_OUT, |
| 90 | |
| 91 | /* GPIO KEYS */ |
| 92 | GPIO10_GPIO, /* hotsync button */ |
| 93 | GPIO12_GPIO, /* power switch */ |
| 94 | GPIO15_GPIO, /* lock switch */ |
| 95 | |
| 96 | /* LEDs */ |
| 97 | GPIO52_GPIO, /* green led */ |
| 98 | GPIO94_GPIO, /* orange led */ |
| 99 | |
| 100 | /* PCMCIA */ |
| 101 | GPIO48_nPOE, |
| 102 | GPIO49_nPWE, |
| 103 | GPIO50_nPIOR, |
| 104 | GPIO51_nPIOW, |
| 105 | GPIO85_nPCE_1, |
| 106 | GPIO54_nPCE_2, |
| 107 | GPIO79_PSKTSEL, |
| 108 | GPIO55_nPREG, |
| 109 | GPIO56_nPWAIT, |
| 110 | GPIO57_nIOIS16, |
| 111 | GPIO36_GPIO, /* wifi power */ |
| 112 | GPIO38_GPIO, /* wifi ready */ |
| 113 | GPIO81_GPIO, /* wifi reset */ |
| 114 | |
Marek Vasut | ecf763c | 2009-07-16 19:37:29 +0200 | [diff] [blame] | 115 | /* FFUART */ |
| 116 | GPIO34_FFUART_RXD, |
| 117 | GPIO39_FFUART_TXD, |
| 118 | |
Marek Vasut | a645072 | 2008-11-20 22:50:46 +0100 | [diff] [blame] | 119 | /* HDD */ |
Marek Vašut | 5a9d251 | 2009-05-21 13:11:05 +0100 | [diff] [blame] | 120 | GPIO98_GPIO, /* HDD reset */ |
Marek Vasut | a645072 | 2008-11-20 22:50:46 +0100 | [diff] [blame] | 121 | GPIO115_GPIO, /* HDD power */ |
| 122 | |
| 123 | /* MISC */ |
| 124 | GPIO13_GPIO, /* earphone detect */ |
| 125 | }; |
| 126 | |
| 127 | /****************************************************************************** |
Marek Vasut | d7c307c | 2009-07-17 19:46:58 +0200 | [diff] [blame] | 128 | * NOR Flash |
| 129 | ******************************************************************************/ |
Marek Vasut | 31620e2 | 2010-07-13 08:16:45 +0200 | [diff] [blame] | 130 | #if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE) |
Marek Vasut | d7c307c | 2009-07-17 19:46:58 +0200 | [diff] [blame] | 131 | static struct mtd_partition palmld_partitions[] = { |
| 132 | { |
| 133 | .name = "Flash", |
| 134 | .offset = 0x00000000, |
| 135 | .size = MTDPART_SIZ_FULL, |
| 136 | .mask_flags = 0 |
| 137 | } |
| 138 | }; |
| 139 | |
| 140 | static struct physmap_flash_data palmld_flash_data[] = { |
| 141 | { |
| 142 | .width = 2, /* bankwidth in bytes */ |
| 143 | .parts = palmld_partitions, |
| 144 | .nr_parts = ARRAY_SIZE(palmld_partitions) |
| 145 | } |
| 146 | }; |
| 147 | |
| 148 | static struct resource palmld_flash_resource = { |
| 149 | .start = PXA_CS0_PHYS, |
| 150 | .end = PXA_CS0_PHYS + SZ_4M - 1, |
| 151 | .flags = IORESOURCE_MEM, |
| 152 | }; |
| 153 | |
| 154 | static struct platform_device palmld_flash = { |
| 155 | .name = "physmap-flash", |
| 156 | .id = 0, |
| 157 | .resource = &palmld_flash_resource, |
| 158 | .num_resources = 1, |
| 159 | .dev = { |
| 160 | .platform_data = palmld_flash_data, |
| 161 | }, |
| 162 | }; |
| 163 | |
Marek Vasut | 31620e2 | 2010-07-13 08:16:45 +0200 | [diff] [blame] | 164 | static void __init palmld_nor_init(void) |
| 165 | { |
| 166 | platform_device_register(&palmld_flash); |
| 167 | } |
| 168 | #else |
| 169 | static inline void palmld_nor_init(void) {} |
| 170 | #endif |
Marek Vasut | a645072 | 2008-11-20 22:50:46 +0100 | [diff] [blame] | 171 | |
| 172 | /****************************************************************************** |
| 173 | * GPIO keyboard |
| 174 | ******************************************************************************/ |
Marek Vasut | 31620e2 | 2010-07-13 08:16:45 +0200 | [diff] [blame] | 175 | #if defined(CONFIG_KEYBOARD_PXA27x) || defined(CONFIG_KEYBOARD_PXA27x_MODULE) |
Chao Xie | 0a085a9 | 2013-05-05 20:24:58 -0700 | [diff] [blame] | 176 | static const unsigned int palmld_matrix_keys[] = { |
Marek Vasut | a645072 | 2008-11-20 22:50:46 +0100 | [diff] [blame] | 177 | KEY(0, 1, KEY_F2), |
| 178 | KEY(0, 2, KEY_UP), |
| 179 | |
| 180 | KEY(1, 0, KEY_F3), |
| 181 | KEY(1, 1, KEY_F4), |
| 182 | KEY(1, 2, KEY_RIGHT), |
| 183 | |
| 184 | KEY(2, 0, KEY_F1), |
| 185 | KEY(2, 1, KEY_F5), |
| 186 | KEY(2, 2, KEY_DOWN), |
| 187 | |
| 188 | KEY(3, 0, KEY_F6), |
| 189 | KEY(3, 1, KEY_ENTER), |
| 190 | KEY(3, 2, KEY_LEFT), |
| 191 | }; |
| 192 | |
Chao Xie | 0a085a9 | 2013-05-05 20:24:58 -0700 | [diff] [blame] | 193 | static struct matrix_keymap_data palmld_matrix_keymap_data = { |
| 194 | .keymap = palmld_matrix_keys, |
| 195 | .keymap_size = ARRAY_SIZE(palmld_matrix_keys), |
| 196 | }; |
| 197 | |
Marek Vasut | a645072 | 2008-11-20 22:50:46 +0100 | [diff] [blame] | 198 | static struct pxa27x_keypad_platform_data palmld_keypad_platform_data = { |
| 199 | .matrix_key_rows = 4, |
| 200 | .matrix_key_cols = 3, |
Chao Xie | 0a085a9 | 2013-05-05 20:24:58 -0700 | [diff] [blame] | 201 | .matrix_keymap_data = &palmld_matrix_keymap_data, |
Marek Vasut | a645072 | 2008-11-20 22:50:46 +0100 | [diff] [blame] | 202 | |
| 203 | .debounce_interval = 30, |
| 204 | }; |
| 205 | |
Marek Vasut | 31620e2 | 2010-07-13 08:16:45 +0200 | [diff] [blame] | 206 | static void __init palmld_kpc_init(void) |
| 207 | { |
| 208 | pxa_set_keypad_info(&palmld_keypad_platform_data); |
| 209 | } |
| 210 | #else |
| 211 | static inline void palmld_kpc_init(void) {} |
| 212 | #endif |
| 213 | |
Marek Vasut | a645072 | 2008-11-20 22:50:46 +0100 | [diff] [blame] | 214 | /****************************************************************************** |
| 215 | * GPIO keys |
| 216 | ******************************************************************************/ |
Marek Vasut | 31620e2 | 2010-07-13 08:16:45 +0200 | [diff] [blame] | 217 | #if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE) |
Marek Vasut | a645072 | 2008-11-20 22:50:46 +0100 | [diff] [blame] | 218 | static struct gpio_keys_button palmld_pxa_buttons[] = { |
| 219 | {KEY_F8, GPIO_NR_PALMLD_HOTSYNC_BUTTON_N, 1, "HotSync Button" }, |
| 220 | {KEY_F9, GPIO_NR_PALMLD_LOCK_SWITCH, 0, "Lock Switch" }, |
| 221 | {KEY_POWER, GPIO_NR_PALMLD_POWER_SWITCH, 0, "Power Switch" }, |
| 222 | }; |
| 223 | |
| 224 | static struct gpio_keys_platform_data palmld_pxa_keys_data = { |
| 225 | .buttons = palmld_pxa_buttons, |
| 226 | .nbuttons = ARRAY_SIZE(palmld_pxa_buttons), |
| 227 | }; |
| 228 | |
| 229 | static struct platform_device palmld_pxa_keys = { |
| 230 | .name = "gpio-keys", |
| 231 | .id = -1, |
| 232 | .dev = { |
| 233 | .platform_data = &palmld_pxa_keys_data, |
| 234 | }, |
| 235 | }; |
| 236 | |
Marek Vasut | 31620e2 | 2010-07-13 08:16:45 +0200 | [diff] [blame] | 237 | static void __init palmld_keys_init(void) |
Marek Vasut | a645072 | 2008-11-20 22:50:46 +0100 | [diff] [blame] | 238 | { |
Marek Vasut | 31620e2 | 2010-07-13 08:16:45 +0200 | [diff] [blame] | 239 | platform_device_register(&palmld_pxa_keys); |
Marek Vasut | a645072 | 2008-11-20 22:50:46 +0100 | [diff] [blame] | 240 | } |
Marek Vasut | 31620e2 | 2010-07-13 08:16:45 +0200 | [diff] [blame] | 241 | #else |
| 242 | static inline void palmld_keys_init(void) {} |
| 243 | #endif |
Marek Vasut | a645072 | 2008-11-20 22:50:46 +0100 | [diff] [blame] | 244 | |
| 245 | /****************************************************************************** |
| 246 | * LEDs |
| 247 | ******************************************************************************/ |
Marek Vasut | 31620e2 | 2010-07-13 08:16:45 +0200 | [diff] [blame] | 248 | #if defined(CONFIG_LEDS_GPIO) || defined(CONFIG_LEDS_GPIO_MODULE) |
Marek Vasut | a645072 | 2008-11-20 22:50:46 +0100 | [diff] [blame] | 249 | struct gpio_led gpio_leds[] = { |
| 250 | { |
| 251 | .name = "palmld:green:led", |
| 252 | .default_trigger = "none", |
| 253 | .gpio = GPIO_NR_PALMLD_LED_GREEN, |
| 254 | }, { |
| 255 | .name = "palmld:amber:led", |
| 256 | .default_trigger = "none", |
| 257 | .gpio = GPIO_NR_PALMLD_LED_AMBER, |
| 258 | }, |
| 259 | }; |
| 260 | |
| 261 | static struct gpio_led_platform_data gpio_led_info = { |
| 262 | .leds = gpio_leds, |
| 263 | .num_leds = ARRAY_SIZE(gpio_leds), |
| 264 | }; |
| 265 | |
| 266 | static struct platform_device palmld_leds = { |
| 267 | .name = "leds-gpio", |
| 268 | .id = -1, |
| 269 | .dev = { |
| 270 | .platform_data = &gpio_led_info, |
| 271 | } |
| 272 | }; |
| 273 | |
Marek Vasut | 31620e2 | 2010-07-13 08:16:45 +0200 | [diff] [blame] | 274 | static void __init palmld_leds_init(void) |
Marek Vasut | a645072 | 2008-11-20 22:50:46 +0100 | [diff] [blame] | 275 | { |
Marek Vasut | 31620e2 | 2010-07-13 08:16:45 +0200 | [diff] [blame] | 276 | platform_device_register(&palmld_leds); |
Marek Vasut | a645072 | 2008-11-20 22:50:46 +0100 | [diff] [blame] | 277 | } |
Marek Vasut | 31620e2 | 2010-07-13 08:16:45 +0200 | [diff] [blame] | 278 | #else |
| 279 | static inline void palmld_leds_init(void) {} |
| 280 | #endif |
Marek Vasut | e91fb91 | 2009-04-17 11:37:35 +0200 | [diff] [blame] | 281 | |
Marek Vasut | a645072 | 2008-11-20 22:50:46 +0100 | [diff] [blame] | 282 | /****************************************************************************** |
Marek Vašut | 5a9d251 | 2009-05-21 13:11:05 +0100 | [diff] [blame] | 283 | * HDD |
| 284 | ******************************************************************************/ |
Marek Vasut | 31620e2 | 2010-07-13 08:16:45 +0200 | [diff] [blame] | 285 | #if defined(CONFIG_PATA_PALMLD) || defined(CONFIG_PATA_PALMLD_MODULE) |
| 286 | static struct platform_device palmld_ide_device = { |
Marek Vašut | 5a9d251 | 2009-05-21 13:11:05 +0100 | [diff] [blame] | 287 | .name = "pata_palmld", |
| 288 | .id = -1, |
| 289 | }; |
| 290 | |
Marek Vasut | 31620e2 | 2010-07-13 08:16:45 +0200 | [diff] [blame] | 291 | static void __init palmld_ide_init(void) |
Marek Vasut | a645072 | 2008-11-20 22:50:46 +0100 | [diff] [blame] | 292 | { |
Marek Vasut | 31620e2 | 2010-07-13 08:16:45 +0200 | [diff] [blame] | 293 | platform_device_register(&palmld_ide_device); |
Marek Vasut | 81854f8 | 2009-03-28 12:37:42 +0100 | [diff] [blame] | 294 | } |
Marek Vasut | 31620e2 | 2010-07-13 08:16:45 +0200 | [diff] [blame] | 295 | #else |
| 296 | static inline void palmld_ide_init(void) {} |
| 297 | #endif |
Marek Vasut | 81854f8 | 2009-03-28 12:37:42 +0100 | [diff] [blame] | 298 | |
Marek Vasut | 81854f8 | 2009-03-28 12:37:42 +0100 | [diff] [blame] | 299 | /****************************************************************************** |
Marek Vasut | a645072 | 2008-11-20 22:50:46 +0100 | [diff] [blame] | 300 | * Machine init |
| 301 | ******************************************************************************/ |
Marek Vasut | a645072 | 2008-11-20 22:50:46 +0100 | [diff] [blame] | 302 | static struct map_desc palmld_io_desc[] __initdata = { |
| 303 | { |
| 304 | .virtual = PALMLD_IDE_VIRT, |
| 305 | .pfn = __phys_to_pfn(PALMLD_IDE_PHYS), |
| 306 | .length = PALMLD_IDE_SIZE, |
| 307 | .type = MT_DEVICE |
| 308 | }, |
| 309 | { |
| 310 | .virtual = PALMLD_USB_VIRT, |
| 311 | .pfn = __phys_to_pfn(PALMLD_USB_PHYS), |
| 312 | .length = PALMLD_USB_SIZE, |
| 313 | .type = MT_DEVICE |
| 314 | }, |
| 315 | }; |
| 316 | |
| 317 | static void __init palmld_map_io(void) |
| 318 | { |
Marek Vasut | 851982c | 2010-10-11 02:20:19 +0200 | [diff] [blame] | 319 | pxa27x_map_io(); |
Marek Vasut | a645072 | 2008-11-20 22:50:46 +0100 | [diff] [blame] | 320 | iotable_init(palmld_io_desc, ARRAY_SIZE(palmld_io_desc)); |
| 321 | } |
| 322 | |
| 323 | static void __init palmld_init(void) |
| 324 | { |
| 325 | pxa2xx_mfp_config(ARRAY_AND_SIZE(palmld_pin_config)); |
Russell King | cc155c6 | 2009-11-09 13:34:08 +0800 | [diff] [blame] | 326 | pxa_set_ffuart_info(NULL); |
| 327 | pxa_set_btuart_info(NULL); |
| 328 | pxa_set_stuart_info(NULL); |
| 329 | |
Marek Vasut | 31620e2 | 2010-07-13 08:16:45 +0200 | [diff] [blame] | 330 | palm27x_mmc_init(GPIO_NR_PALMLD_SD_DETECT_N, GPIO_NR_PALMLD_SD_READONLY, |
| 331 | GPIO_NR_PALMLD_SD_POWER, 0); |
| 332 | palm27x_pm_init(PALMLD_STR_BASE); |
| 333 | palm27x_lcd_init(-1, &palm_320x480_lcd_mode); |
| 334 | palm27x_irda_init(GPIO_NR_PALMLD_IR_DISABLE); |
| 335 | palm27x_ac97_init(PALMLD_BAT_MIN_VOLTAGE, PALMLD_BAT_MAX_VOLTAGE, |
| 336 | GPIO_NR_PALMLD_EARPHONE_DETECT, 95); |
| 337 | palm27x_pwm_init(GPIO_NR_PALMLD_BL_POWER, GPIO_NR_PALMLD_LCD_POWER); |
| 338 | palm27x_power_init(GPIO_NR_PALMLD_POWER_DETECT, |
| 339 | GPIO_NR_PALMLD_USB_DETECT_N); |
| 340 | palm27x_pmic_init(); |
| 341 | palmld_kpc_init(); |
| 342 | palmld_keys_init(); |
| 343 | palmld_nor_init(); |
| 344 | palmld_leds_init(); |
| 345 | palmld_ide_init(); |
Marek Vasut | a645072 | 2008-11-20 22:50:46 +0100 | [diff] [blame] | 346 | } |
| 347 | |
| 348 | MACHINE_START(PALMLD, "Palm LifeDrive") |
Nicolas Pitre | 7375aba | 2011-07-05 22:38:15 -0400 | [diff] [blame] | 349 | .atag_offset = 0x100, |
Marek Vasut | a645072 | 2008-11-20 22:50:46 +0100 | [diff] [blame] | 350 | .map_io = palmld_map_io, |
Rob Herring | 4e61109 | 2012-01-03 16:53:48 -0600 | [diff] [blame] | 351 | .nr_irqs = PXA_NR_IRQS, |
Marek Vasut | a645072 | 2008-11-20 22:50:46 +0100 | [diff] [blame] | 352 | .init_irq = pxa27x_init_irq, |
Eric Miao | 8a97ae2 | 2011-05-18 21:30:04 +0800 | [diff] [blame] | 353 | .handle_irq = pxa27x_handle_irq, |
Stephen Warren | 6bb27d7 | 2012-11-08 12:40:59 -0700 | [diff] [blame] | 354 | .init_time = pxa_timer_init, |
Russell King | 271a74f | 2011-11-04 14:15:53 +0000 | [diff] [blame] | 355 | .init_machine = palmld_init, |
| 356 | .restart = pxa_restart, |
Marek Vasut | a645072 | 2008-11-20 22:50:46 +0100 | [diff] [blame] | 357 | MACHINE_END |