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