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> |
| 25 | #include <linux/wm97xx_batt.h> |
| 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 | a645072 | 2008-11-20 22:50:46 +0100 | [diff] [blame] | 28 | |
| 29 | #include <asm/mach-types.h> |
| 30 | #include <asm/mach/arch.h> |
| 31 | #include <asm/mach/map.h> |
| 32 | |
Eric Miao | 51c6298 | 2009-01-02 23:17:22 +0800 | [diff] [blame] | 33 | #include <mach/pxa27x.h> |
Marek Vasut | a645072 | 2008-11-20 22:50:46 +0100 | [diff] [blame] | 34 | #include <mach/audio.h> |
| 35 | #include <mach/palmld.h> |
| 36 | #include <mach/mmc.h> |
| 37 | #include <mach/pxafb.h> |
Marek Vasut | a645072 | 2008-11-20 22:50:46 +0100 | [diff] [blame] | 38 | #include <mach/irda.h> |
| 39 | #include <mach/pxa27x_keypad.h> |
| 40 | #include <mach/palmasoc.h> |
| 41 | |
| 42 | #include "generic.h" |
| 43 | #include "devices.h" |
| 44 | |
| 45 | /****************************************************************************** |
| 46 | * Pin configuration |
| 47 | ******************************************************************************/ |
| 48 | static unsigned long palmld_pin_config[] __initdata = { |
| 49 | /* MMC */ |
| 50 | GPIO32_MMC_CLK, |
| 51 | GPIO92_MMC_DAT_0, |
| 52 | GPIO109_MMC_DAT_1, |
| 53 | GPIO110_MMC_DAT_2, |
| 54 | GPIO111_MMC_DAT_3, |
| 55 | GPIO112_MMC_CMD, |
| 56 | GPIO14_GPIO, /* SD detect */ |
| 57 | GPIO114_GPIO, /* SD power */ |
| 58 | GPIO116_GPIO, /* SD r/o switch */ |
| 59 | |
| 60 | /* AC97 */ |
| 61 | GPIO28_AC97_BITCLK, |
| 62 | GPIO29_AC97_SDATA_IN_0, |
| 63 | GPIO30_AC97_SDATA_OUT, |
| 64 | GPIO31_AC97_SYNC, |
Marek Vasut | 6ec04f4 | 2009-05-22 01:39:10 +0200 | [diff] [blame] | 65 | GPIO89_AC97_SYSCLK, |
| 66 | GPIO95_AC97_nRESET, |
Marek Vasut | a645072 | 2008-11-20 22:50:46 +0100 | [diff] [blame] | 67 | |
| 68 | /* IrDA */ |
| 69 | GPIO108_GPIO, /* ir disable */ |
| 70 | GPIO46_FICP_RXD, |
| 71 | GPIO47_FICP_TXD, |
| 72 | |
| 73 | /* MATRIX KEYPAD */ |
Marek Vasut | 81854f8 | 2009-03-28 12:37:42 +0100 | [diff] [blame] | 74 | GPIO100_KP_MKIN_0 | WAKEUP_ON_LEVEL_HIGH, |
| 75 | GPIO101_KP_MKIN_1 | WAKEUP_ON_LEVEL_HIGH, |
| 76 | GPIO102_KP_MKIN_2 | WAKEUP_ON_LEVEL_HIGH, |
| 77 | GPIO97_KP_MKIN_3 | WAKEUP_ON_LEVEL_HIGH, |
Marek Vasut | a645072 | 2008-11-20 22:50:46 +0100 | [diff] [blame] | 78 | GPIO103_KP_MKOUT_0, |
| 79 | GPIO104_KP_MKOUT_1, |
| 80 | GPIO105_KP_MKOUT_2, |
| 81 | |
| 82 | /* LCD */ |
| 83 | GPIO58_LCD_LDD_0, |
| 84 | GPIO59_LCD_LDD_1, |
| 85 | GPIO60_LCD_LDD_2, |
| 86 | GPIO61_LCD_LDD_3, |
| 87 | GPIO62_LCD_LDD_4, |
| 88 | GPIO63_LCD_LDD_5, |
| 89 | GPIO64_LCD_LDD_6, |
| 90 | GPIO65_LCD_LDD_7, |
| 91 | GPIO66_LCD_LDD_8, |
| 92 | GPIO67_LCD_LDD_9, |
| 93 | GPIO68_LCD_LDD_10, |
| 94 | GPIO69_LCD_LDD_11, |
| 95 | GPIO70_LCD_LDD_12, |
| 96 | GPIO71_LCD_LDD_13, |
| 97 | GPIO72_LCD_LDD_14, |
| 98 | GPIO73_LCD_LDD_15, |
| 99 | GPIO74_LCD_FCLK, |
| 100 | GPIO75_LCD_LCLK, |
| 101 | GPIO76_LCD_PCLK, |
| 102 | GPIO77_LCD_BIAS, |
| 103 | |
| 104 | /* PWM */ |
| 105 | GPIO16_PWM0_OUT, |
| 106 | |
| 107 | /* GPIO KEYS */ |
| 108 | GPIO10_GPIO, /* hotsync button */ |
| 109 | GPIO12_GPIO, /* power switch */ |
| 110 | GPIO15_GPIO, /* lock switch */ |
| 111 | |
| 112 | /* LEDs */ |
| 113 | GPIO52_GPIO, /* green led */ |
| 114 | GPIO94_GPIO, /* orange led */ |
| 115 | |
| 116 | /* PCMCIA */ |
| 117 | GPIO48_nPOE, |
| 118 | GPIO49_nPWE, |
| 119 | GPIO50_nPIOR, |
| 120 | GPIO51_nPIOW, |
| 121 | GPIO85_nPCE_1, |
| 122 | GPIO54_nPCE_2, |
| 123 | GPIO79_PSKTSEL, |
| 124 | GPIO55_nPREG, |
| 125 | GPIO56_nPWAIT, |
| 126 | GPIO57_nIOIS16, |
| 127 | GPIO36_GPIO, /* wifi power */ |
| 128 | GPIO38_GPIO, /* wifi ready */ |
| 129 | GPIO81_GPIO, /* wifi reset */ |
| 130 | |
Marek Vasut | ecf763c | 2009-07-16 19:37:29 +0200 | [diff] [blame^] | 131 | /* FFUART */ |
| 132 | GPIO34_FFUART_RXD, |
| 133 | GPIO39_FFUART_TXD, |
| 134 | |
Marek Vasut | a645072 | 2008-11-20 22:50:46 +0100 | [diff] [blame] | 135 | /* HDD */ |
Marek Vašut | 5a9d251 | 2009-05-21 13:11:05 +0100 | [diff] [blame] | 136 | GPIO98_GPIO, /* HDD reset */ |
Marek Vasut | a645072 | 2008-11-20 22:50:46 +0100 | [diff] [blame] | 137 | GPIO115_GPIO, /* HDD power */ |
| 138 | |
| 139 | /* MISC */ |
| 140 | GPIO13_GPIO, /* earphone detect */ |
| 141 | }; |
| 142 | |
| 143 | /****************************************************************************** |
| 144 | * SD/MMC card controller |
| 145 | ******************************************************************************/ |
| 146 | static int palmld_mci_init(struct device *dev, irq_handler_t palmld_detect_int, |
| 147 | void *data) |
| 148 | { |
| 149 | int err = 0; |
| 150 | |
| 151 | /* Setup an interrupt for detecting card insert/remove events */ |
| 152 | err = gpio_request(GPIO_NR_PALMLD_SD_DETECT_N, "SD IRQ"); |
| 153 | if (err) |
| 154 | goto err; |
| 155 | err = gpio_direction_input(GPIO_NR_PALMLD_SD_DETECT_N); |
| 156 | if (err) |
| 157 | goto err2; |
| 158 | err = request_irq(gpio_to_irq(GPIO_NR_PALMLD_SD_DETECT_N), |
| 159 | palmld_detect_int, IRQF_DISABLED | IRQF_SAMPLE_RANDOM | |
| 160 | IRQF_TRIGGER_FALLING | IRQF_TRIGGER_RISING, |
| 161 | "SD/MMC card detect", data); |
| 162 | if (err) { |
| 163 | printk(KERN_ERR "%s: cannot request SD/MMC card detect IRQ\n", |
| 164 | __func__); |
| 165 | goto err2; |
| 166 | } |
| 167 | |
| 168 | err = gpio_request(GPIO_NR_PALMLD_SD_POWER, "SD_POWER"); |
| 169 | if (err) |
| 170 | goto err3; |
| 171 | err = gpio_direction_output(GPIO_NR_PALMLD_SD_POWER, 0); |
| 172 | if (err) |
| 173 | goto err4; |
| 174 | |
| 175 | err = gpio_request(GPIO_NR_PALMLD_SD_READONLY, "SD_READONLY"); |
| 176 | if (err) |
| 177 | goto err4; |
| 178 | err = gpio_direction_input(GPIO_NR_PALMLD_SD_READONLY); |
| 179 | if (err) |
| 180 | goto err5; |
| 181 | |
| 182 | printk(KERN_DEBUG "%s: irq registered\n", __func__); |
| 183 | |
| 184 | return 0; |
| 185 | |
| 186 | err5: |
| 187 | gpio_free(GPIO_NR_PALMLD_SD_READONLY); |
| 188 | err4: |
| 189 | gpio_free(GPIO_NR_PALMLD_SD_POWER); |
| 190 | err3: |
| 191 | free_irq(gpio_to_irq(GPIO_NR_PALMLD_SD_DETECT_N), data); |
| 192 | err2: |
| 193 | gpio_free(GPIO_NR_PALMLD_SD_DETECT_N); |
| 194 | err: |
| 195 | return err; |
| 196 | } |
| 197 | |
| 198 | static void palmld_mci_exit(struct device *dev, void *data) |
| 199 | { |
| 200 | gpio_free(GPIO_NR_PALMLD_SD_READONLY); |
| 201 | gpio_free(GPIO_NR_PALMLD_SD_POWER); |
| 202 | free_irq(gpio_to_irq(GPIO_NR_PALMLD_SD_DETECT_N), data); |
| 203 | gpio_free(GPIO_NR_PALMLD_SD_DETECT_N); |
| 204 | } |
| 205 | |
| 206 | static void palmld_mci_power(struct device *dev, unsigned int vdd) |
| 207 | { |
| 208 | struct pxamci_platform_data *p_d = dev->platform_data; |
| 209 | gpio_set_value(GPIO_NR_PALMLD_SD_POWER, p_d->ocr_mask & (1 << vdd)); |
| 210 | } |
| 211 | |
| 212 | static int palmld_mci_get_ro(struct device *dev) |
| 213 | { |
| 214 | return gpio_get_value(GPIO_NR_PALMLD_SD_READONLY); |
| 215 | } |
| 216 | |
| 217 | static struct pxamci_platform_data palmld_mci_platform_data = { |
| 218 | .ocr_mask = MMC_VDD_32_33 | MMC_VDD_33_34, |
| 219 | .setpower = palmld_mci_power, |
| 220 | .get_ro = palmld_mci_get_ro, |
| 221 | .init = palmld_mci_init, |
| 222 | .exit = palmld_mci_exit, |
| 223 | }; |
| 224 | |
| 225 | /****************************************************************************** |
| 226 | * GPIO keyboard |
| 227 | ******************************************************************************/ |
| 228 | static unsigned int palmld_matrix_keys[] = { |
| 229 | KEY(0, 1, KEY_F2), |
| 230 | KEY(0, 2, KEY_UP), |
| 231 | |
| 232 | KEY(1, 0, KEY_F3), |
| 233 | KEY(1, 1, KEY_F4), |
| 234 | KEY(1, 2, KEY_RIGHT), |
| 235 | |
| 236 | KEY(2, 0, KEY_F1), |
| 237 | KEY(2, 1, KEY_F5), |
| 238 | KEY(2, 2, KEY_DOWN), |
| 239 | |
| 240 | KEY(3, 0, KEY_F6), |
| 241 | KEY(3, 1, KEY_ENTER), |
| 242 | KEY(3, 2, KEY_LEFT), |
| 243 | }; |
| 244 | |
| 245 | static struct pxa27x_keypad_platform_data palmld_keypad_platform_data = { |
| 246 | .matrix_key_rows = 4, |
| 247 | .matrix_key_cols = 3, |
| 248 | .matrix_key_map = palmld_matrix_keys, |
| 249 | .matrix_key_map_size = ARRAY_SIZE(palmld_matrix_keys), |
| 250 | |
| 251 | .debounce_interval = 30, |
| 252 | }; |
| 253 | |
| 254 | /****************************************************************************** |
| 255 | * GPIO keys |
| 256 | ******************************************************************************/ |
| 257 | static struct gpio_keys_button palmld_pxa_buttons[] = { |
| 258 | {KEY_F8, GPIO_NR_PALMLD_HOTSYNC_BUTTON_N, 1, "HotSync Button" }, |
| 259 | {KEY_F9, GPIO_NR_PALMLD_LOCK_SWITCH, 0, "Lock Switch" }, |
| 260 | {KEY_POWER, GPIO_NR_PALMLD_POWER_SWITCH, 0, "Power Switch" }, |
| 261 | }; |
| 262 | |
| 263 | static struct gpio_keys_platform_data palmld_pxa_keys_data = { |
| 264 | .buttons = palmld_pxa_buttons, |
| 265 | .nbuttons = ARRAY_SIZE(palmld_pxa_buttons), |
| 266 | }; |
| 267 | |
| 268 | static struct platform_device palmld_pxa_keys = { |
| 269 | .name = "gpio-keys", |
| 270 | .id = -1, |
| 271 | .dev = { |
| 272 | .platform_data = &palmld_pxa_keys_data, |
| 273 | }, |
| 274 | }; |
| 275 | |
| 276 | /****************************************************************************** |
| 277 | * Backlight |
| 278 | ******************************************************************************/ |
| 279 | static int palmld_backlight_init(struct device *dev) |
| 280 | { |
| 281 | int ret; |
| 282 | |
| 283 | ret = gpio_request(GPIO_NR_PALMLD_BL_POWER, "BL POWER"); |
| 284 | if (ret) |
| 285 | goto err; |
| 286 | ret = gpio_direction_output(GPIO_NR_PALMLD_BL_POWER, 0); |
| 287 | if (ret) |
| 288 | goto err2; |
| 289 | ret = gpio_request(GPIO_NR_PALMLD_LCD_POWER, "LCD POWER"); |
| 290 | if (ret) |
| 291 | goto err2; |
| 292 | ret = gpio_direction_output(GPIO_NR_PALMLD_LCD_POWER, 0); |
| 293 | if (ret) |
| 294 | goto err3; |
| 295 | |
| 296 | return 0; |
| 297 | err3: |
| 298 | gpio_free(GPIO_NR_PALMLD_LCD_POWER); |
| 299 | err2: |
| 300 | gpio_free(GPIO_NR_PALMLD_BL_POWER); |
| 301 | err: |
| 302 | return ret; |
| 303 | } |
| 304 | |
| 305 | static int palmld_backlight_notify(int brightness) |
| 306 | { |
| 307 | gpio_set_value(GPIO_NR_PALMLD_BL_POWER, brightness); |
| 308 | gpio_set_value(GPIO_NR_PALMLD_LCD_POWER, brightness); |
| 309 | return brightness; |
| 310 | } |
| 311 | |
| 312 | static void palmld_backlight_exit(struct device *dev) |
| 313 | { |
| 314 | gpio_free(GPIO_NR_PALMLD_BL_POWER); |
| 315 | gpio_free(GPIO_NR_PALMLD_LCD_POWER); |
| 316 | } |
| 317 | |
| 318 | static struct platform_pwm_backlight_data palmld_backlight_data = { |
| 319 | .pwm_id = 0, |
| 320 | .max_brightness = PALMLD_MAX_INTENSITY, |
| 321 | .dft_brightness = PALMLD_MAX_INTENSITY, |
| 322 | .pwm_period_ns = PALMLD_PERIOD_NS, |
| 323 | .init = palmld_backlight_init, |
| 324 | .notify = palmld_backlight_notify, |
| 325 | .exit = palmld_backlight_exit, |
| 326 | }; |
| 327 | |
| 328 | static struct platform_device palmld_backlight = { |
| 329 | .name = "pwm-backlight", |
| 330 | .dev = { |
| 331 | .parent = &pxa27x_device_pwm0.dev, |
| 332 | .platform_data = &palmld_backlight_data, |
| 333 | }, |
| 334 | }; |
| 335 | |
| 336 | /****************************************************************************** |
| 337 | * IrDA |
| 338 | ******************************************************************************/ |
| 339 | static int palmld_irda_startup(struct device *dev) |
| 340 | { |
| 341 | int err; |
| 342 | err = gpio_request(GPIO_NR_PALMLD_IR_DISABLE, "IR DISABLE"); |
| 343 | if (err) |
| 344 | goto err; |
| 345 | err = gpio_direction_output(GPIO_NR_PALMLD_IR_DISABLE, 1); |
| 346 | if (err) |
| 347 | gpio_free(GPIO_NR_PALMLD_IR_DISABLE); |
| 348 | err: |
| 349 | return err; |
| 350 | } |
| 351 | |
| 352 | static void palmld_irda_shutdown(struct device *dev) |
| 353 | { |
| 354 | gpio_free(GPIO_NR_PALMLD_IR_DISABLE); |
| 355 | } |
| 356 | |
| 357 | static void palmld_irda_transceiver_mode(struct device *dev, int mode) |
| 358 | { |
| 359 | gpio_set_value(GPIO_NR_PALMLD_IR_DISABLE, mode & IR_OFF); |
| 360 | pxa2xx_transceiver_mode(dev, mode); |
| 361 | } |
| 362 | |
| 363 | static struct pxaficp_platform_data palmld_ficp_platform_data = { |
| 364 | .startup = palmld_irda_startup, |
| 365 | .shutdown = palmld_irda_shutdown, |
| 366 | .transceiver_cap = IR_SIRMODE | IR_FIRMODE | IR_OFF, |
| 367 | .transceiver_mode = palmld_irda_transceiver_mode, |
| 368 | }; |
| 369 | |
| 370 | /****************************************************************************** |
| 371 | * LEDs |
| 372 | ******************************************************************************/ |
| 373 | struct gpio_led gpio_leds[] = { |
| 374 | { |
| 375 | .name = "palmld:green:led", |
| 376 | .default_trigger = "none", |
| 377 | .gpio = GPIO_NR_PALMLD_LED_GREEN, |
| 378 | }, { |
| 379 | .name = "palmld:amber:led", |
| 380 | .default_trigger = "none", |
| 381 | .gpio = GPIO_NR_PALMLD_LED_AMBER, |
| 382 | }, |
| 383 | }; |
| 384 | |
| 385 | static struct gpio_led_platform_data gpio_led_info = { |
| 386 | .leds = gpio_leds, |
| 387 | .num_leds = ARRAY_SIZE(gpio_leds), |
| 388 | }; |
| 389 | |
| 390 | static struct platform_device palmld_leds = { |
| 391 | .name = "leds-gpio", |
| 392 | .id = -1, |
| 393 | .dev = { |
| 394 | .platform_data = &gpio_led_info, |
| 395 | } |
| 396 | }; |
| 397 | |
| 398 | /****************************************************************************** |
| 399 | * Power supply |
| 400 | ******************************************************************************/ |
| 401 | static int power_supply_init(struct device *dev) |
| 402 | { |
| 403 | int ret; |
| 404 | |
| 405 | ret = gpio_request(GPIO_NR_PALMLD_POWER_DETECT, "CABLE_STATE_AC"); |
| 406 | if (ret) |
| 407 | goto err1; |
| 408 | ret = gpio_direction_input(GPIO_NR_PALMLD_POWER_DETECT); |
| 409 | if (ret) |
| 410 | goto err2; |
| 411 | |
| 412 | ret = gpio_request(GPIO_NR_PALMLD_USB_DETECT_N, "CABLE_STATE_USB"); |
| 413 | if (ret) |
| 414 | goto err2; |
| 415 | ret = gpio_direction_input(GPIO_NR_PALMLD_USB_DETECT_N); |
| 416 | if (ret) |
| 417 | goto err3; |
| 418 | |
| 419 | return 0; |
| 420 | |
| 421 | err3: |
| 422 | gpio_free(GPIO_NR_PALMLD_USB_DETECT_N); |
| 423 | err2: |
| 424 | gpio_free(GPIO_NR_PALMLD_POWER_DETECT); |
| 425 | err1: |
| 426 | return ret; |
| 427 | } |
| 428 | |
| 429 | static int palmld_is_ac_online(void) |
| 430 | { |
| 431 | return gpio_get_value(GPIO_NR_PALMLD_POWER_DETECT); |
| 432 | } |
| 433 | |
| 434 | static int palmld_is_usb_online(void) |
| 435 | { |
| 436 | return !gpio_get_value(GPIO_NR_PALMLD_USB_DETECT_N); |
| 437 | } |
| 438 | |
| 439 | static void power_supply_exit(struct device *dev) |
| 440 | { |
| 441 | gpio_free(GPIO_NR_PALMLD_USB_DETECT_N); |
| 442 | gpio_free(GPIO_NR_PALMLD_POWER_DETECT); |
| 443 | } |
| 444 | |
| 445 | static char *palmld_supplicants[] = { |
| 446 | "main-battery", |
| 447 | }; |
| 448 | |
| 449 | static struct pda_power_pdata power_supply_info = { |
| 450 | .init = power_supply_init, |
| 451 | .is_ac_online = palmld_is_ac_online, |
| 452 | .is_usb_online = palmld_is_usb_online, |
| 453 | .exit = power_supply_exit, |
| 454 | .supplied_to = palmld_supplicants, |
| 455 | .num_supplicants = ARRAY_SIZE(palmld_supplicants), |
| 456 | }; |
| 457 | |
| 458 | static struct platform_device power_supply = { |
| 459 | .name = "pda-power", |
| 460 | .id = -1, |
| 461 | .dev = { |
| 462 | .platform_data = &power_supply_info, |
| 463 | }, |
| 464 | }; |
| 465 | |
| 466 | /****************************************************************************** |
| 467 | * WM97xx battery |
| 468 | ******************************************************************************/ |
| 469 | static struct wm97xx_batt_info wm97xx_batt_pdata = { |
| 470 | .batt_aux = WM97XX_AUX_ID3, |
| 471 | .temp_aux = WM97XX_AUX_ID2, |
| 472 | .charge_gpio = -1, |
| 473 | .max_voltage = PALMLD_BAT_MAX_VOLTAGE, |
| 474 | .min_voltage = PALMLD_BAT_MIN_VOLTAGE, |
| 475 | .batt_mult = 1000, |
| 476 | .batt_div = 414, |
| 477 | .temp_mult = 1, |
| 478 | .temp_div = 1, |
| 479 | .batt_tech = POWER_SUPPLY_TECHNOLOGY_LIPO, |
| 480 | .batt_name = "main-batt", |
| 481 | }; |
| 482 | |
| 483 | /****************************************************************************** |
| 484 | * aSoC audio |
| 485 | ******************************************************************************/ |
Marek Vasut | e91fb91 | 2009-04-17 11:37:35 +0200 | [diff] [blame] | 486 | static struct palm27x_asoc_info palmld_asoc_pdata = { |
Marek Vasut | a645072 | 2008-11-20 22:50:46 +0100 | [diff] [blame] | 487 | .jack_gpio = GPIO_NR_PALMLD_EARPHONE_DETECT, |
| 488 | }; |
| 489 | |
Marek Vasut | e91fb91 | 2009-04-17 11:37:35 +0200 | [diff] [blame] | 490 | static pxa2xx_audio_ops_t palmld_ac97_pdata = { |
| 491 | .reset_gpio = 95, |
| 492 | }; |
| 493 | |
| 494 | static struct platform_device palmld_asoc = { |
| 495 | .name = "palm27x-asoc", |
| 496 | .id = -1, |
| 497 | .dev = { |
| 498 | .platform_data = &palmld_asoc_pdata, |
| 499 | }, |
| 500 | }; |
| 501 | |
Marek Vasut | a645072 | 2008-11-20 22:50:46 +0100 | [diff] [blame] | 502 | /****************************************************************************** |
Marek Vašut | 5a9d251 | 2009-05-21 13:11:05 +0100 | [diff] [blame] | 503 | * HDD |
| 504 | ******************************************************************************/ |
| 505 | static struct platform_device palmld_hdd = { |
| 506 | .name = "pata_palmld", |
| 507 | .id = -1, |
| 508 | }; |
| 509 | |
| 510 | /****************************************************************************** |
Marek Vasut | a645072 | 2008-11-20 22:50:46 +0100 | [diff] [blame] | 511 | * Framebuffer |
| 512 | ******************************************************************************/ |
| 513 | static struct pxafb_mode_info palmld_lcd_modes[] = { |
| 514 | { |
| 515 | .pixclock = 57692, |
| 516 | .xres = 320, |
| 517 | .yres = 480, |
| 518 | .bpp = 16, |
| 519 | |
| 520 | .left_margin = 32, |
| 521 | .right_margin = 1, |
| 522 | .upper_margin = 7, |
| 523 | .lower_margin = 1, |
| 524 | |
| 525 | .hsync_len = 4, |
| 526 | .vsync_len = 1, |
| 527 | }, |
| 528 | }; |
| 529 | |
| 530 | static struct pxafb_mach_info palmld_lcd_screen = { |
| 531 | .modes = palmld_lcd_modes, |
| 532 | .num_modes = ARRAY_SIZE(palmld_lcd_modes), |
| 533 | .lcd_conn = LCD_COLOR_TFT_16BPP | LCD_PCLK_EDGE_FALL, |
| 534 | }; |
| 535 | |
| 536 | /****************************************************************************** |
Marek Vasut | 81854f8 | 2009-03-28 12:37:42 +0100 | [diff] [blame] | 537 | * Power management - standby |
| 538 | ******************************************************************************/ |
Marek Vasut | fc9c1b6 | 2009-05-14 11:27:00 +0200 | [diff] [blame] | 539 | static void __init palmld_pm_init(void) |
Marek Vasut | 81854f8 | 2009-03-28 12:37:42 +0100 | [diff] [blame] | 540 | { |
Marek Vasut | fc9c1b6 | 2009-05-14 11:27:00 +0200 | [diff] [blame] | 541 | static u32 resume[] = { |
| 542 | 0xe3a00101, /* mov r0, #0x40000000 */ |
| 543 | 0xe380060f, /* orr r0, r0, #0x00f00000 */ |
| 544 | 0xe590f008, /* ldr pc, [r0, #0x08] */ |
| 545 | }; |
Marek Vasut | 81854f8 | 2009-03-28 12:37:42 +0100 | [diff] [blame] | 546 | |
Marek Vasut | fc9c1b6 | 2009-05-14 11:27:00 +0200 | [diff] [blame] | 547 | /* copy the bootloader */ |
| 548 | memcpy(phys_to_virt(PALMLD_STR_BASE), resume, sizeof(resume)); |
Marek Vasut | 81854f8 | 2009-03-28 12:37:42 +0100 | [diff] [blame] | 549 | } |
| 550 | |
Marek Vasut | 81854f8 | 2009-03-28 12:37:42 +0100 | [diff] [blame] | 551 | /****************************************************************************** |
Marek Vasut | a645072 | 2008-11-20 22:50:46 +0100 | [diff] [blame] | 552 | * Machine init |
| 553 | ******************************************************************************/ |
| 554 | static struct platform_device *devices[] __initdata = { |
| 555 | #if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE) |
| 556 | &palmld_pxa_keys, |
| 557 | #endif |
| 558 | &palmld_backlight, |
| 559 | &palmld_leds, |
| 560 | &power_supply, |
Marek Vasut | e91fb91 | 2009-04-17 11:37:35 +0200 | [diff] [blame] | 561 | &palmld_asoc, |
Marek Vašut | 5a9d251 | 2009-05-21 13:11:05 +0100 | [diff] [blame] | 562 | &palmld_hdd, |
Marek Vasut | a645072 | 2008-11-20 22:50:46 +0100 | [diff] [blame] | 563 | }; |
| 564 | |
| 565 | static struct map_desc palmld_io_desc[] __initdata = { |
| 566 | { |
| 567 | .virtual = PALMLD_IDE_VIRT, |
| 568 | .pfn = __phys_to_pfn(PALMLD_IDE_PHYS), |
| 569 | .length = PALMLD_IDE_SIZE, |
| 570 | .type = MT_DEVICE |
| 571 | }, |
| 572 | { |
| 573 | .virtual = PALMLD_USB_VIRT, |
| 574 | .pfn = __phys_to_pfn(PALMLD_USB_PHYS), |
| 575 | .length = PALMLD_USB_SIZE, |
| 576 | .type = MT_DEVICE |
| 577 | }, |
| 578 | }; |
| 579 | |
| 580 | static void __init palmld_map_io(void) |
| 581 | { |
| 582 | pxa_map_io(); |
| 583 | iotable_init(palmld_io_desc, ARRAY_SIZE(palmld_io_desc)); |
| 584 | } |
| 585 | |
| 586 | static void __init palmld_init(void) |
| 587 | { |
| 588 | pxa2xx_mfp_config(ARRAY_AND_SIZE(palmld_pin_config)); |
| 589 | |
Marek Vasut | fc9c1b6 | 2009-05-14 11:27:00 +0200 | [diff] [blame] | 590 | palmld_pm_init(); |
Marek Vasut | a645072 | 2008-11-20 22:50:46 +0100 | [diff] [blame] | 591 | set_pxa_fb_info(&palmld_lcd_screen); |
| 592 | pxa_set_mci_info(&palmld_mci_platform_data); |
Marek Vasut | e91fb91 | 2009-04-17 11:37:35 +0200 | [diff] [blame] | 593 | pxa_set_ac97_info(&palmld_ac97_pdata); |
Marek Vasut | a645072 | 2008-11-20 22:50:46 +0100 | [diff] [blame] | 594 | pxa_set_ficp_info(&palmld_ficp_platform_data); |
| 595 | pxa_set_keypad_info(&palmld_keypad_platform_data); |
| 596 | wm97xx_bat_set_pdata(&wm97xx_batt_pdata); |
Marek Vasut | a645072 | 2008-11-20 22:50:46 +0100 | [diff] [blame] | 597 | |
| 598 | platform_add_devices(devices, ARRAY_SIZE(devices)); |
| 599 | } |
| 600 | |
| 601 | MACHINE_START(PALMLD, "Palm LifeDrive") |
| 602 | .phys_io = PALMLD_PHYS_IO_START, |
| 603 | .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc, |
| 604 | .boot_params = 0xa0000100, |
| 605 | .map_io = palmld_map_io, |
| 606 | .init_irq = pxa27x_init_irq, |
| 607 | .timer = &pxa_timer, |
| 608 | .init_machine = palmld_init |
| 609 | MACHINE_END |