eric miao | 8f58de7 | 2007-12-19 17:14:02 +0800 | [diff] [blame] | 1 | #include <linux/module.h> |
| 2 | #include <linux/kernel.h> |
| 3 | #include <linux/init.h> |
| 4 | #include <linux/platform_device.h> |
| 5 | #include <linux/dma-mapping.h> |
| 6 | |
Russell King | a09e64f | 2008-08-05 16:14:15 +0100 | [diff] [blame] | 7 | #include <mach/udc.h> |
| 8 | #include <mach/pxafb.h> |
| 9 | #include <mach/mmc.h> |
| 10 | #include <mach/irda.h> |
Russell King | a09e64f | 2008-08-05 16:14:15 +0100 | [diff] [blame] | 11 | #include <mach/ohci.h> |
| 12 | #include <mach/pxa27x_keypad.h> |
| 13 | #include <mach/pxa2xx_spi.h> |
| 14 | #include <mach/camera.h> |
| 15 | #include <mach/audio.h> |
Haojian Zhuang | 82b95ec | 2009-09-10 13:55:23 +0800 | [diff] [blame] | 16 | #include <plat/i2c.h> |
| 17 | #include <plat/pxa3xx_nand.h> |
eric miao | 8f58de7 | 2007-12-19 17:14:02 +0800 | [diff] [blame] | 18 | |
| 19 | #include "devices.h" |
Philipp Zabel | bc3a595 | 2008-06-02 18:49:27 +0100 | [diff] [blame] | 20 | #include "generic.h" |
eric miao | 8f58de7 | 2007-12-19 17:14:02 +0800 | [diff] [blame] | 21 | |
| 22 | void __init pxa_register_device(struct platform_device *dev, void *data) |
| 23 | { |
| 24 | int ret; |
| 25 | |
| 26 | dev->dev.platform_data = data; |
| 27 | |
| 28 | ret = platform_device_register(dev); |
| 29 | if (ret) |
| 30 | dev_err(&dev->dev, "unable to register device: %d\n", ret); |
| 31 | } |
| 32 | |
| 33 | static struct resource pxamci_resources[] = { |
| 34 | [0] = { |
| 35 | .start = 0x41100000, |
| 36 | .end = 0x41100fff, |
| 37 | .flags = IORESOURCE_MEM, |
| 38 | }, |
| 39 | [1] = { |
| 40 | .start = IRQ_MMC, |
| 41 | .end = IRQ_MMC, |
| 42 | .flags = IORESOURCE_IRQ, |
| 43 | }, |
| 44 | [2] = { |
| 45 | .start = 21, |
| 46 | .end = 21, |
| 47 | .flags = IORESOURCE_DMA, |
| 48 | }, |
| 49 | [3] = { |
| 50 | .start = 22, |
| 51 | .end = 22, |
| 52 | .flags = IORESOURCE_DMA, |
| 53 | }, |
| 54 | }; |
| 55 | |
| 56 | static u64 pxamci_dmamask = 0xffffffffUL; |
| 57 | |
| 58 | struct platform_device pxa_device_mci = { |
| 59 | .name = "pxa2xx-mci", |
Bridge Wu | fafc9d3 | 2007-12-21 19:00:13 +0800 | [diff] [blame] | 60 | .id = 0, |
eric miao | 8f58de7 | 2007-12-19 17:14:02 +0800 | [diff] [blame] | 61 | .dev = { |
| 62 | .dma_mask = &pxamci_dmamask, |
| 63 | .coherent_dma_mask = 0xffffffff, |
| 64 | }, |
| 65 | .num_resources = ARRAY_SIZE(pxamci_resources), |
| 66 | .resource = pxamci_resources, |
| 67 | }; |
| 68 | |
| 69 | void __init pxa_set_mci_info(struct pxamci_platform_data *info) |
| 70 | { |
| 71 | pxa_register_device(&pxa_device_mci, info); |
| 72 | } |
| 73 | |
| 74 | |
Philipp Zabel | 1257629 | 2009-05-26 22:03:32 +0200 | [diff] [blame] | 75 | static struct pxa2xx_udc_mach_info pxa_udc_info = { |
| 76 | .gpio_pullup = -1, |
| 77 | .gpio_vbus = -1, |
| 78 | }; |
eric miao | 8f58de7 | 2007-12-19 17:14:02 +0800 | [diff] [blame] | 79 | |
| 80 | void __init pxa_set_udc_info(struct pxa2xx_udc_mach_info *info) |
| 81 | { |
| 82 | memcpy(&pxa_udc_info, info, sizeof *info); |
| 83 | } |
| 84 | |
| 85 | static struct resource pxa2xx_udc_resources[] = { |
| 86 | [0] = { |
| 87 | .start = 0x40600000, |
| 88 | .end = 0x4060ffff, |
| 89 | .flags = IORESOURCE_MEM, |
| 90 | }, |
| 91 | [1] = { |
| 92 | .start = IRQ_USB, |
| 93 | .end = IRQ_USB, |
| 94 | .flags = IORESOURCE_IRQ, |
| 95 | }, |
| 96 | }; |
| 97 | |
| 98 | static u64 udc_dma_mask = ~(u32)0; |
| 99 | |
Philipp Zabel | 7a85762 | 2008-06-22 23:36:39 +0100 | [diff] [blame] | 100 | struct platform_device pxa25x_device_udc = { |
| 101 | .name = "pxa25x-udc", |
| 102 | .id = -1, |
| 103 | .resource = pxa2xx_udc_resources, |
| 104 | .num_resources = ARRAY_SIZE(pxa2xx_udc_resources), |
| 105 | .dev = { |
| 106 | .platform_data = &pxa_udc_info, |
| 107 | .dma_mask = &udc_dma_mask, |
| 108 | } |
| 109 | }; |
| 110 | |
| 111 | struct platform_device pxa27x_device_udc = { |
| 112 | .name = "pxa27x-udc", |
eric miao | 8f58de7 | 2007-12-19 17:14:02 +0800 | [diff] [blame] | 113 | .id = -1, |
| 114 | .resource = pxa2xx_udc_resources, |
| 115 | .num_resources = ARRAY_SIZE(pxa2xx_udc_resources), |
| 116 | .dev = { |
| 117 | .platform_data = &pxa_udc_info, |
| 118 | .dma_mask = &udc_dma_mask, |
| 119 | } |
| 120 | }; |
| 121 | |
| 122 | static struct resource pxafb_resources[] = { |
| 123 | [0] = { |
| 124 | .start = 0x44000000, |
| 125 | .end = 0x4400ffff, |
| 126 | .flags = IORESOURCE_MEM, |
| 127 | }, |
| 128 | [1] = { |
| 129 | .start = IRQ_LCD, |
| 130 | .end = IRQ_LCD, |
| 131 | .flags = IORESOURCE_IRQ, |
| 132 | }, |
| 133 | }; |
| 134 | |
| 135 | static u64 fb_dma_mask = ~(u64)0; |
| 136 | |
| 137 | struct platform_device pxa_device_fb = { |
| 138 | .name = "pxa2xx-fb", |
| 139 | .id = -1, |
| 140 | .dev = { |
| 141 | .dma_mask = &fb_dma_mask, |
| 142 | .coherent_dma_mask = 0xffffffff, |
| 143 | }, |
| 144 | .num_resources = ARRAY_SIZE(pxafb_resources), |
| 145 | .resource = pxafb_resources, |
| 146 | }; |
| 147 | |
| 148 | void __init set_pxa_fb_info(struct pxafb_mach_info *info) |
| 149 | { |
| 150 | pxa_register_device(&pxa_device_fb, info); |
| 151 | } |
| 152 | |
| 153 | void __init set_pxa_fb_parent(struct device *parent_dev) |
| 154 | { |
| 155 | pxa_device_fb.dev.parent = parent_dev; |
| 156 | } |
| 157 | |
| 158 | static struct resource pxa_resource_ffuart[] = { |
| 159 | { |
Eric Miao | 02f6526 | 2008-11-28 14:08:53 +0800 | [diff] [blame] | 160 | .start = 0x40100000, |
| 161 | .end = 0x40100023, |
eric miao | 8f58de7 | 2007-12-19 17:14:02 +0800 | [diff] [blame] | 162 | .flags = IORESOURCE_MEM, |
| 163 | }, { |
| 164 | .start = IRQ_FFUART, |
| 165 | .end = IRQ_FFUART, |
| 166 | .flags = IORESOURCE_IRQ, |
| 167 | } |
| 168 | }; |
| 169 | |
Russell King | cc155c6 | 2009-11-09 13:34:08 +0800 | [diff] [blame^] | 170 | struct platform_device pxa_device_ffuart = { |
eric miao | 8f58de7 | 2007-12-19 17:14:02 +0800 | [diff] [blame] | 171 | .name = "pxa2xx-uart", |
| 172 | .id = 0, |
| 173 | .resource = pxa_resource_ffuart, |
| 174 | .num_resources = ARRAY_SIZE(pxa_resource_ffuart), |
| 175 | }; |
| 176 | |
Russell King | cc155c6 | 2009-11-09 13:34:08 +0800 | [diff] [blame^] | 177 | void __init pxa_set_ffuart_info(void *info) |
| 178 | { |
| 179 | pxa_register_device(&pxa_device_ffuart, info); |
| 180 | } |
| 181 | |
eric miao | 8f58de7 | 2007-12-19 17:14:02 +0800 | [diff] [blame] | 182 | static struct resource pxa_resource_btuart[] = { |
| 183 | { |
Eric Miao | 02f6526 | 2008-11-28 14:08:53 +0800 | [diff] [blame] | 184 | .start = 0x40200000, |
| 185 | .end = 0x40200023, |
eric miao | 8f58de7 | 2007-12-19 17:14:02 +0800 | [diff] [blame] | 186 | .flags = IORESOURCE_MEM, |
| 187 | }, { |
| 188 | .start = IRQ_BTUART, |
| 189 | .end = IRQ_BTUART, |
| 190 | .flags = IORESOURCE_IRQ, |
| 191 | } |
| 192 | }; |
| 193 | |
| 194 | struct platform_device pxa_device_btuart = { |
| 195 | .name = "pxa2xx-uart", |
| 196 | .id = 1, |
| 197 | .resource = pxa_resource_btuart, |
| 198 | .num_resources = ARRAY_SIZE(pxa_resource_btuart), |
| 199 | }; |
| 200 | |
Russell King | cc155c6 | 2009-11-09 13:34:08 +0800 | [diff] [blame^] | 201 | void __init pxa_set_btuart_info(void *info) |
| 202 | { |
| 203 | pxa_register_device(&pxa_device_btuart, info); |
| 204 | } |
| 205 | |
eric miao | 8f58de7 | 2007-12-19 17:14:02 +0800 | [diff] [blame] | 206 | static struct resource pxa_resource_stuart[] = { |
| 207 | { |
Eric Miao | 02f6526 | 2008-11-28 14:08:53 +0800 | [diff] [blame] | 208 | .start = 0x40700000, |
| 209 | .end = 0x40700023, |
eric miao | 8f58de7 | 2007-12-19 17:14:02 +0800 | [diff] [blame] | 210 | .flags = IORESOURCE_MEM, |
| 211 | }, { |
| 212 | .start = IRQ_STUART, |
| 213 | .end = IRQ_STUART, |
| 214 | .flags = IORESOURCE_IRQ, |
| 215 | } |
| 216 | }; |
| 217 | |
| 218 | struct platform_device pxa_device_stuart = { |
| 219 | .name = "pxa2xx-uart", |
| 220 | .id = 2, |
| 221 | .resource = pxa_resource_stuart, |
| 222 | .num_resources = ARRAY_SIZE(pxa_resource_stuart), |
| 223 | }; |
| 224 | |
Russell King | cc155c6 | 2009-11-09 13:34:08 +0800 | [diff] [blame^] | 225 | void __init pxa_set_stuart_info(void *info) |
| 226 | { |
| 227 | pxa_register_device(&pxa_device_stuart, info); |
| 228 | } |
| 229 | |
eric miao | 8f58de7 | 2007-12-19 17:14:02 +0800 | [diff] [blame] | 230 | static struct resource pxa_resource_hwuart[] = { |
| 231 | { |
Eric Miao | 02f6526 | 2008-11-28 14:08:53 +0800 | [diff] [blame] | 232 | .start = 0x41600000, |
| 233 | .end = 0x4160002F, |
eric miao | 8f58de7 | 2007-12-19 17:14:02 +0800 | [diff] [blame] | 234 | .flags = IORESOURCE_MEM, |
| 235 | }, { |
| 236 | .start = IRQ_HWUART, |
| 237 | .end = IRQ_HWUART, |
| 238 | .flags = IORESOURCE_IRQ, |
| 239 | } |
| 240 | }; |
| 241 | |
| 242 | struct platform_device pxa_device_hwuart = { |
| 243 | .name = "pxa2xx-uart", |
| 244 | .id = 3, |
| 245 | .resource = pxa_resource_hwuart, |
| 246 | .num_resources = ARRAY_SIZE(pxa_resource_hwuart), |
| 247 | }; |
| 248 | |
Russell King | cc155c6 | 2009-11-09 13:34:08 +0800 | [diff] [blame^] | 249 | void __init pxa_set_hwuart_info(void *info) |
| 250 | { |
| 251 | if (cpu_is_pxa255()) |
| 252 | pxa_register_device(&pxa_device_hwuart, info); |
| 253 | else |
| 254 | pr_info("UART: Ignoring attempt to register HWUART on non-PXA255 hardware"); |
| 255 | } |
| 256 | |
eric miao | 8f58de7 | 2007-12-19 17:14:02 +0800 | [diff] [blame] | 257 | static struct resource pxai2c_resources[] = { |
| 258 | { |
| 259 | .start = 0x40301680, |
| 260 | .end = 0x403016a3, |
| 261 | .flags = IORESOURCE_MEM, |
| 262 | }, { |
| 263 | .start = IRQ_I2C, |
| 264 | .end = IRQ_I2C, |
| 265 | .flags = IORESOURCE_IRQ, |
| 266 | }, |
| 267 | }; |
| 268 | |
| 269 | struct platform_device pxa_device_i2c = { |
| 270 | .name = "pxa2xx-i2c", |
| 271 | .id = 0, |
| 272 | .resource = pxai2c_resources, |
| 273 | .num_resources = ARRAY_SIZE(pxai2c_resources), |
| 274 | }; |
| 275 | |
| 276 | void __init pxa_set_i2c_info(struct i2c_pxa_platform_data *info) |
| 277 | { |
| 278 | pxa_register_device(&pxa_device_i2c, info); |
| 279 | } |
| 280 | |
Eric Miao | 9946429 | 2008-11-28 15:01:55 +0800 | [diff] [blame] | 281 | #ifdef CONFIG_PXA27x |
| 282 | static struct resource pxa27x_resources_i2c_power[] = { |
| 283 | { |
| 284 | .start = 0x40f00180, |
| 285 | .end = 0x40f001a3, |
| 286 | .flags = IORESOURCE_MEM, |
| 287 | }, { |
| 288 | .start = IRQ_PWRI2C, |
| 289 | .end = IRQ_PWRI2C, |
| 290 | .flags = IORESOURCE_IRQ, |
| 291 | }, |
| 292 | }; |
| 293 | |
| 294 | struct platform_device pxa27x_device_i2c_power = { |
| 295 | .name = "pxa2xx-i2c", |
| 296 | .id = 1, |
| 297 | .resource = pxa27x_resources_i2c_power, |
| 298 | .num_resources = ARRAY_SIZE(pxa27x_resources_i2c_power), |
| 299 | }; |
| 300 | #endif |
| 301 | |
| 302 | #ifdef CONFIG_PXA3xx |
| 303 | static struct resource pxa3xx_resources_i2c_power[] = { |
| 304 | { |
| 305 | .start = 0x40f500c0, |
| 306 | .end = 0x40f500d3, |
| 307 | .flags = IORESOURCE_MEM, |
| 308 | }, { |
| 309 | .start = IRQ_PWRI2C, |
| 310 | .end = IRQ_PWRI2C, |
| 311 | .flags = IORESOURCE_IRQ, |
| 312 | }, |
| 313 | }; |
| 314 | |
| 315 | struct platform_device pxa3xx_device_i2c_power = { |
Eric Miao | f23d491 | 2009-04-13 14:43:25 +0800 | [diff] [blame] | 316 | .name = "pxa3xx-pwri2c", |
Eric Miao | 9946429 | 2008-11-28 15:01:55 +0800 | [diff] [blame] | 317 | .id = 1, |
| 318 | .resource = pxa3xx_resources_i2c_power, |
| 319 | .num_resources = ARRAY_SIZE(pxa3xx_resources_i2c_power), |
| 320 | }; |
| 321 | #endif |
| 322 | |
eric miao | 8f58de7 | 2007-12-19 17:14:02 +0800 | [diff] [blame] | 323 | static struct resource pxai2s_resources[] = { |
| 324 | { |
| 325 | .start = 0x40400000, |
| 326 | .end = 0x40400083, |
| 327 | .flags = IORESOURCE_MEM, |
| 328 | }, { |
| 329 | .start = IRQ_I2S, |
| 330 | .end = IRQ_I2S, |
| 331 | .flags = IORESOURCE_IRQ, |
| 332 | }, |
| 333 | }; |
| 334 | |
| 335 | struct platform_device pxa_device_i2s = { |
| 336 | .name = "pxa2xx-i2s", |
| 337 | .id = -1, |
| 338 | .resource = pxai2s_resources, |
| 339 | .num_resources = ARRAY_SIZE(pxai2s_resources), |
| 340 | }; |
| 341 | |
| 342 | static u64 pxaficp_dmamask = ~(u32)0; |
| 343 | |
| 344 | struct platform_device pxa_device_ficp = { |
| 345 | .name = "pxa2xx-ir", |
| 346 | .id = -1, |
| 347 | .dev = { |
| 348 | .dma_mask = &pxaficp_dmamask, |
| 349 | .coherent_dma_mask = 0xffffffff, |
| 350 | }, |
| 351 | }; |
| 352 | |
| 353 | void __init pxa_set_ficp_info(struct pxaficp_platform_data *info) |
| 354 | { |
| 355 | pxa_register_device(&pxa_device_ficp, info); |
| 356 | } |
| 357 | |
Robert Jarzmik | 7249314 | 2008-11-13 23:50:56 +0100 | [diff] [blame] | 358 | static struct resource pxa_rtc_resources[] = { |
| 359 | [0] = { |
| 360 | .start = 0x40900000, |
| 361 | .end = 0x40900000 + 0x3b, |
| 362 | .flags = IORESOURCE_MEM, |
| 363 | }, |
| 364 | [1] = { |
| 365 | .start = IRQ_RTC1Hz, |
| 366 | .end = IRQ_RTC1Hz, |
| 367 | .flags = IORESOURCE_IRQ, |
| 368 | }, |
| 369 | [2] = { |
| 370 | .start = IRQ_RTCAlrm, |
| 371 | .end = IRQ_RTCAlrm, |
| 372 | .flags = IORESOURCE_IRQ, |
| 373 | }, |
| 374 | }; |
| 375 | |
| 376 | struct platform_device sa1100_device_rtc = { |
eric miao | 8f58de7 | 2007-12-19 17:14:02 +0800 | [diff] [blame] | 377 | .name = "sa1100-rtc", |
| 378 | .id = -1, |
| 379 | }; |
| 380 | |
Robert Jarzmik | 7249314 | 2008-11-13 23:50:56 +0100 | [diff] [blame] | 381 | struct platform_device pxa_device_rtc = { |
| 382 | .name = "pxa-rtc", |
| 383 | .id = -1, |
| 384 | .num_resources = ARRAY_SIZE(pxa_rtc_resources), |
| 385 | .resource = pxa_rtc_resources, |
| 386 | }; |
| 387 | |
Mark Brown | 9f19d63 | 2008-06-10 12:30:05 +0100 | [diff] [blame] | 388 | static struct resource pxa_ac97_resources[] = { |
| 389 | [0] = { |
| 390 | .start = 0x40500000, |
| 391 | .end = 0x40500000 + 0xfff, |
| 392 | .flags = IORESOURCE_MEM, |
| 393 | }, |
| 394 | [1] = { |
| 395 | .start = IRQ_AC97, |
| 396 | .end = IRQ_AC97, |
| 397 | .flags = IORESOURCE_IRQ, |
| 398 | }, |
| 399 | }; |
| 400 | |
| 401 | static u64 pxa_ac97_dmamask = 0xffffffffUL; |
| 402 | |
| 403 | struct platform_device pxa_device_ac97 = { |
| 404 | .name = "pxa2xx-ac97", |
| 405 | .id = -1, |
| 406 | .dev = { |
| 407 | .dma_mask = &pxa_ac97_dmamask, |
| 408 | .coherent_dma_mask = 0xffffffff, |
| 409 | }, |
| 410 | .num_resources = ARRAY_SIZE(pxa_ac97_resources), |
| 411 | .resource = pxa_ac97_resources, |
| 412 | }; |
| 413 | |
| 414 | void __init pxa_set_ac97_info(pxa2xx_audio_ops_t *ops) |
| 415 | { |
| 416 | pxa_register_device(&pxa_device_ac97, ops); |
| 417 | } |
| 418 | |
eric miao | 8f58de7 | 2007-12-19 17:14:02 +0800 | [diff] [blame] | 419 | #ifdef CONFIG_PXA25x |
| 420 | |
eric miao | 75540c1 | 2008-04-13 21:44:04 +0100 | [diff] [blame] | 421 | static struct resource pxa25x_resource_pwm0[] = { |
| 422 | [0] = { |
| 423 | .start = 0x40b00000, |
| 424 | .end = 0x40b0000f, |
| 425 | .flags = IORESOURCE_MEM, |
| 426 | }, |
| 427 | }; |
| 428 | |
| 429 | struct platform_device pxa25x_device_pwm0 = { |
| 430 | .name = "pxa25x-pwm", |
| 431 | .id = 0, |
| 432 | .resource = pxa25x_resource_pwm0, |
| 433 | .num_resources = ARRAY_SIZE(pxa25x_resource_pwm0), |
| 434 | }; |
| 435 | |
| 436 | static struct resource pxa25x_resource_pwm1[] = { |
| 437 | [0] = { |
| 438 | .start = 0x40c00000, |
| 439 | .end = 0x40c0000f, |
| 440 | .flags = IORESOURCE_MEM, |
| 441 | }, |
| 442 | }; |
| 443 | |
| 444 | struct platform_device pxa25x_device_pwm1 = { |
| 445 | .name = "pxa25x-pwm", |
| 446 | .id = 1, |
| 447 | .resource = pxa25x_resource_pwm1, |
| 448 | .num_resources = ARRAY_SIZE(pxa25x_resource_pwm1), |
| 449 | }; |
| 450 | |
eric miao | 8f58de7 | 2007-12-19 17:14:02 +0800 | [diff] [blame] | 451 | static u64 pxa25x_ssp_dma_mask = DMA_BIT_MASK(32); |
| 452 | |
| 453 | static struct resource pxa25x_resource_ssp[] = { |
| 454 | [0] = { |
| 455 | .start = 0x41000000, |
| 456 | .end = 0x4100001f, |
| 457 | .flags = IORESOURCE_MEM, |
| 458 | }, |
| 459 | [1] = { |
| 460 | .start = IRQ_SSP, |
| 461 | .end = IRQ_SSP, |
| 462 | .flags = IORESOURCE_IRQ, |
| 463 | }, |
| 464 | [2] = { |
| 465 | /* DRCMR for RX */ |
| 466 | .start = 13, |
| 467 | .end = 13, |
| 468 | .flags = IORESOURCE_DMA, |
| 469 | }, |
| 470 | [3] = { |
| 471 | /* DRCMR for TX */ |
| 472 | .start = 14, |
| 473 | .end = 14, |
| 474 | .flags = IORESOURCE_DMA, |
| 475 | }, |
| 476 | }; |
| 477 | |
| 478 | struct platform_device pxa25x_device_ssp = { |
| 479 | .name = "pxa25x-ssp", |
| 480 | .id = 0, |
| 481 | .dev = { |
| 482 | .dma_mask = &pxa25x_ssp_dma_mask, |
| 483 | .coherent_dma_mask = DMA_BIT_MASK(32), |
| 484 | }, |
| 485 | .resource = pxa25x_resource_ssp, |
| 486 | .num_resources = ARRAY_SIZE(pxa25x_resource_ssp), |
| 487 | }; |
| 488 | |
| 489 | static u64 pxa25x_nssp_dma_mask = DMA_BIT_MASK(32); |
| 490 | |
| 491 | static struct resource pxa25x_resource_nssp[] = { |
| 492 | [0] = { |
| 493 | .start = 0x41400000, |
| 494 | .end = 0x4140002f, |
| 495 | .flags = IORESOURCE_MEM, |
| 496 | }, |
| 497 | [1] = { |
| 498 | .start = IRQ_NSSP, |
| 499 | .end = IRQ_NSSP, |
| 500 | .flags = IORESOURCE_IRQ, |
| 501 | }, |
| 502 | [2] = { |
| 503 | /* DRCMR for RX */ |
| 504 | .start = 15, |
| 505 | .end = 15, |
| 506 | .flags = IORESOURCE_DMA, |
| 507 | }, |
| 508 | [3] = { |
| 509 | /* DRCMR for TX */ |
| 510 | .start = 16, |
| 511 | .end = 16, |
| 512 | .flags = IORESOURCE_DMA, |
| 513 | }, |
| 514 | }; |
| 515 | |
| 516 | struct platform_device pxa25x_device_nssp = { |
| 517 | .name = "pxa25x-nssp", |
| 518 | .id = 1, |
| 519 | .dev = { |
| 520 | .dma_mask = &pxa25x_nssp_dma_mask, |
| 521 | .coherent_dma_mask = DMA_BIT_MASK(32), |
| 522 | }, |
| 523 | .resource = pxa25x_resource_nssp, |
| 524 | .num_resources = ARRAY_SIZE(pxa25x_resource_nssp), |
| 525 | }; |
| 526 | |
| 527 | static u64 pxa25x_assp_dma_mask = DMA_BIT_MASK(32); |
| 528 | |
| 529 | static struct resource pxa25x_resource_assp[] = { |
| 530 | [0] = { |
| 531 | .start = 0x41500000, |
| 532 | .end = 0x4150002f, |
| 533 | .flags = IORESOURCE_MEM, |
| 534 | }, |
| 535 | [1] = { |
| 536 | .start = IRQ_ASSP, |
| 537 | .end = IRQ_ASSP, |
| 538 | .flags = IORESOURCE_IRQ, |
| 539 | }, |
| 540 | [2] = { |
| 541 | /* DRCMR for RX */ |
| 542 | .start = 23, |
| 543 | .end = 23, |
| 544 | .flags = IORESOURCE_DMA, |
| 545 | }, |
| 546 | [3] = { |
| 547 | /* DRCMR for TX */ |
| 548 | .start = 24, |
| 549 | .end = 24, |
| 550 | .flags = IORESOURCE_DMA, |
| 551 | }, |
| 552 | }; |
| 553 | |
| 554 | struct platform_device pxa25x_device_assp = { |
| 555 | /* ASSP is basically equivalent to NSSP */ |
| 556 | .name = "pxa25x-nssp", |
| 557 | .id = 2, |
| 558 | .dev = { |
| 559 | .dma_mask = &pxa25x_assp_dma_mask, |
| 560 | .coherent_dma_mask = DMA_BIT_MASK(32), |
| 561 | }, |
| 562 | .resource = pxa25x_resource_assp, |
| 563 | .num_resources = ARRAY_SIZE(pxa25x_resource_assp), |
| 564 | }; |
| 565 | #endif /* CONFIG_PXA25x */ |
| 566 | |
| 567 | #if defined(CONFIG_PXA27x) || defined(CONFIG_PXA3xx) |
| 568 | |
eric miao | 3732098 | 2008-01-23 13:39:13 +0800 | [diff] [blame] | 569 | static struct resource pxa27x_resource_keypad[] = { |
| 570 | [0] = { |
| 571 | .start = 0x41500000, |
| 572 | .end = 0x4150004c, |
| 573 | .flags = IORESOURCE_MEM, |
| 574 | }, |
| 575 | [1] = { |
| 576 | .start = IRQ_KEYPAD, |
| 577 | .end = IRQ_KEYPAD, |
| 578 | .flags = IORESOURCE_IRQ, |
| 579 | }, |
| 580 | }; |
| 581 | |
| 582 | struct platform_device pxa27x_device_keypad = { |
| 583 | .name = "pxa27x-keypad", |
| 584 | .id = -1, |
| 585 | .resource = pxa27x_resource_keypad, |
| 586 | .num_resources = ARRAY_SIZE(pxa27x_resource_keypad), |
| 587 | }; |
| 588 | |
| 589 | void __init pxa_set_keypad_info(struct pxa27x_keypad_platform_data *info) |
| 590 | { |
| 591 | pxa_register_device(&pxa27x_device_keypad, info); |
| 592 | } |
| 593 | |
eric miao | ec68e45 | 2007-12-12 09:29:33 +0800 | [diff] [blame] | 594 | static u64 pxa27x_ohci_dma_mask = DMA_BIT_MASK(32); |
| 595 | |
| 596 | static struct resource pxa27x_resource_ohci[] = { |
| 597 | [0] = { |
| 598 | .start = 0x4C000000, |
| 599 | .end = 0x4C00ff6f, |
| 600 | .flags = IORESOURCE_MEM, |
| 601 | }, |
| 602 | [1] = { |
| 603 | .start = IRQ_USBH1, |
| 604 | .end = IRQ_USBH1, |
| 605 | .flags = IORESOURCE_IRQ, |
| 606 | }, |
| 607 | }; |
| 608 | |
| 609 | struct platform_device pxa27x_device_ohci = { |
| 610 | .name = "pxa27x-ohci", |
| 611 | .id = -1, |
| 612 | .dev = { |
| 613 | .dma_mask = &pxa27x_ohci_dma_mask, |
| 614 | .coherent_dma_mask = DMA_BIT_MASK(32), |
| 615 | }, |
| 616 | .num_resources = ARRAY_SIZE(pxa27x_resource_ohci), |
| 617 | .resource = pxa27x_resource_ohci, |
| 618 | }; |
| 619 | |
| 620 | void __init pxa_set_ohci_info(struct pxaohci_platform_data *info) |
| 621 | { |
| 622 | pxa_register_device(&pxa27x_device_ohci, info); |
| 623 | } |
| 624 | |
eric miao | 8f58de7 | 2007-12-19 17:14:02 +0800 | [diff] [blame] | 625 | static u64 pxa27x_ssp1_dma_mask = DMA_BIT_MASK(32); |
| 626 | |
| 627 | static struct resource pxa27x_resource_ssp1[] = { |
| 628 | [0] = { |
| 629 | .start = 0x41000000, |
| 630 | .end = 0x4100003f, |
| 631 | .flags = IORESOURCE_MEM, |
| 632 | }, |
| 633 | [1] = { |
| 634 | .start = IRQ_SSP, |
| 635 | .end = IRQ_SSP, |
| 636 | .flags = IORESOURCE_IRQ, |
| 637 | }, |
| 638 | [2] = { |
| 639 | /* DRCMR for RX */ |
| 640 | .start = 13, |
| 641 | .end = 13, |
| 642 | .flags = IORESOURCE_DMA, |
| 643 | }, |
| 644 | [3] = { |
| 645 | /* DRCMR for TX */ |
| 646 | .start = 14, |
| 647 | .end = 14, |
| 648 | .flags = IORESOURCE_DMA, |
| 649 | }, |
| 650 | }; |
| 651 | |
| 652 | struct platform_device pxa27x_device_ssp1 = { |
| 653 | .name = "pxa27x-ssp", |
| 654 | .id = 0, |
| 655 | .dev = { |
| 656 | .dma_mask = &pxa27x_ssp1_dma_mask, |
| 657 | .coherent_dma_mask = DMA_BIT_MASK(32), |
| 658 | }, |
| 659 | .resource = pxa27x_resource_ssp1, |
| 660 | .num_resources = ARRAY_SIZE(pxa27x_resource_ssp1), |
| 661 | }; |
| 662 | |
| 663 | static u64 pxa27x_ssp2_dma_mask = DMA_BIT_MASK(32); |
| 664 | |
| 665 | static struct resource pxa27x_resource_ssp2[] = { |
| 666 | [0] = { |
| 667 | .start = 0x41700000, |
| 668 | .end = 0x4170003f, |
| 669 | .flags = IORESOURCE_MEM, |
| 670 | }, |
| 671 | [1] = { |
| 672 | .start = IRQ_SSP2, |
| 673 | .end = IRQ_SSP2, |
| 674 | .flags = IORESOURCE_IRQ, |
| 675 | }, |
| 676 | [2] = { |
| 677 | /* DRCMR for RX */ |
| 678 | .start = 15, |
| 679 | .end = 15, |
| 680 | .flags = IORESOURCE_DMA, |
| 681 | }, |
| 682 | [3] = { |
| 683 | /* DRCMR for TX */ |
| 684 | .start = 16, |
| 685 | .end = 16, |
| 686 | .flags = IORESOURCE_DMA, |
| 687 | }, |
| 688 | }; |
| 689 | |
| 690 | struct platform_device pxa27x_device_ssp2 = { |
| 691 | .name = "pxa27x-ssp", |
| 692 | .id = 1, |
| 693 | .dev = { |
| 694 | .dma_mask = &pxa27x_ssp2_dma_mask, |
| 695 | .coherent_dma_mask = DMA_BIT_MASK(32), |
| 696 | }, |
| 697 | .resource = pxa27x_resource_ssp2, |
| 698 | .num_resources = ARRAY_SIZE(pxa27x_resource_ssp2), |
| 699 | }; |
| 700 | |
| 701 | static u64 pxa27x_ssp3_dma_mask = DMA_BIT_MASK(32); |
| 702 | |
| 703 | static struct resource pxa27x_resource_ssp3[] = { |
| 704 | [0] = { |
| 705 | .start = 0x41900000, |
| 706 | .end = 0x4190003f, |
| 707 | .flags = IORESOURCE_MEM, |
| 708 | }, |
| 709 | [1] = { |
| 710 | .start = IRQ_SSP3, |
| 711 | .end = IRQ_SSP3, |
| 712 | .flags = IORESOURCE_IRQ, |
| 713 | }, |
| 714 | [2] = { |
| 715 | /* DRCMR for RX */ |
| 716 | .start = 66, |
| 717 | .end = 66, |
| 718 | .flags = IORESOURCE_DMA, |
| 719 | }, |
| 720 | [3] = { |
| 721 | /* DRCMR for TX */ |
| 722 | .start = 67, |
| 723 | .end = 67, |
| 724 | .flags = IORESOURCE_DMA, |
| 725 | }, |
| 726 | }; |
| 727 | |
| 728 | struct platform_device pxa27x_device_ssp3 = { |
| 729 | .name = "pxa27x-ssp", |
| 730 | .id = 2, |
| 731 | .dev = { |
| 732 | .dma_mask = &pxa27x_ssp3_dma_mask, |
| 733 | .coherent_dma_mask = DMA_BIT_MASK(32), |
| 734 | }, |
| 735 | .resource = pxa27x_resource_ssp3, |
| 736 | .num_resources = ARRAY_SIZE(pxa27x_resource_ssp3), |
| 737 | }; |
Guennadi Liakhovetski | 3f3acef | 2008-04-11 22:19:45 +0200 | [diff] [blame] | 738 | |
eric miao | 75540c1 | 2008-04-13 21:44:04 +0100 | [diff] [blame] | 739 | static struct resource pxa27x_resource_pwm0[] = { |
| 740 | [0] = { |
| 741 | .start = 0x40b00000, |
| 742 | .end = 0x40b0001f, |
| 743 | .flags = IORESOURCE_MEM, |
| 744 | }, |
| 745 | }; |
| 746 | |
| 747 | struct platform_device pxa27x_device_pwm0 = { |
| 748 | .name = "pxa27x-pwm", |
| 749 | .id = 0, |
| 750 | .resource = pxa27x_resource_pwm0, |
| 751 | .num_resources = ARRAY_SIZE(pxa27x_resource_pwm0), |
| 752 | }; |
| 753 | |
| 754 | static struct resource pxa27x_resource_pwm1[] = { |
| 755 | [0] = { |
| 756 | .start = 0x40c00000, |
| 757 | .end = 0x40c0001f, |
| 758 | .flags = IORESOURCE_MEM, |
| 759 | }, |
| 760 | }; |
| 761 | |
| 762 | struct platform_device pxa27x_device_pwm1 = { |
| 763 | .name = "pxa27x-pwm", |
| 764 | .id = 1, |
| 765 | .resource = pxa27x_resource_pwm1, |
| 766 | .num_resources = ARRAY_SIZE(pxa27x_resource_pwm1), |
| 767 | }; |
| 768 | |
Guennadi Liakhovetski | 3f3acef | 2008-04-11 22:19:45 +0200 | [diff] [blame] | 769 | static struct resource pxa27x_resource_camera[] = { |
| 770 | [0] = { |
| 771 | .start = 0x50000000, |
| 772 | .end = 0x50000fff, |
| 773 | .flags = IORESOURCE_MEM, |
| 774 | }, |
| 775 | [1] = { |
| 776 | .start = IRQ_CAMERA, |
| 777 | .end = IRQ_CAMERA, |
| 778 | .flags = IORESOURCE_IRQ, |
| 779 | }, |
| 780 | }; |
| 781 | |
| 782 | static u64 pxa27x_dma_mask_camera = DMA_BIT_MASK(32); |
| 783 | |
| 784 | static struct platform_device pxa27x_device_camera = { |
| 785 | .name = "pxa27x-camera", |
| 786 | .id = 0, /* This is used to put cameras on this interface */ |
| 787 | .dev = { |
| 788 | .dma_mask = &pxa27x_dma_mask_camera, |
| 789 | .coherent_dma_mask = 0xffffffff, |
| 790 | }, |
| 791 | .num_resources = ARRAY_SIZE(pxa27x_resource_camera), |
| 792 | .resource = pxa27x_resource_camera, |
| 793 | }; |
| 794 | |
| 795 | void __init pxa_set_camera_info(struct pxacamera_platform_data *info) |
| 796 | { |
| 797 | pxa_register_device(&pxa27x_device_camera, info); |
| 798 | } |
eric miao | 8f58de7 | 2007-12-19 17:14:02 +0800 | [diff] [blame] | 799 | #endif /* CONFIG_PXA27x || CONFIG_PXA3xx */ |
| 800 | |
| 801 | #ifdef CONFIG_PXA3xx |
| 802 | static u64 pxa3xx_ssp4_dma_mask = DMA_BIT_MASK(32); |
| 803 | |
| 804 | static struct resource pxa3xx_resource_ssp4[] = { |
| 805 | [0] = { |
| 806 | .start = 0x41a00000, |
| 807 | .end = 0x41a0003f, |
| 808 | .flags = IORESOURCE_MEM, |
| 809 | }, |
| 810 | [1] = { |
| 811 | .start = IRQ_SSP4, |
| 812 | .end = IRQ_SSP4, |
| 813 | .flags = IORESOURCE_IRQ, |
| 814 | }, |
| 815 | [2] = { |
| 816 | /* DRCMR for RX */ |
| 817 | .start = 2, |
| 818 | .end = 2, |
| 819 | .flags = IORESOURCE_DMA, |
| 820 | }, |
| 821 | [3] = { |
| 822 | /* DRCMR for TX */ |
| 823 | .start = 3, |
| 824 | .end = 3, |
| 825 | .flags = IORESOURCE_DMA, |
| 826 | }, |
| 827 | }; |
| 828 | |
| 829 | struct platform_device pxa3xx_device_ssp4 = { |
| 830 | /* PXA3xx SSP is basically equivalent to PXA27x */ |
| 831 | .name = "pxa27x-ssp", |
| 832 | .id = 3, |
| 833 | .dev = { |
| 834 | .dma_mask = &pxa3xx_ssp4_dma_mask, |
| 835 | .coherent_dma_mask = DMA_BIT_MASK(32), |
| 836 | }, |
| 837 | .resource = pxa3xx_resource_ssp4, |
| 838 | .num_resources = ARRAY_SIZE(pxa3xx_resource_ssp4), |
| 839 | }; |
Bridge Wu | 8d33b05 | 2007-12-21 19:15:36 +0800 | [diff] [blame] | 840 | |
| 841 | static struct resource pxa3xx_resources_mci2[] = { |
| 842 | [0] = { |
| 843 | .start = 0x42000000, |
| 844 | .end = 0x42000fff, |
| 845 | .flags = IORESOURCE_MEM, |
| 846 | }, |
| 847 | [1] = { |
| 848 | .start = IRQ_MMC2, |
| 849 | .end = IRQ_MMC2, |
| 850 | .flags = IORESOURCE_IRQ, |
| 851 | }, |
| 852 | [2] = { |
| 853 | .start = 93, |
| 854 | .end = 93, |
| 855 | .flags = IORESOURCE_DMA, |
| 856 | }, |
| 857 | [3] = { |
| 858 | .start = 94, |
| 859 | .end = 94, |
| 860 | .flags = IORESOURCE_DMA, |
| 861 | }, |
| 862 | }; |
| 863 | |
| 864 | struct platform_device pxa3xx_device_mci2 = { |
| 865 | .name = "pxa2xx-mci", |
| 866 | .id = 1, |
| 867 | .dev = { |
| 868 | .dma_mask = &pxamci_dmamask, |
| 869 | .coherent_dma_mask = 0xffffffff, |
| 870 | }, |
| 871 | .num_resources = ARRAY_SIZE(pxa3xx_resources_mci2), |
| 872 | .resource = pxa3xx_resources_mci2, |
| 873 | }; |
| 874 | |
| 875 | void __init pxa3xx_set_mci2_info(struct pxamci_platform_data *info) |
| 876 | { |
| 877 | pxa_register_device(&pxa3xx_device_mci2, info); |
| 878 | } |
| 879 | |
Bridge Wu | 5a1f21b | 2007-12-21 19:27:08 +0800 | [diff] [blame] | 880 | static struct resource pxa3xx_resources_mci3[] = { |
| 881 | [0] = { |
| 882 | .start = 0x42500000, |
| 883 | .end = 0x42500fff, |
| 884 | .flags = IORESOURCE_MEM, |
| 885 | }, |
| 886 | [1] = { |
| 887 | .start = IRQ_MMC3, |
| 888 | .end = IRQ_MMC3, |
| 889 | .flags = IORESOURCE_IRQ, |
| 890 | }, |
| 891 | [2] = { |
| 892 | .start = 100, |
| 893 | .end = 100, |
| 894 | .flags = IORESOURCE_DMA, |
| 895 | }, |
| 896 | [3] = { |
| 897 | .start = 101, |
| 898 | .end = 101, |
| 899 | .flags = IORESOURCE_DMA, |
| 900 | }, |
| 901 | }; |
| 902 | |
| 903 | struct platform_device pxa3xx_device_mci3 = { |
| 904 | .name = "pxa2xx-mci", |
| 905 | .id = 2, |
| 906 | .dev = { |
| 907 | .dma_mask = &pxamci_dmamask, |
| 908 | .coherent_dma_mask = 0xffffffff, |
| 909 | }, |
| 910 | .num_resources = ARRAY_SIZE(pxa3xx_resources_mci3), |
| 911 | .resource = pxa3xx_resources_mci3, |
| 912 | }; |
| 913 | |
| 914 | void __init pxa3xx_set_mci3_info(struct pxamci_platform_data *info) |
| 915 | { |
| 916 | pxa_register_device(&pxa3xx_device_mci3, info); |
| 917 | } |
| 918 | |
Eric Miao | 9ae819a | 2008-06-02 15:22:03 +0800 | [diff] [blame] | 919 | static struct resource pxa3xx_resources_nand[] = { |
| 920 | [0] = { |
| 921 | .start = 0x43100000, |
| 922 | .end = 0x43100053, |
| 923 | .flags = IORESOURCE_MEM, |
| 924 | }, |
| 925 | [1] = { |
| 926 | .start = IRQ_NAND, |
| 927 | .end = IRQ_NAND, |
| 928 | .flags = IORESOURCE_IRQ, |
| 929 | }, |
| 930 | [2] = { |
| 931 | /* DRCMR for Data DMA */ |
| 932 | .start = 97, |
| 933 | .end = 97, |
| 934 | .flags = IORESOURCE_DMA, |
| 935 | }, |
| 936 | [3] = { |
| 937 | /* DRCMR for Command DMA */ |
| 938 | .start = 99, |
| 939 | .end = 99, |
| 940 | .flags = IORESOURCE_DMA, |
| 941 | }, |
| 942 | }; |
| 943 | |
| 944 | static u64 pxa3xx_nand_dma_mask = DMA_BIT_MASK(32); |
| 945 | |
| 946 | struct platform_device pxa3xx_device_nand = { |
| 947 | .name = "pxa3xx-nand", |
| 948 | .id = -1, |
| 949 | .dev = { |
| 950 | .dma_mask = &pxa3xx_nand_dma_mask, |
| 951 | .coherent_dma_mask = DMA_BIT_MASK(32), |
| 952 | }, |
| 953 | .num_resources = ARRAY_SIZE(pxa3xx_resources_nand), |
| 954 | .resource = pxa3xx_resources_nand, |
| 955 | }; |
| 956 | |
| 957 | void __init pxa3xx_set_nand_info(struct pxa3xx_nand_platform_data *info) |
| 958 | { |
| 959 | pxa_register_device(&pxa3xx_device_nand, info); |
| 960 | } |
Daniel Mack | 1ff2c33 | 2009-07-09 19:04:49 +0200 | [diff] [blame] | 961 | |
| 962 | static struct resource pxa3xx_resources_gcu[] = { |
| 963 | { |
| 964 | .start = 0x54000000, |
| 965 | .end = 0x54000fff, |
| 966 | .flags = IORESOURCE_MEM, |
| 967 | }, |
| 968 | { |
| 969 | .start = IRQ_GCU, |
| 970 | .end = IRQ_GCU, |
| 971 | .flags = IORESOURCE_IRQ, |
| 972 | }, |
| 973 | }; |
| 974 | |
| 975 | static u64 pxa3xx_gcu_dmamask = DMA_BIT_MASK(32); |
| 976 | |
| 977 | struct platform_device pxa3xx_device_gcu = { |
| 978 | .name = "pxa3xx-gcu", |
| 979 | .id = -1, |
| 980 | .num_resources = ARRAY_SIZE(pxa3xx_resources_gcu), |
| 981 | .resource = pxa3xx_resources_gcu, |
| 982 | .dev = { |
| 983 | .dma_mask = &pxa3xx_gcu_dmamask, |
| 984 | .coherent_dma_mask = 0xffffffff, |
| 985 | }, |
| 986 | }; |
| 987 | |
eric miao | 8f58de7 | 2007-12-19 17:14:02 +0800 | [diff] [blame] | 988 | #endif /* CONFIG_PXA3xx */ |
Guennadi Liakhovetski | e172274c | 2008-06-13 09:17:31 +0100 | [diff] [blame] | 989 | |
| 990 | /* pxa2xx-spi platform-device ID equals respective SSP platform-device ID + 1. |
| 991 | * See comment in arch/arm/mach-pxa/ssp.c::ssp_probe() */ |
| 992 | void __init pxa2xx_set_spi_info(unsigned id, struct pxa2xx_spi_master *info) |
| 993 | { |
| 994 | struct platform_device *pd; |
| 995 | |
| 996 | pd = platform_device_alloc("pxa2xx-spi", id); |
| 997 | if (pd == NULL) { |
| 998 | printk(KERN_ERR "pxa2xx-spi: failed to allocate device id %d\n", |
| 999 | id); |
| 1000 | return; |
| 1001 | } |
| 1002 | |
| 1003 | pd->dev.platform_data = info; |
| 1004 | platform_device_add(pd); |
| 1005 | } |