From patchwork Tue Apr 6 10:39:49 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Roman Tereshonkov X-Patchwork-Id: 90774 Received: from lists.sourceforge.net (lists.sourceforge.net [216.34.181.88]) by demeter.kernel.org (8.14.3/8.14.3) with ESMTP id o36AeF4D004899 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Tue, 6 Apr 2010 10:40:51 GMT Received: from localhost ([127.0.0.1] helo=sfs-ml-4.v29.ch3.sourceforge.com) by sfs-ml-4.v29.ch3.sourceforge.com with esmtp (Exim 4.69) (envelope-from ) id 1Nz6Cd-0004Dt-0D; Tue, 06 Apr 2010 10:40:15 +0000 Received: from sfi-mx-2.v28.ch3.sourceforge.com ([172.29.28.122] helo=mx.sourceforge.net) by sfs-ml-4.v29.ch3.sourceforge.com with esmtp (Exim 4.69) (envelope-from ) id 1Nz6CS-0004CU-I0 for spi-devel-general@lists.sourceforge.net; Tue, 06 Apr 2010 10:40:04 +0000 Received-SPF: pass (sfi-mx-2.v28.ch3.sourceforge.com: domain of nokia.com designates 192.100.122.233 as permitted sender) client-ip=192.100.122.233; envelope-from=roman.tereshonkov@nokia.com; helo=mgw-mx06.nokia.com; Received: from smtp.nokia.com ([192.100.122.233] helo=mgw-mx06.nokia.com) by sfi-mx-2.v28.ch3.sourceforge.com with esmtps (TLSv1:AES256-SHA:256) (Exim 4.69) id 1Nz6CR-00029D-1L for spi-devel-general@lists.sourceforge.net; Tue, 06 Apr 2010 10:40:04 +0000 Received: from vaebh105.NOE.Nokia.com (vaebh105.europe.nokia.com [10.160.244.31]) by mgw-mx06.nokia.com (Switch-3.3.3/Switch-3.3.3) with ESMTP id o36Adddo023672; Tue, 6 Apr 2010 13:39:55 +0300 Received: from vaebh104.NOE.Nokia.com ([10.160.244.30]) by vaebh105.NOE.Nokia.com with Microsoft SMTPSVC(6.0.3790.3959); Tue, 6 Apr 2010 13:39:51 +0300 Received: from mgw-sa01.ext.nokia.com ([147.243.1.47]) by vaebh104.NOE.Nokia.com over TLS secured channel with Microsoft SMTPSVC(6.0.3790.3959); Tue, 6 Apr 2010 13:39:50 +0300 Received: from localhost.localdomain (ramses.research.nokia.com [172.21.51.130]) by mgw-sa01.ext.nokia.com (Switch-3.3.3/Switch-3.3.3) with ESMTP id o36AdnpN024910; Tue, 6 Apr 2010 13:39:50 +0300 From: Roman Tereshonkov To: spi-devel-general@lists.sourceforge.net Date: Tue, 6 Apr 2010 13:39:49 +0300 Message-Id: <1270550389-30392-2-git-send-email-roman.tereshonkov@nokia.com> X-Mailer: git-send-email 1.6.2.rc1.3.g81d3f In-Reply-To: <1270550389-30392-1-git-send-email-roman.tereshonkov@nokia.com> References: <1270550389-30392-1-git-send-email-roman.tereshonkov@nokia.com> X-OriginalArrivalTime: 06 Apr 2010 10:39:50.0992 (UTC) FILETIME=[7C7CBD00:01CAD575] X-Nokia-AV: Clean X-Spam-Score: -1.5 (-) X-Spam-Report: Spam Filtering performed by mx.sourceforge.net. See http://spamassassin.org/tag/ for more details. -1.5 SPF_CHECK_PASS SPF reports sender host as permitted sender for sender-domain -0.0 SPF_PASS SPF: sender matches SPF record X-Headers-End: 1Nz6CR-00029D-1L Cc: Roman Tereshonkov Subject: [spi-devel-general] [PATCH 2/2] omap2_mcspi: Use dma_min_bytes parameter when it is configured. X-BeenThere: spi-devel-general@lists.sourceforge.net X-Mailman-Version: 2.1.9 Precedence: list List-Id: Linux SPI core/device drivers discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: spi-devel-general-bounces@lists.sourceforge.net X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter.kernel.org [140.211.167.41]); Tue, 06 Apr 2010 10:40:52 +0000 (UTC) diff --git a/drivers/spi/omap2_mcspi.c b/drivers/spi/omap2_mcspi.c index a9d58ce..1befdf8 100644 --- a/drivers/spi/omap2_mcspi.c +++ b/drivers/spi/omap2_mcspi.c @@ -793,6 +793,7 @@ static void omap2_mcspi_work(struct work_struct *work) int par_override = 0; int status = 0; u32 chconf; + u32 dma_min_bytes = DMA_MIN_BYTES; m = container_of(mcspi->msg_queue.next, struct spi_message, queue); @@ -803,6 +804,9 @@ static void omap2_mcspi_work(struct work_struct *work) spi = m->spi; cs = spi->controller_state; + if (spi->dma_min_bytes) + dma_min_bytes = spi->dma_min_bytes; + omap2_mcspi_set_enable(spi, 1); list_for_each_entry(t, &m->transfers, transfer_list) { if (t->tx_buf == NULL && t->rx_buf == NULL && t->len) { @@ -839,7 +843,7 @@ static void omap2_mcspi_work(struct work_struct *work) __raw_writel(0, cs->base + OMAP2_MCSPI_TX0); - if (m->is_dma_mapped || t->len >= DMA_MIN_BYTES) + if (m->is_dma_mapped || t->len >= dma_min_bytes) count = omap2_mcspi_txrx_dma(spi, t); else count = omap2_mcspi_txrx_pio(spi, t); @@ -889,6 +893,7 @@ static int omap2_mcspi_transfer(struct spi_device *spi, struct spi_message *m) struct omap2_mcspi *mcspi; unsigned long flags; struct spi_transfer *t; + u32 dma_min_bytes; m->actual_length = 0; m->status = 0; @@ -896,6 +901,9 @@ static int omap2_mcspi_transfer(struct spi_device *spi, struct spi_message *m) /* reject invalid messages and transfers */ if (list_empty(&m->transfers) || !m->complete) return -EINVAL; + + dma_min_bytes = spi->dma_min_bytes ? spi->dma_min_bytes : DMA_MIN_BYTES; + list_for_each_entry(t, &m->transfers, transfer_list) { const void *tx_buf = t->tx_buf; void *rx_buf = t->rx_buf; @@ -921,7 +929,7 @@ static int omap2_mcspi_transfer(struct spi_device *spi, struct spi_message *m) return -EINVAL; } - if (m->is_dma_mapped || len < DMA_MIN_BYTES) + if (m->is_dma_mapped || len < dma_min_bytes) continue; /* Do DMA mapping "early" for better error reporting and