| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-or-later |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * Applied Micro X-Gene SoC DMA engine Driver |
|---|
| 3 | 4 | * |
|---|
| 4 | 5 | * Copyright (c) 2015, Applied Micro Circuits Corporation |
|---|
| 5 | 6 | * Authors: Rameshwar Prasad Sahu <rsahu@apm.com> |
|---|
| 6 | 7 | * Loc Ho <lho@apm.com> |
|---|
| 7 | | - * |
|---|
| 8 | | - * This program is free software; you can redistribute it and/or modify it |
|---|
| 9 | | - * under the terms of the GNU General Public License as published by the |
|---|
| 10 | | - * Free Software Foundation; either version 2 of the License, or (at your |
|---|
| 11 | | - * option) any later version. |
|---|
| 12 | | - * |
|---|
| 13 | | - * This program is distributed in the hope that it will be useful, |
|---|
| 14 | | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|---|
| 15 | | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|---|
| 16 | | - * GNU General Public License for more details. |
|---|
| 17 | | - * |
|---|
| 18 | | - * You should have received a copy of the GNU General Public License |
|---|
| 19 | | - * along with this program. If not, see <http://www.gnu.org/licenses/>. |
|---|
| 20 | 8 | * |
|---|
| 21 | 9 | * NOTE: PM support is currently not available. |
|---|
| 22 | 10 | */ |
|---|
| .. | .. |
|---|
| 299 | 287 | |
|---|
| 300 | 288 | /** |
|---|
| 301 | 289 | * struct xgene_dma - internal representation of an X-Gene DMA device |
|---|
| 290 | + * @dev: reference to this device's struct device |
|---|
| 291 | + * @clk: reference to this device's clock |
|---|
| 302 | 292 | * @err_irq: DMA error irq number |
|---|
| 303 | 293 | * @ring_num: start id number for DMA ring |
|---|
| 304 | 294 | * @csr_dma: base for DMA register access |
|---|
| .. | .. |
|---|
| 703 | 693 | |
|---|
| 704 | 694 | INIT_LIST_HEAD(&ld_completed); |
|---|
| 705 | 695 | |
|---|
| 706 | | - spin_lock_bh(&chan->lock); |
|---|
| 696 | + spin_lock(&chan->lock); |
|---|
| 707 | 697 | |
|---|
| 708 | 698 | /* Clean already completed and acked descriptors */ |
|---|
| 709 | 699 | xgene_dma_clean_completed_descriptor(chan); |
|---|
| .. | .. |
|---|
| 772 | 762 | */ |
|---|
| 773 | 763 | xgene_chan_xfer_ld_pending(chan); |
|---|
| 774 | 764 | |
|---|
| 775 | | - spin_unlock_bh(&chan->lock); |
|---|
| 765 | + spin_unlock(&chan->lock); |
|---|
| 776 | 766 | |
|---|
| 777 | 767 | /* Run the callback for each descriptor, in order */ |
|---|
| 778 | 768 | list_for_each_entry_safe(desc_sw, _desc_sw, &ld_completed, node) { |
|---|
| .. | .. |
|---|
| 797 | 787 | return -ENOMEM; |
|---|
| 798 | 788 | } |
|---|
| 799 | 789 | |
|---|
| 800 | | - chan_dbg(chan, "Allocate descripto pool\n"); |
|---|
| 790 | + chan_dbg(chan, "Allocate descriptor pool\n"); |
|---|
| 801 | 791 | |
|---|
| 802 | 792 | return 1; |
|---|
| 803 | 793 | } |
|---|
| .. | .. |
|---|
| 985 | 975 | return dma_cookie_status(dchan, cookie, txstate); |
|---|
| 986 | 976 | } |
|---|
| 987 | 977 | |
|---|
| 988 | | -static void xgene_dma_tasklet_cb(unsigned long data) |
|---|
| 978 | +static void xgene_dma_tasklet_cb(struct tasklet_struct *t) |
|---|
| 989 | 979 | { |
|---|
| 990 | | - struct xgene_dma_chan *chan = (struct xgene_dma_chan *)data; |
|---|
| 980 | + struct xgene_dma_chan *chan = from_tasklet(chan, t, tasklet); |
|---|
| 991 | 981 | |
|---|
| 992 | 982 | /* Run all cleanup for descriptors which have been completed */ |
|---|
| 993 | 983 | xgene_dma_cleanup_descriptors(chan); |
|---|
| .. | .. |
|---|
| 1208 | 1198 | ring->size = ret; |
|---|
| 1209 | 1199 | |
|---|
| 1210 | 1200 | /* Allocate memory for DMA ring descriptor */ |
|---|
| 1211 | | - ring->desc_vaddr = dma_zalloc_coherent(chan->dev, ring->size, |
|---|
| 1212 | | - &ring->desc_paddr, GFP_KERNEL); |
|---|
| 1201 | + ring->desc_vaddr = dma_alloc_coherent(chan->dev, ring->size, |
|---|
| 1202 | + &ring->desc_paddr, GFP_KERNEL); |
|---|
| 1213 | 1203 | if (!ring->desc_vaddr) { |
|---|
| 1214 | 1204 | chan_err(chan, "Failed to allocate ring desc\n"); |
|---|
| 1215 | 1205 | return -ENOMEM; |
|---|
| .. | .. |
|---|
| 1549 | 1539 | INIT_LIST_HEAD(&chan->ld_pending); |
|---|
| 1550 | 1540 | INIT_LIST_HEAD(&chan->ld_running); |
|---|
| 1551 | 1541 | INIT_LIST_HEAD(&chan->ld_completed); |
|---|
| 1552 | | - tasklet_init(&chan->tasklet, xgene_dma_tasklet_cb, |
|---|
| 1553 | | - (unsigned long)chan); |
|---|
| 1542 | + tasklet_setup(&chan->tasklet, xgene_dma_tasklet_cb); |
|---|
| 1554 | 1543 | |
|---|
| 1555 | 1544 | chan->pending = 0; |
|---|
| 1556 | 1545 | chan->desc_pool = NULL; |
|---|
| .. | .. |
|---|
| 1690 | 1679 | |
|---|
| 1691 | 1680 | /* Get DMA error interrupt */ |
|---|
| 1692 | 1681 | irq = platform_get_irq(pdev, 0); |
|---|
| 1693 | | - if (irq <= 0) { |
|---|
| 1694 | | - dev_err(&pdev->dev, "Failed to get Error IRQ\n"); |
|---|
| 1682 | + if (irq <= 0) |
|---|
| 1695 | 1683 | return -ENXIO; |
|---|
| 1696 | | - } |
|---|
| 1697 | 1684 | |
|---|
| 1698 | 1685 | pdma->err_irq = irq; |
|---|
| 1699 | 1686 | |
|---|
| 1700 | 1687 | /* Get DMA Rx ring descriptor interrupts for all DMA channels */ |
|---|
| 1701 | 1688 | for (i = 1; i <= XGENE_DMA_MAX_CHANNEL; i++) { |
|---|
| 1702 | 1689 | irq = platform_get_irq(pdev, i); |
|---|
| 1703 | | - if (irq <= 0) { |
|---|
| 1704 | | - dev_err(&pdev->dev, "Failed to get Rx IRQ\n"); |
|---|
| 1690 | + if (irq <= 0) |
|---|
| 1705 | 1691 | return -ENXIO; |
|---|
| 1706 | | - } |
|---|
| 1707 | 1692 | |
|---|
| 1708 | 1693 | pdma->chan[i - 1].rx_irq = irq; |
|---|
| 1709 | 1694 | } |
|---|