From patchwork Thu Jan 21 11:40:52 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: George Shore X-Patchwork-Id: 74320 Received: from lists.sourceforge.net (lists.sourceforge.net [216.34.181.88]) by demeter.kernel.org (8.14.3/8.14.2) with ESMTP id o0LCxbEA009119 for ; Thu, 21 Jan 2010 12:59:37 GMT Received: from localhost ([127.0.0.1] helo=sfs-ml-2.v29.ch3.sourceforge.com) by sfs-ml-2.v29.ch3.sourceforge.com with esmtp (Exim 4.69) (envelope-from ) id 1NXwdM-00013q-Kg; Thu, 21 Jan 2010 12:59:36 +0000 Received: from sfi-mx-3.v28.ch3.sourceforge.com ([172.29.28.123] helo=mx.sourceforge.net) by sfs-ml-2.v29.ch3.sourceforge.com with esmtp (Exim 4.69) (envelope-from ) id 1NXwdL-00013k-M9 for spi-devel-general@lists.sourceforge.net; Thu, 21 Jan 2010 12:59:35 +0000 X-ACL-Warn: Received: from smtp3.34sp.com ([80.82.115.202]) by sfi-mx-3.v28.ch3.sourceforge.com with esmtp (Exim 4.69) id 1NXwdK-0001ti-Ay for spi-devel-general@lists.sourceforge.net; Thu, 21 Jan 2010 12:59:35 +0000 Received: from localhost (localhost.localdomain [127.0.0.1]) by smtp3.34sp.com (Postfix) with ESMTP id 547AA1510005; Thu, 21 Jan 2010 11:41:06 +0000 (GMT) X-Virus-Scanned: amavisd-new at smtp.34sp.com Received: from smtp3.34sp.com ([127.0.0.1]) by localhost (smtp3.34sp.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id dia3JOGymhD4; Thu, 21 Jan 2010 11:41:06 +0000 (GMT) Received: from localhost.localdomain (87-194-181-195.bethere.co.uk [87.194.181.195]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) (Authenticated sender: binarymage) by smtp3.34sp.com (Postfix) with ESMTP id 201A71510016; Thu, 21 Jan 2010 11:41:06 +0000 (GMT) From: George Shore To: spi-devel-list , Grant Likely , David Brownell Date: Thu, 21 Jan 2010 11:40:52 +0000 Message-Id: <1264074052-2214-5-git-send-email-george@georgeshore.com> X-Mailer: git-send-email 1.6.6.264.gd0743 In-Reply-To: <1264074052-2214-1-git-send-email-george@georgeshore.com> References: <1264074052-2214-1-git-send-email-george@georgeshore.com> X-Sender-Verify: failed, postmaster X-Spam-Score: 0.5 (/) X-Spam-Report: Spam Filtering performed by mx.sourceforge.net. See http://spamassassin.org/tag/ for more details. 0.5 VA_SENDER_VERIFY_POSTMASTER Unable to Verify postmaster@domain.tld X-Headers-End: 1NXwdK-0001ti-Ay Cc: George Shore Subject: [spi-devel-general] [PATCH 5/5] spi/dw_spi.c: conditional transfer mode changes 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 diff --git a/drivers/spi/dw_spi.c b/drivers/spi/dw_spi.c index 4f91554..a1c195f 100644 --- a/drivers/spi/dw_spi.c +++ b/drivers/spi/dw_spi.c @@ -537,6 +537,22 @@ static void pump_transfers(unsigned long data) } message->state = RUNNING_STATE; + /* + * Adjust transfer mode if necessary. Requires platform dependent + * chipselect mechanism. + */ + if (dws->cs_control) { + if (dws->rx && dws->tx) + chip->tmode = 0x00; + else if (dws->rx) + chip->tmode = 0x02; + else + chip->tmode = 0x01; + + cr0 &= ~(0x3 << SPI_MODE_OFFSET); + cr0 |= (chip->tmode << SPI_TMOD_OFFSET); + } + /* Check if current transfer is a DMA transaction */ dws->dma_mapped = map_dma_buffers(dws);