From patchwork Thu Dec 9 20:34:55 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ben Gardiner X-Patchwork-Id: 396052 Received: from lists.sourceforge.net (lists.sourceforge.net [216.34.181.88]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id oB9KZPTu015931 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Thu, 9 Dec 2010 20:35:46 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 1PQnCu-0006xC-UR; Thu, 09 Dec 2010 20:35:16 +0000 Received: from sog-mx-1.v43.ch3.sourceforge.com ([172.29.43.191] helo=mx.sourceforge.net) by sfs-ml-4.v29.ch3.sourceforge.com with esmtp (Exim 4.69) (envelope-from ) id 1PQnCt-0006x3-FS for spi-devel-general@lists.sourceforge.net; Thu, 09 Dec 2010 20:35:15 +0000 X-ACL-Warn: Received: from na3sys009aog111.obsmtp.com ([74.125.149.205]) by sog-mx-1.v43.ch3.sourceforge.com with smtp (Exim 4.69) id 1PQnCs-0002JF-H4 for spi-devel-general@lists.sourceforge.net; Thu, 09 Dec 2010 20:35:15 +0000 Received: from source ([209.85.213.173]) by na3sys009aob111.postini.com ([74.125.148.12]) with SMTP ID DSNKTQE9d0kvDj9ZGQgtnJ4z1csz3oh8F4uz@postini.com; Thu, 09 Dec 2010 12:35:14 PST Received: by mail-yx0-f173.google.com with SMTP id 31so1860830yxl.32 for ; Thu, 09 Dec 2010 12:35:03 -0800 (PST) Received: by 10.150.53.18 with SMTP id b18mr9706yba.351.1291926903555; Thu, 09 Dec 2010 12:35:03 -0800 (PST) Received: from localhost.localdomain ([206.191.47.130]) by mx.google.com with ESMTPS id p30sm935055ybk.20.2010.12.09.12.35.02 (version=TLSv1/SSLv3 cipher=RC4-MD5); Thu, 09 Dec 2010 12:35:02 -0800 (PST) From: Ben Gardiner To: spi-devel-general@lists.sourceforge.net, Grant Likely , David Brownell Subject: [RFC][PATCH v2 2/3] spi_bitbang : get nsecs delay from cs during transfer Date: Thu, 9 Dec 2010 15:34:55 -0500 Message-Id: <67270e44ec792d1a684d6052f7aebbc8c538a6c1.1291925752.git.bengardiner@nanometrics.ca> X-Mailer: git-send-email 1.7.0.4 In-Reply-To: References: <1290205185-11956-1-git-send-email-bengardiner@nanometrics.ca> X-Spam-Score: 0.0 (/) X-Spam-Report: Spam Filtering performed by mx.sourceforge.net. See http://spamassassin.org/tag/ for more details. X-Headers-End: 1PQnCs-0002JF-H4 Cc: linux-kernel@vger.kernel.org, Michael Buesch 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 (demeter1.kernel.org [140.211.167.41]); Thu, 09 Dec 2010 20:35:46 +0000 (UTC) diff --git a/drivers/spi/spi_bitbang.c b/drivers/spi/spi_bitbang.c index 8b55724..8707133 100644 --- a/drivers/spi/spi_bitbang.c +++ b/drivers/spi/spi_bitbang.c @@ -269,6 +269,7 @@ static void bitbang_work(struct work_struct *work) while (!list_empty(&bitbang->queue)) { struct spi_message *m; struct spi_device *spi; + struct spi_bitbang_cs *cs; unsigned nsecs; struct spi_transfer *t = NULL; unsigned tmp; @@ -281,13 +282,15 @@ static void bitbang_work(struct work_struct *work) list_del_init(&m->queue); spin_unlock_irqrestore(&bitbang->lock, flags); - /* FIXME this is made-up ... the correct value is known to - * word-at-a-time bitbang code, and presumably chipselect() - * should enforce these requirements too? - */ - nsecs = 100; - spi = m->spi; + cs = spi->controller_state; + nsecs = +#if defined(CONFIG_SLOWER_SPI_GPIO) + !cs->nsecs ? cs->nsecs : 100; +#else + 100; +#endif + tmp = 0; cs_change = 1; status = 0;