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 Vasut | 3eb37ff | 2009-07-18 16:51:41 +0200 | [diff] [blame] | 31 | #include <linux/mtd/nand.h> |
| 32 | #include <linux/mtd/partitions.h> |
Marek Vasut | 91cf6a9 | 2009-07-27 02:07:41 +0200 | [diff] [blame] | 33 | #include <linux/mtd/mtd.h> |
| 34 | #include <linux/mtd/physmap.h> |
Marek Vašut | b5e4ad5 | 2008-07-07 17:25:46 +0100 | [diff] [blame] | 35 | |
| 36 | #include <asm/mach-types.h> |
| 37 | #include <asm/mach/arch.h> |
| 38 | #include <asm/mach/map.h> |
| 39 | |
Eric Miao | 51c6298 | 2009-01-02 23:17:22 +0800 | [diff] [blame] | 40 | #include <mach/pxa27x.h> |
Russell King | a09e64f | 2008-08-05 16:14:15 +0100 | [diff] [blame] | 41 | #include <mach/audio.h> |
| 42 | #include <mach/palmtx.h> |
| 43 | #include <mach/mmc.h> |
| 44 | #include <mach/pxafb.h> |
Russell King | a09e64f | 2008-08-05 16:14:15 +0100 | [diff] [blame] | 45 | #include <mach/irda.h> |
| 46 | #include <mach/pxa27x_keypad.h> |
| 47 | #include <mach/udc.h> |
Marek Vasut | e91fb91 | 2009-04-17 11:37:35 +0200 | [diff] [blame] | 48 | #include <mach/palmasoc.h> |
Marek Vašut | b5e4ad5 | 2008-07-07 17:25:46 +0100 | [diff] [blame] | 49 | |
| 50 | #include "generic.h" |
| 51 | #include "devices.h" |
| 52 | |
| 53 | /****************************************************************************** |
| 54 | * Pin configuration |
| 55 | ******************************************************************************/ |
| 56 | static unsigned long palmtx_pin_config[] __initdata = { |
| 57 | /* MMC */ |
| 58 | GPIO32_MMC_CLK, |
| 59 | GPIO92_MMC_DAT_0, |
| 60 | GPIO109_MMC_DAT_1, |
| 61 | GPIO110_MMC_DAT_2, |
| 62 | GPIO111_MMC_DAT_3, |
| 63 | GPIO112_MMC_CMD, |
Marek Vasut | a730b32 | 2008-11-20 17:34:57 +0100 | [diff] [blame] | 64 | GPIO14_GPIO, /* SD detect */ |
| 65 | GPIO114_GPIO, /* SD power */ |
| 66 | GPIO115_GPIO, /* SD r/o switch */ |
Marek Vašut | b5e4ad5 | 2008-07-07 17:25:46 +0100 | [diff] [blame] | 67 | |
| 68 | /* AC97 */ |
| 69 | GPIO28_AC97_BITCLK, |
| 70 | GPIO29_AC97_SDATA_IN_0, |
| 71 | GPIO30_AC97_SDATA_OUT, |
| 72 | GPIO31_AC97_SYNC, |
Marek Vasut | 6ec04f4 | 2009-05-22 01:39:10 +0200 | [diff] [blame] | 73 | GPIO89_AC97_SYSCLK, |
Marek Vasut | efb12cd | 2009-04-12 16:37:23 +0200 | [diff] [blame] | 74 | GPIO95_AC97_nRESET, |
Marek Vašut | b5e4ad5 | 2008-07-07 17:25:46 +0100 | [diff] [blame] | 75 | |
| 76 | /* IrDA */ |
Marek Vasut | a730b32 | 2008-11-20 17:34:57 +0100 | [diff] [blame] | 77 | GPIO40_GPIO, /* ir disable */ |
Marek Vašut | b5e4ad5 | 2008-07-07 17:25:46 +0100 | [diff] [blame] | 78 | GPIO46_FICP_RXD, |
| 79 | GPIO47_FICP_TXD, |
| 80 | |
| 81 | /* PWM */ |
| 82 | GPIO16_PWM0_OUT, |
| 83 | |
| 84 | /* USB */ |
Marek Vasut | a730b32 | 2008-11-20 17:34:57 +0100 | [diff] [blame] | 85 | GPIO13_GPIO, /* usb detect */ |
Marek Vasut | efb12cd | 2009-04-12 16:37:23 +0200 | [diff] [blame] | 86 | GPIO93_GPIO, /* usb power */ |
Marek Vašut | 3597840 | 2008-07-07 17:28:59 +0100 | [diff] [blame] | 87 | |
| 88 | /* PCMCIA */ |
| 89 | GPIO48_nPOE, |
| 90 | GPIO49_nPWE, |
| 91 | GPIO50_nPIOR, |
| 92 | GPIO51_nPIOW, |
| 93 | GPIO85_nPCE_1, |
| 94 | GPIO54_nPCE_2, |
| 95 | GPIO79_PSKTSEL, |
| 96 | GPIO55_nPREG, |
| 97 | GPIO56_nPWAIT, |
| 98 | GPIO57_nIOIS16, |
Marek Vasut | a730b32 | 2008-11-20 17:34:57 +0100 | [diff] [blame] | 99 | GPIO94_GPIO, /* wifi power 1 */ |
| 100 | GPIO108_GPIO, /* wifi power 2 */ |
| 101 | GPIO116_GPIO, /* wifi ready */ |
| 102 | |
| 103 | /* MATRIX KEYPAD */ |
Marek Vasut | 81854f8 | 2009-03-28 12:37:42 +0100 | [diff] [blame] | 104 | GPIO100_KP_MKIN_0 | WAKEUP_ON_LEVEL_HIGH, |
| 105 | GPIO101_KP_MKIN_1 | WAKEUP_ON_LEVEL_HIGH, |
| 106 | GPIO102_KP_MKIN_2 | WAKEUP_ON_LEVEL_HIGH, |
| 107 | GPIO97_KP_MKIN_3 | WAKEUP_ON_LEVEL_HIGH, |
Marek Vasut | a730b32 | 2008-11-20 17:34:57 +0100 | [diff] [blame] | 108 | GPIO103_KP_MKOUT_0, |
| 109 | GPIO104_KP_MKOUT_1, |
| 110 | GPIO105_KP_MKOUT_2, |
| 111 | |
| 112 | /* LCD */ |
Eric Miao | bedbda9 | 2010-01-04 11:37:14 +0800 | [diff] [blame] | 113 | GPIOxx_LCD_TFT_16BPP, |
Marek Vasut | a730b32 | 2008-11-20 17:34:57 +0100 | [diff] [blame] | 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 | 3eb37ff | 2009-07-18 16:51:41 +0200 | [diff] [blame] | 119 | /* NAND */ |
| 120 | GPIO15_nCS_1, |
| 121 | GPIO18_RDY, |
| 122 | |
Marek Vasut | a730b32 | 2008-11-20 17:34:57 +0100 | [diff] [blame] | 123 | /* MISC. */ |
| 124 | GPIO10_GPIO, /* hotsync button */ |
| 125 | GPIO12_GPIO, /* power detect */ |
| 126 | GPIO107_GPIO, /* earphone detect */ |
Marek Vašut | b5e4ad5 | 2008-07-07 17:25:46 +0100 | [diff] [blame] | 127 | }; |
| 128 | |
| 129 | /****************************************************************************** |
Marek Vasut | 91cf6a9 | 2009-07-27 02:07:41 +0200 | [diff] [blame] | 130 | * NOR Flash |
| 131 | ******************************************************************************/ |
| 132 | static struct mtd_partition palmtx_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 palmtx_flash_data[] = { |
| 142 | { |
| 143 | .width = 2, /* bankwidth in bytes */ |
| 144 | .parts = palmtx_partitions, |
| 145 | .nr_parts = ARRAY_SIZE(palmtx_partitions) |
| 146 | } |
| 147 | }; |
| 148 | |
| 149 | static struct resource palmtx_flash_resource = { |
| 150 | .start = PXA_CS0_PHYS, |
| 151 | .end = PXA_CS0_PHYS + SZ_8M - 1, |
| 152 | .flags = IORESOURCE_MEM, |
| 153 | }; |
| 154 | |
| 155 | static struct platform_device palmtx_flash = { |
| 156 | .name = "physmap-flash", |
| 157 | .id = 0, |
| 158 | .resource = &palmtx_flash_resource, |
| 159 | .num_resources = 1, |
| 160 | .dev = { |
| 161 | .platform_data = palmtx_flash_data, |
| 162 | }, |
| 163 | }; |
| 164 | |
| 165 | /****************************************************************************** |
Marek Vašut | b5e4ad5 | 2008-07-07 17:25:46 +0100 | [diff] [blame] | 166 | * SD/MMC card controller |
| 167 | ******************************************************************************/ |
Marek Vašut | b5e4ad5 | 2008-07-07 17:25:46 +0100 | [diff] [blame] | 168 | static struct pxamci_platform_data palmtx_mci_platform_data = { |
Robert Jarzmik | 7a64825 | 2009-07-06 22:16:42 +0200 | [diff] [blame] | 169 | .ocr_mask = MMC_VDD_32_33 | MMC_VDD_33_34, |
| 170 | .gpio_card_detect = GPIO_NR_PALMTX_SD_DETECT_N, |
| 171 | .gpio_card_ro = GPIO_NR_PALMTX_SD_READONLY, |
| 172 | .gpio_power = GPIO_NR_PALMTX_SD_POWER, |
Eric Miao | f97cab2 | 2010-04-14 07:00:42 +0800 | [diff] [blame] | 173 | .detect_delay_ms = 200, |
Marek Vašut | b5e4ad5 | 2008-07-07 17:25:46 +0100 | [diff] [blame] | 174 | }; |
| 175 | |
| 176 | /****************************************************************************** |
| 177 | * GPIO keyboard |
| 178 | ******************************************************************************/ |
| 179 | static unsigned int palmtx_matrix_keys[] = { |
| 180 | KEY(0, 0, KEY_POWER), |
| 181 | KEY(0, 1, KEY_F1), |
| 182 | KEY(0, 2, KEY_ENTER), |
| 183 | |
| 184 | KEY(1, 0, KEY_F2), |
| 185 | KEY(1, 1, KEY_F3), |
| 186 | KEY(1, 2, KEY_F4), |
| 187 | |
| 188 | KEY(2, 0, KEY_UP), |
| 189 | KEY(2, 2, KEY_DOWN), |
| 190 | |
| 191 | KEY(3, 0, KEY_RIGHT), |
| 192 | KEY(3, 2, KEY_LEFT), |
Marek Vašut | b5e4ad5 | 2008-07-07 17:25:46 +0100 | [diff] [blame] | 193 | }; |
| 194 | |
| 195 | static struct pxa27x_keypad_platform_data palmtx_keypad_platform_data = { |
| 196 | .matrix_key_rows = 4, |
| 197 | .matrix_key_cols = 3, |
| 198 | .matrix_key_map = palmtx_matrix_keys, |
| 199 | .matrix_key_map_size = ARRAY_SIZE(palmtx_matrix_keys), |
| 200 | |
| 201 | .debounce_interval = 30, |
| 202 | }; |
| 203 | |
| 204 | /****************************************************************************** |
| 205 | * GPIO keys |
| 206 | ******************************************************************************/ |
| 207 | static struct gpio_keys_button palmtx_pxa_buttons[] = { |
| 208 | {KEY_F8, GPIO_NR_PALMTX_HOTSYNC_BUTTON_N, 1, "HotSync Button" }, |
| 209 | }; |
| 210 | |
| 211 | static struct gpio_keys_platform_data palmtx_pxa_keys_data = { |
| 212 | .buttons = palmtx_pxa_buttons, |
| 213 | .nbuttons = ARRAY_SIZE(palmtx_pxa_buttons), |
| 214 | }; |
| 215 | |
| 216 | static struct platform_device palmtx_pxa_keys = { |
| 217 | .name = "gpio-keys", |
| 218 | .id = -1, |
| 219 | .dev = { |
| 220 | .platform_data = &palmtx_pxa_keys_data, |
| 221 | }, |
| 222 | }; |
| 223 | |
| 224 | /****************************************************************************** |
| 225 | * Backlight |
| 226 | ******************************************************************************/ |
| 227 | static int palmtx_backlight_init(struct device *dev) |
| 228 | { |
| 229 | int ret; |
| 230 | |
| 231 | ret = gpio_request(GPIO_NR_PALMTX_BL_POWER, "BL POWER"); |
| 232 | if (ret) |
| 233 | goto err; |
Marek Vasut | a730b32 | 2008-11-20 17:34:57 +0100 | [diff] [blame] | 234 | ret = gpio_direction_output(GPIO_NR_PALMTX_BL_POWER, 0); |
| 235 | if (ret) |
| 236 | goto err2; |
Marek Vašut | b5e4ad5 | 2008-07-07 17:25:46 +0100 | [diff] [blame] | 237 | ret = gpio_request(GPIO_NR_PALMTX_LCD_POWER, "LCD POWER"); |
| 238 | if (ret) |
| 239 | goto err2; |
Marek Vasut | a730b32 | 2008-11-20 17:34:57 +0100 | [diff] [blame] | 240 | ret = gpio_direction_output(GPIO_NR_PALMTX_LCD_POWER, 0); |
| 241 | if (ret) |
| 242 | goto err3; |
Marek Vašut | b5e4ad5 | 2008-07-07 17:25:46 +0100 | [diff] [blame] | 243 | |
| 244 | return 0; |
Marek Vasut | a730b32 | 2008-11-20 17:34:57 +0100 | [diff] [blame] | 245 | err3: |
| 246 | gpio_free(GPIO_NR_PALMTX_LCD_POWER); |
Marek Vašut | b5e4ad5 | 2008-07-07 17:25:46 +0100 | [diff] [blame] | 247 | err2: |
| 248 | gpio_free(GPIO_NR_PALMTX_BL_POWER); |
| 249 | err: |
| 250 | return ret; |
| 251 | } |
| 252 | |
Eric Miao | 2d51a52 | 2010-01-04 11:42:01 +0800 | [diff] [blame] | 253 | static int palmtx_backlight_notify(struct device *dev, int brightness) |
Marek Vašut | b5e4ad5 | 2008-07-07 17:25:46 +0100 | [diff] [blame] | 254 | { |
| 255 | gpio_set_value(GPIO_NR_PALMTX_BL_POWER, brightness); |
| 256 | gpio_set_value(GPIO_NR_PALMTX_LCD_POWER, brightness); |
| 257 | return brightness; |
| 258 | } |
| 259 | |
| 260 | static void palmtx_backlight_exit(struct device *dev) |
| 261 | { |
| 262 | gpio_free(GPIO_NR_PALMTX_BL_POWER); |
| 263 | gpio_free(GPIO_NR_PALMTX_LCD_POWER); |
| 264 | } |
| 265 | |
| 266 | static struct platform_pwm_backlight_data palmtx_backlight_data = { |
| 267 | .pwm_id = 0, |
| 268 | .max_brightness = PALMTX_MAX_INTENSITY, |
| 269 | .dft_brightness = PALMTX_MAX_INTENSITY, |
| 270 | .pwm_period_ns = PALMTX_PERIOD_NS, |
| 271 | .init = palmtx_backlight_init, |
| 272 | .notify = palmtx_backlight_notify, |
| 273 | .exit = palmtx_backlight_exit, |
| 274 | }; |
| 275 | |
| 276 | static struct platform_device palmtx_backlight = { |
| 277 | .name = "pwm-backlight", |
| 278 | .dev = { |
| 279 | .parent = &pxa27x_device_pwm0.dev, |
| 280 | .platform_data = &palmtx_backlight_data, |
| 281 | }, |
| 282 | }; |
| 283 | |
| 284 | /****************************************************************************** |
| 285 | * IrDA |
| 286 | ******************************************************************************/ |
Marek Vašut | b5e4ad5 | 2008-07-07 17:25:46 +0100 | [diff] [blame] | 287 | static struct pxaficp_platform_data palmtx_ficp_platform_data = { |
Marek Vasut | c4bd017 | 2009-07-17 12:50:43 +0200 | [diff] [blame] | 288 | .gpio_pwdown = GPIO_NR_PALMTX_IR_DISABLE, |
| 289 | .transceiver_cap = IR_SIRMODE | IR_OFF, |
Marek Vašut | b5e4ad5 | 2008-07-07 17:25:46 +0100 | [diff] [blame] | 290 | }; |
| 291 | |
| 292 | /****************************************************************************** |
| 293 | * UDC |
| 294 | ******************************************************************************/ |
Marek Vasut | 8768dc9 | 2009-04-23 11:12:37 +0200 | [diff] [blame] | 295 | static struct gpio_vbus_mach_info palmtx_udc_info = { |
Marek Vašut | b5e4ad5 | 2008-07-07 17:25:46 +0100 | [diff] [blame] | 296 | .gpio_vbus = GPIO_NR_PALMTX_USB_DETECT_N, |
| 297 | .gpio_vbus_inverted = 1, |
Marek Vasut | efb12cd | 2009-04-12 16:37:23 +0200 | [diff] [blame] | 298 | .gpio_pullup = GPIO_NR_PALMTX_USB_PULLUP, |
Marek Vasut | 8768dc9 | 2009-04-23 11:12:37 +0200 | [diff] [blame] | 299 | }; |
| 300 | |
| 301 | static struct platform_device palmtx_gpio_vbus = { |
| 302 | .name = "gpio-vbus", |
| 303 | .id = -1, |
| 304 | .dev = { |
| 305 | .platform_data = &palmtx_udc_info, |
| 306 | }, |
Marek Vašut | b5e4ad5 | 2008-07-07 17:25:46 +0100 | [diff] [blame] | 307 | }; |
| 308 | |
| 309 | /****************************************************************************** |
Marek Vašut | d4b19c4 | 2008-07-07 17:31:58 +0100 | [diff] [blame] | 310 | * Power supply |
| 311 | ******************************************************************************/ |
| 312 | static int power_supply_init(struct device *dev) |
| 313 | { |
| 314 | int ret; |
| 315 | |
| 316 | ret = gpio_request(GPIO_NR_PALMTX_POWER_DETECT, "CABLE_STATE_AC"); |
| 317 | if (ret) |
Marek Vasut | a730b32 | 2008-11-20 17:34:57 +0100 | [diff] [blame] | 318 | goto err1; |
| 319 | ret = gpio_direction_input(GPIO_NR_PALMTX_POWER_DETECT); |
Marek Vašut | d4b19c4 | 2008-07-07 17:31:58 +0100 | [diff] [blame] | 320 | if (ret) |
Marek Vasut | a730b32 | 2008-11-20 17:34:57 +0100 | [diff] [blame] | 321 | goto err2; |
Marek Vašut | d4b19c4 | 2008-07-07 17:31:58 +0100 | [diff] [blame] | 322 | |
| 323 | return 0; |
| 324 | |
Marek Vasut | a730b32 | 2008-11-20 17:34:57 +0100 | [diff] [blame] | 325 | err2: |
Marek Vašut | d4b19c4 | 2008-07-07 17:31:58 +0100 | [diff] [blame] | 326 | gpio_free(GPIO_NR_PALMTX_POWER_DETECT); |
Marek Vasut | a730b32 | 2008-11-20 17:34:57 +0100 | [diff] [blame] | 327 | err1: |
Marek Vašut | d4b19c4 | 2008-07-07 17:31:58 +0100 | [diff] [blame] | 328 | return ret; |
| 329 | } |
| 330 | |
| 331 | static int palmtx_is_ac_online(void) |
| 332 | { |
| 333 | return gpio_get_value(GPIO_NR_PALMTX_POWER_DETECT); |
| 334 | } |
| 335 | |
Marek Vašut | d4b19c4 | 2008-07-07 17:31:58 +0100 | [diff] [blame] | 336 | static void power_supply_exit(struct device *dev) |
| 337 | { |
Marek Vašut | d4b19c4 | 2008-07-07 17:31:58 +0100 | [diff] [blame] | 338 | gpio_free(GPIO_NR_PALMTX_POWER_DETECT); |
| 339 | } |
| 340 | |
| 341 | static char *palmtx_supplicants[] = { |
| 342 | "main-battery", |
| 343 | }; |
| 344 | |
| 345 | static struct pda_power_pdata power_supply_info = { |
| 346 | .init = power_supply_init, |
| 347 | .is_ac_online = palmtx_is_ac_online, |
Marek Vašut | d4b19c4 | 2008-07-07 17:31:58 +0100 | [diff] [blame] | 348 | .exit = power_supply_exit, |
| 349 | .supplied_to = palmtx_supplicants, |
| 350 | .num_supplicants = ARRAY_SIZE(palmtx_supplicants), |
| 351 | }; |
| 352 | |
| 353 | static struct platform_device power_supply = { |
| 354 | .name = "pda-power", |
| 355 | .id = -1, |
| 356 | .dev = { |
| 357 | .platform_data = &power_supply_info, |
| 358 | }, |
| 359 | }; |
| 360 | |
| 361 | /****************************************************************************** |
Marek Vašut | 4e9687d | 2008-09-11 19:37:32 +0100 | [diff] [blame] | 362 | * WM97xx battery |
| 363 | ******************************************************************************/ |
| 364 | static struct wm97xx_batt_info wm97xx_batt_pdata = { |
| 365 | .batt_aux = WM97XX_AUX_ID3, |
| 366 | .temp_aux = WM97XX_AUX_ID2, |
| 367 | .charge_gpio = -1, |
| 368 | .max_voltage = PALMTX_BAT_MAX_VOLTAGE, |
| 369 | .min_voltage = PALMTX_BAT_MIN_VOLTAGE, |
| 370 | .batt_mult = 1000, |
| 371 | .batt_div = 414, |
| 372 | .temp_mult = 1, |
| 373 | .temp_div = 1, |
| 374 | .batt_tech = POWER_SUPPLY_TECHNOLOGY_LIPO, |
| 375 | .batt_name = "main-batt", |
| 376 | }; |
| 377 | |
| 378 | /****************************************************************************** |
Marek Vasut | e91fb91 | 2009-04-17 11:37:35 +0200 | [diff] [blame] | 379 | * aSoC audio |
| 380 | ******************************************************************************/ |
| 381 | static struct palm27x_asoc_info palmtx_asoc_pdata = { |
| 382 | .jack_gpio = GPIO_NR_PALMTX_EARPHONE_DETECT, |
| 383 | }; |
| 384 | |
| 385 | static pxa2xx_audio_ops_t palmtx_ac97_pdata = { |
| 386 | .reset_gpio = 95, |
| 387 | }; |
| 388 | |
| 389 | static struct platform_device palmtx_asoc = { |
| 390 | .name = "palm27x-asoc", |
| 391 | .id = -1, |
| 392 | .dev = { |
| 393 | .platform_data = &palmtx_asoc_pdata, |
| 394 | }, |
| 395 | }; |
| 396 | |
| 397 | /****************************************************************************** |
Marek Vašut | b5e4ad5 | 2008-07-07 17:25:46 +0100 | [diff] [blame] | 398 | * Framebuffer |
| 399 | ******************************************************************************/ |
| 400 | static struct pxafb_mode_info palmtx_lcd_modes[] = { |
| 401 | { |
| 402 | .pixclock = 57692, |
| 403 | .xres = 320, |
| 404 | .yres = 480, |
| 405 | .bpp = 16, |
| 406 | |
| 407 | .left_margin = 32, |
| 408 | .right_margin = 1, |
| 409 | .upper_margin = 7, |
| 410 | .lower_margin = 1, |
| 411 | |
| 412 | .hsync_len = 4, |
| 413 | .vsync_len = 1, |
| 414 | }, |
| 415 | }; |
| 416 | |
| 417 | static struct pxafb_mach_info palmtx_lcd_screen = { |
| 418 | .modes = palmtx_lcd_modes, |
| 419 | .num_modes = ARRAY_SIZE(palmtx_lcd_modes), |
| 420 | .lcd_conn = LCD_COLOR_TFT_16BPP | LCD_PCLK_EDGE_FALL, |
| 421 | }; |
| 422 | |
| 423 | /****************************************************************************** |
Marek Vasut | 3eb37ff | 2009-07-18 16:51:41 +0200 | [diff] [blame] | 424 | * NAND Flash |
| 425 | ******************************************************************************/ |
| 426 | static void palmtx_nand_cmd_ctl(struct mtd_info *mtd, int cmd, |
| 427 | unsigned int ctrl) |
| 428 | { |
| 429 | struct nand_chip *this = mtd->priv; |
| 430 | unsigned long nandaddr = (unsigned long)this->IO_ADDR_W; |
| 431 | |
| 432 | if (cmd == NAND_CMD_NONE) |
| 433 | return; |
| 434 | |
| 435 | if (ctrl & NAND_CLE) |
| 436 | writeb(cmd, PALMTX_NAND_CLE_VIRT); |
| 437 | else if (ctrl & NAND_ALE) |
| 438 | writeb(cmd, PALMTX_NAND_ALE_VIRT); |
| 439 | else |
| 440 | writeb(cmd, nandaddr); |
| 441 | } |
| 442 | |
| 443 | static struct mtd_partition palmtx_partition_info[] = { |
| 444 | [0] = { |
| 445 | .name = "palmtx-0", |
| 446 | .offset = 0, |
| 447 | .size = MTDPART_SIZ_FULL |
| 448 | }, |
| 449 | }; |
| 450 | |
| 451 | static const char *palmtx_part_probes[] = { "cmdlinepart", NULL }; |
| 452 | |
| 453 | struct platform_nand_data palmtx_nand_platdata = { |
| 454 | .chip = { |
| 455 | .nr_chips = 1, |
| 456 | .chip_offset = 0, |
| 457 | .nr_partitions = ARRAY_SIZE(palmtx_partition_info), |
| 458 | .partitions = palmtx_partition_info, |
| 459 | .chip_delay = 20, |
| 460 | .part_probe_types = palmtx_part_probes, |
| 461 | }, |
| 462 | .ctrl = { |
| 463 | .cmd_ctrl = palmtx_nand_cmd_ctl, |
| 464 | }, |
| 465 | }; |
| 466 | |
| 467 | static struct resource palmtx_nand_resource[] = { |
| 468 | [0] = { |
| 469 | .start = PXA_CS1_PHYS, |
| 470 | .end = PXA_CS1_PHYS + SZ_1M - 1, |
| 471 | .flags = IORESOURCE_MEM, |
| 472 | }, |
| 473 | }; |
| 474 | |
| 475 | static struct platform_device palmtx_nand = { |
| 476 | .name = "gen_nand", |
| 477 | .num_resources = ARRAY_SIZE(palmtx_nand_resource), |
| 478 | .resource = palmtx_nand_resource, |
| 479 | .id = -1, |
| 480 | .dev = { |
| 481 | .platform_data = &palmtx_nand_platdata, |
| 482 | } |
| 483 | }; |
| 484 | |
| 485 | /****************************************************************************** |
Marek Vasut | 81854f8 | 2009-03-28 12:37:42 +0100 | [diff] [blame] | 486 | * Power management - standby |
| 487 | ******************************************************************************/ |
Marek Vasut | fc9c1b6 | 2009-05-14 11:27:00 +0200 | [diff] [blame] | 488 | static void __init palmtx_pm_init(void) |
Marek Vasut | 81854f8 | 2009-03-28 12:37:42 +0100 | [diff] [blame] | 489 | { |
Marek Vasut | fc9c1b6 | 2009-05-14 11:27:00 +0200 | [diff] [blame] | 490 | static u32 resume[] = { |
| 491 | 0xe3a00101, /* mov r0, #0x40000000 */ |
| 492 | 0xe380060f, /* orr r0, r0, #0x00f00000 */ |
| 493 | 0xe590f008, /* ldr pc, [r0, #0x08] */ |
| 494 | }; |
Marek Vasut | 81854f8 | 2009-03-28 12:37:42 +0100 | [diff] [blame] | 495 | |
Marek Vasut | fc9c1b6 | 2009-05-14 11:27:00 +0200 | [diff] [blame] | 496 | /* copy the bootloader */ |
| 497 | memcpy(phys_to_virt(PALMTX_STR_BASE), resume, sizeof(resume)); |
Marek Vasut | 81854f8 | 2009-03-28 12:37:42 +0100 | [diff] [blame] | 498 | } |
| 499 | |
Marek Vasut | 81854f8 | 2009-03-28 12:37:42 +0100 | [diff] [blame] | 500 | /****************************************************************************** |
Marek Vašut | b5e4ad5 | 2008-07-07 17:25:46 +0100 | [diff] [blame] | 501 | * Machine init |
| 502 | ******************************************************************************/ |
| 503 | static struct platform_device *devices[] __initdata = { |
| 504 | #if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE) |
| 505 | &palmtx_pxa_keys, |
| 506 | #endif |
| 507 | &palmtx_backlight, |
Marek Vašut | d4b19c4 | 2008-07-07 17:31:58 +0100 | [diff] [blame] | 508 | &power_supply, |
Marek Vasut | e91fb91 | 2009-04-17 11:37:35 +0200 | [diff] [blame] | 509 | &palmtx_asoc, |
Marek Vasut | 8768dc9 | 2009-04-23 11:12:37 +0200 | [diff] [blame] | 510 | &palmtx_gpio_vbus, |
Marek Vasut | 91cf6a9 | 2009-07-27 02:07:41 +0200 | [diff] [blame] | 511 | &palmtx_flash, |
Marek Vasut | 3eb37ff | 2009-07-18 16:51:41 +0200 | [diff] [blame] | 512 | &palmtx_nand, |
Marek Vašut | b5e4ad5 | 2008-07-07 17:25:46 +0100 | [diff] [blame] | 513 | }; |
| 514 | |
| 515 | static struct map_desc palmtx_io_desc[] __initdata = { |
| 516 | { |
| 517 | .virtual = PALMTX_PCMCIA_VIRT, |
| 518 | .pfn = __phys_to_pfn(PALMTX_PCMCIA_PHYS), |
| 519 | .length = PALMTX_PCMCIA_SIZE, |
Marek Vasut | 3eb37ff | 2009-07-18 16:51:41 +0200 | [diff] [blame] | 520 | .type = MT_DEVICE, |
| 521 | }, { |
| 522 | .virtual = PALMTX_NAND_ALE_VIRT, |
| 523 | .pfn = __phys_to_pfn(PALMTX_NAND_ALE_PHYS), |
| 524 | .length = SZ_1M, |
| 525 | .type = MT_DEVICE, |
| 526 | }, { |
| 527 | .virtual = PALMTX_NAND_CLE_VIRT, |
| 528 | .pfn = __phys_to_pfn(PALMTX_NAND_CLE_PHYS), |
| 529 | .length = SZ_1M, |
| 530 | .type = MT_DEVICE, |
| 531 | } |
Marek Vašut | b5e4ad5 | 2008-07-07 17:25:46 +0100 | [diff] [blame] | 532 | }; |
| 533 | |
| 534 | static void __init palmtx_map_io(void) |
| 535 | { |
| 536 | pxa_map_io(); |
| 537 | iotable_init(palmtx_io_desc, ARRAY_SIZE(palmtx_io_desc)); |
| 538 | } |
| 539 | |
Marek Vasut | a730b32 | 2008-11-20 17:34:57 +0100 | [diff] [blame] | 540 | /* setup udc GPIOs initial state */ |
| 541 | static void __init palmtx_udc_init(void) |
| 542 | { |
Marek Vasut | efb12cd | 2009-04-12 16:37:23 +0200 | [diff] [blame] | 543 | if (!gpio_request(GPIO_NR_PALMTX_USB_PULLUP, "UDC Vbus")) { |
| 544 | gpio_direction_output(GPIO_NR_PALMTX_USB_PULLUP, 1); |
| 545 | gpio_free(GPIO_NR_PALMTX_USB_PULLUP); |
Marek Vasut | a730b32 | 2008-11-20 17:34:57 +0100 | [diff] [blame] | 546 | } |
| 547 | } |
| 548 | |
| 549 | |
Marek Vašut | b5e4ad5 | 2008-07-07 17:25:46 +0100 | [diff] [blame] | 550 | static void __init palmtx_init(void) |
| 551 | { |
| 552 | pxa2xx_mfp_config(ARRAY_AND_SIZE(palmtx_pin_config)); |
| 553 | |
Russell King | cc155c6 | 2009-11-09 13:34:08 +0800 | [diff] [blame] | 554 | pxa_set_ffuart_info(NULL); |
| 555 | pxa_set_btuart_info(NULL); |
| 556 | pxa_set_stuart_info(NULL); |
| 557 | |
Marek Vasut | fc9c1b6 | 2009-05-14 11:27:00 +0200 | [diff] [blame] | 558 | palmtx_pm_init(); |
Marek Vašut | b5e4ad5 | 2008-07-07 17:25:46 +0100 | [diff] [blame] | 559 | set_pxa_fb_info(&palmtx_lcd_screen); |
| 560 | pxa_set_mci_info(&palmtx_mci_platform_data); |
Marek Vasut | a730b32 | 2008-11-20 17:34:57 +0100 | [diff] [blame] | 561 | palmtx_udc_init(); |
Marek Vasut | e91fb91 | 2009-04-17 11:37:35 +0200 | [diff] [blame] | 562 | pxa_set_ac97_info(&palmtx_ac97_pdata); |
Marek Vašut | b5e4ad5 | 2008-07-07 17:25:46 +0100 | [diff] [blame] | 563 | pxa_set_ficp_info(&palmtx_ficp_platform_data); |
| 564 | pxa_set_keypad_info(&palmtx_keypad_platform_data); |
Marek Vašut | 4e9687d | 2008-09-11 19:37:32 +0100 | [diff] [blame] | 565 | wm97xx_bat_set_pdata(&wm97xx_batt_pdata); |
Marek Vašut | b5e4ad5 | 2008-07-07 17:25:46 +0100 | [diff] [blame] | 566 | |
| 567 | platform_add_devices(devices, ARRAY_SIZE(devices)); |
| 568 | } |
| 569 | |
| 570 | MACHINE_START(PALMTX, "Palm T|X") |
| 571 | .phys_io = PALMTX_PHYS_IO_START, |
| 572 | .io_pg_offst = io_p2v(0x40000000), |
| 573 | .boot_params = 0xa0000100, |
| 574 | .map_io = palmtx_map_io, |
| 575 | .init_irq = pxa27x_init_irq, |
| 576 | .timer = &pxa_timer, |
| 577 | .init_machine = palmtx_init |
| 578 | MACHINE_END |