.. | .. |
---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-or-later |
---|
1 | 2 | /* |
---|
2 | 3 | * S3C24XX DMA handling |
---|
3 | 4 | * |
---|
.. | .. |
---|
10 | 11 | * |
---|
11 | 12 | * Author: Peter Pearse <peter.pearse@arm.com> |
---|
12 | 13 | * Author: Linus Walleij <linus.walleij@stericsson.com> |
---|
13 | | - * |
---|
14 | | - * This program is free software; you can redistribute it and/or modify it |
---|
15 | | - * under the terms of the GNU General Public License as published by the Free |
---|
16 | | - * Software Foundation; either version 2 of the License, or (at your option) |
---|
17 | | - * any later version. |
---|
18 | 14 | * |
---|
19 | 15 | * The DMA controllers in S3C24XX SoCs have a varying number of DMA signals |
---|
20 | 16 | * that can be routed to any of the 4 to 8 hardware-channels. |
---|
.. | .. |
---|
523 | 519 | s3c24xx_dma_start_next_sg(s3cchan, txd); |
---|
524 | 520 | } |
---|
525 | 521 | |
---|
526 | | -static void s3c24xx_dma_free_txd_list(struct s3c24xx_dma_engine *s3cdma, |
---|
527 | | - struct s3c24xx_dma_chan *s3cchan) |
---|
528 | | -{ |
---|
529 | | - LIST_HEAD(head); |
---|
530 | | - |
---|
531 | | - vchan_get_all_descriptors(&s3cchan->vc, &head); |
---|
532 | | - vchan_dma_desc_free_list(&s3cchan->vc, &head); |
---|
533 | | -} |
---|
534 | | - |
---|
535 | 522 | /* |
---|
536 | 523 | * Try to allocate a physical channel. When successful, assign it to |
---|
537 | 524 | * this virtual channel, and initiate the next descriptor. The |
---|
.. | .. |
---|
713 | 700 | { |
---|
714 | 701 | struct s3c24xx_dma_chan *s3cchan = to_s3c24xx_dma_chan(chan); |
---|
715 | 702 | struct s3c24xx_dma_engine *s3cdma = s3cchan->host; |
---|
| 703 | + LIST_HEAD(head); |
---|
716 | 704 | unsigned long flags; |
---|
717 | | - int ret = 0; |
---|
| 705 | + int ret; |
---|
718 | 706 | |
---|
719 | 707 | spin_lock_irqsave(&s3cchan->vc.lock, flags); |
---|
720 | 708 | |
---|
.. | .. |
---|
738 | 726 | } |
---|
739 | 727 | |
---|
740 | 728 | /* Dequeue jobs not yet fired as well */ |
---|
741 | | - s3c24xx_dma_free_txd_list(s3cdma, s3cchan); |
---|
| 729 | + |
---|
| 730 | + vchan_get_all_descriptors(&s3cchan->vc, &head); |
---|
| 731 | + |
---|
| 732 | + spin_unlock_irqrestore(&s3cchan->vc.lock, flags); |
---|
| 733 | + |
---|
| 734 | + vchan_dma_desc_free_list(&s3cchan->vc, &head); |
---|
| 735 | + |
---|
| 736 | + return 0; |
---|
| 737 | + |
---|
742 | 738 | unlock: |
---|
743 | 739 | spin_unlock_irqrestore(&s3cchan->vc.lock, flags); |
---|
744 | 740 | |
---|
.. | .. |
---|
1202 | 1198 | |
---|
1203 | 1199 | /* Basic sanity check */ |
---|
1204 | 1200 | if (pdata->num_phy_channels > MAX_DMA_CHANNELS) { |
---|
1205 | | - dev_err(&pdev->dev, "to many dma channels %d, max %d\n", |
---|
| 1201 | + dev_err(&pdev->dev, "too many dma channels %d, max %d\n", |
---|
1206 | 1202 | pdata->num_phy_channels, MAX_DMA_CHANNELS); |
---|
1207 | 1203 | return -EINVAL; |
---|
1208 | 1204 | } |
---|
.. | .. |
---|
1241 | 1237 | phy->host = s3cdma; |
---|
1242 | 1238 | |
---|
1243 | 1239 | phy->irq = platform_get_irq(pdev, i); |
---|
1244 | | - if (phy->irq < 0) { |
---|
1245 | | - dev_err(&pdev->dev, "failed to get irq %d, err %d\n", |
---|
1246 | | - i, phy->irq); |
---|
| 1240 | + if (phy->irq < 0) |
---|
1247 | 1241 | continue; |
---|
1248 | | - } |
---|
1249 | 1242 | |
---|
1250 | 1243 | ret = devm_request_irq(&pdev->dev, phy->irq, s3c24xx_dma_irq, |
---|
1251 | 1244 | 0, pdev->name, phy); |
---|