usb: renesas_usbhs: use dmaengine helper functions
This patch used dmaengine helper functions instead of using hand setting. Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
277bd8746b
commit
2f0de9d844
|
@ -771,22 +771,15 @@ static void xfer_work(struct work_struct *work)
|
||||||
struct usbhs_pipe *pipe = pkt->pipe;
|
struct usbhs_pipe *pipe = pkt->pipe;
|
||||||
struct usbhs_fifo *fifo = usbhs_pipe_to_fifo(pipe);
|
struct usbhs_fifo *fifo = usbhs_pipe_to_fifo(pipe);
|
||||||
struct usbhs_priv *priv = usbhs_pipe_to_priv(pipe);
|
struct usbhs_priv *priv = usbhs_pipe_to_priv(pipe);
|
||||||
struct scatterlist sg;
|
|
||||||
struct dma_async_tx_descriptor *desc;
|
struct dma_async_tx_descriptor *desc;
|
||||||
struct dma_chan *chan = usbhsf_dma_chan_get(fifo, pkt);
|
struct dma_chan *chan = usbhsf_dma_chan_get(fifo, pkt);
|
||||||
struct device *dev = usbhs_priv_to_dev(priv);
|
struct device *dev = usbhs_priv_to_dev(priv);
|
||||||
enum dma_transfer_direction dir;
|
enum dma_transfer_direction dir;
|
||||||
dma_cookie_t cookie;
|
|
||||||
|
|
||||||
dir = usbhs_pipe_is_dir_in(pipe) ? DMA_DEV_TO_MEM : DMA_MEM_TO_DEV;
|
dir = usbhs_pipe_is_dir_in(pipe) ? DMA_DEV_TO_MEM : DMA_MEM_TO_DEV;
|
||||||
|
|
||||||
sg_init_table(&sg, 1);
|
desc = dmaengine_prep_slave_single(chan, pkt->dma + pkt->actual,
|
||||||
sg_set_page(&sg, virt_to_page(pkt->dma),
|
pkt->trans, dir,
|
||||||
pkt->length, offset_in_page(pkt->dma));
|
|
||||||
sg_dma_address(&sg) = pkt->dma + pkt->actual;
|
|
||||||
sg_dma_len(&sg) = pkt->trans;
|
|
||||||
|
|
||||||
desc = dmaengine_prep_slave_sg(chan, &sg, 1, dir,
|
|
||||||
DMA_PREP_INTERRUPT | DMA_CTRL_ACK);
|
DMA_PREP_INTERRUPT | DMA_CTRL_ACK);
|
||||||
if (!desc)
|
if (!desc)
|
||||||
return;
|
return;
|
||||||
|
@ -794,8 +787,7 @@ static void xfer_work(struct work_struct *work)
|
||||||
desc->callback = usbhsf_dma_complete;
|
desc->callback = usbhsf_dma_complete;
|
||||||
desc->callback_param = pipe;
|
desc->callback_param = pipe;
|
||||||
|
|
||||||
cookie = desc->tx_submit(desc);
|
if (dmaengine_submit(desc) < 0) {
|
||||||
if (cookie < 0) {
|
|
||||||
dev_err(dev, "Failed to submit dma descriptor\n");
|
dev_err(dev, "Failed to submit dma descriptor\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue