edma.c 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671
  1. /*
  2. * TI EDMA DMA engine driver
  3. *
  4. * Copyright 2012 Texas Instruments
  5. *
  6. * This program is free software; you can redistribute it and/or
  7. * modify it under the terms of the GNU General Public License as
  8. * published by the Free Software Foundation version 2.
  9. *
  10. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
  11. * kind, whether express or implied; without even the implied warranty
  12. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. * GNU General Public License for more details.
  14. */
  15. #include <linux/dmaengine.h>
  16. #include <linux/dma-mapping.h>
  17. #include <linux/err.h>
  18. #include <linux/init.h>
  19. #include <linux/interrupt.h>
  20. #include <linux/list.h>
  21. #include <linux/module.h>
  22. #include <linux/platform_device.h>
  23. #include <linux/slab.h>
  24. #include <linux/spinlock.h>
  25. #include <mach/edma.h>
  26. #include "dmaengine.h"
  27. #include "virt-dma.h"
  28. /*
  29. * This will go away when the private EDMA API is folded
  30. * into this driver and the platform device(s) are
  31. * instantiated in the arch code. We can only get away
  32. * with this simplification because DA8XX may not be built
  33. * in the same kernel image with other DaVinci parts. This
  34. * avoids having to sprinkle dmaengine driver platform devices
  35. * and data throughout all the existing board files.
  36. */
  37. #ifdef CONFIG_ARCH_DAVINCI_DA8XX
  38. #define EDMA_CTLRS 2
  39. #define EDMA_CHANS 32
  40. #else
  41. #define EDMA_CTLRS 1
  42. #define EDMA_CHANS 64
  43. #endif /* CONFIG_ARCH_DAVINCI_DA8XX */
  44. /* Max of 16 segments per channel to conserve PaRAM slots */
  45. #define MAX_NR_SG 16
  46. #define EDMA_MAX_SLOTS MAX_NR_SG
  47. #define EDMA_DESCRIPTORS 16
  48. struct edma_desc {
  49. struct virt_dma_desc vdesc;
  50. struct list_head node;
  51. int absync;
  52. int pset_nr;
  53. struct edmacc_param pset[0];
  54. };
  55. struct edma_cc;
  56. struct edma_chan {
  57. struct virt_dma_chan vchan;
  58. struct list_head node;
  59. struct edma_desc *edesc;
  60. struct edma_cc *ecc;
  61. int ch_num;
  62. bool alloced;
  63. int slot[EDMA_MAX_SLOTS];
  64. dma_addr_t addr;
  65. int addr_width;
  66. int maxburst;
  67. };
  68. struct edma_cc {
  69. int ctlr;
  70. struct dma_device dma_slave;
  71. struct edma_chan slave_chans[EDMA_CHANS];
  72. int num_slave_chans;
  73. int dummy_slot;
  74. };
  75. static inline struct edma_cc *to_edma_cc(struct dma_device *d)
  76. {
  77. return container_of(d, struct edma_cc, dma_slave);
  78. }
  79. static inline struct edma_chan *to_edma_chan(struct dma_chan *c)
  80. {
  81. return container_of(c, struct edma_chan, vchan.chan);
  82. }
  83. static inline struct edma_desc
  84. *to_edma_desc(struct dma_async_tx_descriptor *tx)
  85. {
  86. return container_of(tx, struct edma_desc, vdesc.tx);
  87. }
  88. static void edma_desc_free(struct virt_dma_desc *vdesc)
  89. {
  90. kfree(container_of(vdesc, struct edma_desc, vdesc));
  91. }
  92. /* Dispatch a queued descriptor to the controller (caller holds lock) */
  93. static void edma_execute(struct edma_chan *echan)
  94. {
  95. struct virt_dma_desc *vdesc = vchan_next_desc(&echan->vchan);
  96. struct edma_desc *edesc;
  97. int i;
  98. if (!vdesc) {
  99. echan->edesc = NULL;
  100. return;
  101. }
  102. list_del(&vdesc->node);
  103. echan->edesc = edesc = to_edma_desc(&vdesc->tx);
  104. /* Write descriptor PaRAM set(s) */
  105. for (i = 0; i < edesc->pset_nr; i++) {
  106. edma_write_slot(echan->slot[i], &edesc->pset[i]);
  107. dev_dbg(echan->vchan.chan.device->dev,
  108. "\n pset[%d]:\n"
  109. " chnum\t%d\n"
  110. " slot\t%d\n"
  111. " opt\t%08x\n"
  112. " src\t%08x\n"
  113. " dst\t%08x\n"
  114. " abcnt\t%08x\n"
  115. " ccnt\t%08x\n"
  116. " bidx\t%08x\n"
  117. " cidx\t%08x\n"
  118. " lkrld\t%08x\n",
  119. i, echan->ch_num, echan->slot[i],
  120. edesc->pset[i].opt,
  121. edesc->pset[i].src,
  122. edesc->pset[i].dst,
  123. edesc->pset[i].a_b_cnt,
  124. edesc->pset[i].ccnt,
  125. edesc->pset[i].src_dst_bidx,
  126. edesc->pset[i].src_dst_cidx,
  127. edesc->pset[i].link_bcntrld);
  128. /* Link to the previous slot if not the last set */
  129. if (i != (edesc->pset_nr - 1))
  130. edma_link(echan->slot[i], echan->slot[i+1]);
  131. /* Final pset links to the dummy pset */
  132. else
  133. edma_link(echan->slot[i], echan->ecc->dummy_slot);
  134. }
  135. edma_start(echan->ch_num);
  136. }
  137. static int edma_terminate_all(struct edma_chan *echan)
  138. {
  139. unsigned long flags;
  140. LIST_HEAD(head);
  141. spin_lock_irqsave(&echan->vchan.lock, flags);
  142. /*
  143. * Stop DMA activity: we assume the callback will not be called
  144. * after edma_dma() returns (even if it does, it will see
  145. * echan->edesc is NULL and exit.)
  146. */
  147. if (echan->edesc) {
  148. echan->edesc = NULL;
  149. edma_stop(echan->ch_num);
  150. }
  151. vchan_get_all_descriptors(&echan->vchan, &head);
  152. spin_unlock_irqrestore(&echan->vchan.lock, flags);
  153. vchan_dma_desc_free_list(&echan->vchan, &head);
  154. return 0;
  155. }
  156. static int edma_slave_config(struct edma_chan *echan,
  157. struct dma_slave_config *config)
  158. {
  159. if ((config->src_addr_width > DMA_SLAVE_BUSWIDTH_4_BYTES) ||
  160. (config->dst_addr_width > DMA_SLAVE_BUSWIDTH_4_BYTES))
  161. return -EINVAL;
  162. if (config->direction == DMA_MEM_TO_DEV) {
  163. if (config->dst_addr)
  164. echan->addr = config->dst_addr;
  165. if (config->dst_addr_width)
  166. echan->addr_width = config->dst_addr_width;
  167. if (config->dst_maxburst)
  168. echan->maxburst = config->dst_maxburst;
  169. } else if (config->direction == DMA_DEV_TO_MEM) {
  170. if (config->src_addr)
  171. echan->addr = config->src_addr;
  172. if (config->src_addr_width)
  173. echan->addr_width = config->src_addr_width;
  174. if (config->src_maxburst)
  175. echan->maxburst = config->src_maxburst;
  176. }
  177. return 0;
  178. }
  179. static int edma_control(struct dma_chan *chan, enum dma_ctrl_cmd cmd,
  180. unsigned long arg)
  181. {
  182. int ret = 0;
  183. struct dma_slave_config *config;
  184. struct edma_chan *echan = to_edma_chan(chan);
  185. switch (cmd) {
  186. case DMA_TERMINATE_ALL:
  187. edma_terminate_all(echan);
  188. break;
  189. case DMA_SLAVE_CONFIG:
  190. config = (struct dma_slave_config *)arg;
  191. ret = edma_slave_config(echan, config);
  192. break;
  193. default:
  194. ret = -ENOSYS;
  195. }
  196. return ret;
  197. }
  198. static struct dma_async_tx_descriptor *edma_prep_slave_sg(
  199. struct dma_chan *chan, struct scatterlist *sgl,
  200. unsigned int sg_len, enum dma_transfer_direction direction,
  201. unsigned long tx_flags, void *context)
  202. {
  203. struct edma_chan *echan = to_edma_chan(chan);
  204. struct device *dev = chan->device->dev;
  205. struct edma_desc *edesc;
  206. struct scatterlist *sg;
  207. int i;
  208. int acnt, bcnt, ccnt, src, dst, cidx;
  209. int src_bidx, dst_bidx, src_cidx, dst_cidx;
  210. if (unlikely(!echan || !sgl || !sg_len))
  211. return NULL;
  212. if (echan->addr_width == DMA_SLAVE_BUSWIDTH_UNDEFINED) {
  213. dev_err(dev, "Undefined slave buswidth\n");
  214. return NULL;
  215. }
  216. if (sg_len > MAX_NR_SG) {
  217. dev_err(dev, "Exceeded max SG segments %d > %d\n",
  218. sg_len, MAX_NR_SG);
  219. return NULL;
  220. }
  221. edesc = kzalloc(sizeof(*edesc) + sg_len *
  222. sizeof(edesc->pset[0]), GFP_ATOMIC);
  223. if (!edesc) {
  224. dev_dbg(dev, "Failed to allocate a descriptor\n");
  225. return NULL;
  226. }
  227. edesc->pset_nr = sg_len;
  228. for_each_sg(sgl, sg, sg_len, i) {
  229. /* Allocate a PaRAM slot, if needed */
  230. if (echan->slot[i] < 0) {
  231. echan->slot[i] =
  232. edma_alloc_slot(EDMA_CTLR(echan->ch_num),
  233. EDMA_SLOT_ANY);
  234. if (echan->slot[i] < 0) {
  235. dev_err(dev, "Failed to allocate slot\n");
  236. return NULL;
  237. }
  238. }
  239. acnt = echan->addr_width;
  240. /*
  241. * If the maxburst is equal to the fifo width, use
  242. * A-synced transfers. This allows for large contiguous
  243. * buffer transfers using only one PaRAM set.
  244. */
  245. if (echan->maxburst == 1) {
  246. edesc->absync = false;
  247. ccnt = sg_dma_len(sg) / acnt / (SZ_64K - 1);
  248. bcnt = sg_dma_len(sg) / acnt - ccnt * (SZ_64K - 1);
  249. if (bcnt)
  250. ccnt++;
  251. else
  252. bcnt = SZ_64K - 1;
  253. cidx = acnt;
  254. /*
  255. * If maxburst is greater than the fifo address_width,
  256. * use AB-synced transfers where A count is the fifo
  257. * address_width and B count is the maxburst. In this
  258. * case, we are limited to transfers of C count frames
  259. * of (address_width * maxburst) where C count is limited
  260. * to SZ_64K-1. This places an upper bound on the length
  261. * of an SG segment that can be handled.
  262. */
  263. } else {
  264. edesc->absync = true;
  265. bcnt = echan->maxburst;
  266. ccnt = sg_dma_len(sg) / (acnt * bcnt);
  267. if (ccnt > (SZ_64K - 1)) {
  268. dev_err(dev, "Exceeded max SG segment size\n");
  269. return NULL;
  270. }
  271. cidx = acnt * bcnt;
  272. }
  273. if (direction == DMA_MEM_TO_DEV) {
  274. src = sg_dma_address(sg);
  275. dst = echan->addr;
  276. src_bidx = acnt;
  277. src_cidx = cidx;
  278. dst_bidx = 0;
  279. dst_cidx = 0;
  280. } else {
  281. src = echan->addr;
  282. dst = sg_dma_address(sg);
  283. src_bidx = 0;
  284. src_cidx = 0;
  285. dst_bidx = acnt;
  286. dst_cidx = cidx;
  287. }
  288. edesc->pset[i].opt = EDMA_TCC(EDMA_CHAN_SLOT(echan->ch_num));
  289. /* Configure A or AB synchronized transfers */
  290. if (edesc->absync)
  291. edesc->pset[i].opt |= SYNCDIM;
  292. /* If this is the last set, enable completion interrupt flag */
  293. if (i == sg_len - 1)
  294. edesc->pset[i].opt |= TCINTEN;
  295. edesc->pset[i].src = src;
  296. edesc->pset[i].dst = dst;
  297. edesc->pset[i].src_dst_bidx = (dst_bidx << 16) | src_bidx;
  298. edesc->pset[i].src_dst_cidx = (dst_cidx << 16) | src_cidx;
  299. edesc->pset[i].a_b_cnt = bcnt << 16 | acnt;
  300. edesc->pset[i].ccnt = ccnt;
  301. edesc->pset[i].link_bcntrld = 0xffffffff;
  302. }
  303. return vchan_tx_prep(&echan->vchan, &edesc->vdesc, tx_flags);
  304. }
  305. static void edma_callback(unsigned ch_num, u16 ch_status, void *data)
  306. {
  307. struct edma_chan *echan = data;
  308. struct device *dev = echan->vchan.chan.device->dev;
  309. struct edma_desc *edesc;
  310. unsigned long flags;
  311. /* Stop the channel */
  312. edma_stop(echan->ch_num);
  313. switch (ch_status) {
  314. case DMA_COMPLETE:
  315. dev_dbg(dev, "transfer complete on channel %d\n", ch_num);
  316. spin_lock_irqsave(&echan->vchan.lock, flags);
  317. edesc = echan->edesc;
  318. if (edesc) {
  319. edma_execute(echan);
  320. vchan_cookie_complete(&edesc->vdesc);
  321. }
  322. spin_unlock_irqrestore(&echan->vchan.lock, flags);
  323. break;
  324. case DMA_CC_ERROR:
  325. dev_dbg(dev, "transfer error on channel %d\n", ch_num);
  326. break;
  327. default:
  328. break;
  329. }
  330. }
  331. /* Alloc channel resources */
  332. static int edma_alloc_chan_resources(struct dma_chan *chan)
  333. {
  334. struct edma_chan *echan = to_edma_chan(chan);
  335. struct device *dev = chan->device->dev;
  336. int ret;
  337. int a_ch_num;
  338. LIST_HEAD(descs);
  339. a_ch_num = edma_alloc_channel(echan->ch_num, edma_callback,
  340. chan, EVENTQ_DEFAULT);
  341. if (a_ch_num < 0) {
  342. ret = -ENODEV;
  343. goto err_no_chan;
  344. }
  345. if (a_ch_num != echan->ch_num) {
  346. dev_err(dev, "failed to allocate requested channel %u:%u\n",
  347. EDMA_CTLR(echan->ch_num),
  348. EDMA_CHAN_SLOT(echan->ch_num));
  349. ret = -ENODEV;
  350. goto err_wrong_chan;
  351. }
  352. echan->alloced = true;
  353. echan->slot[0] = echan->ch_num;
  354. dev_info(dev, "allocated channel for %u:%u\n",
  355. EDMA_CTLR(echan->ch_num), EDMA_CHAN_SLOT(echan->ch_num));
  356. return 0;
  357. err_wrong_chan:
  358. edma_free_channel(a_ch_num);
  359. err_no_chan:
  360. return ret;
  361. }
  362. /* Free channel resources */
  363. static void edma_free_chan_resources(struct dma_chan *chan)
  364. {
  365. struct edma_chan *echan = to_edma_chan(chan);
  366. struct device *dev = chan->device->dev;
  367. int i;
  368. /* Terminate transfers */
  369. edma_stop(echan->ch_num);
  370. vchan_free_chan_resources(&echan->vchan);
  371. /* Free EDMA PaRAM slots */
  372. for (i = 1; i < EDMA_MAX_SLOTS; i++) {
  373. if (echan->slot[i] >= 0) {
  374. edma_free_slot(echan->slot[i]);
  375. echan->slot[i] = -1;
  376. }
  377. }
  378. /* Free EDMA channel */
  379. if (echan->alloced) {
  380. edma_free_channel(echan->ch_num);
  381. echan->alloced = false;
  382. }
  383. dev_info(dev, "freeing channel for %u\n", echan->ch_num);
  384. }
  385. /* Send pending descriptor to hardware */
  386. static void edma_issue_pending(struct dma_chan *chan)
  387. {
  388. struct edma_chan *echan = to_edma_chan(chan);
  389. unsigned long flags;
  390. spin_lock_irqsave(&echan->vchan.lock, flags);
  391. if (vchan_issue_pending(&echan->vchan) && !echan->edesc)
  392. edma_execute(echan);
  393. spin_unlock_irqrestore(&echan->vchan.lock, flags);
  394. }
  395. static size_t edma_desc_size(struct edma_desc *edesc)
  396. {
  397. int i;
  398. size_t size;
  399. if (edesc->absync)
  400. for (size = i = 0; i < edesc->pset_nr; i++)
  401. size += (edesc->pset[i].a_b_cnt & 0xffff) *
  402. (edesc->pset[i].a_b_cnt >> 16) *
  403. edesc->pset[i].ccnt;
  404. else
  405. size = (edesc->pset[0].a_b_cnt & 0xffff) *
  406. (edesc->pset[0].a_b_cnt >> 16) +
  407. (edesc->pset[0].a_b_cnt & 0xffff) *
  408. (SZ_64K - 1) * edesc->pset[0].ccnt;
  409. return size;
  410. }
  411. /* Check request completion status */
  412. static enum dma_status edma_tx_status(struct dma_chan *chan,
  413. dma_cookie_t cookie,
  414. struct dma_tx_state *txstate)
  415. {
  416. struct edma_chan *echan = to_edma_chan(chan);
  417. struct virt_dma_desc *vdesc;
  418. enum dma_status ret;
  419. unsigned long flags;
  420. ret = dma_cookie_status(chan, cookie, txstate);
  421. if (ret == DMA_SUCCESS || !txstate)
  422. return ret;
  423. spin_lock_irqsave(&echan->vchan.lock, flags);
  424. vdesc = vchan_find_desc(&echan->vchan, cookie);
  425. if (vdesc) {
  426. txstate->residue = edma_desc_size(to_edma_desc(&vdesc->tx));
  427. } else if (echan->edesc && echan->edesc->vdesc.tx.cookie == cookie) {
  428. struct edma_desc *edesc = echan->edesc;
  429. txstate->residue = edma_desc_size(edesc);
  430. } else {
  431. txstate->residue = 0;
  432. }
  433. spin_unlock_irqrestore(&echan->vchan.lock, flags);
  434. return ret;
  435. }
  436. static void __init edma_chan_init(struct edma_cc *ecc,
  437. struct dma_device *dma,
  438. struct edma_chan *echans)
  439. {
  440. int i, j;
  441. for (i = 0; i < EDMA_CHANS; i++) {
  442. struct edma_chan *echan = &echans[i];
  443. echan->ch_num = EDMA_CTLR_CHAN(ecc->ctlr, i);
  444. echan->ecc = ecc;
  445. echan->vchan.desc_free = edma_desc_free;
  446. vchan_init(&echan->vchan, dma);
  447. INIT_LIST_HEAD(&echan->node);
  448. for (j = 0; j < EDMA_MAX_SLOTS; j++)
  449. echan->slot[j] = -1;
  450. }
  451. }
  452. static void edma_dma_init(struct edma_cc *ecc, struct dma_device *dma,
  453. struct device *dev)
  454. {
  455. dma->device_prep_slave_sg = edma_prep_slave_sg;
  456. dma->device_alloc_chan_resources = edma_alloc_chan_resources;
  457. dma->device_free_chan_resources = edma_free_chan_resources;
  458. dma->device_issue_pending = edma_issue_pending;
  459. dma->device_tx_status = edma_tx_status;
  460. dma->device_control = edma_control;
  461. dma->dev = dev;
  462. INIT_LIST_HEAD(&dma->channels);
  463. }
  464. static int edma_probe(struct platform_device *pdev)
  465. {
  466. struct edma_cc *ecc;
  467. int ret;
  468. ecc = devm_kzalloc(&pdev->dev, sizeof(*ecc), GFP_KERNEL);
  469. if (!ecc) {
  470. dev_err(&pdev->dev, "Can't allocate controller\n");
  471. return -ENOMEM;
  472. }
  473. ecc->ctlr = pdev->id;
  474. ecc->dummy_slot = edma_alloc_slot(ecc->ctlr, EDMA_SLOT_ANY);
  475. if (ecc->dummy_slot < 0) {
  476. dev_err(&pdev->dev, "Can't allocate PaRAM dummy slot\n");
  477. return -EIO;
  478. }
  479. dma_cap_zero(ecc->dma_slave.cap_mask);
  480. dma_cap_set(DMA_SLAVE, ecc->dma_slave.cap_mask);
  481. edma_dma_init(ecc, &ecc->dma_slave, &pdev->dev);
  482. edma_chan_init(ecc, &ecc->dma_slave, ecc->slave_chans);
  483. ret = dma_async_device_register(&ecc->dma_slave);
  484. if (ret)
  485. goto err_reg1;
  486. platform_set_drvdata(pdev, ecc);
  487. dev_info(&pdev->dev, "TI EDMA DMA engine driver\n");
  488. return 0;
  489. err_reg1:
  490. edma_free_slot(ecc->dummy_slot);
  491. return ret;
  492. }
  493. static int edma_remove(struct platform_device *pdev)
  494. {
  495. struct device *dev = &pdev->dev;
  496. struct edma_cc *ecc = dev_get_drvdata(dev);
  497. dma_async_device_unregister(&ecc->dma_slave);
  498. edma_free_slot(ecc->dummy_slot);
  499. return 0;
  500. }
  501. static struct platform_driver edma_driver = {
  502. .probe = edma_probe,
  503. .remove = edma_remove,
  504. .driver = {
  505. .name = "edma-dma-engine",
  506. .owner = THIS_MODULE,
  507. },
  508. };
  509. bool edma_filter_fn(struct dma_chan *chan, void *param)
  510. {
  511. if (chan->device->dev->driver == &edma_driver.driver) {
  512. struct edma_chan *echan = to_edma_chan(chan);
  513. unsigned ch_req = *(unsigned *)param;
  514. return ch_req == echan->ch_num;
  515. }
  516. return false;
  517. }
  518. EXPORT_SYMBOL(edma_filter_fn);
  519. static struct platform_device *pdev0, *pdev1;
  520. static const struct platform_device_info edma_dev_info0 = {
  521. .name = "edma-dma-engine",
  522. .id = 0,
  523. .dma_mask = DMA_BIT_MASK(32),
  524. };
  525. static const struct platform_device_info edma_dev_info1 = {
  526. .name = "edma-dma-engine",
  527. .id = 1,
  528. .dma_mask = DMA_BIT_MASK(32),
  529. };
  530. static int edma_init(void)
  531. {
  532. int ret = platform_driver_register(&edma_driver);
  533. if (ret == 0) {
  534. pdev0 = platform_device_register_full(&edma_dev_info0);
  535. if (IS_ERR(pdev0)) {
  536. platform_driver_unregister(&edma_driver);
  537. ret = PTR_ERR(pdev0);
  538. goto out;
  539. }
  540. }
  541. if (EDMA_CTLRS == 2) {
  542. pdev1 = platform_device_register_full(&edma_dev_info1);
  543. if (IS_ERR(pdev1)) {
  544. platform_driver_unregister(&edma_driver);
  545. platform_device_unregister(pdev0);
  546. ret = PTR_ERR(pdev1);
  547. }
  548. }
  549. out:
  550. return ret;
  551. }
  552. subsys_initcall(edma_init);
  553. static void __exit edma_exit(void)
  554. {
  555. platform_device_unregister(pdev0);
  556. if (pdev1)
  557. platform_device_unregister(pdev1);
  558. platform_driver_unregister(&edma_driver);
  559. }
  560. module_exit(edma_exit);
  561. MODULE_AUTHOR("Matt Porter <mporter@ti.com>");
  562. MODULE_DESCRIPTION("TI EDMA DMA engine driver");
  563. MODULE_LICENSE("GPL v2");