Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f000df8c authored by Gerald Baeza's avatar Gerald Baeza Committed by Fabio Baltieri
Browse files

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: default avatarGerald Baeza <gerald.baeza@stericsson.com>
Tested-by: default avatarYannick Fertre <yannick.fertre@stericsson.com>
Reviewed-by: default avatarPer Forlin <per.forlin@stericsson.com>
Acked-by: default avatarLinus Walleij <linus.walleij@linaro.org>
Acked-by: default avatarVinod Koul <vinod.koul@intel.com>
Signed-off-by: default avatarFabio Baltieri <fabio.baltieri@linaro.org>
parent ccc3d697
Loading
Loading
Loading
Loading
+11 −2
Original line number Original line Diff line number Diff line
@@ -1711,10 +1711,12 @@ static int d40_allocate_channel(struct d40_chan *d40c, bool *first_phy_user)
	int i;
	int i;
	int j;
	int j;
	int log_num;
	int log_num;
	int num_phy_chans;
	bool is_src;
	bool is_src;
	bool is_log = d40c->dma_cfg.mode == STEDMA40_MODE_LOGICAL;
	bool is_log = d40c->dma_cfg.mode == STEDMA40_MODE_LOGICAL;


	phys = d40c->base->phy_res;
	phys = d40c->base->phy_res;
	num_phy_chans = d40c->base->num_phy_chans;


	if (d40c->dma_cfg.dir == STEDMA40_PERIPH_TO_MEM) {
	if (d40c->dma_cfg.dir == STEDMA40_PERIPH_TO_MEM) {
		dev_type = d40c->dma_cfg.src_dev_type;
		dev_type = d40c->dma_cfg.src_dev_type;
@@ -1735,13 +1737,20 @@ static int d40_allocate_channel(struct d40_chan *d40c, bool *first_phy_user)
	if (!is_log) {
	if (!is_log) {
		if (d40c->dma_cfg.dir == STEDMA40_MEM_TO_MEM) {
		if (d40c->dma_cfg.dir == STEDMA40_MEM_TO_MEM) {
			/* Find physical half channel */
			/* Find physical half channel */
			for (i = 0; i < d40c->base->num_phy_chans; i++) {
			if (d40c->dma_cfg.use_fixed_channel) {

				i = d40c->dma_cfg.phy_channel;
				if (d40_alloc_mask_set(&phys[i], is_src,
						       0, is_log,
						       first_phy_user))
					goto found_phy;
			} else {
				for (i = 0; i < num_phy_chans; i++) {
					if (d40_alloc_mask_set(&phys[i], is_src,
					if (d40_alloc_mask_set(&phys[i], is_src,
						       0, is_log,
						       0, is_log,
						       first_phy_user))
						       first_phy_user))
						goto found_phy;
						goto found_phy;
				}
				}
			}
		} else
		} else
			for (j = 0; j < d40c->base->num_phy_chans; j += 8) {
			for (j = 0; j < d40c->base->num_phy_chans; j += 8) {
				int phy_num = j  + event_group * 2;
				int phy_num = j  + event_group * 2;