aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorRabin Vincent <rabin.vincent@stericsson.com>2011-01-25 05:18:28 -0500
committerDan Williams <dan.j.williams@intel.com>2011-01-31 01:27:20 -0500
commit822c567639971628ceba2c53531670d595e3164d (patch)
tree5a292828c12cb2cb1ee787345159f3a244fc826f /drivers
parentcc31b6f7949efd46c5f13d0758cf7b0bcb71fae2 (diff)
dma40: unify src/dst addr check
Acked-by: Per Forlin <per.forlin@stericsson.com> Acked-by: Jonas Aaberg <jonas.aberg@stericsson.com> Signed-off-by: Rabin Vincent <rabin.vincent@stericsson.com> Signed-off-by: Linus Walleij <linus.walleij@stericsson.com> Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/dma/ste_dma40.c29
1 files changed, 16 insertions, 13 deletions
diff --git a/drivers/dma/ste_dma40.c b/drivers/dma/ste_dma40.c
index 3c61c582303d..d9dfda2c65b5 100644
--- a/drivers/dma/ste_dma40.c
+++ b/drivers/dma/ste_dma40.c
@@ -1635,11 +1635,9 @@ static u32 stedma40_residue(struct dma_chan *chan)
1635static int 1635static int
1636d40_prep_sg_log(struct d40_chan *chan, struct d40_desc *desc, 1636d40_prep_sg_log(struct d40_chan *chan, struct d40_desc *desc,
1637 struct scatterlist *sg_src, struct scatterlist *sg_dst, 1637 struct scatterlist *sg_src, struct scatterlist *sg_dst,
1638 unsigned int sg_len, enum dma_data_direction direction, 1638 unsigned int sg_len, dma_addr_t src_dev_addr,
1639 dma_addr_t dev_addr) 1639 dma_addr_t dst_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;
1643 struct stedma40_chan_cfg *cfg = &chan->dma_cfg; 1641 struct stedma40_chan_cfg *cfg = &chan->dma_cfg;
1644 struct stedma40_half_channel_info *src_info = &cfg->src_info; 1642 struct stedma40_half_channel_info *src_info = &cfg->src_info;
1645 struct stedma40_half_channel_info *dst_info = &cfg->dst_info; 1643 struct stedma40_half_channel_info *dst_info = &cfg->dst_info;
@@ -1665,11 +1663,9 @@ d40_prep_sg_log(struct d40_chan *chan, struct d40_desc *desc,
1665static int 1663static int
1666d40_prep_sg_phy(struct d40_chan *chan, struct d40_desc *desc, 1664d40_prep_sg_phy(struct d40_chan *chan, struct d40_desc *desc,
1667 struct scatterlist *sg_src, struct scatterlist *sg_dst, 1665 struct scatterlist *sg_src, struct scatterlist *sg_dst,
1668 unsigned int sg_len, enum dma_data_direction direction, 1666 unsigned int sg_len, dma_addr_t src_dev_addr,
1669 dma_addr_t dev_addr) 1667 dma_addr_t dst_dev_addr)
1670{ 1668{
1671 dma_addr_t src_dev_addr = direction == DMA_FROM_DEVICE ? dev_addr : 0;
1672 dma_addr_t dst_dev_addr = direction == DMA_TO_DEVICE ? dev_addr : 0;
1673 struct stedma40_chan_cfg *cfg = &chan->dma_cfg; 1669 struct stedma40_chan_cfg *cfg = &chan->dma_cfg;
1674 struct stedma40_half_channel_info *src_info = &cfg->src_info; 1670 struct stedma40_half_channel_info *src_info = &cfg->src_info;
1675 struct stedma40_half_channel_info *dst_info = &cfg->dst_info; 1671 struct stedma40_half_channel_info *dst_info = &cfg->dst_info;
@@ -1757,7 +1753,8 @@ d40_prep_sg(struct dma_chan *dchan, struct scatterlist *sg_src,
1757 enum dma_data_direction direction, unsigned long dma_flags) 1753 enum dma_data_direction direction, unsigned long dma_flags)
1758{ 1754{
1759 struct d40_chan *chan = container_of(dchan, struct d40_chan, chan); 1755 struct d40_chan *chan = container_of(dchan, struct d40_chan, chan);
1760 dma_addr_t dev_addr = 0; 1756 dma_addr_t src_dev_addr = 0;
1757 dma_addr_t dst_dev_addr = 0;
1761 struct d40_desc *desc; 1758 struct d40_desc *desc;
1762 unsigned long flags; 1759 unsigned long flags;
1763 int ret; 1760 int ret;
@@ -1773,15 +1770,21 @@ d40_prep_sg(struct dma_chan *dchan, struct scatterlist *sg_src,
1773 if (desc == NULL) 1770 if (desc == NULL)
1774 goto err; 1771 goto err;
1775 1772
1776 if (direction != DMA_NONE) 1773 if (direction != DMA_NONE) {
1777 dev_addr = d40_get_dev_addr(chan, direction); 1774 dma_addr_t dev_addr = d40_get_dev_addr(chan, direction);
1775
1776 if (direction == DMA_FROM_DEVICE)
1777 src_dev_addr = dev_addr;
1778 else if (direction == DMA_TO_DEVICE)
1779 dst_dev_addr = dev_addr;
1780 }
1778 1781
1779 if (chan_is_logical(chan)) 1782 if (chan_is_logical(chan))
1780 ret = d40_prep_sg_log(chan, desc, sg_src, sg_dst, 1783 ret = d40_prep_sg_log(chan, desc, sg_src, sg_dst,
1781 sg_len, direction, dev_addr); 1784 sg_len, src_dev_addr, dst_dev_addr);
1782 else 1785 else
1783 ret = d40_prep_sg_phy(chan, desc, sg_src, sg_dst, 1786 ret = d40_prep_sg_phy(chan, desc, sg_src, sg_dst,
1784 sg_len, direction, dev_addr); 1787 sg_len, src_dev_addr, dst_dev_addr);
1785 1788
1786 if (ret) { 1789 if (ret) {
1787 chan_err(chan, "Failed to prepare %s sg job: %d\n", 1790 chan_err(chan, "Failed to prepare %s sg job: %d\n",