All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v1] spi/xilinx: Revert master->setup function removal
@ 2013-07-10  7:25 Michal Simek
  2013-07-10  9:06 ` Mark Brown
  0 siblings, 1 reply; 2+ messages in thread
From: Michal Simek @ 2013-07-10  7:25 UTC (permalink / raw)
  To: Mark Brown
  Cc: Stephen Warren, Michal Simek, Grant Likely, linux-spi, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 1761 bytes --]

master->setup() must be initialized to be able
to successfully run spi_bitbang_start()
and satisfy if/else logic there.

"spi: convert drivers to use bits_per_word_mask"
(sha1: 24778be20f87d5aadb19624fc768b3159fa43efc)

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
---
Based on the latest Linus tree.

---
 drivers/spi/spi-xilinx.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/drivers/spi/spi-xilinx.c b/drivers/spi/spi-xilinx.c
index fb56fcf..09a9428 100644
--- a/drivers/spi/spi-xilinx.c
+++ b/drivers/spi/spi-xilinx.c
@@ -233,6 +233,21 @@ static int xilinx_spi_setup_transfer(struct spi_device *spi,
 	return 0;
 }

+static int xilinx_spi_setup(struct spi_device *spi)
+{
+	/* always return 0, we can not check the number of bits.
+	 * There are cases when SPI setup is called before any driver is
+	 * there, in that case the SPI core defaults to 8 bits, which we
+	 * do not support in some cases. But if we return an error, the
+	 * SPI device would not be registered and no driver can get hold of it
+	 * When the driver is there, it will call SPI setup again with the
+	 * correct number of bits per transfer.
+	 * If a driver setups with the wrong bit number, it will fail when
+	 * it tries to do a transfer
+	 */
+	return 0;
+}
+
 static void xilinx_spi_fill_tx_fifo(struct xilinx_spi *xspi)
 {
 	u8 sr;
@@ -360,6 +375,7 @@ struct spi_master *xilinx_spi_init(struct device *dev, struct resource *mem,
 	xspi->bitbang.chipselect = xilinx_spi_chipselect;
 	xspi->bitbang.setup_transfer = xilinx_spi_setup_transfer;
 	xspi->bitbang.txrx_bufs = xilinx_spi_txrx_bufs;
+	xspi->bitbang.master->setup = xilinx_spi_setup;
 	init_completion(&xspi->done);

 	if (!request_mem_region(mem->start, resource_size(mem),
--
1.8.2.3


[-- Attachment #2: Type: application/pgp-signature, Size: 198 bytes --]

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

* Re: [PATCH v1] spi/xilinx: Revert master->setup function removal
  2013-07-10  7:25 [PATCH v1] spi/xilinx: Revert master->setup function removal Michal Simek
@ 2013-07-10  9:06 ` Mark Brown
  0 siblings, 0 replies; 2+ messages in thread
From: Mark Brown @ 2013-07-10  9:06 UTC (permalink / raw)
  To: Michal Simek
  Cc: Stephen Warren, Michal Simek, Grant Likely, linux-spi, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 293 bytes --]

On Wed, Jul 10, 2013 at 09:25:28AM +0200, Michal Simek wrote:
> master->setup() must be initialized to be able
> to successfully run spi_bitbang_start()
> and satisfy if/else logic there.

Applied, thanks.  We should still fix things so the bitbang stuff isn't
needed but for v3.12 not v3.11.

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

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

end of thread, other threads:[~2013-07-10  9:07 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-07-10  7:25 [PATCH v1] spi/xilinx: Revert master->setup function removal Michal Simek
2013-07-10  9:06 ` Mark Brown

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.