From patchwork Fri Oct 16 19:09:29 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kevin Hilman X-Patchwork-Id: 54374 Received: from bear.ext.ti.com (bear.ext.ti.com [192.94.94.41]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n9GJHX4W012789 for ; Fri, 16 Oct 2009 19:17:34 GMT Received: from dlep34.itg.ti.com ([157.170.170.115]) by bear.ext.ti.com (8.13.7/8.13.7) with ESMTP id n9GJHSYS012527 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Fri, 16 Oct 2009 14:17:29 -0500 Received: from linux.omap.com (localhost [127.0.0.1]) by dlep34.itg.ti.com (8.13.7/8.13.7) with ESMTP id n9GJHP4U002723 for ; Fri, 16 Oct 2009 14:17:26 -0500 (CDT) Received: from linux.omap.com (localhost [127.0.0.1]) by linux.omap.com (Postfix) with ESMTP id 4354F80AF9 for ; Fri, 16 Oct 2009 14:16:09 -0500 (CDT) X-Original-To: davinci-linux-open-source@linux.davincidsp.com Delivered-To: davinci-linux-open-source@linux.davincidsp.com Received: from dflp52.itg.ti.com (dflp52.itg.ti.com [128.247.22.96]) by linux.omap.com (Postfix) with ESMTP id DAF7780631 for ; Fri, 16 Oct 2009 14:12:51 -0500 (CDT) Received: from neches.ext.ti.com (localhost [127.0.0.1]) by dflp52.itg.ti.com (8.13.7/8.13.7) with ESMTP id n9GJCpQf013954 for ; Fri, 16 Oct 2009 14:12:51 -0500 (CDT) Received: from mail187-tx2-R.bigfish.com (mail-tx2.bigfish.com [65.55.88.114]) by neches.ext.ti.com (8.13.7/8.13.7) with ESMTP id n9GJCpos028165 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=FAIL) for ; Fri, 16 Oct 2009 14:12:51 -0500 Received: from mail187-tx2 (localhost.localdomain [127.0.0.1]) by mail187-tx2-R.bigfish.com (Postfix) with ESMTP id 2432688863C for ; Fri, 16 Oct 2009 19:12:51 +0000 (UTC) X-SpamScore: 7 X-BigFish: vps7(zza4b1ozz1202hzzz2dh6bh62h) X-Spam-TCS-SCL: 1:0 X-FB-SS: 5, X-MS-Exchange-Organization-Antispam-Report: OrigIP: 74.125.78.147; Service: EHS Received: by mail187-tx2 (MessageSwitch) id 1255720337153846_21886; Fri, 16 Oct 2009 19:12:17 +0000 (UCT) Received: from TX2EHSMHS007.bigfish.com (unknown [10.9.14.239]) by mail187-tx2.bigfish.com (Postfix) with ESMTP id B666E1A10075 for ; Fri, 16 Oct 2009 19:12:15 +0000 (UTC) Received: from ey-out-1920.google.com (74.125.78.147) by TX2EHSMHS007.bigfish.com (10.9.99.107) with Microsoft SMTP Server id 14.0.482.32; Fri, 16 Oct 2009 19:12:14 +0000 Received: by ey-out-1920.google.com with SMTP id 3so488924eyh.30 for ; Fri, 16 Oct 2009 12:12:14 -0700 (PDT) Received: by 10.216.90.209 with SMTP id e59mr696853wef.193.1255720333983; Fri, 16 Oct 2009 12:12:13 -0700 (PDT) Received: from localhost ([216.254.16.51]) by mx.google.com with ESMTPS id p37sm3113799gvf.24.2009.10.16.12.12.11 (version=TLSv1/SSLv3 cipher=RC4-MD5); Fri, 16 Oct 2009 12:12:13 -0700 (PDT) From: Kevin Hilman To: linux-arm-kernel@lists.infradead.org Date: Fri, 16 Oct 2009 12:09:29 -0700 Message-ID: <1255720190-7452-27-git-send-email-khilman@deeprootsystems.com> X-Mailer: git-send-email 1.6.4.3 In-Reply-To: <1255720190-7452-26-git-send-email-khilman@deeprootsystems.com> References: <1255720190-7452-1-git-send-email-khilman@deeprootsystems.com> <1255720190-7452-2-git-send-email-khilman@deeprootsystems.com> <1255720190-7452-3-git-send-email-khilman@deeprootsystems.com> <1255720190-7452-4-git-send-email-khilman@deeprootsystems.com> <1255720190-7452-5-git-send-email-khilman@deeprootsystems.com> <1255720190-7452-6-git-send-email-khilman@deeprootsystems.com> <1255720190-7452-7-git-send-email-khilman@deeprootsystems.com> <1255720190-7452-8-git-send-email-khilman@deeprootsystems.com> <1255720190-7452-9-git-send-email-khilman@deeprootsystems.com> <1255720190-7452-10-git-send-email-khilman@deeprootsystems.com> <1255720190-7452-11-git-send-email-khilman@deeprootsystems.com> <1255720190-7452-12-git-send-email-khilman@deeprootsystems.com> <1255720190-7452-13-git-send-email-khilman@deeprootsystems.com> <1255720190-7452-14-git-send-email-khilman@deeprootsystems.com> <1255720190-7452-15-git-send-email-khilman@deeprootsystems.com> <1255720190-7452-16-git-send-email-khilman@deeprootsystems.com> <1255720190-7452-17-git-send-email-khilman@deeprootsystems.com> <1255720190-7452-18-git-send-email-khilman@deeprootsystems.com> <1255720190-7452-19-git-send-email-khilman@deeprootsystems.com> <1255720190-7452-20-git-send-email-khilman@deeprootsystems.com> <1255720190-7452-21-git-send-email-khilman@deeprootsystems.com> <1255720190-7452-22-git-send-email-khilman@deeprootsystems.com> <1255720190-7452-23-git-send-email-khilman@deeprootsystems.com> <1255720190-7452-24-git-send-email-khilman@deeprootsystems.com> <1255720190-7452-25-git-send-email-khilman@deeprootsystems.com> <1255720190-7452-26-git-send-email-khilman@deeprootsystems.com> MIME-Version: 1.0 X-Reverse-DNS: ey-out-1920.google.com Cc: davinci-linux-open-source@linux.davincidsp.com Subject: [PATCH 25/46] DaVinci: EDMA: Fix Bug while obtaining contiguous params X-BeenThere: davinci-linux-open-source@linux.davincidsp.com X-Mailman-Version: 2.1.4 Precedence: list List-Id: davinci-linux-open-source.linux.davincidsp.com List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: davinci-linux-open-source-bounces+patchwork-davinci=patchwork.kernel.org@linux.davincidsp.com Errors-To: davinci-linux-open-source-bounces+patchwork-davinci=patchwork.kernel.org@linux.davincidsp.com diff --git a/arch/arm/mach-davinci/dma.c b/arch/arm/mach-davinci/dma.c index 8eda4c3..b097592 100644 --- a/arch/arm/mach-davinci/dma.c +++ b/arch/arm/mach-davinci/dma.c @@ -515,17 +515,30 @@ static int reserve_contiguous_params(int ctlr, unsigned int id, { int i, j; unsigned int count = num_params; + int stop_param = start_param; + DECLARE_BITMAP(tmp_inuse, EDMA_MAX_PARAMENTRY); for (i = start_param; i < edma_info[ctlr]->num_slots; ++i) { j = EDMA_CHAN_SLOT(i); - if (!test_and_set_bit(j, edma_info[ctlr]->edma_inuse)) + if (!test_and_set_bit(j, edma_info[ctlr]->edma_inuse)) { + /* Record our current beginning slot */ + if (count == num_params) + stop_param = i; + count--; + set_bit(j, tmp_inuse); + if (count == 0) break; - else if (id == EDMA_CONT_PARAMS_FIXED_EXACT) - break; - else - count = num_params; + } else { + clear_bit(j, tmp_inuse); + + if (id == EDMA_CONT_PARAMS_FIXED_EXACT) { + stop_param = i; + break; + } else + count = num_params; + } } /* @@ -534,12 +547,15 @@ static int reserve_contiguous_params(int ctlr, unsigned int id, * of contiguous parameter RAMs but do not find the exact number * requested as we may reach the total number of parameter RAMs */ - if (count) { - for (j = i - num_params + count + 1; j <= i ; ++j) + if (i == edma_info[ctlr]->num_slots) + stop_param = i; + + for (j = start_param; j < stop_param; j++) + if (test_bit(j, tmp_inuse)) clear_bit(j, edma_info[ctlr]->edma_inuse); + if (count) return -EBUSY; - } for (j = i - num_params + 1; j <= i; ++j) memcpy_toio(edmacc_regs_base[ctlr] + PARM_OFFSET(j),