diff options
author | Gerald Baeza <gerald.baeza@stericsson.com> | 2012-11-08 08:39:07 -0500 |
---|---|---|
committer | Fabio Baltieri <fabio.baltieri@linaro.org> | 2013-01-14 04:50:40 -0500 |
commit | f000df8c5a0e2002acc5989aad99a97d32a24718 (patch) | |
tree | c8547aa62958e7d65b39d4ec1827efb9f31954f2 /drivers/dma | |
parent | ccc3d6976433aa67131117fccd2b5143d82a6f48 (diff) |
dmaengine: ste_dma40: support fixed physical channel allocation
This patch makes existing use_fixed_channel field (of stedma40_chan_cfg
structure) applicable to physical channels.
Signed-off-by: Gerald Baeza <gerald.baeza@stericsson.com>
Tested-by: Yannick Fertre <yannick.fertre@stericsson.com>
Reviewed-by: Per Forlin <per.forlin@stericsson.com>
Acked-by: Linus Walleij <linus.walleij@linaro.org>
Acked-by: Vinod Koul <vinod.koul@intel.com>
Signed-off-by: Fabio Baltieri <fabio.baltieri@linaro.org>
Diffstat (limited to 'drivers/dma')
-rw-r--r-- | drivers/dma/ste_dma40.c | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/drivers/dma/ste_dma40.c b/drivers/dma/ste_dma40.c index 9f8964a0a287..5feab7db9449 100644 --- a/drivers/dma/ste_dma40.c +++ b/drivers/dma/ste_dma40.c | |||
@@ -1711,10 +1711,12 @@ static int d40_allocate_channel(struct d40_chan *d40c, bool *first_phy_user) | |||
1711 | int i; | 1711 | int i; |
1712 | int j; | 1712 | int j; |
1713 | int log_num; | 1713 | int log_num; |
1714 | int num_phy_chans; | ||
1714 | bool is_src; | 1715 | bool is_src; |
1715 | bool is_log = d40c->dma_cfg.mode == STEDMA40_MODE_LOGICAL; | 1716 | bool is_log = d40c->dma_cfg.mode == STEDMA40_MODE_LOGICAL; |
1716 | 1717 | ||
1717 | phys = d40c->base->phy_res; | 1718 | phys = d40c->base->phy_res; |
1719 | num_phy_chans = d40c->base->num_phy_chans; | ||
1718 | 1720 | ||
1719 | if (d40c->dma_cfg.dir == STEDMA40_PERIPH_TO_MEM) { | 1721 | if (d40c->dma_cfg.dir == STEDMA40_PERIPH_TO_MEM) { |
1720 | dev_type = d40c->dma_cfg.src_dev_type; | 1722 | dev_type = d40c->dma_cfg.src_dev_type; |
@@ -1735,12 +1737,19 @@ static int d40_allocate_channel(struct d40_chan *d40c, bool *first_phy_user) | |||
1735 | if (!is_log) { | 1737 | if (!is_log) { |
1736 | if (d40c->dma_cfg.dir == STEDMA40_MEM_TO_MEM) { | 1738 | if (d40c->dma_cfg.dir == STEDMA40_MEM_TO_MEM) { |
1737 | /* Find physical half channel */ | 1739 | /* Find physical half channel */ |
1738 | for (i = 0; i < d40c->base->num_phy_chans; i++) { | 1740 | if (d40c->dma_cfg.use_fixed_channel) { |
1739 | 1741 | i = d40c->dma_cfg.phy_channel; | |
1740 | if (d40_alloc_mask_set(&phys[i], is_src, | 1742 | if (d40_alloc_mask_set(&phys[i], is_src, |
1741 | 0, is_log, | 1743 | 0, is_log, |
1742 | first_phy_user)) | 1744 | first_phy_user)) |
1743 | goto found_phy; | 1745 | goto found_phy; |
1746 | } else { | ||
1747 | for (i = 0; i < num_phy_chans; i++) { | ||
1748 | if (d40_alloc_mask_set(&phys[i], is_src, | ||
1749 | 0, is_log, | ||
1750 | first_phy_user)) | ||
1751 | goto found_phy; | ||
1752 | } | ||
1744 | } | 1753 | } |
1745 | } else | 1754 | } else |
1746 | for (j = 0; j < d40c->base->num_phy_chans; j += 8) { | 1755 | for (j = 0; j < d40c->base->num_phy_chans; j += 8) { |