dma_lib.c 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621
  1. // SPDX-License-Identifier: GPL-2.0-only
  2. /*
  3. * Copyright (C) 2006-2007 PA Semi, Inc
  4. *
  5. * Common functions for DMA access on PA Semi PWRficient
  6. */
  7. #include <linux/kernel.h>
  8. #include <linux/export.h>
  9. #include <linux/pci.h>
  10. #include <linux/slab.h>
  11. #include <linux/of.h>
  12. #include <linux/of_address.h>
  13. #include <linux/of_irq.h>
  14. #include <linux/sched.h>
  15. #include <asm/pasemi_dma.h>
  16. #define MAX_TXCH 64
  17. #define MAX_RXCH 64
  18. #define MAX_FLAGS 64
  19. #define MAX_FUN 8
  20. static struct pasdma_status *dma_status;
  21. static void __iomem *iob_regs;
  22. static void __iomem *mac_regs[6];
  23. static void __iomem *dma_regs;
  24. static int base_hw_irq;
  25. static int num_txch, num_rxch;
  26. static struct pci_dev *dma_pdev;
  27. /* Bitmaps to handle allocation of channels */
  28. static DECLARE_BITMAP(txch_free, MAX_TXCH);
  29. static DECLARE_BITMAP(rxch_free, MAX_RXCH);
  30. static DECLARE_BITMAP(flags_free, MAX_FLAGS);
  31. static DECLARE_BITMAP(fun_free, MAX_FUN);
  32. /* pasemi_read_iob_reg - read IOB register
  33. * @reg: Register to read (offset into PCI CFG space)
  34. */
  35. unsigned int pasemi_read_iob_reg(unsigned int reg)
  36. {
  37. return in_le32(iob_regs+reg);
  38. }
  39. EXPORT_SYMBOL(pasemi_read_iob_reg);
  40. /* pasemi_write_iob_reg - write IOB register
  41. * @reg: Register to write to (offset into PCI CFG space)
  42. * @val: Value to write
  43. */
  44. void pasemi_write_iob_reg(unsigned int reg, unsigned int val)
  45. {
  46. out_le32(iob_regs+reg, val);
  47. }
  48. EXPORT_SYMBOL(pasemi_write_iob_reg);
  49. /* pasemi_read_mac_reg - read MAC register
  50. * @intf: MAC interface
  51. * @reg: Register to read (offset into PCI CFG space)
  52. */
  53. unsigned int pasemi_read_mac_reg(int intf, unsigned int reg)
  54. {
  55. return in_le32(mac_regs[intf]+reg);
  56. }
  57. EXPORT_SYMBOL(pasemi_read_mac_reg);
  58. /* pasemi_write_mac_reg - write MAC register
  59. * @intf: MAC interface
  60. * @reg: Register to write to (offset into PCI CFG space)
  61. * @val: Value to write
  62. */
  63. void pasemi_write_mac_reg(int intf, unsigned int reg, unsigned int val)
  64. {
  65. out_le32(mac_regs[intf]+reg, val);
  66. }
  67. EXPORT_SYMBOL(pasemi_write_mac_reg);
  68. /* pasemi_read_dma_reg - read DMA register
  69. * @reg: Register to read (offset into PCI CFG space)
  70. */
  71. unsigned int pasemi_read_dma_reg(unsigned int reg)
  72. {
  73. return in_le32(dma_regs+reg);
  74. }
  75. EXPORT_SYMBOL(pasemi_read_dma_reg);
  76. /* pasemi_write_dma_reg - write DMA register
  77. * @reg: Register to write to (offset into PCI CFG space)
  78. * @val: Value to write
  79. */
  80. void pasemi_write_dma_reg(unsigned int reg, unsigned int val)
  81. {
  82. out_le32(dma_regs+reg, val);
  83. }
  84. EXPORT_SYMBOL(pasemi_write_dma_reg);
  85. static int pasemi_alloc_tx_chan(enum pasemi_dmachan_type type)
  86. {
  87. int bit;
  88. int start, limit;
  89. switch (type & (TXCHAN_EVT0|TXCHAN_EVT1)) {
  90. case TXCHAN_EVT0:
  91. start = 0;
  92. limit = 10;
  93. break;
  94. case TXCHAN_EVT1:
  95. start = 10;
  96. limit = MAX_TXCH;
  97. break;
  98. default:
  99. start = 0;
  100. limit = MAX_TXCH;
  101. break;
  102. }
  103. retry:
  104. bit = find_next_bit(txch_free, MAX_TXCH, start);
  105. if (bit >= limit)
  106. return -ENOSPC;
  107. if (!test_and_clear_bit(bit, txch_free))
  108. goto retry;
  109. return bit;
  110. }
  111. static void pasemi_free_tx_chan(int chan)
  112. {
  113. BUG_ON(test_bit(chan, txch_free));
  114. set_bit(chan, txch_free);
  115. }
  116. static int pasemi_alloc_rx_chan(void)
  117. {
  118. int bit;
  119. retry:
  120. bit = find_first_bit(rxch_free, MAX_RXCH);
  121. if (bit >= MAX_TXCH)
  122. return -ENOSPC;
  123. if (!test_and_clear_bit(bit, rxch_free))
  124. goto retry;
  125. return bit;
  126. }
  127. static void pasemi_free_rx_chan(int chan)
  128. {
  129. BUG_ON(test_bit(chan, rxch_free));
  130. set_bit(chan, rxch_free);
  131. }
  132. /* pasemi_dma_alloc_chan - Allocate a DMA channel
  133. * @type: Type of channel to allocate
  134. * @total_size: Total size of structure to allocate (to allow for more
  135. * room behind the structure to be used by the client)
  136. * @offset: Offset in bytes from start of the total structure to the beginning
  137. * of struct pasemi_dmachan. Needed when struct pasemi_dmachan is
  138. * not the first member of the client structure.
  139. *
  140. * pasemi_dma_alloc_chan allocates a DMA channel for use by a client. The
  141. * type argument specifies whether it's a RX or TX channel, and in the case
  142. * of TX channels which group it needs to belong to (if any).
  143. *
  144. * Returns a pointer to the total structure allocated on success, NULL
  145. * on failure.
  146. */
  147. void *pasemi_dma_alloc_chan(enum pasemi_dmachan_type type,
  148. int total_size, int offset)
  149. {
  150. void *buf;
  151. struct pasemi_dmachan *chan;
  152. int chno;
  153. BUG_ON(total_size < sizeof(struct pasemi_dmachan));
  154. buf = kzalloc(total_size, GFP_KERNEL);
  155. if (!buf)
  156. return NULL;
  157. chan = buf + offset;
  158. chan->priv = buf;
  159. switch (type & (TXCHAN|RXCHAN)) {
  160. case RXCHAN:
  161. chno = pasemi_alloc_rx_chan();
  162. chan->chno = chno;
  163. chan->irq = irq_create_mapping(NULL,
  164. base_hw_irq + num_txch + chno);
  165. chan->status = &dma_status->rx_sta[chno];
  166. break;
  167. case TXCHAN:
  168. chno = pasemi_alloc_tx_chan(type);
  169. chan->chno = chno;
  170. chan->irq = irq_create_mapping(NULL, base_hw_irq + chno);
  171. chan->status = &dma_status->tx_sta[chno];
  172. break;
  173. }
  174. chan->chan_type = type;
  175. return chan;
  176. }
  177. EXPORT_SYMBOL(pasemi_dma_alloc_chan);
  178. /* pasemi_dma_free_chan - Free a previously allocated channel
  179. * @chan: Channel to free
  180. *
  181. * Frees a previously allocated channel. It will also deallocate any
  182. * descriptor ring associated with the channel, if allocated.
  183. */
  184. void pasemi_dma_free_chan(struct pasemi_dmachan *chan)
  185. {
  186. if (chan->ring_virt)
  187. pasemi_dma_free_ring(chan);
  188. switch (chan->chan_type & (RXCHAN|TXCHAN)) {
  189. case RXCHAN:
  190. pasemi_free_rx_chan(chan->chno);
  191. break;
  192. case TXCHAN:
  193. pasemi_free_tx_chan(chan->chno);
  194. break;
  195. }
  196. kfree(chan->priv);
  197. }
  198. EXPORT_SYMBOL(pasemi_dma_free_chan);
  199. /* pasemi_dma_alloc_ring - Allocate descriptor ring for a channel
  200. * @chan: Channel for which to allocate
  201. * @ring_size: Ring size in 64-bit (8-byte) words
  202. *
  203. * Allocate a descriptor ring for a channel. Returns 0 on success, errno
  204. * on failure. The passed in struct pasemi_dmachan is updated with the
  205. * virtual and DMA addresses of the ring.
  206. */
  207. int pasemi_dma_alloc_ring(struct pasemi_dmachan *chan, int ring_size)
  208. {
  209. BUG_ON(chan->ring_virt);
  210. chan->ring_size = ring_size;
  211. chan->ring_virt = dma_alloc_coherent(&dma_pdev->dev,
  212. ring_size * sizeof(u64),
  213. &chan->ring_dma, GFP_KERNEL);
  214. if (!chan->ring_virt)
  215. return -ENOMEM;
  216. return 0;
  217. }
  218. EXPORT_SYMBOL(pasemi_dma_alloc_ring);
  219. /* pasemi_dma_free_ring - Free an allocated descriptor ring for a channel
  220. * @chan: Channel for which to free the descriptor ring
  221. *
  222. * Frees a previously allocated descriptor ring for a channel.
  223. */
  224. void pasemi_dma_free_ring(struct pasemi_dmachan *chan)
  225. {
  226. BUG_ON(!chan->ring_virt);
  227. dma_free_coherent(&dma_pdev->dev, chan->ring_size * sizeof(u64),
  228. chan->ring_virt, chan->ring_dma);
  229. chan->ring_virt = NULL;
  230. chan->ring_size = 0;
  231. chan->ring_dma = 0;
  232. }
  233. EXPORT_SYMBOL(pasemi_dma_free_ring);
  234. /* pasemi_dma_start_chan - Start a DMA channel
  235. * @chan: Channel to start
  236. * @cmdsta: Additional CCMDSTA/TCMDSTA bits to write
  237. *
  238. * Enables (starts) a DMA channel with optional additional arguments.
  239. */
  240. void pasemi_dma_start_chan(const struct pasemi_dmachan *chan, const u32 cmdsta)
  241. {
  242. if (chan->chan_type == RXCHAN)
  243. pasemi_write_dma_reg(PAS_DMA_RXCHAN_CCMDSTA(chan->chno),
  244. cmdsta | PAS_DMA_RXCHAN_CCMDSTA_EN);
  245. else
  246. pasemi_write_dma_reg(PAS_DMA_TXCHAN_TCMDSTA(chan->chno),
  247. cmdsta | PAS_DMA_TXCHAN_TCMDSTA_EN);
  248. }
  249. EXPORT_SYMBOL(pasemi_dma_start_chan);
  250. /* pasemi_dma_stop_chan - Stop a DMA channel
  251. * @chan: Channel to stop
  252. *
  253. * Stops (disables) a DMA channel. This is done by setting the ST bit in the
  254. * CMDSTA register and waiting on the ACT (active) bit to clear, then
  255. * finally disabling the whole channel.
  256. *
  257. * This function will only try for a short while for the channel to stop, if
  258. * it doesn't it will return failure.
  259. *
  260. * Returns 1 on success, 0 on failure.
  261. */
  262. #define MAX_RETRIES 5000
  263. int pasemi_dma_stop_chan(const struct pasemi_dmachan *chan)
  264. {
  265. int reg, retries;
  266. u32 sta;
  267. if (chan->chan_type == RXCHAN) {
  268. reg = PAS_DMA_RXCHAN_CCMDSTA(chan->chno);
  269. pasemi_write_dma_reg(reg, PAS_DMA_RXCHAN_CCMDSTA_ST);
  270. for (retries = 0; retries < MAX_RETRIES; retries++) {
  271. sta = pasemi_read_dma_reg(reg);
  272. if (!(sta & PAS_DMA_RXCHAN_CCMDSTA_ACT)) {
  273. pasemi_write_dma_reg(reg, 0);
  274. return 1;
  275. }
  276. cond_resched();
  277. }
  278. } else {
  279. reg = PAS_DMA_TXCHAN_TCMDSTA(chan->chno);
  280. pasemi_write_dma_reg(reg, PAS_DMA_TXCHAN_TCMDSTA_ST);
  281. for (retries = 0; retries < MAX_RETRIES; retries++) {
  282. sta = pasemi_read_dma_reg(reg);
  283. if (!(sta & PAS_DMA_TXCHAN_TCMDSTA_ACT)) {
  284. pasemi_write_dma_reg(reg, 0);
  285. return 1;
  286. }
  287. cond_resched();
  288. }
  289. }
  290. return 0;
  291. }
  292. EXPORT_SYMBOL(pasemi_dma_stop_chan);
  293. /* pasemi_dma_alloc_buf - Allocate a buffer to use for DMA
  294. * @chan: Channel to allocate for
  295. * @size: Size of buffer in bytes
  296. * @handle: DMA handle
  297. *
  298. * Allocate a buffer to be used by the DMA engine for read/write,
  299. * similar to dma_alloc_coherent().
  300. *
  301. * Returns the virtual address of the buffer, or NULL in case of failure.
  302. */
  303. void *pasemi_dma_alloc_buf(struct pasemi_dmachan *chan, int size,
  304. dma_addr_t *handle)
  305. {
  306. return dma_alloc_coherent(&dma_pdev->dev, size, handle, GFP_KERNEL);
  307. }
  308. EXPORT_SYMBOL(pasemi_dma_alloc_buf);
  309. /* pasemi_dma_free_buf - Free a buffer used for DMA
  310. * @chan: Channel the buffer was allocated for
  311. * @size: Size of buffer in bytes
  312. * @handle: DMA handle
  313. *
  314. * Frees a previously allocated buffer.
  315. */
  316. void pasemi_dma_free_buf(struct pasemi_dmachan *chan, int size,
  317. dma_addr_t *handle)
  318. {
  319. dma_free_coherent(&dma_pdev->dev, size, handle, GFP_KERNEL);
  320. }
  321. EXPORT_SYMBOL(pasemi_dma_free_buf);
  322. /* pasemi_dma_alloc_flag - Allocate a flag (event) for channel synchronization
  323. *
  324. * Allocates a flag for use with channel synchronization (event descriptors).
  325. * Returns allocated flag (0-63), < 0 on error.
  326. */
  327. int pasemi_dma_alloc_flag(void)
  328. {
  329. int bit;
  330. retry:
  331. bit = find_first_bit(flags_free, MAX_FLAGS);
  332. if (bit >= MAX_FLAGS)
  333. return -ENOSPC;
  334. if (!test_and_clear_bit(bit, flags_free))
  335. goto retry;
  336. return bit;
  337. }
  338. EXPORT_SYMBOL(pasemi_dma_alloc_flag);
  339. /* pasemi_dma_free_flag - Deallocates a flag (event)
  340. * @flag: Flag number to deallocate
  341. *
  342. * Frees up a flag so it can be reused for other purposes.
  343. */
  344. void pasemi_dma_free_flag(int flag)
  345. {
  346. BUG_ON(test_bit(flag, flags_free));
  347. BUG_ON(flag >= MAX_FLAGS);
  348. set_bit(flag, flags_free);
  349. }
  350. EXPORT_SYMBOL(pasemi_dma_free_flag);
  351. /* pasemi_dma_set_flag - Sets a flag (event) to 1
  352. * @flag: Flag number to set active
  353. *
  354. * Sets the flag provided to 1.
  355. */
  356. void pasemi_dma_set_flag(int flag)
  357. {
  358. BUG_ON(flag >= MAX_FLAGS);
  359. if (flag < 32)
  360. pasemi_write_dma_reg(PAS_DMA_TXF_SFLG0, 1 << flag);
  361. else
  362. pasemi_write_dma_reg(PAS_DMA_TXF_SFLG1, 1 << flag);
  363. }
  364. EXPORT_SYMBOL(pasemi_dma_set_flag);
  365. /* pasemi_dma_clear_flag - Sets a flag (event) to 0
  366. * @flag: Flag number to set inactive
  367. *
  368. * Sets the flag provided to 0.
  369. */
  370. void pasemi_dma_clear_flag(int flag)
  371. {
  372. BUG_ON(flag >= MAX_FLAGS);
  373. if (flag < 32)
  374. pasemi_write_dma_reg(PAS_DMA_TXF_CFLG0, 1 << flag);
  375. else
  376. pasemi_write_dma_reg(PAS_DMA_TXF_CFLG1, 1 << flag);
  377. }
  378. EXPORT_SYMBOL(pasemi_dma_clear_flag);
  379. /* pasemi_dma_alloc_fun - Allocate a function engine
  380. *
  381. * Allocates a function engine to use for crypto/checksum offload
  382. * Returns allocated engine (0-8), < 0 on error.
  383. */
  384. int pasemi_dma_alloc_fun(void)
  385. {
  386. int bit;
  387. retry:
  388. bit = find_first_bit(fun_free, MAX_FLAGS);
  389. if (bit >= MAX_FLAGS)
  390. return -ENOSPC;
  391. if (!test_and_clear_bit(bit, fun_free))
  392. goto retry;
  393. return bit;
  394. }
  395. EXPORT_SYMBOL(pasemi_dma_alloc_fun);
  396. /* pasemi_dma_free_fun - Deallocates a function engine
  397. * @flag: Engine number to deallocate
  398. *
  399. * Frees up a function engine so it can be used for other purposes.
  400. */
  401. void pasemi_dma_free_fun(int fun)
  402. {
  403. BUG_ON(test_bit(fun, fun_free));
  404. BUG_ON(fun >= MAX_FLAGS);
  405. set_bit(fun, fun_free);
  406. }
  407. EXPORT_SYMBOL(pasemi_dma_free_fun);
  408. static void *map_onedev(struct pci_dev *p, int index)
  409. {
  410. struct device_node *dn;
  411. void __iomem *ret;
  412. dn = pci_device_to_OF_node(p);
  413. if (!dn)
  414. goto fallback;
  415. ret = of_iomap(dn, index);
  416. if (!ret)
  417. goto fallback;
  418. return ret;
  419. fallback:
  420. /* This is hardcoded and ugly, but we have some firmware versions
  421. * that don't provide the register space in the device tree. Luckily
  422. * they are at well-known locations so we can just do the math here.
  423. */
  424. return ioremap(0xe0000000 + (p->devfn << 12), 0x2000);
  425. }
  426. /* pasemi_dma_init - Initialize the PA Semi DMA library
  427. *
  428. * This function initializes the DMA library. It must be called before
  429. * any other function in the library.
  430. *
  431. * Returns 0 on success, errno on failure.
  432. */
  433. int pasemi_dma_init(void)
  434. {
  435. static DEFINE_SPINLOCK(init_lock);
  436. struct pci_dev *iob_pdev;
  437. struct pci_dev *pdev;
  438. struct resource res;
  439. struct device_node *dn;
  440. int i, intf, err = 0;
  441. unsigned long timeout;
  442. u32 tmp;
  443. if (!machine_is(pasemi))
  444. return -ENODEV;
  445. spin_lock(&init_lock);
  446. /* Make sure we haven't already initialized */
  447. if (dma_pdev)
  448. goto out;
  449. iob_pdev = pci_get_device(PCI_VENDOR_ID_PASEMI, 0xa001, NULL);
  450. if (!iob_pdev) {
  451. BUG();
  452. pr_warn("Can't find I/O Bridge\n");
  453. err = -ENODEV;
  454. goto out;
  455. }
  456. iob_regs = map_onedev(iob_pdev, 0);
  457. dma_pdev = pci_get_device(PCI_VENDOR_ID_PASEMI, 0xa007, NULL);
  458. if (!dma_pdev) {
  459. BUG();
  460. pr_warn("Can't find DMA controller\n");
  461. err = -ENODEV;
  462. goto out;
  463. }
  464. dma_regs = map_onedev(dma_pdev, 0);
  465. base_hw_irq = virq_to_hw(dma_pdev->irq);
  466. pci_read_config_dword(dma_pdev, PAS_DMA_CAP_TXCH, &tmp);
  467. num_txch = (tmp & PAS_DMA_CAP_TXCH_TCHN_M) >> PAS_DMA_CAP_TXCH_TCHN_S;
  468. pci_read_config_dword(dma_pdev, PAS_DMA_CAP_RXCH, &tmp);
  469. num_rxch = (tmp & PAS_DMA_CAP_RXCH_RCHN_M) >> PAS_DMA_CAP_RXCH_RCHN_S;
  470. intf = 0;
  471. for (pdev = pci_get_device(PCI_VENDOR_ID_PASEMI, 0xa006, NULL);
  472. pdev;
  473. pdev = pci_get_device(PCI_VENDOR_ID_PASEMI, 0xa006, pdev))
  474. mac_regs[intf++] = map_onedev(pdev, 0);
  475. pci_dev_put(pdev);
  476. for (pdev = pci_get_device(PCI_VENDOR_ID_PASEMI, 0xa005, NULL);
  477. pdev;
  478. pdev = pci_get_device(PCI_VENDOR_ID_PASEMI, 0xa005, pdev))
  479. mac_regs[intf++] = map_onedev(pdev, 0);
  480. pci_dev_put(pdev);
  481. dn = pci_device_to_OF_node(iob_pdev);
  482. if (dn)
  483. err = of_address_to_resource(dn, 1, &res);
  484. if (!dn || err) {
  485. /* Fallback for old firmware */
  486. res.start = 0xfd800000;
  487. res.end = res.start + 0x1000;
  488. }
  489. dma_status = ioremap_cache(res.start, resource_size(&res));
  490. pci_dev_put(iob_pdev);
  491. for (i = 0; i < MAX_TXCH; i++)
  492. __set_bit(i, txch_free);
  493. for (i = 0; i < MAX_RXCH; i++)
  494. __set_bit(i, rxch_free);
  495. timeout = jiffies + HZ;
  496. pasemi_write_dma_reg(PAS_DMA_COM_RXCMD, 0);
  497. while (pasemi_read_dma_reg(PAS_DMA_COM_RXSTA) & 1) {
  498. if (time_after(jiffies, timeout)) {
  499. pr_warn("Warning: Could not disable RX section\n");
  500. break;
  501. }
  502. }
  503. timeout = jiffies + HZ;
  504. pasemi_write_dma_reg(PAS_DMA_COM_TXCMD, 0);
  505. while (pasemi_read_dma_reg(PAS_DMA_COM_TXSTA) & 1) {
  506. if (time_after(jiffies, timeout)) {
  507. pr_warn("Warning: Could not disable TX section\n");
  508. break;
  509. }
  510. }
  511. /* setup resource allocations for the different DMA sections */
  512. tmp = pasemi_read_dma_reg(PAS_DMA_COM_CFG);
  513. pasemi_write_dma_reg(PAS_DMA_COM_CFG, tmp | 0x18000000);
  514. /* enable tx section */
  515. pasemi_write_dma_reg(PAS_DMA_COM_TXCMD, PAS_DMA_COM_TXCMD_EN);
  516. /* enable rx section */
  517. pasemi_write_dma_reg(PAS_DMA_COM_RXCMD, PAS_DMA_COM_RXCMD_EN);
  518. for (i = 0; i < MAX_FLAGS; i++)
  519. __set_bit(i, flags_free);
  520. for (i = 0; i < MAX_FUN; i++)
  521. __set_bit(i, fun_free);
  522. /* clear all status flags */
  523. pasemi_write_dma_reg(PAS_DMA_TXF_CFLG0, 0xffffffff);
  524. pasemi_write_dma_reg(PAS_DMA_TXF_CFLG1, 0xffffffff);
  525. pr_info("PA Semi PWRficient DMA library initialized "
  526. "(%d tx, %d rx channels)\n", num_txch, num_rxch);
  527. out:
  528. spin_unlock(&init_lock);
  529. return err;
  530. }
  531. EXPORT_SYMBOL(pasemi_dma_init);