aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/dma/ste_dma40.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/dma/ste_dma40.c')
-rw-r--r--drivers/dma/ste_dma40.c41
1 files changed, 16 insertions, 25 deletions
diff --git a/drivers/dma/ste_dma40.c b/drivers/dma/ste_dma40.c
index 6a7a00d5d682..c597dba713b0 100644
--- a/drivers/dma/ste_dma40.c
+++ b/drivers/dma/ste_dma40.c
@@ -1638,37 +1638,28 @@ d40_prep_sg_log(struct d40_chan *chan, struct d40_desc *desc,
1638 unsigned int sg_len, enum dma_data_direction direction, 1638 unsigned int sg_len, enum dma_data_direction direction,
1639 dma_addr_t dev_addr) 1639 dma_addr_t dev_addr)
1640{ 1640{
1641 dma_addr_t src_dev_addr = direction == DMA_FROM_DEVICE ? dev_addr : 0;
1642 dma_addr_t dst_dev_addr = direction == DMA_TO_DEVICE ? dev_addr : 0;
1641 struct stedma40_chan_cfg *cfg = &chan->dma_cfg; 1643 struct stedma40_chan_cfg *cfg = &chan->dma_cfg;
1642 struct stedma40_half_channel_info *src_info = &cfg->src_info; 1644 struct stedma40_half_channel_info *src_info = &cfg->src_info;
1643 struct stedma40_half_channel_info *dst_info = &cfg->dst_info; 1645 struct stedma40_half_channel_info *dst_info = &cfg->dst_info;
1646 int ret;
1644 1647
1645 if (direction == DMA_NONE) { 1648 ret = d40_log_sg_to_lli(sg_src, sg_len,
1646 /* memcpy */ 1649 src_dev_addr,
1647 (void) d40_log_sg_to_lli(sg_src, sg_len, 1650 desc->lli_log.src,
1648 desc->lli_log.src, 1651 chan->log_def.lcsp1,
1649 chan->log_def.lcsp1, 1652 src_info->data_width,
1650 src_info->data_width, 1653 dst_info->data_width);
1651 dst_info->data_width);
1652
1653 (void) d40_log_sg_to_lli(sg_dst, sg_len,
1654 desc->lli_log.dst,
1655 chan->log_def.lcsp3,
1656 dst_info->data_width,
1657 src_info->data_width);
1658 } else {
1659 unsigned int total_size;
1660 1654
1661 total_size = d40_log_sg_to_dev(sg_src, sg_len, 1655 ret = d40_log_sg_to_lli(sg_dst, sg_len,
1662 &desc->lli_log, 1656 dst_dev_addr,
1663 &chan->log_def, 1657 desc->lli_log.dst,
1664 src_info->data_width, 1658 chan->log_def.lcsp3,
1665 dst_info->data_width, 1659 dst_info->data_width,
1666 direction, dev_addr); 1660 src_info->data_width);
1667 if (total_size < 0)
1668 return -EINVAL;
1669 }
1670 1661
1671 return 0; 1662 return ret < 0 ? ret : 0;
1672} 1663}
1673 1664
1674static int 1665static int