public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 2.6-git] SPI: add set_clock() to bitbang
@ 2005-12-22 15:04 Vitaly Wool
  2005-12-22 16:40 ` David Brownell
  0 siblings, 1 reply; 9+ messages in thread
From: Vitaly Wool @ 2005-12-22 15:04 UTC (permalink / raw)
  To: david-b; +Cc: linux-kernel, spi-devel-general

Hi David,

inlined is the small patch that adds set_clock function to the spi_bitbang structure.
Currently SPI bus clock can be configured either in chipselect() (which is _wrong_) or in txrx_buf (also doesn't encourage me much). Making it a separate function adds readability for the code.
Also, it seems to be redundant to set clock on each transfer, so it's proposed to do per-message clock setting. If SPI bus clock setting involves some PLL reconfiguration it's definitely gonna save some time.

Vitaly

Signed-off-by: Vitaly Wool <vwool@ru.mvista.com>

 drivers/spi/spi_bitbang.c       |    3 +++
 include/linux/spi/spi_bitbang.h |    1 +
 2 files changed, 4 insertions(+)

Index: linux-2.6.orig/drivers/spi/spi_bitbang.c
===================================================================
--- linux-2.6.orig.orig/drivers/spi/spi_bitbang.c
+++ linux-2.6.orig/drivers/spi/spi_bitbang.c
@@ -263,6 +263,9 @@ nsecs = 100;
 		chipselect = 0;
 		status = 0;
 
+		if (bitbang->set_clock)
+			bitbang->set_clock(spi);
+
 		for (;;t++) {
 			if (bitbang->shutdown) {
 				status = -ESHUTDOWN;
Index: linux-2.6.orig/include/linux/spi/spi_bitbang.h
===================================================================
--- linux-2.6.orig.orig/include/linux/spi/spi_bitbang.h
+++ linux-2.6.orig/include/linux/spi/spi_bitbang.h
@@ -31,6 +31,7 @@ struct spi_bitbang {
 	struct spi_master	*master;
 
 	void	(*chipselect)(struct spi_device *spi, int is_on);
+	void	(*set_clock)(struct spi_device *spi);
 
 	int	(*txrx_bufs)(struct spi_device *spi, struct spi_transfer *t);
 	u32	(*txrx_word[4])(struct spi_device *spi,

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2005-12-23  8:37 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-12-22 15:04 [PATCH 2.6-git] SPI: add set_clock() to bitbang Vitaly Wool
2005-12-22 16:40 ` David Brownell
2005-12-22 21:23   ` Vitaly Wool
2005-12-22 21:37     ` David Brownell
2005-12-22 21:42       ` Vitaly Wool
2005-12-23  0:37         ` David Brownell
2005-12-23  7:08           ` Vitaly Wool
2005-12-23  8:28             ` David Brownell
2005-12-23  8:38               ` Vitaly Wool

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox