diff options
Diffstat (limited to 'drivers/spi/spi-xilinx.c')
| -rw-r--r-- | drivers/spi/spi-xilinx.c | 31 | 
1 files changed, 8 insertions, 23 deletions
diff --git a/drivers/spi/spi-xilinx.c b/drivers/spi/spi-xilinx.c index 0bf1b2c457a..a3b0b9944bf 100644 --- a/drivers/spi/spi-xilinx.c +++ b/drivers/spi/spi-xilinx.c @@ -14,7 +14,6 @@   */  #include <linux/module.h> -#include <linux/init.h>  #include <linux/interrupt.h>  #include <linux/of.h>  #include <linux/platform_device.h> @@ -88,10 +87,10 @@ struct xilinx_spi {  	const u8 *tx_ptr;	/* pointer in the Rx buffer */  	int remaining_bytes;	/* the number of bytes left to transfer */  	u8 bits_per_word; -	unsigned int (*read_fn) (void __iomem *); -	void (*write_fn) (u32, void __iomem *); -	void (*tx_fn) (struct xilinx_spi *); -	void (*rx_fn) (struct xilinx_spi *); +	unsigned int (*read_fn)(void __iomem *); +	void (*write_fn)(u32, void __iomem *); +	void (*tx_fn)(struct xilinx_spi *); +	void (*rx_fn)(struct xilinx_spi *);  };  static void xspi_write32(u32 val, void __iomem *addr) @@ -209,26 +208,11 @@ static void xilinx_spi_chipselect(struct spi_device *spi, int is_on)  }  /* spi_bitbang requires custom setup_transfer() to be defined if there is a - * custom txrx_bufs(). We have nothing to setup here as the SPI IP block - * supports 8 or 16 bits per word which cannot be changed in software. - * SPI clock can't be changed in software either. - * Check for correct bits per word. Chip select delay calculations could be - * added here as soon as bitbang_work() can be made aware of the delay value. + * custom txrx_bufs().   */  static int xilinx_spi_setup_transfer(struct spi_device *spi,  		struct spi_transfer *t)  { -	struct xilinx_spi *xspi = spi_master_get_devdata(spi->master); -	u8 bits_per_word; - -	bits_per_word = (t && t->bits_per_word) -			 ? t->bits_per_word : spi->bits_per_word; -	if (bits_per_word != xspi->bits_per_word) { -		dev_err(&spi->dev, "%s, unsupported bits_per_word=%d\n", -			__func__, bits_per_word); -		return -EINVAL; -	} -  	return 0;  } @@ -258,7 +242,7 @@ static int xilinx_spi_txrx_bufs(struct spi_device *spi, struct spi_transfer *t)  	xspi->tx_ptr = t->tx_buf;  	xspi->rx_ptr = t->rx_buf;  	xspi->remaining_bytes = t->len; -	INIT_COMPLETION(xspi->done); +	reinit_completion(&xspi->done);  	/* Enable the transmit empty interrupt, which we use to determine @@ -372,7 +356,7 @@ static int xilinx_spi_probe(struct platform_device *pdev)  	master->mode_bits = SPI_CPOL | SPI_CPHA;  	xspi = spi_master_get_devdata(master); -	xspi->bitbang.master = spi_master_get(master); +	xspi->bitbang.master = master;  	xspi->bitbang.chipselect = xilinx_spi_chipselect;  	xspi->bitbang.setup_transfer = xilinx_spi_setup_transfer;  	xspi->bitbang.txrx_bufs = xilinx_spi_txrx_bufs; @@ -407,6 +391,7 @@ static int xilinx_spi_probe(struct platform_device *pdev)  		xspi->write_fn = xspi_write32_be;  	} +	master->bits_per_word_mask = SPI_BPW_MASK(bits_per_word);  	xspi->bits_per_word = bits_per_word;  	if (xspi->bits_per_word == 8) {  		xspi->tx_fn = xspi_tx8;  | 
