From patchwork Fri Oct 29 15:02:24 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Marc-Andr=C3=A9_H=C3=A9bert?= X-Patchwork-Id: 290382 Received: from comal.ext.ti.com (comal.ext.ti.com [198.47.26.152]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id o9TF4F4V008351 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Fri, 29 Oct 2010 15:04:39 GMT Received: from dlep35.itg.ti.com ([157.170.170.118]) by comal.ext.ti.com (8.13.7/8.13.7) with ESMTP id o9TF2UqX006851 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Fri, 29 Oct 2010 10:02:30 -0500 Received: from linux.omap.com (localhost [127.0.0.1]) by dlep35.itg.ti.com (8.13.7/8.13.7) with ESMTP id o9TF2SLM027292; Fri, 29 Oct 2010 10:02:29 -0500 (CDT) Received: from linux.omap.com (localhost [127.0.0.1]) by linux.omap.com (Postfix) with ESMTP id 6781580627; Fri, 29 Oct 2010 10:02:28 -0500 (CDT) X-Original-To: davinci-linux-open-source@linux.davincidsp.com Delivered-To: davinci-linux-open-source@linux.davincidsp.com Received: from dflp51.itg.ti.com (dflp51.itg.ti.com [128.247.22.94]) by linux.omap.com (Postfix) with ESMTP id 4AF2F80626 for ; Fri, 29 Oct 2010 10:02:27 -0500 (CDT) Received: from medina.ext.ti.com (localhost [127.0.0.1]) by dflp51.itg.ti.com (8.13.7/8.13.7) with ESMTP id o9TF2QT7019799 for ; Fri, 29 Oct 2010 10:02:26 -0500 (CDT) Received: from psmtp.com (na3sys009amx223.postini.com [74.125.149.63]) by medina.ext.ti.com (8.13.7/8.13.7) with SMTP id o9TF2QIQ015002 for ; Fri, 29 Oct 2010 10:02:26 -0500 Received: from source ([209.85.214.45]) by na3sys009amx223.postini.com ([74.125.148.10]) with SMTP; Fri, 29 Oct 2010 08:02:26 PDT Received: by bwz2 with SMTP id 2so2740650bwz.4 for ; Fri, 29 Oct 2010 08:02:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:received:in-reply-to :references:date:message-id:subject:from:to:cc:content-type; bh=RODGJVbujbGGKTg72EokdlImFm+K1NufExsMEC1Z4Pw=; b=B6KIsF4PESaUS8+Ajb30nL75p6ReLuxz2Po7z+RHvmfwvO0Bf7+rP6hhpEvmhpVtGp NoIqRdi/ee+B40V1LOIOevH3miZ+/QBSjTibrAQt6Uyqo6juDUqs7l4q9aqfvpkG/EnC uYqy/oPhetn914llSu+sfoX7IOa6U6N99frzI= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; b=h4ptOrLEbhRILMY40h9VJnXUNV3hOVRofuPulxzcw2797aYYASFBMNMNvQjLwvT96Z SzdepmPghxhQBF/1moOJ6bv7JuFCTCLUIRPl88H35h5NBYl1r/o/uXcEwYotbfAQhBge ZhiU/rQSQKtJ08lQiT/Ru0qhd9t21lmJAnGdA= MIME-Version: 1.0 Received: by 10.204.51.198 with SMTP id e6mr108621bkg.142.1288364544842; Fri, 29 Oct 2010 08:02:24 -0700 (PDT) Received: by 10.204.48.66 with HTTP; Fri, 29 Oct 2010 08:02:24 -0700 (PDT) In-Reply-To: <4CC8461A.1020903@audioscience.com> References: <4CC8461A.1020903@audioscience.com> Date: Fri, 29 Oct 2010 11:02:24 -0400 Message-ID: Subject: Re: Problem with new SPI driver From: =?ISO-8859-1?Q?Marc=2DAndr=E9_H=E9bert?= To: Andrew Elder X-pstn-neptune: 0/0/0.00/0 X-pstn-levels: (S:99.17135/99.90000 CV:99.9000 FC:95.5390 LC:95.5390 R:95.9108 P:95.9108 M:97.0282 C:98.6951 ) X-pstn-settings: 2 (0.5000:0.0750) s cv GT3 gt2 gt1 r p m c X-pstn-addresses: from [db-null] Cc: david.kondrad@legrand.us, davinci-linux-open-source@linux.davincidsp.com X-BeenThere: davinci-linux-open-source@linux.davincidsp.com X-Mailman-Version: 2.1.12 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: davinci-linux-open-source-bounces@linux.davincidsp.com Errors-To: davinci-linux-open-source-bounces@linux.davincidsp.com X-Greylist: Sender succeeded STARTTLS authentication, not delayed by milter-greylist-4.2.3 (demeter1.kernel.org [140.211.167.41]); Fri, 29 Oct 2010 15:04:39 +0000 (UTC) diff --git a/drivers/spi/davinci_spi.c b/drivers/spi/davinci_spi.c index 5c9e9ce..93e716d 100644 --- a/drivers/spi/davinci_spi.c +++ b/drivers/spi/davinci_spi.c @@ -763,27 +763,47 @@ static int davinci_spi_txrx_bufs(struct spi_device *spi, struct spi_transfer *t) t->rx_dma = dma_map_single(&spi->dev, rx_buf, rx_buf_count, DMA_FROM_DEVICE); - tx_param.opt = TCINTEN | EDMA_TCC(davinci_dma->dma_tx_channel); - tx_param.src = t->tx_buf ? t->tx_dma : tx_reg; - tx_param.a_b_cnt = davinci_spi->wcount << 16 | data_type; - tx_param.dst = tx_reg; - tx_param.src_dst_bidx = t->tx_buf ? data_type : 0; - tx_param.link_bcntrld = 0xffff; - tx_param.src_dst_cidx = 0; - tx_param.ccnt = 1; - edma_write_slot(davinci_dma->dma_tx_channel, &tx_param); - edma_link(davinci_dma->dma_tx_channel, - davinci_dma->dummy_param_slot); - - rx_param.opt = TCINTEN | EDMA_TCC(davinci_dma->dma_rx_channel); - rx_param.src = rx_reg; - rx_param.a_b_cnt = davinci_spi->rcount << 16 | data_type; - rx_param.dst = t->rx_dma; - rx_param.src_dst_bidx = (t->rx_buf ? data_type : 0) << 16; - rx_param.link_bcntrld = 0xffff; - rx_param.src_dst_cidx = 0; - rx_param.ccnt = 1; - edma_write_slot(davinci_dma->dma_rx_channel, &rx_param); + if( davinci_spi->wcount < 0x10000 || !(davinci_spi->wcount & 0x7fff) ) { + /*We can use a single PaRAM slot*/ + tx_param.opt = TCINTEN | EDMA_TCC(davinci_dma->dma_tx_channel); + tx_param.src = t->tx_buf ? t->tx_dma : tx_reg; + tx_param.dst = tx_reg; + tx_param.src_dst_bidx = t->tx_buf ? data_type : 0; + tx_param.src_dst_cidx = t->tx_buf ? data_type : 0; + tx_param.link_bcntrld = (0x8000 << 16) | 0xffff; + if( davinci_spi->wcount < 0x10000 ) { /*Use a single frame of BCNT=wcount*/ + tx_param.a_b_cnt = davinci_spi->wcount << 16 | data_type; + tx_param.ccnt = 1; + } + else { /*Use multiple frames of BCNT=32K*/ + tx_param.a_b_cnt = 0x8000 << 16 | data_type; + tx_param.ccnt = davinci_spi->wcount / 0x8000; + } + edma_write_slot(davinci_dma->dma_tx_channel, &tx_param); + edma_link(davinci_dma->dma_tx_channel, + davinci_dma->dummy_param_slot); + + rx_param.opt = TCINTEN | EDMA_TCC(davinci_dma->dma_rx_channel); + rx_param.src = rx_reg; + rx_param.dst = t->rx_dma; + rx_param.src_dst_bidx = (t->rx_buf ? data_type : 0) << 16; + rx_param.src_dst_cidx = (t->rx_buf ? data_type : 0) << 16; + rx_param.link_bcntrld = (0x8000 << 16) | 0xffff; + if( davinci_spi->rcount < 0x10000 ) { /*Use a single frame of BCNT=wcount*/ + rx_param.a_b_cnt = davinci_spi->rcount << 16 | data_type; + rx_param.ccnt = 1; + } + else { /*Use multiple frames of BCNT=32K*/ + rx_param.a_b_cnt = 0x8000 << 16 | data_type; + rx_param.ccnt = davinci_spi->rcount / 0x8000; + } + edma_write_slot(davinci_dma->dma_rx_channel, &rx_param); + } + else { + /*Need to use multiple PaRAM slots*/ + printk("unsupported\n"); + return -EIO; + } iowrite16(spidat1 >> SPIDAT1_CSNR_SHIFT,