devices.c 19 KB

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