Skip to content

Commit 70f092a

Browse files
committed
Merge remote-tracking branch 'spi/fix/xilinx' into spi-linus
2 parents 52bc441 + e076195 commit 70f092a

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

drivers/spi/spi-xilinx.c

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -233,6 +233,21 @@ static int xilinx_spi_setup_transfer(struct spi_device *spi,
233233
return 0;
234234
}
235235

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

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

0 commit comments

Comments
 (0)