diff options
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) { |