devices.c 19 KB

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