devices.c 19 KB

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