Skip to content

Commit f5f28b8

Browse files
committed
Merge tag 'spi-v3.11-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi
Pull spi fixes from Mark Brown: "A couple of things missed during the v3.11 work here: - The spi-bitbang core requires a setup() function even if it does nothing which caused breakage when some empty setup functions were removed after their contents were factored out into the core. While this is clearly silly and will be fixed for v3.12 for now we just restore the functions. - A missing case handled in the s3c64xx driver" * tag 'spi-v3.11-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi: spi: revert master->setup function removal for altera and nuc900 spi/xilinx: Revert master->setup function removal spi: s3c64xx: add missing check for polling mode
2 parents 47188d3 + 70f092a commit f5f28b8

File tree

4 files changed

+44
-0
lines changed

4 files changed

+44
-0
lines changed

drivers/spi/spi-altera.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,16 @@ static void altera_spi_chipsel(struct spi_device *spi, int value)
103103
}
104104
}
105105

106+
static int altera_spi_setupxfer(struct spi_device *spi, struct spi_transfer *t)
107+
{
108+
return 0;
109+
}
110+
111+
static int altera_spi_setup(struct spi_device *spi)
112+
{
113+
return 0;
114+
}
115+
106116
static inline unsigned int hw_txbyte(struct altera_spi *hw, int count)
107117
{
108118
if (hw->tx) {
@@ -221,6 +231,7 @@ static int altera_spi_probe(struct platform_device *pdev)
221231
master->bus_num = pdev->id;
222232
master->num_chipselect = 16;
223233
master->mode_bits = SPI_CS_HIGH;
234+
master->setup = altera_spi_setup;
224235

225236
hw = spi_master_get_devdata(master);
226237
platform_set_drvdata(pdev, hw);
@@ -229,6 +240,7 @@ static int altera_spi_probe(struct platform_device *pdev)
229240
hw->bitbang.master = spi_master_get(master);
230241
if (!hw->bitbang.master)
231242
return err;
243+
hw->bitbang.setup_transfer = altera_spi_setupxfer;
232244
hw->bitbang.chipselect = altera_spi_chipsel;
233245
hw->bitbang.txrx_bufs = altera_spi_txrx;
234246

drivers/spi/spi-nuc900.c

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,17 @@ static void nuc900_spi_gobusy(struct nuc900_spi *hw)
174174
spin_unlock_irqrestore(&hw->lock, flags);
175175
}
176176

177+
static int nuc900_spi_setupxfer(struct spi_device *spi,
178+
struct spi_transfer *t)
179+
{
180+
return 0;
181+
}
182+
183+
static int nuc900_spi_setup(struct spi_device *spi)
184+
{
185+
return 0;
186+
}
187+
177188
static inline unsigned int hw_txbyte(struct nuc900_spi *hw, int count)
178189
{
179190
return hw->tx ? hw->tx[count] : 0;
@@ -366,8 +377,10 @@ static int nuc900_spi_probe(struct platform_device *pdev)
366377
master->num_chipselect = hw->pdata->num_cs;
367378
master->bus_num = hw->pdata->bus_num;
368379
hw->bitbang.master = hw->master;
380+
hw->bitbang.setup_transfer = nuc900_spi_setupxfer;
369381
hw->bitbang.chipselect = nuc900_spi_chipsel;
370382
hw->bitbang.txrx_bufs = nuc900_spi_txrx;
383+
hw->bitbang.master->setup = nuc900_spi_setup;
371384

372385
hw->res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
373386
if (hw->res == NULL) {

drivers/spi/spi-s3c64xx.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -434,6 +434,9 @@ static int s3c64xx_spi_prepare_transfer(struct spi_master *spi)
434434
dma_cap_mask_t mask;
435435
int ret;
436436

437+
if (is_polling(sdd))
438+
return 0;
439+
437440
dma_cap_zero(mask);
438441
dma_cap_set(DMA_SLAVE, mask);
439442

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)