From patchwork Wed Dec 12 09:37:21 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Fabio Baltieri X-Patchwork-Id: 13498 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id 1E2104C17AA for ; Wed, 12 Dec 2012 10:25:38 +0000 (UTC) Received: from mail-ie0-f176.google.com (mail-ie0-f176.google.com [209.85.223.176]) by fiordland.canonical.com (Postfix) with ESMTP id A6515A19365 for ; Wed, 12 Dec 2012 10:25:37 +0000 (UTC) Received: by mail-ie0-f176.google.com with SMTP id 13so1472710iea.21 for ; Wed, 12 Dec 2012 02:25:37 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-forwarded-to:x-forwarded-for:delivered-to:received-spf :resent-from:resent-date:resent-message-id:resent-to:from:to:cc :subject:date:message-id:x-mailer:in-reply-to:references :x-gm-message-state; bh=XJaNCe5hH/+HtuPsyqqg4BwcaxLo3tRdq32iWqS0xEw=; b=KvnmNUurqlXDJTNEzIk/HnmoTDIJNdc5ThSPO4VOps3DhUImTJEY+tXwaC6HyR6TB4 oZaTCE2j9HdKEy+1APpD8SFneHcKpGrBJtEZda8XvvMeT7dgG8zGUG/nZnAuA+xIJpDw /pUjgrrhOk/gSmHV9+WcW6D31cVY5HR6ABAMJIiG2DYMVuAwHeuRZAOO7e1lT3NozM91 S6r2at7Kfs6k06Fg0uzuXCw3C+bZ2uwT3eoeqTQEGCh51ny2PYoYzhYzQPMjZHpk83fJ ynsDSLHvXvVHQC+vyEHtGQLs1o1vIDtZqEzYtosNglIoNjLB+8vxpkKfMUhRU55vW0M1 WmHQ== Received: by 10.50.42.168 with SMTP id p8mr12727322igl.57.1355307936923; Wed, 12 Dec 2012 02:25:36 -0800 (PST) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.50.67.148 with SMTP id n20csp190163igt; Wed, 12 Dec 2012 02:25:36 -0800 (PST) Received: by 10.14.208.137 with SMTP id q9mr1563630eeo.28.1355307936060; Wed, 12 Dec 2012 02:25:36 -0800 (PST) Received: from mail-ee0-f49.google.com (mail-ee0-f49.google.com [74.125.83.49]) by mx.google.com with ESMTPS id m3si62154970een.116.2012.12.12.02.25.35 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 12 Dec 2012 02:25:36 -0800 (PST) Received-SPF: neutral (google.com: 74.125.83.49 is neither permitted nor denied by best guess record for domain of fabio.baltieri@linaro.org) client-ip=74.125.83.49; Authentication-Results: mx.google.com; spf=neutral (google.com: 74.125.83.49 is neither permitted nor denied by best guess record for domain of fabio.baltieri@linaro.org) smtp.mail=fabio.baltieri@linaro.org Received: by mail-ee0-f49.google.com with SMTP id c4so297709eek.36 for ; Wed, 12 Dec 2012 02:25:35 -0800 (PST) Received: by 10.14.218.69 with SMTP id j45mr1572971eep.35.1355307935505; Wed, 12 Dec 2012 02:25:35 -0800 (PST) Received: from localhost ([2a01:2003:1:1d66:8e70:5aff:feac:ad8]) by mx.google.com with ESMTPS id q44sm55042545eep.5.2012.12.12.02.25.34 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 12 Dec 2012 02:25:35 -0800 (PST) Resent-From: Fabio Baltieri Resent-Date: Wed, 12 Dec 2012 11:25:27 +0100 Resent-Message-ID: <20121212102527.GH10536@balto.lan> Resent-To: patches@linaro.org Received: from localhost ([2a01:2003:1:1d66:8e70:5aff:feac:ad8]) by mx.google.com with ESMTPS id w3sm54867005eel.17.2012.12.12.01.38.31 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 12 Dec 2012 01:38:32 -0800 (PST) From: Fabio Baltieri To: Linus Walleij , Srinidhi Kasagar Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Gerald Baeza , Fabio Baltieri Subject: [PATCH 7/7] dmaengine: ste_dma40: support fixed physical channel allocation Date: Wed, 12 Dec 2012 10:37:21 +0100 Message-Id: <1355305041-2338-8-git-send-email-fabio.baltieri@linaro.org> X-Mailer: git-send-email 1.7.12.1 In-Reply-To: <1355305041-2338-1-git-send-email-fabio.baltieri@linaro.org> References: <1355305041-2338-1-git-send-email-fabio.baltieri@linaro.org> X-Gm-Message-State: ALoCoQklVD+QU69cfVnqsPbpPM7MkOSdkXVme+s//nq1/VDHTdD31SNcPuzD4dP5pJ8qQoeu87xT From: Gerald Baeza This patch makes existing use_fixed_channel field (of stedma40_chan_cfg structure) applicable to physical channels. Signed-off-by: Gerald Baeza Tested-by: Yannick Fertre Reviewed-by: Per Forlin Acked-by: Linus Walleij Signed-off-by: Fabio Baltieri --- 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) {