Marek Vašut | b5e4ad5 | 2008-07-07 17:25:46 +0100 | [diff] [blame] | 1 | /* |
| 2 | * Hardware definitions for PalmTX |
| 3 | * |
| 4 | * Author: Marek Vasut <marek.vasut@gmail.com> |
| 5 | * |
| 6 | * Based on work of: |
| 7 | * Alex Osborne <ato@meshy.org> |
| 8 | * Cristiano P. <cristianop@users.sourceforge.net> |
| 9 | * Jan Herman <2hp@seznam.cz> |
| 10 | * Michal Hrusecky |
| 11 | * |
| 12 | * This program is free software; you can redistribute it and/or modify |
| 13 | * it under the terms of the GNU General Public License version 2 as |
| 14 | * published by the Free Software Foundation. |
| 15 | * |
| 16 | * (find more info at www.hackndev.com) |
| 17 | * |
| 18 | */ |
| 19 | |
| 20 | #include <linux/platform_device.h> |
| 21 | #include <linux/delay.h> |
| 22 | #include <linux/irq.h> |
| 23 | #include <linux/gpio_keys.h> |
| 24 | #include <linux/input.h> |
Marek Vašut | d4b19c4 | 2008-07-07 17:31:58 +0100 | [diff] [blame] | 25 | #include <linux/pda_power.h> |
Marek Vašut | b5e4ad5 | 2008-07-07 17:25:46 +0100 | [diff] [blame] | 26 | #include <linux/pwm_backlight.h> |
| 27 | #include <linux/gpio.h> |
Marek Vašut | 4e9687d | 2008-09-11 19:37:32 +0100 | [diff] [blame] | 28 | #include <linux/wm97xx_batt.h> |
| 29 | #include <linux/power_supply.h> |
Marek Vašut | b5e4ad5 | 2008-07-07 17:25: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> |
Russell King | a09e64f | 2008-08-05 16:14:15 +0100 | [diff] [blame] | 36 | #include <mach/audio.h> |
| 37 | #include <mach/palmtx.h> |
| 38 | #include <mach/mmc.h> |
| 39 | #include <mach/pxafb.h> |
Russell King | a09e64f | 2008-08-05 16:14:15 +0100 | [diff] [blame] | 40 | #include <mach/irda.h> |
| 41 | #include <mach/pxa27x_keypad.h> |
| 42 | #include <mach/udc.h> |
Marek Vašut | b5e4ad5 | 2008-07-07 17:25:46 +0100 | [diff] [blame] | 43 | |
| 44 | #include "generic.h" |
| 45 | #include "devices.h" |
| 46 | |
| 47 | /****************************************************************************** |
| 48 | * Pin configuration |
| 49 | ******************************************************************************/ |
| 50 | static unsigned long palmtx_pin_config[] __initdata = { |
| 51 | /* MMC */ |
| 52 | GPIO32_MMC_CLK, |
| 53 | GPIO92_MMC_DAT_0, |
| 54 | GPIO109_MMC_DAT_1, |
| 55 | GPIO110_MMC_DAT_2, |
| 56 | GPIO111_MMC_DAT_3, |
| 57 | GPIO112_MMC_CMD, |
Marek Vasut | a730b32 | 2008-11-20 17:34:57 +0100 | [diff] [blame] | 58 | GPIO14_GPIO, /* SD detect */ |
| 59 | GPIO114_GPIO, /* SD power */ |
| 60 | GPIO115_GPIO, /* SD r/o switch */ |
Marek Vašut | b5e4ad5 | 2008-07-07 17:25:46 +0100 | [diff] [blame] | 61 | |
| 62 | /* AC97 */ |
| 63 | GPIO28_AC97_BITCLK, |
| 64 | GPIO29_AC97_SDATA_IN_0, |
| 65 | GPIO30_AC97_SDATA_OUT, |
| 66 | GPIO31_AC97_SYNC, |
| 67 | |
| 68 | /* IrDA */ |
Marek Vasut | a730b32 | 2008-11-20 17:34:57 +0100 | [diff] [blame] | 69 | GPIO40_GPIO, /* ir disable */ |
Marek Vašut | b5e4ad5 | 2008-07-07 17:25:46 +0100 | [diff] [blame] | 70 | GPIO46_FICP_RXD, |
| 71 | GPIO47_FICP_TXD, |
| 72 | |
| 73 | /* PWM */ |
| 74 | GPIO16_PWM0_OUT, |
| 75 | |
| 76 | /* USB */ |
Marek Vasut | a730b32 | 2008-11-20 17:34:57 +0100 | [diff] [blame] | 77 | GPIO13_GPIO, /* usb detect */ |
| 78 | GPIO95_GPIO, /* usb power */ |
Marek Vašut | 3597840 | 2008-07-07 17:28:59 +0100 | [diff] [blame] | 79 | |
| 80 | /* PCMCIA */ |
| 81 | GPIO48_nPOE, |
| 82 | GPIO49_nPWE, |
| 83 | GPIO50_nPIOR, |
| 84 | GPIO51_nPIOW, |
| 85 | GPIO85_nPCE_1, |
| 86 | GPIO54_nPCE_2, |
| 87 | GPIO79_PSKTSEL, |
| 88 | GPIO55_nPREG, |
| 89 | GPIO56_nPWAIT, |
| 90 | GPIO57_nIOIS16, |
Marek Vasut | a730b32 | 2008-11-20 17:34:57 +0100 | [diff] [blame] | 91 | GPIO94_GPIO, /* wifi power 1 */ |
| 92 | GPIO108_GPIO, /* wifi power 2 */ |
| 93 | GPIO116_GPIO, /* wifi ready */ |
| 94 | |
| 95 | /* MATRIX KEYPAD */ |
Marek Vasut | 81854f8 | 2009-03-28 12:37:42 +0100 | [diff] [blame^] | 96 | GPIO100_KP_MKIN_0 | WAKEUP_ON_LEVEL_HIGH, |
| 97 | GPIO101_KP_MKIN_1 | WAKEUP_ON_LEVEL_HIGH, |
| 98 | GPIO102_KP_MKIN_2 | WAKEUP_ON_LEVEL_HIGH, |
| 99 | GPIO97_KP_MKIN_3 | WAKEUP_ON_LEVEL_HIGH, |
Marek Vasut | a730b32 | 2008-11-20 17:34:57 +0100 | [diff] [blame] | 100 | GPIO103_KP_MKOUT_0, |
| 101 | GPIO104_KP_MKOUT_1, |
| 102 | GPIO105_KP_MKOUT_2, |
| 103 | |
| 104 | /* LCD */ |
| 105 | GPIO58_LCD_LDD_0, |
| 106 | GPIO59_LCD_LDD_1, |
| 107 | GPIO60_LCD_LDD_2, |
| 108 | GPIO61_LCD_LDD_3, |
| 109 | GPIO62_LCD_LDD_4, |
| 110 | GPIO63_LCD_LDD_5, |
| 111 | GPIO64_LCD_LDD_6, |
| 112 | GPIO65_LCD_LDD_7, |
| 113 | GPIO66_LCD_LDD_8, |
| 114 | GPIO67_LCD_LDD_9, |
| 115 | GPIO68_LCD_LDD_10, |
| 116 | GPIO69_LCD_LDD_11, |
| 117 | GPIO70_LCD_LDD_12, |
| 118 | GPIO71_LCD_LDD_13, |
| 119 | GPIO72_LCD_LDD_14, |
| 120 | GPIO73_LCD_LDD_15, |
| 121 | GPIO74_LCD_FCLK, |
| 122 | GPIO75_LCD_LCLK, |
| 123 | GPIO76_LCD_PCLK, |
| 124 | GPIO77_LCD_BIAS, |
| 125 | |
| 126 | /* MISC. */ |
| 127 | GPIO10_GPIO, /* hotsync button */ |
| 128 | GPIO12_GPIO, /* power detect */ |
| 129 | GPIO107_GPIO, /* earphone detect */ |
Marek Vašut | b5e4ad5 | 2008-07-07 17:25:46 +0100 | [diff] [blame] | 130 | }; |
| 131 | |
| 132 | /****************************************************************************** |
| 133 | * SD/MMC card controller |
| 134 | ******************************************************************************/ |
| 135 | static int palmtx_mci_init(struct device *dev, irq_handler_t palmtx_detect_int, |
| 136 | void *data) |
| 137 | { |
| 138 | int err = 0; |
| 139 | |
| 140 | /* Setup an interrupt for detecting card insert/remove events */ |
Marek Vasut | a730b32 | 2008-11-20 17:34:57 +0100 | [diff] [blame] | 141 | err = gpio_request(GPIO_NR_PALMTX_SD_DETECT_N, "SD IRQ"); |
| 142 | if (err) |
| 143 | goto err; |
| 144 | err = gpio_direction_input(GPIO_NR_PALMTX_SD_DETECT_N); |
| 145 | if (err) |
| 146 | goto err2; |
| 147 | err = request_irq(gpio_to_irq(GPIO_NR_PALMTX_SD_DETECT_N), |
| 148 | palmtx_detect_int, IRQF_DISABLED | IRQF_SAMPLE_RANDOM | |
Marek Vašut | b5e4ad5 | 2008-07-07 17:25:46 +0100 | [diff] [blame] | 149 | IRQF_TRIGGER_FALLING | IRQF_TRIGGER_RISING, |
| 150 | "SD/MMC card detect", data); |
| 151 | if (err) { |
| 152 | printk(KERN_ERR "%s: cannot request SD/MMC card detect IRQ\n", |
| 153 | __func__); |
Marek Vasut | a730b32 | 2008-11-20 17:34:57 +0100 | [diff] [blame] | 154 | goto err2; |
Marek Vašut | b5e4ad5 | 2008-07-07 17:25:46 +0100 | [diff] [blame] | 155 | } |
| 156 | |
| 157 | err = gpio_request(GPIO_NR_PALMTX_SD_POWER, "SD_POWER"); |
| 158 | if (err) |
Marek Vasut | a730b32 | 2008-11-20 17:34:57 +0100 | [diff] [blame] | 159 | goto err3; |
| 160 | err = gpio_direction_output(GPIO_NR_PALMTX_SD_POWER, 0); |
| 161 | if (err) |
| 162 | goto err4; |
Marek Vašut | b5e4ad5 | 2008-07-07 17:25:46 +0100 | [diff] [blame] | 163 | |
| 164 | err = gpio_request(GPIO_NR_PALMTX_SD_READONLY, "SD_READONLY"); |
| 165 | if (err) |
Marek Vasut | a730b32 | 2008-11-20 17:34:57 +0100 | [diff] [blame] | 166 | goto err4; |
| 167 | err = gpio_direction_input(GPIO_NR_PALMTX_SD_READONLY); |
| 168 | if (err) |
| 169 | goto err5; |
Marek Vašut | b5e4ad5 | 2008-07-07 17:25:46 +0100 | [diff] [blame] | 170 | |
| 171 | printk(KERN_DEBUG "%s: irq registered\n", __func__); |
| 172 | |
| 173 | return 0; |
| 174 | |
Marek Vasut | a730b32 | 2008-11-20 17:34:57 +0100 | [diff] [blame] | 175 | err5: |
| 176 | gpio_free(GPIO_NR_PALMTX_SD_READONLY); |
| 177 | err4: |
Marek Vašut | b5e4ad5 | 2008-07-07 17:25:46 +0100 | [diff] [blame] | 178 | gpio_free(GPIO_NR_PALMTX_SD_POWER); |
Marek Vasut | a730b32 | 2008-11-20 17:34:57 +0100 | [diff] [blame] | 179 | err3: |
| 180 | free_irq(gpio_to_irq(GPIO_NR_PALMTX_SD_DETECT_N), data); |
| 181 | err2: |
| 182 | gpio_free(GPIO_NR_PALMTX_SD_DETECT_N); |
| 183 | err: |
Marek Vašut | b5e4ad5 | 2008-07-07 17:25:46 +0100 | [diff] [blame] | 184 | return err; |
| 185 | } |
| 186 | |
| 187 | static void palmtx_mci_exit(struct device *dev, void *data) |
| 188 | { |
| 189 | gpio_free(GPIO_NR_PALMTX_SD_READONLY); |
| 190 | gpio_free(GPIO_NR_PALMTX_SD_POWER); |
Marek Vasut | a730b32 | 2008-11-20 17:34:57 +0100 | [diff] [blame] | 191 | free_irq(gpio_to_irq(GPIO_NR_PALMTX_SD_DETECT_N), data); |
| 192 | gpio_free(GPIO_NR_PALMTX_SD_DETECT_N); |
Marek Vašut | b5e4ad5 | 2008-07-07 17:25:46 +0100 | [diff] [blame] | 193 | } |
| 194 | |
| 195 | static void palmtx_mci_power(struct device *dev, unsigned int vdd) |
| 196 | { |
| 197 | struct pxamci_platform_data *p_d = dev->platform_data; |
| 198 | gpio_set_value(GPIO_NR_PALMTX_SD_POWER, p_d->ocr_mask & (1 << vdd)); |
| 199 | } |
| 200 | |
| 201 | static int palmtx_mci_get_ro(struct device *dev) |
| 202 | { |
| 203 | return gpio_get_value(GPIO_NR_PALMTX_SD_READONLY); |
| 204 | } |
| 205 | |
| 206 | static struct pxamci_platform_data palmtx_mci_platform_data = { |
| 207 | .ocr_mask = MMC_VDD_32_33 | MMC_VDD_33_34, |
| 208 | .setpower = palmtx_mci_power, |
| 209 | .get_ro = palmtx_mci_get_ro, |
| 210 | .init = palmtx_mci_init, |
| 211 | .exit = palmtx_mci_exit, |
| 212 | }; |
| 213 | |
| 214 | /****************************************************************************** |
| 215 | * GPIO keyboard |
| 216 | ******************************************************************************/ |
| 217 | static unsigned int palmtx_matrix_keys[] = { |
| 218 | KEY(0, 0, KEY_POWER), |
| 219 | KEY(0, 1, KEY_F1), |
| 220 | KEY(0, 2, KEY_ENTER), |
| 221 | |
| 222 | KEY(1, 0, KEY_F2), |
| 223 | KEY(1, 1, KEY_F3), |
| 224 | KEY(1, 2, KEY_F4), |
| 225 | |
| 226 | KEY(2, 0, KEY_UP), |
| 227 | KEY(2, 2, KEY_DOWN), |
| 228 | |
| 229 | KEY(3, 0, KEY_RIGHT), |
| 230 | KEY(3, 2, KEY_LEFT), |
Marek Vašut | b5e4ad5 | 2008-07-07 17:25:46 +0100 | [diff] [blame] | 231 | }; |
| 232 | |
| 233 | static struct pxa27x_keypad_platform_data palmtx_keypad_platform_data = { |
| 234 | .matrix_key_rows = 4, |
| 235 | .matrix_key_cols = 3, |
| 236 | .matrix_key_map = palmtx_matrix_keys, |
| 237 | .matrix_key_map_size = ARRAY_SIZE(palmtx_matrix_keys), |
| 238 | |
| 239 | .debounce_interval = 30, |
| 240 | }; |
| 241 | |
| 242 | /****************************************************************************** |
| 243 | * GPIO keys |
| 244 | ******************************************************************************/ |
| 245 | static struct gpio_keys_button palmtx_pxa_buttons[] = { |
| 246 | {KEY_F8, GPIO_NR_PALMTX_HOTSYNC_BUTTON_N, 1, "HotSync Button" }, |
| 247 | }; |
| 248 | |
| 249 | static struct gpio_keys_platform_data palmtx_pxa_keys_data = { |
| 250 | .buttons = palmtx_pxa_buttons, |
| 251 | .nbuttons = ARRAY_SIZE(palmtx_pxa_buttons), |
| 252 | }; |
| 253 | |
| 254 | static struct platform_device palmtx_pxa_keys = { |
| 255 | .name = "gpio-keys", |
| 256 | .id = -1, |
| 257 | .dev = { |
| 258 | .platform_data = &palmtx_pxa_keys_data, |
| 259 | }, |
| 260 | }; |
| 261 | |
| 262 | /****************************************************************************** |
| 263 | * Backlight |
| 264 | ******************************************************************************/ |
| 265 | static int palmtx_backlight_init(struct device *dev) |
| 266 | { |
| 267 | int ret; |
| 268 | |
| 269 | ret = gpio_request(GPIO_NR_PALMTX_BL_POWER, "BL POWER"); |
| 270 | if (ret) |
| 271 | goto err; |
Marek Vasut | a730b32 | 2008-11-20 17:34:57 +0100 | [diff] [blame] | 272 | ret = gpio_direction_output(GPIO_NR_PALMTX_BL_POWER, 0); |
| 273 | if (ret) |
| 274 | goto err2; |
Marek Vašut | b5e4ad5 | 2008-07-07 17:25:46 +0100 | [diff] [blame] | 275 | ret = gpio_request(GPIO_NR_PALMTX_LCD_POWER, "LCD POWER"); |
| 276 | if (ret) |
| 277 | goto err2; |
Marek Vasut | a730b32 | 2008-11-20 17:34:57 +0100 | [diff] [blame] | 278 | ret = gpio_direction_output(GPIO_NR_PALMTX_LCD_POWER, 0); |
| 279 | if (ret) |
| 280 | goto err3; |
Marek Vašut | b5e4ad5 | 2008-07-07 17:25:46 +0100 | [diff] [blame] | 281 | |
| 282 | return 0; |
Marek Vasut | a730b32 | 2008-11-20 17:34:57 +0100 | [diff] [blame] | 283 | err3: |
| 284 | gpio_free(GPIO_NR_PALMTX_LCD_POWER); |
Marek Vašut | b5e4ad5 | 2008-07-07 17:25:46 +0100 | [diff] [blame] | 285 | err2: |
| 286 | gpio_free(GPIO_NR_PALMTX_BL_POWER); |
| 287 | err: |
| 288 | return ret; |
| 289 | } |
| 290 | |
| 291 | static int palmtx_backlight_notify(int brightness) |
| 292 | { |
| 293 | gpio_set_value(GPIO_NR_PALMTX_BL_POWER, brightness); |
| 294 | gpio_set_value(GPIO_NR_PALMTX_LCD_POWER, brightness); |
| 295 | return brightness; |
| 296 | } |
| 297 | |
| 298 | static void palmtx_backlight_exit(struct device *dev) |
| 299 | { |
| 300 | gpio_free(GPIO_NR_PALMTX_BL_POWER); |
| 301 | gpio_free(GPIO_NR_PALMTX_LCD_POWER); |
| 302 | } |
| 303 | |
| 304 | static struct platform_pwm_backlight_data palmtx_backlight_data = { |
| 305 | .pwm_id = 0, |
| 306 | .max_brightness = PALMTX_MAX_INTENSITY, |
| 307 | .dft_brightness = PALMTX_MAX_INTENSITY, |
| 308 | .pwm_period_ns = PALMTX_PERIOD_NS, |
| 309 | .init = palmtx_backlight_init, |
| 310 | .notify = palmtx_backlight_notify, |
| 311 | .exit = palmtx_backlight_exit, |
| 312 | }; |
| 313 | |
| 314 | static struct platform_device palmtx_backlight = { |
| 315 | .name = "pwm-backlight", |
| 316 | .dev = { |
| 317 | .parent = &pxa27x_device_pwm0.dev, |
| 318 | .platform_data = &palmtx_backlight_data, |
| 319 | }, |
| 320 | }; |
| 321 | |
| 322 | /****************************************************************************** |
| 323 | * IrDA |
| 324 | ******************************************************************************/ |
Marek Vasut | a730b32 | 2008-11-20 17:34:57 +0100 | [diff] [blame] | 325 | static int palmtx_irda_startup(struct device *dev) |
| 326 | { |
| 327 | int err; |
| 328 | err = gpio_request(GPIO_NR_PALMTX_IR_DISABLE, "IR DISABLE"); |
| 329 | if (err) |
| 330 | goto err; |
| 331 | err = gpio_direction_output(GPIO_NR_PALMTX_IR_DISABLE, 1); |
| 332 | if (err) |
| 333 | gpio_free(GPIO_NR_PALMTX_IR_DISABLE); |
| 334 | err: |
| 335 | return err; |
| 336 | } |
| 337 | |
| 338 | static void palmtx_irda_shutdown(struct device *dev) |
| 339 | { |
| 340 | gpio_free(GPIO_NR_PALMTX_IR_DISABLE); |
| 341 | } |
| 342 | |
Marek Vašut | b5e4ad5 | 2008-07-07 17:25:46 +0100 | [diff] [blame] | 343 | static void palmtx_irda_transceiver_mode(struct device *dev, int mode) |
| 344 | { |
| 345 | gpio_set_value(GPIO_NR_PALMTX_IR_DISABLE, mode & IR_OFF); |
| 346 | pxa2xx_transceiver_mode(dev, mode); |
| 347 | } |
| 348 | |
| 349 | static struct pxaficp_platform_data palmtx_ficp_platform_data = { |
Marek Vasut | a730b32 | 2008-11-20 17:34:57 +0100 | [diff] [blame] | 350 | .startup = palmtx_irda_startup, |
| 351 | .shutdown = palmtx_irda_shutdown, |
Marek Vašut | b5e4ad5 | 2008-07-07 17:25:46 +0100 | [diff] [blame] | 352 | .transceiver_cap = IR_SIRMODE | IR_FIRMODE | IR_OFF, |
| 353 | .transceiver_mode = palmtx_irda_transceiver_mode, |
| 354 | }; |
| 355 | |
| 356 | /****************************************************************************** |
| 357 | * UDC |
| 358 | ******************************************************************************/ |
Marek Vašut | b5e4ad5 | 2008-07-07 17:25:46 +0100 | [diff] [blame] | 359 | static struct pxa2xx_udc_mach_info palmtx_udc_info __initdata = { |
| 360 | .gpio_vbus = GPIO_NR_PALMTX_USB_DETECT_N, |
| 361 | .gpio_vbus_inverted = 1, |
Marek Vasut | a730b32 | 2008-11-20 17:34:57 +0100 | [diff] [blame] | 362 | .gpio_pullup = GPIO_NR_PALMTX_USB_POWER, |
| 363 | .gpio_pullup_inverted = 0, |
Marek Vašut | b5e4ad5 | 2008-07-07 17:25:46 +0100 | [diff] [blame] | 364 | }; |
| 365 | |
| 366 | /****************************************************************************** |
Marek Vašut | d4b19c4 | 2008-07-07 17:31:58 +0100 | [diff] [blame] | 367 | * Power supply |
| 368 | ******************************************************************************/ |
| 369 | static int power_supply_init(struct device *dev) |
| 370 | { |
| 371 | int ret; |
| 372 | |
| 373 | ret = gpio_request(GPIO_NR_PALMTX_POWER_DETECT, "CABLE_STATE_AC"); |
| 374 | if (ret) |
Marek Vasut | a730b32 | 2008-11-20 17:34:57 +0100 | [diff] [blame] | 375 | goto err1; |
| 376 | ret = gpio_direction_input(GPIO_NR_PALMTX_POWER_DETECT); |
Marek Vašut | d4b19c4 | 2008-07-07 17:31:58 +0100 | [diff] [blame] | 377 | if (ret) |
Marek Vasut | a730b32 | 2008-11-20 17:34:57 +0100 | [diff] [blame] | 378 | goto err2; |
Marek Vašut | d4b19c4 | 2008-07-07 17:31:58 +0100 | [diff] [blame] | 379 | |
| 380 | return 0; |
| 381 | |
Marek Vasut | a730b32 | 2008-11-20 17:34:57 +0100 | [diff] [blame] | 382 | err2: |
Marek Vašut | d4b19c4 | 2008-07-07 17:31:58 +0100 | [diff] [blame] | 383 | gpio_free(GPIO_NR_PALMTX_POWER_DETECT); |
Marek Vasut | a730b32 | 2008-11-20 17:34:57 +0100 | [diff] [blame] | 384 | err1: |
Marek Vašut | d4b19c4 | 2008-07-07 17:31:58 +0100 | [diff] [blame] | 385 | return ret; |
| 386 | } |
| 387 | |
| 388 | static int palmtx_is_ac_online(void) |
| 389 | { |
| 390 | return gpio_get_value(GPIO_NR_PALMTX_POWER_DETECT); |
| 391 | } |
| 392 | |
Marek Vašut | d4b19c4 | 2008-07-07 17:31:58 +0100 | [diff] [blame] | 393 | static void power_supply_exit(struct device *dev) |
| 394 | { |
Marek Vašut | d4b19c4 | 2008-07-07 17:31:58 +0100 | [diff] [blame] | 395 | gpio_free(GPIO_NR_PALMTX_POWER_DETECT); |
| 396 | } |
| 397 | |
| 398 | static char *palmtx_supplicants[] = { |
| 399 | "main-battery", |
| 400 | }; |
| 401 | |
| 402 | static struct pda_power_pdata power_supply_info = { |
| 403 | .init = power_supply_init, |
| 404 | .is_ac_online = palmtx_is_ac_online, |
Marek Vašut | d4b19c4 | 2008-07-07 17:31:58 +0100 | [diff] [blame] | 405 | .exit = power_supply_exit, |
| 406 | .supplied_to = palmtx_supplicants, |
| 407 | .num_supplicants = ARRAY_SIZE(palmtx_supplicants), |
| 408 | }; |
| 409 | |
| 410 | static struct platform_device power_supply = { |
| 411 | .name = "pda-power", |
| 412 | .id = -1, |
| 413 | .dev = { |
| 414 | .platform_data = &power_supply_info, |
| 415 | }, |
| 416 | }; |
| 417 | |
| 418 | /****************************************************************************** |
Marek Vašut | 4e9687d | 2008-09-11 19:37:32 +0100 | [diff] [blame] | 419 | * WM97xx battery |
| 420 | ******************************************************************************/ |
| 421 | static struct wm97xx_batt_info wm97xx_batt_pdata = { |
| 422 | .batt_aux = WM97XX_AUX_ID3, |
| 423 | .temp_aux = WM97XX_AUX_ID2, |
| 424 | .charge_gpio = -1, |
| 425 | .max_voltage = PALMTX_BAT_MAX_VOLTAGE, |
| 426 | .min_voltage = PALMTX_BAT_MIN_VOLTAGE, |
| 427 | .batt_mult = 1000, |
| 428 | .batt_div = 414, |
| 429 | .temp_mult = 1, |
| 430 | .temp_div = 1, |
| 431 | .batt_tech = POWER_SUPPLY_TECHNOLOGY_LIPO, |
| 432 | .batt_name = "main-batt", |
| 433 | }; |
| 434 | |
| 435 | /****************************************************************************** |
Marek Vašut | b5e4ad5 | 2008-07-07 17:25:46 +0100 | [diff] [blame] | 436 | * Framebuffer |
| 437 | ******************************************************************************/ |
| 438 | static struct pxafb_mode_info palmtx_lcd_modes[] = { |
| 439 | { |
| 440 | .pixclock = 57692, |
| 441 | .xres = 320, |
| 442 | .yres = 480, |
| 443 | .bpp = 16, |
| 444 | |
| 445 | .left_margin = 32, |
| 446 | .right_margin = 1, |
| 447 | .upper_margin = 7, |
| 448 | .lower_margin = 1, |
| 449 | |
| 450 | .hsync_len = 4, |
| 451 | .vsync_len = 1, |
| 452 | }, |
| 453 | }; |
| 454 | |
| 455 | static struct pxafb_mach_info palmtx_lcd_screen = { |
| 456 | .modes = palmtx_lcd_modes, |
| 457 | .num_modes = ARRAY_SIZE(palmtx_lcd_modes), |
| 458 | .lcd_conn = LCD_COLOR_TFT_16BPP | LCD_PCLK_EDGE_FALL, |
| 459 | }; |
| 460 | |
| 461 | /****************************************************************************** |
Marek Vasut | 81854f8 | 2009-03-28 12:37:42 +0100 | [diff] [blame^] | 462 | * Power management - standby |
| 463 | ******************************************************************************/ |
| 464 | #ifdef CONFIG_PM |
| 465 | static u32 *addr __initdata; |
| 466 | static u32 resume[3] __initdata = { |
| 467 | 0xe3a00101, /* mov r0, #0x40000000 */ |
| 468 | 0xe380060f, /* orr r0, r0, #0x00f00000 */ |
| 469 | 0xe590f008, /* ldr pc, [r0, #0x08] */ |
| 470 | }; |
| 471 | |
| 472 | static int __init palmtx_pm_init(void) |
| 473 | { |
| 474 | int i; |
| 475 | |
| 476 | /* this is where the bootloader jumps */ |
| 477 | addr = phys_to_virt(PALMTX_STR_BASE); |
| 478 | |
| 479 | for (i = 0; i < 3; i++) |
| 480 | addr[i] = resume[i]; |
| 481 | |
| 482 | return 0; |
| 483 | } |
| 484 | |
| 485 | device_initcall(palmtx_pm_init); |
| 486 | #endif |
| 487 | |
| 488 | /****************************************************************************** |
Marek Vašut | b5e4ad5 | 2008-07-07 17:25:46 +0100 | [diff] [blame] | 489 | * Machine init |
| 490 | ******************************************************************************/ |
| 491 | static struct platform_device *devices[] __initdata = { |
| 492 | #if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE) |
| 493 | &palmtx_pxa_keys, |
| 494 | #endif |
| 495 | &palmtx_backlight, |
Marek Vašut | d4b19c4 | 2008-07-07 17:31:58 +0100 | [diff] [blame] | 496 | &power_supply, |
Marek Vašut | b5e4ad5 | 2008-07-07 17:25:46 +0100 | [diff] [blame] | 497 | }; |
| 498 | |
| 499 | static struct map_desc palmtx_io_desc[] __initdata = { |
| 500 | { |
| 501 | .virtual = PALMTX_PCMCIA_VIRT, |
| 502 | .pfn = __phys_to_pfn(PALMTX_PCMCIA_PHYS), |
| 503 | .length = PALMTX_PCMCIA_SIZE, |
| 504 | .type = MT_DEVICE |
| 505 | }, |
| 506 | }; |
| 507 | |
| 508 | static void __init palmtx_map_io(void) |
| 509 | { |
| 510 | pxa_map_io(); |
| 511 | iotable_init(palmtx_io_desc, ARRAY_SIZE(palmtx_io_desc)); |
| 512 | } |
| 513 | |
Marek Vasut | a730b32 | 2008-11-20 17:34:57 +0100 | [diff] [blame] | 514 | /* setup udc GPIOs initial state */ |
| 515 | static void __init palmtx_udc_init(void) |
| 516 | { |
| 517 | if (!gpio_request(GPIO_NR_PALMTX_USB_POWER, "UDC Vbus")) { |
| 518 | gpio_direction_output(GPIO_NR_PALMTX_USB_POWER, 1); |
| 519 | gpio_free(GPIO_NR_PALMTX_USB_POWER); |
| 520 | } |
| 521 | } |
| 522 | |
| 523 | |
Marek Vašut | b5e4ad5 | 2008-07-07 17:25:46 +0100 | [diff] [blame] | 524 | static void __init palmtx_init(void) |
| 525 | { |
| 526 | pxa2xx_mfp_config(ARRAY_AND_SIZE(palmtx_pin_config)); |
| 527 | |
| 528 | set_pxa_fb_info(&palmtx_lcd_screen); |
| 529 | pxa_set_mci_info(&palmtx_mci_platform_data); |
Marek Vasut | a730b32 | 2008-11-20 17:34:57 +0100 | [diff] [blame] | 530 | palmtx_udc_init(); |
Marek Vašut | b5e4ad5 | 2008-07-07 17:25:46 +0100 | [diff] [blame] | 531 | pxa_set_udc_info(&palmtx_udc_info); |
| 532 | pxa_set_ac97_info(NULL); |
| 533 | pxa_set_ficp_info(&palmtx_ficp_platform_data); |
| 534 | pxa_set_keypad_info(&palmtx_keypad_platform_data); |
Marek Vašut | 4e9687d | 2008-09-11 19:37:32 +0100 | [diff] [blame] | 535 | wm97xx_bat_set_pdata(&wm97xx_batt_pdata); |
Marek Vašut | b5e4ad5 | 2008-07-07 17:25:46 +0100 | [diff] [blame] | 536 | |
| 537 | platform_add_devices(devices, ARRAY_SIZE(devices)); |
| 538 | } |
| 539 | |
| 540 | MACHINE_START(PALMTX, "Palm T|X") |
| 541 | .phys_io = PALMTX_PHYS_IO_START, |
| 542 | .io_pg_offst = io_p2v(0x40000000), |
| 543 | .boot_params = 0xa0000100, |
| 544 | .map_io = palmtx_map_io, |
| 545 | .init_irq = pxa27x_init_irq, |
| 546 | .timer = &pxa_timer, |
| 547 | .init_machine = palmtx_init |
| 548 | MACHINE_END |