forked from ~ljy/RK356X_SDK_RELEASE

hc
2024-01-31 f70575805708cabdedea7498aaa3f710fde4d920
kernel/drivers/dma/sh/usb-dmac.c
....@@ -1,3 +1,4 @@
1
+// SPDX-License-Identifier: GPL-2.0
12 /*
23 * Renesas USB DMA Controller Driver
34 *
....@@ -6,10 +7,6 @@
67 * based on rcar-dmac.c
78 * Copyright (C) 2014 Renesas Electronics Inc.
89 * Author: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
9
- *
10
- * This is free software; you can redistribute it and/or modify
11
- * it under the terms of version 2 of the GNU General Public License as
12
- * published by the Free Software Foundation.
1310 */
1411
1512 #include <linux/delay.h>
....@@ -60,7 +57,7 @@
6057 u32 residue;
6158 struct list_head node;
6259 dma_cookie_t done_cookie;
63
- struct usb_dmac_sg sg[0];
60
+ struct usb_dmac_sg sg[];
6461 };
6562
6663 #define to_usb_dmac_desc(vd) container_of(vd, struct usb_dmac_desc, vd)
....@@ -589,6 +586,8 @@
589586 desc->residue = usb_dmac_get_current_residue(chan, desc,
590587 desc->sg_index - 1);
591588 desc->done_cookie = desc->vd.tx.cookie;
589
+ desc->vd.tx_result.result = DMA_TRANS_NOERROR;
590
+ desc->vd.tx_result.residue = desc->residue;
592591 vchan_cookie_complete(&desc->vd);
593592
594593 /* Restart the next transfer if this driver has a next desc */
....@@ -639,9 +638,6 @@
639638 struct usb_dmac_chan *uchan = to_usb_dmac_chan(chan);
640639 struct of_phandle_args *dma_spec = arg;
641640
642
- if (dma_spec->np != chan->device->dev->of_node)
643
- return false;
644
-
645641 /* USB-DMAC should be used with fixed usb controller's FIFO */
646642 if (uchan->index != dma_spec->args[0])
647643 return false;
....@@ -662,7 +658,8 @@
662658 dma_cap_zero(mask);
663659 dma_cap_set(DMA_SLAVE, mask);
664660
665
- chan = dma_request_channel(mask, usb_dmac_chan_filter, dma_spec);
661
+ chan = __dma_request_channel(&mask, usb_dmac_chan_filter, dma_spec,
662
+ ofdma->of_node);
666663 if (!chan)
667664 return NULL;
668665
....@@ -722,10 +719,8 @@
722719 /* Request the channel interrupt. */
723720 sprintf(pdev_irqname, "ch%u", index);
724721 uchan->irq = platform_get_irq_byname(pdev, pdev_irqname);
725
- if (uchan->irq < 0) {
726
- dev_err(dmac->dev, "no IRQ specified for channel %u\n", index);
722
+ if (uchan->irq < 0)
727723 return -ENODEV;
728
- }
729724
730725 irqname = devm_kasprintf(dmac->dev, GFP_KERNEL, "%s:%u",
731726 dev_name(dmac->dev), index);