Marek | 543cd84 | 2010-03-09 04:04:12 +0100 | [diff] [blame] | 1 | /* |
| 2 | * Hardware definitions for Voipac PXA270 |
| 3 | * |
| 4 | * Copyright (C) 2010 |
| 5 | * Marek Vasut <marek.vasut@gmail.com> |
| 6 | * |
| 7 | * This program is free software; you can redistribute it and/or modify |
| 8 | * it under the terms of the GNU General Public License version 2 as |
| 9 | * published by the Free Software Foundation. |
| 10 | * |
| 11 | */ |
| 12 | |
| 13 | #include <linux/platform_device.h> |
| 14 | #include <linux/delay.h> |
| 15 | #include <linux/irq.h> |
| 16 | #include <linux/gpio_keys.h> |
| 17 | #include <linux/input.h> |
| 18 | #include <linux/gpio.h> |
| 19 | #include <linux/sysdev.h> |
Marek Vasut | 3d98f88 | 2010-03-10 05:24:27 +0100 | [diff] [blame] | 20 | #include <linux/usb/gpio_vbus.h> |
Marek | 543cd84 | 2010-03-09 04:04:12 +0100 | [diff] [blame] | 21 | #include <linux/mtd/mtd.h> |
| 22 | #include <linux/mtd/partitions.h> |
| 23 | #include <linux/mtd/physmap.h> |
Marek Vasut | bcc399b | 2010-05-01 06:54:36 +0200 | [diff] [blame] | 24 | #include <linux/mtd/onenand.h> |
Marek Vasut | 947fb57 | 2010-03-10 05:38:54 +0100 | [diff] [blame] | 25 | #include <linux/dm9000.h> |
Marek Vasut | 1a8fb70 | 2010-03-26 04:45:54 +0100 | [diff] [blame] | 26 | #include <linux/ucb1400.h> |
Marek Vasut | 052345a | 2010-04-26 21:46:07 +0200 | [diff] [blame] | 27 | #include <linux/ata_platform.h> |
Marek Vasut | 54e70bf | 2010-05-21 03:12:43 +0200 | [diff] [blame] | 28 | #include <linux/regulator/max1586.h> |
Marek | 543cd84 | 2010-03-09 04:04:12 +0100 | [diff] [blame] | 29 | |
| 30 | #include <asm/mach-types.h> |
| 31 | #include <asm/mach/arch.h> |
| 32 | |
| 33 | #include <mach/pxa27x.h> |
Marek Vasut | 1a8fb70 | 2010-03-26 04:45:54 +0100 | [diff] [blame] | 34 | #include <mach/audio.h> |
Marek | 543cd84 | 2010-03-09 04:04:12 +0100 | [diff] [blame] | 35 | #include <mach/vpac270.h> |
| 36 | #include <mach/mmc.h> |
| 37 | #include <mach/pxafb.h> |
Marek Vasut | 3d98f88 | 2010-03-10 05:24:27 +0100 | [diff] [blame] | 38 | #include <mach/ohci.h> |
| 39 | #include <mach/pxa27x-udc.h> |
| 40 | #include <mach/udc.h> |
Marek Vasut | 9b2dbdc | 2010-05-21 03:12:45 +0200 | [diff] [blame] | 41 | #include <mach/pata_pxa.h> |
Marek | 543cd84 | 2010-03-09 04:04:12 +0100 | [diff] [blame] | 42 | |
Marek Vasut | 83a4a10 | 2010-03-26 05:38:10 +0100 | [diff] [blame] | 43 | #include <plat/i2c.h> |
| 44 | |
Marek | 543cd84 | 2010-03-09 04:04:12 +0100 | [diff] [blame] | 45 | #include "generic.h" |
| 46 | #include "devices.h" |
| 47 | |
| 48 | /****************************************************************************** |
| 49 | * Pin configuration |
| 50 | ******************************************************************************/ |
| 51 | static unsigned long vpac270_pin_config[] __initdata = { |
| 52 | /* MMC */ |
| 53 | GPIO32_MMC_CLK, |
| 54 | GPIO92_MMC_DAT_0, |
| 55 | GPIO109_MMC_DAT_1, |
| 56 | GPIO110_MMC_DAT_2, |
| 57 | GPIO111_MMC_DAT_3, |
| 58 | GPIO112_MMC_CMD, |
| 59 | GPIO53_GPIO, /* SD detect */ |
| 60 | GPIO52_GPIO, /* SD r/o switch */ |
| 61 | |
| 62 | /* GPIO KEYS */ |
| 63 | GPIO1_GPIO, /* USER BTN */ |
| 64 | |
| 65 | /* LEDs */ |
| 66 | GPIO15_GPIO, /* orange led */ |
| 67 | |
| 68 | /* FFUART */ |
| 69 | GPIO34_FFUART_RXD, |
| 70 | GPIO39_FFUART_TXD, |
| 71 | GPIO27_FFUART_RTS, |
| 72 | GPIO100_FFUART_CTS, |
| 73 | GPIO33_FFUART_DSR, |
| 74 | GPIO40_FFUART_DTR, |
| 75 | GPIO10_FFUART_DCD, |
| 76 | GPIO38_FFUART_RI, |
| 77 | |
| 78 | /* LCD */ |
| 79 | GPIO58_LCD_LDD_0, |
| 80 | GPIO59_LCD_LDD_1, |
| 81 | GPIO60_LCD_LDD_2, |
| 82 | GPIO61_LCD_LDD_3, |
| 83 | GPIO62_LCD_LDD_4, |
| 84 | GPIO63_LCD_LDD_5, |
| 85 | GPIO64_LCD_LDD_6, |
| 86 | GPIO65_LCD_LDD_7, |
| 87 | GPIO66_LCD_LDD_8, |
| 88 | GPIO67_LCD_LDD_9, |
| 89 | GPIO68_LCD_LDD_10, |
| 90 | GPIO69_LCD_LDD_11, |
| 91 | GPIO70_LCD_LDD_12, |
| 92 | GPIO71_LCD_LDD_13, |
| 93 | GPIO72_LCD_LDD_14, |
| 94 | GPIO73_LCD_LDD_15, |
| 95 | GPIO86_LCD_LDD_16, |
| 96 | GPIO87_LCD_LDD_17, |
| 97 | GPIO74_LCD_FCLK, |
| 98 | GPIO75_LCD_LCLK, |
| 99 | GPIO76_LCD_PCLK, |
| 100 | GPIO77_LCD_BIAS, |
Marek Vasut | addff0f | 2010-03-10 04:16:28 +0100 | [diff] [blame] | 101 | |
| 102 | /* PCMCIA */ |
| 103 | GPIO48_nPOE, |
| 104 | GPIO49_nPWE, |
| 105 | GPIO50_nPIOR, |
| 106 | GPIO51_nPIOW, |
| 107 | GPIO85_nPCE_1, |
| 108 | GPIO54_nPCE_2, |
| 109 | GPIO55_nPREG, |
| 110 | GPIO57_nIOIS16, |
| 111 | GPIO56_nPWAIT, |
| 112 | GPIO104_PSKTSEL, |
| 113 | GPIO84_GPIO, /* PCMCIA CD */ |
| 114 | GPIO35_GPIO, /* PCMCIA RDY */ |
| 115 | GPIO107_GPIO, /* PCMCIA PPEN */ |
| 116 | GPIO11_GPIO, /* PCMCIA RESET */ |
| 117 | GPIO17_GPIO, /* CF CD */ |
| 118 | GPIO12_GPIO, /* CF RDY */ |
| 119 | GPIO16_GPIO, /* CF RESET */ |
| 120 | |
Marek Vasut | 3d98f88 | 2010-03-10 05:24:27 +0100 | [diff] [blame] | 121 | /* UHC */ |
| 122 | GPIO88_USBH1_PWR, |
| 123 | GPIO89_USBH1_PEN, |
| 124 | GPIO119_USBH2_PWR, |
| 125 | GPIO120_USBH2_PEN, |
| 126 | |
| 127 | /* UDC */ |
| 128 | GPIO41_GPIO, |
Marek Vasut | 947fb57 | 2010-03-10 05:38:54 +0100 | [diff] [blame] | 129 | |
| 130 | /* Ethernet */ |
| 131 | GPIO114_GPIO, /* IRQ */ |
Marek Vasut | 1a8fb70 | 2010-03-26 04:45:54 +0100 | [diff] [blame] | 132 | |
| 133 | /* AC97 */ |
| 134 | GPIO28_AC97_BITCLK, |
| 135 | GPIO29_AC97_SDATA_IN_0, |
| 136 | GPIO30_AC97_SDATA_OUT, |
| 137 | GPIO31_AC97_SYNC, |
| 138 | GPIO95_AC97_nRESET, |
| 139 | GPIO98_AC97_SYSCLK, |
| 140 | GPIO113_GPIO, /* TS IRQ */ |
Marek Vasut | 83a4a10 | 2010-03-26 05:38:10 +0100 | [diff] [blame] | 141 | |
| 142 | /* I2C */ |
| 143 | GPIO117_I2C_SCL, |
| 144 | GPIO118_I2C_SDA, |
Marek Vasut | 052345a | 2010-04-26 21:46:07 +0200 | [diff] [blame] | 145 | |
| 146 | /* IDE */ |
| 147 | GPIO36_GPIO, /* IDE IRQ */ |
| 148 | GPIO80_DREQ_1, |
Marek | 543cd84 | 2010-03-09 04:04:12 +0100 | [diff] [blame] | 149 | }; |
| 150 | |
| 151 | /****************************************************************************** |
| 152 | * NOR Flash |
| 153 | ******************************************************************************/ |
| 154 | #if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE) |
Marek Vasut | bcc399b | 2010-05-01 06:54:36 +0200 | [diff] [blame] | 155 | static struct mtd_partition vpac270_nor_partitions[] = { |
Marek | 543cd84 | 2010-03-09 04:04:12 +0100 | [diff] [blame] | 156 | { |
| 157 | .name = "Flash", |
| 158 | .offset = 0x00000000, |
| 159 | .size = MTDPART_SIZ_FULL, |
| 160 | } |
| 161 | }; |
| 162 | |
| 163 | static struct physmap_flash_data vpac270_flash_data[] = { |
| 164 | { |
| 165 | .width = 2, /* bankwidth in bytes */ |
Marek Vasut | bcc399b | 2010-05-01 06:54:36 +0200 | [diff] [blame] | 166 | .parts = vpac270_nor_partitions, |
| 167 | .nr_parts = ARRAY_SIZE(vpac270_nor_partitions) |
Marek | 543cd84 | 2010-03-09 04:04:12 +0100 | [diff] [blame] | 168 | } |
| 169 | }; |
| 170 | |
| 171 | static struct resource vpac270_flash_resource = { |
| 172 | .start = PXA_CS0_PHYS, |
| 173 | .end = PXA_CS0_PHYS + SZ_64M - 1, |
| 174 | .flags = IORESOURCE_MEM, |
| 175 | }; |
| 176 | |
| 177 | static struct platform_device vpac270_flash = { |
| 178 | .name = "physmap-flash", |
| 179 | .id = 0, |
| 180 | .resource = &vpac270_flash_resource, |
| 181 | .num_resources = 1, |
| 182 | .dev = { |
| 183 | .platform_data = vpac270_flash_data, |
| 184 | }, |
| 185 | }; |
| 186 | static void __init vpac270_nor_init(void) |
| 187 | { |
| 188 | platform_device_register(&vpac270_flash); |
| 189 | } |
| 190 | #else |
| 191 | static inline void vpac270_nor_init(void) {} |
| 192 | #endif |
| 193 | |
| 194 | /****************************************************************************** |
Marek Vasut | bcc399b | 2010-05-01 06:54:36 +0200 | [diff] [blame] | 195 | * OneNAND Flash |
| 196 | ******************************************************************************/ |
| 197 | #if defined(CONFIG_MTD_ONENAND) || defined(CONFIG_MTD_ONENAND_MODULE) |
| 198 | static struct mtd_partition vpac270_onenand_partitions[] = { |
| 199 | { |
| 200 | .name = "Flash", |
| 201 | .offset = 0x00000000, |
| 202 | .size = MTDPART_SIZ_FULL, |
| 203 | } |
| 204 | }; |
| 205 | |
| 206 | static struct onenand_platform_data vpac270_onenand_info = { |
| 207 | .parts = vpac270_onenand_partitions, |
| 208 | .nr_parts = ARRAY_SIZE(vpac270_onenand_partitions), |
| 209 | }; |
| 210 | |
| 211 | static struct resource vpac270_onenand_resources[] = { |
| 212 | [0] = { |
| 213 | .start = PXA_CS0_PHYS, |
| 214 | .end = PXA_CS0_PHYS + SZ_1M, |
| 215 | .flags = IORESOURCE_MEM, |
| 216 | }, |
| 217 | }; |
| 218 | |
| 219 | static struct platform_device vpac270_onenand = { |
| 220 | .name = "onenand-flash", |
| 221 | .id = -1, |
| 222 | .resource = vpac270_onenand_resources, |
| 223 | .num_resources = ARRAY_SIZE(vpac270_onenand_resources), |
| 224 | .dev = { |
| 225 | .platform_data = &vpac270_onenand_info, |
| 226 | }, |
| 227 | }; |
| 228 | |
| 229 | static void __init vpac270_onenand_init(void) |
| 230 | { |
| 231 | platform_device_register(&vpac270_onenand); |
| 232 | } |
| 233 | #else |
| 234 | static void __init vpac270_onenand_init(void) {} |
| 235 | #endif |
| 236 | |
| 237 | /****************************************************************************** |
Marek | 543cd84 | 2010-03-09 04:04:12 +0100 | [diff] [blame] | 238 | * SD/MMC card controller |
| 239 | ******************************************************************************/ |
| 240 | #if defined(CONFIG_MMC_PXA) || defined(CONFIG_MMC_PXA_MODULE) |
| 241 | static struct pxamci_platform_data vpac270_mci_platform_data = { |
| 242 | .ocr_mask = MMC_VDD_32_33 | MMC_VDD_33_34, |
Marek Vasut | 979a281c | 2010-08-09 03:55:09 +0200 | [diff] [blame] | 243 | .gpio_power = -1, |
Marek | 543cd84 | 2010-03-09 04:04:12 +0100 | [diff] [blame] | 244 | .gpio_card_detect = GPIO53_VPAC270_SD_DETECT_N, |
| 245 | .gpio_card_ro = GPIO52_VPAC270_SD_READONLY, |
Eric Miao | f97cab2 | 2010-04-14 07:00:42 +0800 | [diff] [blame] | 246 | .detect_delay_ms = 200, |
Marek | 543cd84 | 2010-03-09 04:04:12 +0100 | [diff] [blame] | 247 | }; |
| 248 | |
| 249 | static void __init vpac270_mmc_init(void) |
| 250 | { |
| 251 | pxa_set_mci_info(&vpac270_mci_platform_data); |
| 252 | } |
| 253 | #else |
| 254 | static inline void vpac270_mmc_init(void) {} |
| 255 | #endif |
| 256 | |
| 257 | /****************************************************************************** |
| 258 | * GPIO keys |
| 259 | ******************************************************************************/ |
| 260 | #if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE) |
| 261 | static struct gpio_keys_button vpac270_pxa_buttons[] = { |
| 262 | {KEY_POWER, GPIO1_VPAC270_USER_BTN, 0, "USER BTN"}, |
| 263 | }; |
| 264 | |
| 265 | static struct gpio_keys_platform_data vpac270_pxa_keys_data = { |
| 266 | .buttons = vpac270_pxa_buttons, |
| 267 | .nbuttons = ARRAY_SIZE(vpac270_pxa_buttons), |
| 268 | }; |
| 269 | |
| 270 | static struct platform_device vpac270_pxa_keys = { |
| 271 | .name = "gpio-keys", |
| 272 | .id = -1, |
| 273 | .dev = { |
| 274 | .platform_data = &vpac270_pxa_keys_data, |
| 275 | }, |
| 276 | }; |
| 277 | |
| 278 | static void __init vpac270_keys_init(void) |
| 279 | { |
| 280 | platform_device_register(&vpac270_pxa_keys); |
| 281 | } |
| 282 | #else |
| 283 | static inline void vpac270_keys_init(void) {} |
| 284 | #endif |
| 285 | |
| 286 | /****************************************************************************** |
| 287 | * LED |
| 288 | ******************************************************************************/ |
| 289 | #if defined(CONFIG_LEDS_GPIO) || defined(CONFIG_LEDS_GPIO_MODULE) |
| 290 | struct gpio_led vpac270_gpio_leds[] = { |
| 291 | { |
| 292 | .name = "vpac270:orange:user", |
| 293 | .default_trigger = "none", |
| 294 | .gpio = GPIO15_VPAC270_LED_ORANGE, |
| 295 | .active_low = 1, |
| 296 | } |
| 297 | }; |
| 298 | |
| 299 | static struct gpio_led_platform_data vpac270_gpio_led_info = { |
| 300 | .leds = vpac270_gpio_leds, |
| 301 | .num_leds = ARRAY_SIZE(vpac270_gpio_leds), |
| 302 | }; |
| 303 | |
| 304 | static struct platform_device vpac270_leds = { |
| 305 | .name = "leds-gpio", |
| 306 | .id = -1, |
| 307 | .dev = { |
| 308 | .platform_data = &vpac270_gpio_led_info, |
| 309 | } |
| 310 | }; |
| 311 | |
| 312 | static void __init vpac270_leds_init(void) |
| 313 | { |
| 314 | platform_device_register(&vpac270_leds); |
| 315 | } |
| 316 | #else |
| 317 | static inline void vpac270_leds_init(void) {} |
| 318 | #endif |
| 319 | |
| 320 | /****************************************************************************** |
Marek Vasut | 3d98f88 | 2010-03-10 05:24:27 +0100 | [diff] [blame] | 321 | * USB Host |
| 322 | ******************************************************************************/ |
| 323 | #if defined(CONFIG_USB_OHCI_HCD) || defined(CONFIG_USB_OHCI_HCD_MODULE) |
| 324 | static int vpac270_ohci_init(struct device *dev) |
| 325 | { |
| 326 | UP2OCR = UP2OCR_HXS | UP2OCR_HXOE | UP2OCR_DPPDE | UP2OCR_DMPDE; |
| 327 | return 0; |
| 328 | } |
| 329 | |
| 330 | static struct pxaohci_platform_data vpac270_ohci_info = { |
| 331 | .port_mode = PMM_PERPORT_MODE, |
| 332 | .flags = ENABLE_PORT1 | ENABLE_PORT2 | |
| 333 | POWER_CONTROL_LOW | POWER_SENSE_LOW, |
| 334 | .init = vpac270_ohci_init, |
| 335 | }; |
| 336 | |
| 337 | static void __init vpac270_uhc_init(void) |
| 338 | { |
| 339 | pxa_set_ohci_info(&vpac270_ohci_info); |
| 340 | } |
| 341 | #else |
| 342 | static inline void vpac270_uhc_init(void) {} |
| 343 | #endif |
| 344 | |
| 345 | /****************************************************************************** |
| 346 | * USB Gadget |
| 347 | ******************************************************************************/ |
| 348 | #if defined(CONFIG_USB_GADGET_PXA27X)||defined(CONFIG_USB_GADGET_PXA27X_MODULE) |
| 349 | static struct gpio_vbus_mach_info vpac270_gpio_vbus_info = { |
| 350 | .gpio_vbus = GPIO41_VPAC270_UDC_DETECT, |
| 351 | .gpio_pullup = -1, |
| 352 | }; |
| 353 | |
| 354 | static struct platform_device vpac270_gpio_vbus = { |
| 355 | .name = "gpio-vbus", |
| 356 | .id = -1, |
| 357 | .dev = { |
| 358 | .platform_data = &vpac270_gpio_vbus_info, |
| 359 | }, |
| 360 | }; |
| 361 | |
| 362 | static void vpac270_udc_command(int cmd) |
| 363 | { |
| 364 | if (cmd == PXA2XX_UDC_CMD_CONNECT) |
Marek Vasut | fb25cb3 | 2010-05-02 06:10:25 +0200 | [diff] [blame] | 365 | UP2OCR = UP2OCR_HXOE | UP2OCR_DPPUE; |
Marek Vasut | 3d98f88 | 2010-03-10 05:24:27 +0100 | [diff] [blame] | 366 | else if (cmd == PXA2XX_UDC_CMD_DISCONNECT) |
Marek Vasut | fb25cb3 | 2010-05-02 06:10:25 +0200 | [diff] [blame] | 367 | UP2OCR = UP2OCR_HXOE; |
Marek Vasut | 3d98f88 | 2010-03-10 05:24:27 +0100 | [diff] [blame] | 368 | } |
| 369 | |
| 370 | static struct pxa2xx_udc_mach_info vpac270_udc_info __initdata = { |
| 371 | .udc_command = vpac270_udc_command, |
| 372 | .gpio_pullup = -1, |
| 373 | }; |
| 374 | |
| 375 | static void __init vpac270_udc_init(void) |
| 376 | { |
| 377 | pxa_set_udc_info(&vpac270_udc_info); |
| 378 | platform_device_register(&vpac270_gpio_vbus); |
| 379 | } |
| 380 | #else |
| 381 | static inline void vpac270_udc_init(void) {} |
| 382 | #endif |
| 383 | |
| 384 | /****************************************************************************** |
Marek Vasut | 947fb57 | 2010-03-10 05:38:54 +0100 | [diff] [blame] | 385 | * Ethernet |
| 386 | ******************************************************************************/ |
| 387 | #if defined(CONFIG_DM9000) || defined(CONFIG_DM9000_MODULE) |
| 388 | static struct resource vpac270_dm9000_resources[] = { |
| 389 | [0] = { |
| 390 | .start = PXA_CS2_PHYS + 0x300, |
| 391 | .end = PXA_CS2_PHYS + 0x303, |
| 392 | .flags = IORESOURCE_MEM, |
| 393 | }, |
| 394 | [1] = { |
| 395 | .start = PXA_CS2_PHYS + 0x304, |
| 396 | .end = PXA_CS2_PHYS + 0x343, |
| 397 | .flags = IORESOURCE_MEM, |
| 398 | }, |
| 399 | [2] = { |
| 400 | .start = IRQ_GPIO(GPIO114_VPAC270_ETH_IRQ), |
| 401 | .end = IRQ_GPIO(GPIO114_VPAC270_ETH_IRQ), |
| 402 | .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE, |
| 403 | }, |
| 404 | }; |
| 405 | |
| 406 | static struct dm9000_plat_data vpac270_dm9000_platdata = { |
| 407 | .flags = DM9000_PLATF_32BITONLY, |
| 408 | }; |
| 409 | |
| 410 | static struct platform_device vpac270_dm9000_device = { |
| 411 | .name = "dm9000", |
| 412 | .id = -1, |
| 413 | .num_resources = ARRAY_SIZE(vpac270_dm9000_resources), |
| 414 | .resource = vpac270_dm9000_resources, |
| 415 | .dev = { |
| 416 | .platform_data = &vpac270_dm9000_platdata, |
| 417 | } |
| 418 | }; |
| 419 | |
| 420 | static void __init vpac270_eth_init(void) |
| 421 | { |
| 422 | platform_device_register(&vpac270_dm9000_device); |
| 423 | } |
| 424 | #else |
| 425 | static inline void vpac270_eth_init(void) {} |
| 426 | #endif |
| 427 | |
| 428 | /****************************************************************************** |
Marek Vasut | 1a8fb70 | 2010-03-26 04:45:54 +0100 | [diff] [blame] | 429 | * Audio and Touchscreen |
| 430 | ******************************************************************************/ |
| 431 | #if defined(CONFIG_TOUCHSCREEN_UCB1400) || \ |
| 432 | defined(CONFIG_TOUCHSCREEN_UCB1400_MODULE) |
| 433 | static pxa2xx_audio_ops_t vpac270_ac97_pdata = { |
| 434 | .reset_gpio = 95, |
| 435 | }; |
| 436 | |
| 437 | static struct ucb1400_pdata vpac270_ucb1400_pdata = { |
Marek Vasut | aeec134 | 2010-04-26 23:23:48 +0200 | [diff] [blame] | 438 | .irq = IRQ_GPIO(GPIO113_VPAC270_TS_IRQ), |
Marek Vasut | 1a8fb70 | 2010-03-26 04:45:54 +0100 | [diff] [blame] | 439 | }; |
| 440 | |
| 441 | static struct platform_device vpac270_ucb1400_device = { |
| 442 | .name = "ucb1400_core", |
| 443 | .id = -1, |
| 444 | .dev = { |
| 445 | .platform_data = &vpac270_ucb1400_pdata, |
| 446 | }, |
| 447 | }; |
| 448 | |
| 449 | static void __init vpac270_ts_init(void) |
| 450 | { |
| 451 | pxa_set_ac97_info(&vpac270_ac97_pdata); |
| 452 | platform_device_register(&vpac270_ucb1400_device); |
| 453 | } |
| 454 | #else |
| 455 | static inline void vpac270_ts_init(void) {} |
| 456 | #endif |
| 457 | |
| 458 | /****************************************************************************** |
Marek Vasut | 83a4a10 | 2010-03-26 05:38:10 +0100 | [diff] [blame] | 459 | * RTC |
| 460 | ******************************************************************************/ |
| 461 | #if defined(CONFIG_RTC_DRV_DS1307) || defined(CONFIG_RTC_DRV_DS1307_MODULE) |
| 462 | static struct i2c_board_info __initdata vpac270_i2c_devs[] = { |
| 463 | { |
| 464 | I2C_BOARD_INFO("ds1339", 0x68), |
| 465 | }, |
| 466 | }; |
| 467 | |
| 468 | static void __init vpac270_rtc_init(void) |
| 469 | { |
Marek Vasut | 83a4a10 | 2010-03-26 05:38:10 +0100 | [diff] [blame] | 470 | i2c_register_board_info(0, ARRAY_AND_SIZE(vpac270_i2c_devs)); |
| 471 | } |
| 472 | #else |
| 473 | static inline void vpac270_rtc_init(void) {} |
| 474 | #endif |
| 475 | |
| 476 | /****************************************************************************** |
Marek | 543cd84 | 2010-03-09 04:04:12 +0100 | [diff] [blame] | 477 | * Framebuffer |
| 478 | ******************************************************************************/ |
| 479 | #if defined(CONFIG_FB_PXA) || defined(CONFIG_FB_PXA_MODULE) |
| 480 | static struct pxafb_mode_info vpac270_lcd_modes[] = { |
| 481 | { |
| 482 | .pixclock = 57692, |
| 483 | .xres = 640, |
| 484 | .yres = 480, |
| 485 | .bpp = 32, |
| 486 | .depth = 18, |
| 487 | |
| 488 | .left_margin = 144, |
| 489 | .right_margin = 32, |
| 490 | .upper_margin = 13, |
| 491 | .lower_margin = 30, |
| 492 | |
| 493 | .hsync_len = 32, |
| 494 | .vsync_len = 2, |
| 495 | |
| 496 | .sync = FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT, |
Marek Vasut | 97dbc51 | 2010-05-21 03:12:46 +0200 | [diff] [blame] | 497 | }, { /* CRT 640x480 */ |
| 498 | .pixclock = 35000, |
| 499 | .xres = 640, |
| 500 | .yres = 480, |
| 501 | .bpp = 16, |
| 502 | .depth = 16, |
| 503 | |
| 504 | .left_margin = 96, |
| 505 | .right_margin = 48, |
| 506 | .upper_margin = 33, |
| 507 | .lower_margin = 10, |
| 508 | |
| 509 | .hsync_len = 48, |
| 510 | .vsync_len = 1, |
| 511 | |
| 512 | .sync = FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT, |
| 513 | }, { /* CRT 800x600 H=30kHz V=48HZ */ |
| 514 | .pixclock = 25000, |
| 515 | .xres = 800, |
| 516 | .yres = 600, |
| 517 | .bpp = 16, |
| 518 | .depth = 16, |
| 519 | |
| 520 | .left_margin = 50, |
| 521 | .right_margin = 1, |
| 522 | .upper_margin = 21, |
| 523 | .lower_margin = 12, |
| 524 | |
| 525 | .hsync_len = 8, |
| 526 | .vsync_len = 1, |
| 527 | |
| 528 | .sync = FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT, |
| 529 | }, { /* CRT 1024x768 H=40kHz V=50Hz */ |
| 530 | .pixclock = 15000, |
| 531 | .xres = 1024, |
| 532 | .yres = 768, |
| 533 | .bpp = 16, |
| 534 | .depth = 16, |
| 535 | |
| 536 | .left_margin = 220, |
| 537 | .right_margin = 8, |
| 538 | .upper_margin = 33, |
| 539 | .lower_margin = 2, |
| 540 | |
| 541 | .hsync_len = 48, |
| 542 | .vsync_len = 1, |
| 543 | |
| 544 | .sync = FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT, |
| 545 | } |
Marek | 543cd84 | 2010-03-09 04:04:12 +0100 | [diff] [blame] | 546 | }; |
| 547 | |
| 548 | static struct pxafb_mach_info vpac270_lcd_screen = { |
| 549 | .modes = vpac270_lcd_modes, |
| 550 | .num_modes = ARRAY_SIZE(vpac270_lcd_modes), |
| 551 | .lcd_conn = LCD_COLOR_TFT_18BPP, |
| 552 | }; |
| 553 | |
| 554 | static void vpac270_lcd_power(int on, struct fb_var_screeninfo *info) |
| 555 | { |
| 556 | gpio_set_value(GPIO81_VPAC270_BKL_ON, on); |
| 557 | } |
| 558 | |
| 559 | static void __init vpac270_lcd_init(void) |
| 560 | { |
| 561 | int ret; |
| 562 | |
| 563 | ret = gpio_request(GPIO81_VPAC270_BKL_ON, "BKL-ON"); |
| 564 | if (ret) { |
| 565 | pr_err("Requesting BKL-ON GPIO failed!\n"); |
| 566 | goto err; |
| 567 | } |
| 568 | |
| 569 | ret = gpio_direction_output(GPIO81_VPAC270_BKL_ON, 1); |
| 570 | if (ret) { |
| 571 | pr_err("Setting BKL-ON GPIO direction failed!\n"); |
| 572 | goto err2; |
| 573 | } |
| 574 | |
| 575 | vpac270_lcd_screen.pxafb_lcd_power = vpac270_lcd_power; |
| 576 | set_pxa_fb_info(&vpac270_lcd_screen); |
| 577 | return; |
| 578 | |
| 579 | err2: |
| 580 | gpio_free(GPIO81_VPAC270_BKL_ON); |
| 581 | err: |
| 582 | return; |
| 583 | } |
| 584 | #else |
| 585 | static inline void vpac270_lcd_init(void) {} |
| 586 | #endif |
| 587 | |
| 588 | /****************************************************************************** |
Marek Vasut | 052345a | 2010-04-26 21:46:07 +0200 | [diff] [blame] | 589 | * PATA IDE |
| 590 | ******************************************************************************/ |
Marek Vasut | 9b2dbdc | 2010-05-21 03:12:45 +0200 | [diff] [blame] | 591 | #if defined(CONFIG_PATA_PXA) || defined(CONFIG_PATA_PXA_MODULE) |
| 592 | static struct pata_pxa_pdata vpac270_pata_pdata = { |
| 593 | .reg_shift = 1, |
| 594 | .dma_dreq = 1, |
Marek Vasut | 052345a | 2010-04-26 21:46:07 +0200 | [diff] [blame] | 595 | .irq_flags = IRQF_TRIGGER_RISING, |
| 596 | }; |
| 597 | |
| 598 | static struct resource vpac270_ide_resources[] = { |
| 599 | [0] = { /* I/O Base address */ |
| 600 | .start = PXA_CS3_PHYS + 0x120, |
| 601 | .end = PXA_CS3_PHYS + 0x13f, |
| 602 | .flags = IORESOURCE_MEM |
| 603 | }, |
| 604 | [1] = { /* CTL Base address */ |
| 605 | .start = PXA_CS3_PHYS + 0x15c, |
| 606 | .end = PXA_CS3_PHYS + 0x15f, |
| 607 | .flags = IORESOURCE_MEM |
| 608 | }, |
Marek Vasut | 9b2dbdc | 2010-05-21 03:12:45 +0200 | [diff] [blame] | 609 | [2] = { /* DMA Base address */ |
| 610 | .start = PXA_CS3_PHYS + 0x20, |
| 611 | .end = PXA_CS3_PHYS + 0x2f, |
| 612 | .flags = IORESOURCE_DMA |
| 613 | }, |
| 614 | [3] = { /* IDE IRQ pin */ |
Marek Vasut | 052345a | 2010-04-26 21:46:07 +0200 | [diff] [blame] | 615 | .start = gpio_to_irq(GPIO36_VPAC270_IDE_IRQ), |
| 616 | .end = gpio_to_irq(GPIO36_VPAC270_IDE_IRQ), |
| 617 | .flags = IORESOURCE_IRQ |
| 618 | } |
| 619 | }; |
| 620 | |
| 621 | static struct platform_device vpac270_ide_device = { |
Marek Vasut | 9b2dbdc | 2010-05-21 03:12:45 +0200 | [diff] [blame] | 622 | .name = "pata_pxa", |
Marek Vasut | 052345a | 2010-04-26 21:46:07 +0200 | [diff] [blame] | 623 | .num_resources = ARRAY_SIZE(vpac270_ide_resources), |
| 624 | .resource = vpac270_ide_resources, |
| 625 | .dev = { |
| 626 | .platform_data = &vpac270_pata_pdata, |
Marek Vasut | 9b2dbdc | 2010-05-21 03:12:45 +0200 | [diff] [blame] | 627 | .coherent_dma_mask = 0xffffffff, |
Marek Vasut | 052345a | 2010-04-26 21:46:07 +0200 | [diff] [blame] | 628 | } |
| 629 | }; |
| 630 | |
| 631 | static void __init vpac270_ide_init(void) |
| 632 | { |
| 633 | platform_device_register(&vpac270_ide_device); |
| 634 | } |
| 635 | #else |
| 636 | static inline void vpac270_ide_init(void) {} |
| 637 | #endif |
| 638 | |
| 639 | /****************************************************************************** |
Marek Vasut | 54e70bf | 2010-05-21 03:12:43 +0200 | [diff] [blame] | 640 | * Core power regulator |
| 641 | ******************************************************************************/ |
| 642 | #if defined(CONFIG_REGULATOR_MAX1586) || \ |
| 643 | defined(CONFIG_REGULATOR_MAX1586_MODULE) |
| 644 | static struct regulator_consumer_supply vpac270_max1587a_consumers[] = { |
| 645 | { |
| 646 | .supply = "vcc_core", |
| 647 | } |
| 648 | }; |
| 649 | |
| 650 | static struct regulator_init_data vpac270_max1587a_v3_info = { |
| 651 | .constraints = { |
| 652 | .name = "vcc_core range", |
| 653 | .min_uV = 900000, |
| 654 | .max_uV = 1705000, |
| 655 | .always_on = 1, |
| 656 | .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE, |
| 657 | }, |
| 658 | .consumer_supplies = vpac270_max1587a_consumers, |
| 659 | .num_consumer_supplies = ARRAY_SIZE(vpac270_max1587a_consumers), |
| 660 | }; |
| 661 | |
| 662 | static struct max1586_subdev_data vpac270_max1587a_subdevs[] = { |
| 663 | { |
| 664 | .name = "vcc_core", |
| 665 | .id = MAX1586_V3, |
| 666 | .platform_data = &vpac270_max1587a_v3_info, |
| 667 | } |
| 668 | }; |
| 669 | |
| 670 | static struct max1586_platform_data vpac270_max1587a_info = { |
| 671 | .subdevs = vpac270_max1587a_subdevs, |
| 672 | .num_subdevs = ARRAY_SIZE(vpac270_max1587a_subdevs), |
| 673 | .v3_gain = MAX1586_GAIN_R24_3k32, /* 730..1550 mV */ |
| 674 | }; |
| 675 | |
| 676 | static struct i2c_board_info __initdata vpac270_pi2c_board_info[] = { |
| 677 | { |
| 678 | I2C_BOARD_INFO("max1586", 0x14), |
| 679 | .platform_data = &vpac270_max1587a_info, |
| 680 | }, |
| 681 | }; |
| 682 | |
| 683 | static void __init vpac270_pmic_init(void) |
| 684 | { |
| 685 | i2c_register_board_info(1, ARRAY_AND_SIZE(vpac270_pi2c_board_info)); |
| 686 | } |
| 687 | #else |
| 688 | static inline void vpac270_pmic_init(void) {} |
| 689 | #endif |
| 690 | |
| 691 | |
| 692 | /****************************************************************************** |
Marek | 543cd84 | 2010-03-09 04:04:12 +0100 | [diff] [blame] | 693 | * Machine init |
| 694 | ******************************************************************************/ |
| 695 | static void __init vpac270_init(void) |
| 696 | { |
| 697 | pxa2xx_mfp_config(ARRAY_AND_SIZE(vpac270_pin_config)); |
| 698 | |
| 699 | pxa_set_ffuart_info(NULL); |
| 700 | pxa_set_btuart_info(NULL); |
| 701 | pxa_set_stuart_info(NULL); |
Marek Vasut | 54e70bf | 2010-05-21 03:12:43 +0200 | [diff] [blame] | 702 | pxa_set_i2c_info(NULL); |
| 703 | pxa27x_set_i2c_power_info(NULL); |
Marek | 543cd84 | 2010-03-09 04:04:12 +0100 | [diff] [blame] | 704 | |
Marek Vasut | 54e70bf | 2010-05-21 03:12:43 +0200 | [diff] [blame] | 705 | vpac270_pmic_init(); |
Marek | 543cd84 | 2010-03-09 04:04:12 +0100 | [diff] [blame] | 706 | vpac270_lcd_init(); |
| 707 | vpac270_mmc_init(); |
| 708 | vpac270_nor_init(); |
Marek Vasut | bcc399b | 2010-05-01 06:54:36 +0200 | [diff] [blame] | 709 | vpac270_onenand_init(); |
Marek | 543cd84 | 2010-03-09 04:04:12 +0100 | [diff] [blame] | 710 | vpac270_leds_init(); |
| 711 | vpac270_keys_init(); |
Marek Vasut | 3d98f88 | 2010-03-10 05:24:27 +0100 | [diff] [blame] | 712 | vpac270_uhc_init(); |
| 713 | vpac270_udc_init(); |
Marek Vasut | 947fb57 | 2010-03-10 05:38:54 +0100 | [diff] [blame] | 714 | vpac270_eth_init(); |
Marek Vasut | 1a8fb70 | 2010-03-26 04:45:54 +0100 | [diff] [blame] | 715 | vpac270_ts_init(); |
Marek Vasut | 83a4a10 | 2010-03-26 05:38:10 +0100 | [diff] [blame] | 716 | vpac270_rtc_init(); |
Marek Vasut | 052345a | 2010-04-26 21:46:07 +0200 | [diff] [blame] | 717 | vpac270_ide_init(); |
Marek | 543cd84 | 2010-03-09 04:04:12 +0100 | [diff] [blame] | 718 | } |
| 719 | |
| 720 | MACHINE_START(VPAC270, "Voipac PXA270") |
Marek | 543cd84 | 2010-03-09 04:04:12 +0100 | [diff] [blame] | 721 | .boot_params = 0xa0000100, |
| 722 | .map_io = pxa_map_io, |
| 723 | .init_irq = pxa27x_init_irq, |
| 724 | .timer = &pxa_timer, |
| 725 | .init_machine = vpac270_init |
| 726 | MACHINE_END |