Skip to contentSkip to conversation

spi: Freescale STMP driver

PATCH In review David Brownell 3 participants 5 messages Aug 28, 2009 – Sep 2, 2009 3 messages not in the archive

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 spi: Freescale STMP driver

Subject: [PATCH] Freescale STMP spi driver, revised
From: dmitry pervushin <dpervushin-L1vi/lXTdtvkgf6YlCu6wwC/[email protected]>
Date: Wed, 03 Jun 2009 20:15:46 +0400

Add SPI driver for Freescale STMP 3xxx-based boards

[[email protected]: cleanup sequence, spi_unregister_master]

---
 drivers/spi/Kconfig    |    6 
 drivers/spi/Makefile   |    1 
 drivers/spi/spi_stmp.c |  679 +++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 686 insertions(+)
drivers/spi/Kconfig +6 -0
@@ -222,6 +222,12 @@ config SPI_SH_SCI
 	help
 	  SPI driver for SuperH SCI blocks.
 
+config SPI_STMP3XXX
+	tristate "Freescale STMP37xx/378x SPI/SSP controller"
+	depends on ARCH_STMP3XXX && SPI_MASTER
+	help
+	  SPI driver for Freescale STMP37xx/378x SoC SSP interface
+
 config SPI_TXX9
 	tristate "Toshiba TXx9 SPI controller"
 	depends on GENERIC_GPIO && CPU_TX49XX
drivers/spi/Makefile +1 -0
@@ -32,6 +32,7 @@ obj-$(CONFIG_SPI_S3C24XX)		+= spi_s3c24x
 obj-$(CONFIG_SPI_TXX9)			+= spi_txx9.o
 obj-$(CONFIG_SPI_XILINX)		+= xilinx_spi.o
 obj-$(CONFIG_SPI_SH_SCI)		+= spi_sh_sci.o
+obj-$(CONFIG_SPI_STMP3XXX)		+= spi_stmp.o
 # 	... add above this line ...
 
 # SPI protocol drivers (device/link on bus)
drivers/spi/spi_stmp.c new file +679 -0

679 lines not on this page · raw message

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july

A message that is not in the archive (sent off-list or not yet received): 200908271847.43226.david-b-yBeKhBN/[email protected]

#2 lore raw
Quoted 8 lines · On Thu, 27 Aug 2009 18:47:42 -0700 David Brownell…

Subject: [PATCH] Freescale STMP spi driver, revised
From: dmitry pervushin <dpervushin-L1vi/lXTdtvkgf6YlCu6wwC/[email protected]>
Date: Wed, 03 Jun 2009 20:15:46 +0400

Add SPI driver for Freescale STMP 3xxx-based boards

[[email protected]: cleanup sequence, spi_unregister_master]

Does "freescale" have a maintainer? Me no understand it.

drivers/spi/spi_stmp.c line 81

Quoted 13 lines
drivers/spi/spi_stmp.c new file +13 -0
+#define busy_wait(cond)							\
+	({								\
+	unsigned long end_jiffies = jiffies + STMP_SPI_TIMEOUT;		\
+	bool succeeded = false;						\
+	do {								\
+		if (cond) {						\
+			succeeded = true;				\
+			break;						\
+		}							\
+		cpu_relax();						\
+	} while (time_before(end_jiffies, jiffies));			\
+	succeeded;							\
+	})

Oh dear.

Quoted 4 lines

+/**
+ * stmp_spi_init_hw
+ * Initialize the SSP port
+ */

The /** token indicates that the comment is in kerneldoc form. But this comment lacks all the stuff one would expect to see in a kerneldoc comment.

Quoted 3 lines

...

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july

A message that is not in the archive (sent off-list or not yet received): 20090901135112.58f50b30.akpm-de/[email protected]

#4 lore raw
Quoted 14 lines · Andrew Morton
Quoted 5 lines

+#define busy_wait(cond)                                                      \
+     ({                                                              \
+     unsigned long end_jiffies = jiffies + STMP_SPI_TIMEOUT;         \
+     bool succeeded = false;                                         \
+     do {                                                            \

Quoted 8 lines

+             if (cond) {                                             \
+                     succeeded = true;                               \
+                     break;                                          \
+             }                                                       \
+             cpu_relax();                                            \
+     } while (time_before(end_jiffies, jiffies));                    \
+     succeeded;                                                      \
+     })

Quoted 1 line

Oh dear.

Bothered me a bit too, but ... compared to <linux/wait.h> and all the wait_event_*() macros, I couldn't object much. :)

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july

A message that is not in the archive (sent off-list or not yet received): 200909020847.18907.david-b-yBeKhBN/[email protected]

#6 lore raw
Quoted 15 lines · David Brownell
Quoted 14 lines · Andrew Morton
Quoted 13 lines
drivers/spi/spi_stmp.c new file +13 -0
+#define busy_wait(cond)                                                      \
+     ({                                                              \
+     unsigned long end_jiffies = jiffies + STMP_SPI_TIMEOUT;         \
+     bool succeeded = false;                                         \
+     do {                                                            \
+             if (cond) {                                             \
+                     succeeded = true;                               \
+                     break;                                          \
+             }                                                       \
+             cpu_relax();                                            \
+     } while (time_before(end_jiffies, jiffies));                    \
+     succeeded;                                                      \
+     })
Quoted 4 lines
Quoted 1 line

Oh dear.

Bothered me a bit too, but ... compared to <linux/wait.h> and all the wait_event_*() macros, I couldn't object much. :)

Yes, you've found the root of this ugly stuff :)

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july

#7 lore raw
In reply to a message not in the archive
Quoted 14 lines · On Wed, 2 Sep 2009 08:47:18 -0700 David Brownell…
Quoted 5 lines · Andrew Morton
Quoted 5 lines
(quoted diff) +5 -0
+#define busy_wait(cond)____________________________________________________________________________________________________________\
+__________({____________________________________________________________________________________________________________________________\
+__________unsigned long end_jiffies = jiffies + STMP_SPI_TIMEOUT;__________________\
+__________bool succeeded = false;__________________________________________________________________________________\
+__________do {________________________________________________________________________________________________________________________\
Quoted 8 lines

Review

Quoted 8 lines
(quoted diff) +8 -0
+__________________________if (cond) {__________________________________________________________________________________________\
+__________________________________________succeeded = true;______________________________________________________________\
+__________________________________________break;____________________________________________________________________________________\
+__________________________}______________________________________________________________________________________________________________\
+__________________________cpu_relax();________________________________________________________________________________________\
+__________} while (time_before(end_jiffies, jiffies));________________________________________\
+__________succeeded;____________________________________________________________________________________________________________\
+__________})

(^^ your email client turns 0x09's into 0xa0's)

Quoted 4 lines
Quoted 1 line

Oh dear.

Bothered me a bit too, but ... compared to <linux/wait.h> and all the wait_event_*() macros, I couldn't object much. :)

The use of a macro is a minor issue.

The "oh dear" issue is that this driver does so much busy-waiting.

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july