From patchwork Mon Jan 7 11:21:49 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Fabio Baltieri X-Patchwork-Id: 13870 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 D649023EC8 for ; Mon, 7 Jan 2013 11:24:21 +0000 (UTC) Received: from mail-vc0-f174.google.com (mail-vc0-f174.google.com [209.85.220.174]) by fiordland.canonical.com (Postfix) with ESMTP id 953A2A19344 for ; Mon, 7 Jan 2013 11:24:21 +0000 (UTC) Received: by mail-vc0-f174.google.com with SMTP id d16so19328889vcd.33 for ; Mon, 07 Jan 2013 03:24:21 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:x-forwarded-to:x-forwarded-for:delivered-to:x-received :received-spf:x-received:from:to:cc:subject:date:message-id:x-mailer :in-reply-to:references:x-gm-message-state; bh=xrJ10UreId0q23svhGJd2N/34D+ALPkYUZey/v1w0TA=; b=iWiLnYJZ14IJFmIqXt50JXIyfTZ8B7LdHi+YVMw1PlAHqMptTpvpgzr6XSsg3iSZFb Ochkc8Apib/XorbmYHQjR0Skkc8sK0Q2/34qx/hrUATz/pX1L02Qb7Uej2BpqNuL8Lq8 sy2NgigEhGG2d37ih9meONEp/aUeX1Vr2lQTnkBZnZ7iJ70CaDmp0j/rZLDkWNR7btsU ON5gMlQLyXAVqOGf09vfRxOIHS2l0uUaqDDBMPlOYWJGZ9m9gWvYjs8Y2OZCFB/1n/TZ E8fMF7Dm6PZ4+gCqHlNwX8kSahyjZR4bB4IQnpTLbpYIcyfQcuHtO+xgE8mjiN65SC3x J2EA== X-Received: by 10.220.8.18 with SMTP id f18mr80286592vcf.14.1357557861098; Mon, 07 Jan 2013 03:24:21 -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.58.145.101 with SMTP id st5csp56249veb; Mon, 7 Jan 2013 03:24:20 -0800 (PST) X-Received: by 10.180.87.102 with SMTP id w6mr8585139wiz.19.1357557859056; Mon, 07 Jan 2013 03:24:19 -0800 (PST) Received: from mail-we0-f182.google.com (mail-we0-f182.google.com [74.125.82.182]) by mx.google.com with ESMTPS id hv5si10056787wib.8.2013.01.07.03.24.18 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 07 Jan 2013 03:24:19 -0800 (PST) Received-SPF: neutral (google.com: 74.125.82.182 is neither permitted nor denied by best guess record for domain of fabio.baltieri@linaro.org) client-ip=74.125.82.182; Authentication-Results: mx.google.com; spf=neutral (google.com: 74.125.82.182 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-we0-f182.google.com with SMTP id u54so9802808wey.41 for ; Mon, 07 Jan 2013 03:24:18 -0800 (PST) X-Received: by 10.180.75.208 with SMTP id e16mr8797329wiw.3.1357557858579; Mon, 07 Jan 2013 03:24:18 -0800 (PST) Received: from localhost ([2a01:2029:1:11e3:8e70:5aff:feac:ad8]) by mx.google.com with ESMTPS id dm3sm11642451wib.9.2013.01.07.03.24.12 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Mon, 07 Jan 2013 03:24:17 -0800 (PST) From: Fabio Baltieri To: Vinod Koul Cc: Dan Williams , Linus Walleij , Srinidhi Kasagar , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Gerald Baeza , Fabio Baltieri Subject: [PATCH 07/16] dmaengine: ste_dma40: support fixed physical channel allocation Date: Mon, 7 Jan 2013 12:21:49 +0100 Message-Id: <1357557718-15676-8-git-send-email-fabio.baltieri@linaro.org> X-Mailer: git-send-email 1.7.12.1 In-Reply-To: <1357557718-15676-1-git-send-email-fabio.baltieri@linaro.org> References: <1357557718-15676-1-git-send-email-fabio.baltieri@linaro.org> X-Gm-Message-State: ALoCoQmJFQ2bDD9b+kYQd2K/y4LAfXktHXdueIFPtjpIdi5rA3tu+SO3t7ZJJUHHqiCkEF8ianNv 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 9f8964a..5feab7db9 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) 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; @@ -1735,12 +1737,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) {