devices.c 21 KB

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