diff mbox

[RFC,v2,2/3] spi_bitbang : get nsecs delay from cs during transfer

Message ID 67270e44ec792d1a684d6052f7aebbc8c538a6c1.1291925752.git.bengardiner@nanometrics.ca (mailing list archive)
State Superseded, archived
Headers show

Commit Message

Ben Gardiner Dec. 9, 2010, 8:34 p.m. UTC
None
diff mbox

Patch

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;