linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: fabio.baltieri@linaro.org (Fabio Baltieri)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 7/7] dmaengine: ste_dma40: support fixed physical channel allocation
Date: Wed, 12 Dec 2012 10:37:21 +0100	[thread overview]
Message-ID: <1355305041-2338-8-git-send-email-fabio.baltieri@linaro.org> (raw)
In-Reply-To: <1355305041-2338-1-git-send-email-fabio.baltieri@linaro.org>

From: Gerald Baeza <gerald.baeza@stericsson.com>

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>
Signed-off-by: Fabio Baltieri <fabio.baltieri@linaro.org>
---
 drivers/dma/ste_dma40.c | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/drivers/dma/ste_dma40.c b/drivers/dma/ste_dma40.c
index f871df6..efe8be7 100644
--- a/drivers/dma/ste_dma40.c
+++ b/drivers/dma/ste_dma40.c
@@ -1712,10 +1712,12 @@ static int d40_allocate_channel(struct d40_chan *d40c, bool *first_phy_user)
 	int i;
 	int j;
 	int log_num;
+	int num_phy_chans;
 	bool is_src;
 	bool is_log = d40c->dma_cfg.mode == STEDMA40_MODE_LOGICAL;
 
 	phys = d40c->base->phy_res;
+	num_phy_chans = d40c->base->num_phy_chans;
 
 	if (d40c->dma_cfg.dir == STEDMA40_PERIPH_TO_MEM) {
 		dev_type = d40c->dma_cfg.src_dev_type;
@@ -1736,12 +1738,19 @@ static int d40_allocate_channel(struct d40_chan *d40c, bool *first_phy_user)
 	if (!is_log) {
 		if (d40c->dma_cfg.dir == STEDMA40_MEM_TO_MEM) {
 			/* 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,
+						       0, is_log,
+						       first_phy_user))
+						goto found_phy;
+				}
 			}
 		} else
 			for (j = 0; j < d40c->base->num_phy_chans; j += 8) {
-- 
1.7.12.1

  parent reply	other threads:[~2012-12-12  9:37 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-12-12  9:37 [PATCH 0/7] various ste_dma40 fixes Fabio Baltieri
2012-12-12  9:37 ` [PATCH 1/7] dmaengine: ste_dma40: reset priority bit for logical channels Fabio Baltieri
2012-12-12  9:37 ` [PATCH 2/7] dmaengine: ste_dma40: use writel_relaxed for lcxa Fabio Baltieri
2012-12-12  9:37 ` [PATCH 3/7] dmaengine: ste_dma40: set dma max seg size Fabio Baltieri
2012-12-12  9:37 ` [PATCH 4/7] dmaengine: ste_dma40: limit burst size to 16 Fabio Baltieri
2012-12-12  9:37 ` [PATCH 5/7] dmaengine: ste_dma40: don't check for pm_runtime_suspended() Fabio Baltieri
2012-12-12  9:37 ` [PATCH 6/7] dmaengine: ste_dma40: don't allow high priority dest event lines Fabio Baltieri
2012-12-12  9:37 ` Fabio Baltieri [this message]
2012-12-12 10:16 ` [PATCH 0/7] various ste_dma40 fixes Fabio Baltieri

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1355305041-2338-8-git-send-email-fabio.baltieri@linaro.org \
    --to=fabio.baltieri@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).