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 Vasut | 8768dc9 | 2009-04-23 11:12:37 +0200 | [diff] [blame] | 30 | #include <linux/usb/gpio_vbus.h> |
Marek Vašut | b5e4ad5 | 2008-07-07 17:25: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> |
Russell King | a09e64f | 2008-08-05 16:14:15 +0100 | [diff] [blame] | 37 | #include <mach/audio.h> |
| 38 | #include <mach/palmtx.h> |
| 39 | #include <mach/mmc.h> |
| 40 | #include <mach/pxafb.h> |
Russell King | a09e64f | 2008-08-05 16:14:15 +0100 | [diff] [blame] | 41 | #include <mach/irda.h> |
| 42 | #include <mach/pxa27x_keypad.h> |
| 43 | #include <mach/udc.h> |
Marek Vasut | e91fb91 | 2009-04-17 11:37:35 +0200 | [diff] [blame] | 44 | #include <mach/palmasoc.h> |
Marek Vašut | b5e4ad5 | 2008-07-07 17:25:46 +0100 | [diff] [blame] | 45 | |
| 46 | #include "generic.h" |
| 47 | #include "devices.h" |
| 48 | |
| 49 | /****************************************************************************** |
| 50 | * Pin configuration |
| 51 | ******************************************************************************/ |
| 52 | static unsigned long palmtx_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, |
Marek Vasut | a730b32 | 2008-11-20 17:34:57 +0100 | [diff] [blame] | 60 | GPIO14_GPIO, /* SD detect */ |
| 61 | GPIO114_GPIO, /* SD power */ |
| 62 | GPIO115_GPIO, /* SD r/o switch */ |
Marek Vašut | b5e4ad5 | 2008-07-07 17:25:46 +0100 | [diff] [blame] | 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, |
Marek Vasut | efb12cd | 2009-04-12 16:37:23 +0200 | [diff] [blame] | 70 | GPIO95_AC97_nRESET, |
Marek Vašut | b5e4ad5 | 2008-07-07 17:25:46 +0100 | [diff] [blame] | 71 | |
| 72 | /* IrDA */ |
Marek Vasut | a730b32 | 2008-11-20 17:34:57 +0100 | [diff] [blame] | 73 | GPIO40_GPIO, /* ir disable */ |
Marek Vašut | b5e4ad5 | 2008-07-07 17:25:46 +0100 | [diff] [blame] | 74 | GPIO46_FICP_RXD, |
| 75 | GPIO47_FICP_TXD, |
| 76 | |
| 77 | /* PWM */ |
| 78 | GPIO16_PWM0_OUT, |
| 79 | |
| 80 | /* USB */ |
Marek Vasut | a730b32 | 2008-11-20 17:34:57 +0100 | [diff] [blame] | 81 | GPIO13_GPIO, /* usb detect */ |
Marek Vasut | efb12cd | 2009-04-12 16:37:23 +0200 | [diff] [blame] | 82 | GPIO93_GPIO, /* usb power */ |
Marek Vašut | 3597840 | 2008-07-07 17:28:59 +0100 | [diff] [blame] | 83 | |
| 84 | /* PCMCIA */ |
| 85 | GPIO48_nPOE, |
| 86 | GPIO49_nPWE, |
| 87 | GPIO50_nPIOR, |
| 88 | GPIO51_nPIOW, |
| 89 | GPIO85_nPCE_1, |
| 90 | GPIO54_nPCE_2, |
| 91 | GPIO79_PSKTSEL, |
| 92 | GPIO55_nPREG, |
| 93 | GPIO56_nPWAIT, |
| 94 | GPIO57_nIOIS16, |
Marek Vasut | a730b32 | 2008-11-20 17:34:57 +0100 | [diff] [blame] | 95 | GPIO94_GPIO, /* wifi power 1 */ |
| 96 | GPIO108_GPIO, /* wifi power 2 */ |
| 97 | GPIO116_GPIO, /* wifi ready */ |
| 98 | |
| 99 | /* MATRIX KEYPAD */ |
Marek Vasut | 81854f8 | 2009-03-28 12:37:42 +0100 | [diff] [blame] | 100 | GPIO100_KP_MKIN_0 | WAKEUP_ON_LEVEL_HIGH, |
| 101 | GPIO101_KP_MKIN_1 | WAKEUP_ON_LEVEL_HIGH, |
| 102 | GPIO102_KP_MKIN_2 | WAKEUP_ON_LEVEL_HIGH, |
| 103 | GPIO97_KP_MKIN_3 | WAKEUP_ON_LEVEL_HIGH, |
Marek Vasut | a730b32 | 2008-11-20 17:34:57 +0100 | [diff] [blame] | 104 | GPIO103_KP_MKOUT_0, |
| 105 | GPIO104_KP_MKOUT_1, |
| 106 | GPIO105_KP_MKOUT_2, |
| 107 | |
| 108 | /* LCD */ |
| 109 | GPIO58_LCD_LDD_0, |
| 110 | GPIO59_LCD_LDD_1, |
| 111 | GPIO60_LCD_LDD_2, |
| 112 | GPIO61_LCD_LDD_3, |
| 113 | GPIO62_LCD_LDD_4, |
| 114 | GPIO63_LCD_LDD_5, |
| 115 | GPIO64_LCD_LDD_6, |
| 116 | GPIO65_LCD_LDD_7, |
| 117 | GPIO66_LCD_LDD_8, |
| 118 | GPIO67_LCD_LDD_9, |
| 119 | GPIO68_LCD_LDD_10, |
| 120 | GPIO69_LCD_LDD_11, |
| 121 | GPIO70_LCD_LDD_12, |
| 122 | GPIO71_LCD_LDD_13, |
| 123 | GPIO72_LCD_LDD_14, |
| 124 | GPIO73_LCD_LDD_15, |
| 125 | GPIO74_LCD_FCLK, |
| 126 | GPIO75_LCD_LCLK, |
| 127 | GPIO76_LCD_PCLK, |
| 128 | GPIO77_LCD_BIAS, |
| 129 | |
Marek Vasut | ecf763c | 2009-07-16 19:37:29 +0200 | [diff] [blame] | 130 | /* FFUART */ |
| 131 | GPIO34_FFUART_RXD, |
| 132 | GPIO39_FFUART_TXD, |
| 133 | |
Marek Vasut | a730b32 | 2008-11-20 17:34:57 +0100 | [diff] [blame] | 134 | /* MISC. */ |
| 135 | GPIO10_GPIO, /* hotsync button */ |
| 136 | GPIO12_GPIO, /* power detect */ |
| 137 | GPIO107_GPIO, /* earphone detect */ |
Marek Vašut | b5e4ad5 | 2008-07-07 17:25:46 +0100 | [diff] [blame] | 138 | }; |
| 139 | |
| 140 | /****************************************************************************** |
| 141 | * SD/MMC card controller |
| 142 | ******************************************************************************/ |
Marek Vašut | b5e4ad5 | 2008-07-07 17:25:46 +0100 | [diff] [blame] | 143 | static struct pxamci_platform_data palmtx_mci_platform_data = { |
Robert Jarzmik | 7a64825 | 2009-07-06 22:16:42 +0200 | [diff] [blame] | 144 | .ocr_mask = MMC_VDD_32_33 | MMC_VDD_33_34, |
| 145 | .gpio_card_detect = GPIO_NR_PALMTX_SD_DETECT_N, |
| 146 | .gpio_card_ro = GPIO_NR_PALMTX_SD_READONLY, |
| 147 | .gpio_power = GPIO_NR_PALMTX_SD_POWER, |
Marek Vasut | 9845b6b | 2009-07-16 19:38:41 +0200 | [diff] [blame^] | 148 | .detect_delay = 20, |
Marek Vašut | b5e4ad5 | 2008-07-07 17:25:46 +0100 | [diff] [blame] | 149 | }; |
| 150 | |
| 151 | /****************************************************************************** |
| 152 | * GPIO keyboard |
| 153 | ******************************************************************************/ |
| 154 | static unsigned int palmtx_matrix_keys[] = { |
| 155 | KEY(0, 0, KEY_POWER), |
| 156 | KEY(0, 1, KEY_F1), |
| 157 | KEY(0, 2, KEY_ENTER), |
| 158 | |
| 159 | KEY(1, 0, KEY_F2), |
| 160 | KEY(1, 1, KEY_F3), |
| 161 | KEY(1, 2, KEY_F4), |
| 162 | |
| 163 | KEY(2, 0, KEY_UP), |
| 164 | KEY(2, 2, KEY_DOWN), |
| 165 | |
| 166 | KEY(3, 0, KEY_RIGHT), |
| 167 | KEY(3, 2, KEY_LEFT), |
Marek Vašut | b5e4ad5 | 2008-07-07 17:25:46 +0100 | [diff] [blame] | 168 | }; |
| 169 | |
| 170 | static struct pxa27x_keypad_platform_data palmtx_keypad_platform_data = { |
| 171 | .matrix_key_rows = 4, |
| 172 | .matrix_key_cols = 3, |
| 173 | .matrix_key_map = palmtx_matrix_keys, |
| 174 | .matrix_key_map_size = ARRAY_SIZE(palmtx_matrix_keys), |
| 175 | |
| 176 | .debounce_interval = 30, |
| 177 | }; |
| 178 | |
| 179 | /****************************************************************************** |
| 180 | * GPIO keys |
| 181 | ******************************************************************************/ |
| 182 | static struct gpio_keys_button palmtx_pxa_buttons[] = { |
| 183 | {KEY_F8, GPIO_NR_PALMTX_HOTSYNC_BUTTON_N, 1, "HotSync Button" }, |
| 184 | }; |
| 185 | |
| 186 | static struct gpio_keys_platform_data palmtx_pxa_keys_data = { |
| 187 | .buttons = palmtx_pxa_buttons, |
| 188 | .nbuttons = ARRAY_SIZE(palmtx_pxa_buttons), |
| 189 | }; |
| 190 | |
| 191 | static struct platform_device palmtx_pxa_keys = { |
| 192 | .name = "gpio-keys", |
| 193 | .id = -1, |
| 194 | .dev = { |
| 195 | .platform_data = &palmtx_pxa_keys_data, |
| 196 | }, |
| 197 | }; |
| 198 | |
| 199 | /****************************************************************************** |
| 200 | * Backlight |
| 201 | ******************************************************************************/ |
| 202 | static int palmtx_backlight_init(struct device *dev) |
| 203 | { |
| 204 | int ret; |
| 205 | |
| 206 | ret = gpio_request(GPIO_NR_PALMTX_BL_POWER, "BL POWER"); |
| 207 | if (ret) |
| 208 | goto err; |
Marek Vasut | a730b32 | 2008-11-20 17:34:57 +0100 | [diff] [blame] | 209 | ret = gpio_direction_output(GPIO_NR_PALMTX_BL_POWER, 0); |
| 210 | if (ret) |
| 211 | goto err2; |
Marek Vašut | b5e4ad5 | 2008-07-07 17:25:46 +0100 | [diff] [blame] | 212 | ret = gpio_request(GPIO_NR_PALMTX_LCD_POWER, "LCD POWER"); |
| 213 | if (ret) |
| 214 | goto err2; |
Marek Vasut | a730b32 | 2008-11-20 17:34:57 +0100 | [diff] [blame] | 215 | ret = gpio_direction_output(GPIO_NR_PALMTX_LCD_POWER, 0); |
| 216 | if (ret) |
| 217 | goto err3; |
Marek Vašut | b5e4ad5 | 2008-07-07 17:25:46 +0100 | [diff] [blame] | 218 | |
| 219 | return 0; |
Marek Vasut | a730b32 | 2008-11-20 17:34:57 +0100 | [diff] [blame] | 220 | err3: |
| 221 | gpio_free(GPIO_NR_PALMTX_LCD_POWER); |
Marek Vašut | b5e4ad5 | 2008-07-07 17:25:46 +0100 | [diff] [blame] | 222 | err2: |
| 223 | gpio_free(GPIO_NR_PALMTX_BL_POWER); |
| 224 | err: |
| 225 | return ret; |
| 226 | } |
| 227 | |
| 228 | static int palmtx_backlight_notify(int brightness) |
| 229 | { |
| 230 | gpio_set_value(GPIO_NR_PALMTX_BL_POWER, brightness); |
| 231 | gpio_set_value(GPIO_NR_PALMTX_LCD_POWER, brightness); |
| 232 | return brightness; |
| 233 | } |
| 234 | |
| 235 | static void palmtx_backlight_exit(struct device *dev) |
| 236 | { |
| 237 | gpio_free(GPIO_NR_PALMTX_BL_POWER); |
| 238 | gpio_free(GPIO_NR_PALMTX_LCD_POWER); |
| 239 | } |
| 240 | |
| 241 | static struct platform_pwm_backlight_data palmtx_backlight_data = { |
| 242 | .pwm_id = 0, |
| 243 | .max_brightness = PALMTX_MAX_INTENSITY, |
| 244 | .dft_brightness = PALMTX_MAX_INTENSITY, |
| 245 | .pwm_period_ns = PALMTX_PERIOD_NS, |
| 246 | .init = palmtx_backlight_init, |
| 247 | .notify = palmtx_backlight_notify, |
| 248 | .exit = palmtx_backlight_exit, |
| 249 | }; |
| 250 | |
| 251 | static struct platform_device palmtx_backlight = { |
| 252 | .name = "pwm-backlight", |
| 253 | .dev = { |
| 254 | .parent = &pxa27x_device_pwm0.dev, |
| 255 | .platform_data = &palmtx_backlight_data, |
| 256 | }, |
| 257 | }; |
| 258 | |
| 259 | /****************************************************************************** |
| 260 | * IrDA |
| 261 | ******************************************************************************/ |
Marek Vasut | a730b32 | 2008-11-20 17:34:57 +0100 | [diff] [blame] | 262 | static int palmtx_irda_startup(struct device *dev) |
| 263 | { |
| 264 | int err; |
| 265 | err = gpio_request(GPIO_NR_PALMTX_IR_DISABLE, "IR DISABLE"); |
| 266 | if (err) |
| 267 | goto err; |
| 268 | err = gpio_direction_output(GPIO_NR_PALMTX_IR_DISABLE, 1); |
| 269 | if (err) |
| 270 | gpio_free(GPIO_NR_PALMTX_IR_DISABLE); |
| 271 | err: |
| 272 | return err; |
| 273 | } |
| 274 | |
| 275 | static void palmtx_irda_shutdown(struct device *dev) |
| 276 | { |
| 277 | gpio_free(GPIO_NR_PALMTX_IR_DISABLE); |
| 278 | } |
| 279 | |
Marek Vašut | b5e4ad5 | 2008-07-07 17:25:46 +0100 | [diff] [blame] | 280 | static void palmtx_irda_transceiver_mode(struct device *dev, int mode) |
| 281 | { |
| 282 | gpio_set_value(GPIO_NR_PALMTX_IR_DISABLE, mode & IR_OFF); |
| 283 | pxa2xx_transceiver_mode(dev, mode); |
| 284 | } |
| 285 | |
| 286 | static struct pxaficp_platform_data palmtx_ficp_platform_data = { |
Marek Vasut | a730b32 | 2008-11-20 17:34:57 +0100 | [diff] [blame] | 287 | .startup = palmtx_irda_startup, |
| 288 | .shutdown = palmtx_irda_shutdown, |
Marek Vašut | b5e4ad5 | 2008-07-07 17:25:46 +0100 | [diff] [blame] | 289 | .transceiver_cap = IR_SIRMODE | IR_FIRMODE | IR_OFF, |
| 290 | .transceiver_mode = palmtx_irda_transceiver_mode, |
| 291 | }; |
| 292 | |
| 293 | /****************************************************************************** |
| 294 | * UDC |
| 295 | ******************************************************************************/ |
Marek Vasut | 8768dc9 | 2009-04-23 11:12:37 +0200 | [diff] [blame] | 296 | static struct gpio_vbus_mach_info palmtx_udc_info = { |
Marek Vašut | b5e4ad5 | 2008-07-07 17:25:46 +0100 | [diff] [blame] | 297 | .gpio_vbus = GPIO_NR_PALMTX_USB_DETECT_N, |
| 298 | .gpio_vbus_inverted = 1, |
Marek Vasut | efb12cd | 2009-04-12 16:37:23 +0200 | [diff] [blame] | 299 | .gpio_pullup = GPIO_NR_PALMTX_USB_PULLUP, |
Marek Vasut | 8768dc9 | 2009-04-23 11:12:37 +0200 | [diff] [blame] | 300 | }; |
| 301 | |
| 302 | static struct platform_device palmtx_gpio_vbus = { |
| 303 | .name = "gpio-vbus", |
| 304 | .id = -1, |
| 305 | .dev = { |
| 306 | .platform_data = &palmtx_udc_info, |
| 307 | }, |
Marek Vašut | b5e4ad5 | 2008-07-07 17:25:46 +0100 | [diff] [blame] | 308 | }; |
| 309 | |
| 310 | /****************************************************************************** |
Marek Vašut | d4b19c4 | 2008-07-07 17:31:58 +0100 | [diff] [blame] | 311 | * Power supply |
| 312 | ******************************************************************************/ |
| 313 | static int power_supply_init(struct device *dev) |
| 314 | { |
| 315 | int ret; |
| 316 | |
| 317 | ret = gpio_request(GPIO_NR_PALMTX_POWER_DETECT, "CABLE_STATE_AC"); |
| 318 | if (ret) |
Marek Vasut | a730b32 | 2008-11-20 17:34:57 +0100 | [diff] [blame] | 319 | goto err1; |
| 320 | ret = gpio_direction_input(GPIO_NR_PALMTX_POWER_DETECT); |
Marek Vašut | d4b19c4 | 2008-07-07 17:31:58 +0100 | [diff] [blame] | 321 | if (ret) |
Marek Vasut | a730b32 | 2008-11-20 17:34:57 +0100 | [diff] [blame] | 322 | goto err2; |
Marek Vašut | d4b19c4 | 2008-07-07 17:31:58 +0100 | [diff] [blame] | 323 | |
| 324 | return 0; |
| 325 | |
Marek Vasut | a730b32 | 2008-11-20 17:34:57 +0100 | [diff] [blame] | 326 | err2: |
Marek Vašut | d4b19c4 | 2008-07-07 17:31:58 +0100 | [diff] [blame] | 327 | gpio_free(GPIO_NR_PALMTX_POWER_DETECT); |
Marek Vasut | a730b32 | 2008-11-20 17:34:57 +0100 | [diff] [blame] | 328 | err1: |
Marek Vašut | d4b19c4 | 2008-07-07 17:31:58 +0100 | [diff] [blame] | 329 | return ret; |
| 330 | } |
| 331 | |
| 332 | static int palmtx_is_ac_online(void) |
| 333 | { |
| 334 | return gpio_get_value(GPIO_NR_PALMTX_POWER_DETECT); |
| 335 | } |
| 336 | |
Marek Vašut | d4b19c4 | 2008-07-07 17:31:58 +0100 | [diff] [blame] | 337 | static void power_supply_exit(struct device *dev) |
| 338 | { |
Marek Vašut | d4b19c4 | 2008-07-07 17:31:58 +0100 | [diff] [blame] | 339 | gpio_free(GPIO_NR_PALMTX_POWER_DETECT); |
| 340 | } |
| 341 | |
| 342 | static char *palmtx_supplicants[] = { |
| 343 | "main-battery", |
| 344 | }; |
| 345 | |
| 346 | static struct pda_power_pdata power_supply_info = { |
| 347 | .init = power_supply_init, |
| 348 | .is_ac_online = palmtx_is_ac_online, |
Marek Vašut | d4b19c4 | 2008-07-07 17:31:58 +0100 | [diff] [blame] | 349 | .exit = power_supply_exit, |
| 350 | .supplied_to = palmtx_supplicants, |
| 351 | .num_supplicants = ARRAY_SIZE(palmtx_supplicants), |
| 352 | }; |
| 353 | |
| 354 | static struct platform_device power_supply = { |
| 355 | .name = "pda-power", |
| 356 | .id = -1, |
| 357 | .dev = { |
| 358 | .platform_data = &power_supply_info, |
| 359 | }, |
| 360 | }; |
| 361 | |
| 362 | /****************************************************************************** |
Marek Vašut | 4e9687d | 2008-09-11 19:37:32 +0100 | [diff] [blame] | 363 | * WM97xx battery |
| 364 | ******************************************************************************/ |
| 365 | static struct wm97xx_batt_info wm97xx_batt_pdata = { |
| 366 | .batt_aux = WM97XX_AUX_ID3, |
| 367 | .temp_aux = WM97XX_AUX_ID2, |
| 368 | .charge_gpio = -1, |
| 369 | .max_voltage = PALMTX_BAT_MAX_VOLTAGE, |
| 370 | .min_voltage = PALMTX_BAT_MIN_VOLTAGE, |
| 371 | .batt_mult = 1000, |
| 372 | .batt_div = 414, |
| 373 | .temp_mult = 1, |
| 374 | .temp_div = 1, |
| 375 | .batt_tech = POWER_SUPPLY_TECHNOLOGY_LIPO, |
| 376 | .batt_name = "main-batt", |
| 377 | }; |
| 378 | |
| 379 | /****************************************************************************** |
Marek Vasut | e91fb91 | 2009-04-17 11:37:35 +0200 | [diff] [blame] | 380 | * aSoC audio |
| 381 | ******************************************************************************/ |
| 382 | static struct palm27x_asoc_info palmtx_asoc_pdata = { |
| 383 | .jack_gpio = GPIO_NR_PALMTX_EARPHONE_DETECT, |
| 384 | }; |
| 385 | |
| 386 | static pxa2xx_audio_ops_t palmtx_ac97_pdata = { |
| 387 | .reset_gpio = 95, |
| 388 | }; |
| 389 | |
| 390 | static struct platform_device palmtx_asoc = { |
| 391 | .name = "palm27x-asoc", |
| 392 | .id = -1, |
| 393 | .dev = { |
| 394 | .platform_data = &palmtx_asoc_pdata, |
| 395 | }, |
| 396 | }; |
| 397 | |
| 398 | /****************************************************************************** |
Marek Vašut | b5e4ad5 | 2008-07-07 17:25:46 +0100 | [diff] [blame] | 399 | * Framebuffer |
| 400 | ******************************************************************************/ |
| 401 | static struct pxafb_mode_info palmtx_lcd_modes[] = { |
| 402 | { |
| 403 | .pixclock = 57692, |
| 404 | .xres = 320, |
| 405 | .yres = 480, |
| 406 | .bpp = 16, |
| 407 | |
| 408 | .left_margin = 32, |
| 409 | .right_margin = 1, |
| 410 | .upper_margin = 7, |
| 411 | .lower_margin = 1, |
| 412 | |
| 413 | .hsync_len = 4, |
| 414 | .vsync_len = 1, |
| 415 | }, |
| 416 | }; |
| 417 | |
| 418 | static struct pxafb_mach_info palmtx_lcd_screen = { |
| 419 | .modes = palmtx_lcd_modes, |
| 420 | .num_modes = ARRAY_SIZE(palmtx_lcd_modes), |
| 421 | .lcd_conn = LCD_COLOR_TFT_16BPP | LCD_PCLK_EDGE_FALL, |
| 422 | }; |
| 423 | |
| 424 | /****************************************************************************** |
Marek Vasut | 81854f8 | 2009-03-28 12:37:42 +0100 | [diff] [blame] | 425 | * Power management - standby |
| 426 | ******************************************************************************/ |
Marek Vasut | fc9c1b6 | 2009-05-14 11:27:00 +0200 | [diff] [blame] | 427 | static void __init palmtx_pm_init(void) |
Marek Vasut | 81854f8 | 2009-03-28 12:37:42 +0100 | [diff] [blame] | 428 | { |
Marek Vasut | fc9c1b6 | 2009-05-14 11:27:00 +0200 | [diff] [blame] | 429 | static u32 resume[] = { |
| 430 | 0xe3a00101, /* mov r0, #0x40000000 */ |
| 431 | 0xe380060f, /* orr r0, r0, #0x00f00000 */ |
| 432 | 0xe590f008, /* ldr pc, [r0, #0x08] */ |
| 433 | }; |
Marek Vasut | 81854f8 | 2009-03-28 12:37:42 +0100 | [diff] [blame] | 434 | |
Marek Vasut | fc9c1b6 | 2009-05-14 11:27:00 +0200 | [diff] [blame] | 435 | /* copy the bootloader */ |
| 436 | memcpy(phys_to_virt(PALMTX_STR_BASE), resume, sizeof(resume)); |
Marek Vasut | 81854f8 | 2009-03-28 12:37:42 +0100 | [diff] [blame] | 437 | } |
| 438 | |
Marek Vasut | 81854f8 | 2009-03-28 12:37:42 +0100 | [diff] [blame] | 439 | /****************************************************************************** |
Marek Vašut | b5e4ad5 | 2008-07-07 17:25:46 +0100 | [diff] [blame] | 440 | * Machine init |
| 441 | ******************************************************************************/ |
| 442 | static struct platform_device *devices[] __initdata = { |
| 443 | #if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE) |
| 444 | &palmtx_pxa_keys, |
| 445 | #endif |
| 446 | &palmtx_backlight, |
Marek Vašut | d4b19c4 | 2008-07-07 17:31:58 +0100 | [diff] [blame] | 447 | &power_supply, |
Marek Vasut | e91fb91 | 2009-04-17 11:37:35 +0200 | [diff] [blame] | 448 | &palmtx_asoc, |
Marek Vasut | 8768dc9 | 2009-04-23 11:12:37 +0200 | [diff] [blame] | 449 | &palmtx_gpio_vbus, |
Marek Vašut | b5e4ad5 | 2008-07-07 17:25:46 +0100 | [diff] [blame] | 450 | }; |
| 451 | |
| 452 | static struct map_desc palmtx_io_desc[] __initdata = { |
| 453 | { |
| 454 | .virtual = PALMTX_PCMCIA_VIRT, |
| 455 | .pfn = __phys_to_pfn(PALMTX_PCMCIA_PHYS), |
| 456 | .length = PALMTX_PCMCIA_SIZE, |
| 457 | .type = MT_DEVICE |
| 458 | }, |
| 459 | }; |
| 460 | |
| 461 | static void __init palmtx_map_io(void) |
| 462 | { |
| 463 | pxa_map_io(); |
| 464 | iotable_init(palmtx_io_desc, ARRAY_SIZE(palmtx_io_desc)); |
| 465 | } |
| 466 | |
Marek Vasut | a730b32 | 2008-11-20 17:34:57 +0100 | [diff] [blame] | 467 | /* setup udc GPIOs initial state */ |
| 468 | static void __init palmtx_udc_init(void) |
| 469 | { |
Marek Vasut | efb12cd | 2009-04-12 16:37:23 +0200 | [diff] [blame] | 470 | if (!gpio_request(GPIO_NR_PALMTX_USB_PULLUP, "UDC Vbus")) { |
| 471 | gpio_direction_output(GPIO_NR_PALMTX_USB_PULLUP, 1); |
| 472 | gpio_free(GPIO_NR_PALMTX_USB_PULLUP); |
Marek Vasut | a730b32 | 2008-11-20 17:34:57 +0100 | [diff] [blame] | 473 | } |
| 474 | } |
| 475 | |
| 476 | |
Marek Vašut | b5e4ad5 | 2008-07-07 17:25:46 +0100 | [diff] [blame] | 477 | static void __init palmtx_init(void) |
| 478 | { |
| 479 | pxa2xx_mfp_config(ARRAY_AND_SIZE(palmtx_pin_config)); |
| 480 | |
Marek Vasut | fc9c1b6 | 2009-05-14 11:27:00 +0200 | [diff] [blame] | 481 | palmtx_pm_init(); |
Marek Vašut | b5e4ad5 | 2008-07-07 17:25:46 +0100 | [diff] [blame] | 482 | set_pxa_fb_info(&palmtx_lcd_screen); |
| 483 | pxa_set_mci_info(&palmtx_mci_platform_data); |
Marek Vasut | a730b32 | 2008-11-20 17:34:57 +0100 | [diff] [blame] | 484 | palmtx_udc_init(); |
Marek Vasut | e91fb91 | 2009-04-17 11:37:35 +0200 | [diff] [blame] | 485 | pxa_set_ac97_info(&palmtx_ac97_pdata); |
Marek Vašut | b5e4ad5 | 2008-07-07 17:25:46 +0100 | [diff] [blame] | 486 | pxa_set_ficp_info(&palmtx_ficp_platform_data); |
| 487 | pxa_set_keypad_info(&palmtx_keypad_platform_data); |
Marek Vašut | 4e9687d | 2008-09-11 19:37:32 +0100 | [diff] [blame] | 488 | wm97xx_bat_set_pdata(&wm97xx_batt_pdata); |
Marek Vašut | b5e4ad5 | 2008-07-07 17:25:46 +0100 | [diff] [blame] | 489 | |
| 490 | platform_add_devices(devices, ARRAY_SIZE(devices)); |
| 491 | } |
| 492 | |
| 493 | MACHINE_START(PALMTX, "Palm T|X") |
| 494 | .phys_io = PALMTX_PHYS_IO_START, |
| 495 | .io_pg_offst = io_p2v(0x40000000), |
| 496 | .boot_params = 0xa0000100, |
| 497 | .map_io = palmtx_map_io, |
| 498 | .init_irq = pxa27x_init_irq, |
| 499 | .timer = &pxa_timer, |
| 500 | .init_machine = palmtx_init |
| 501 | MACHINE_END |