Skip to content

Commit

Permalink
Merge tag 'spi-v3.11-rc1' of git://git.kernel.org/pub/scm/linux/kerne…
Browse files Browse the repository at this point in the history
…l/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
  • Loading branch information
Linus Torvalds committed Jul 15, 2013
2 parents 47188d3 + 70f092a commit f5f28b8
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 0 deletions.
12 changes: 12 additions & 0 deletions drivers/spi/spi-altera.c
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,16 @@ static void altera_spi_chipsel(struct spi_device *spi, int value)
}
}

static int altera_spi_setupxfer(struct spi_device *spi, struct spi_transfer *t)
{
return 0;
}

static int altera_spi_setup(struct spi_device *spi)
{
return 0;
}

static inline unsigned int hw_txbyte(struct altera_spi *hw, int count)
{
if (hw->tx) {
Expand Down Expand Up @@ -221,6 +231,7 @@ static int altera_spi_probe(struct platform_device *pdev)
master->bus_num = pdev->id;
master->num_chipselect = 16;
master->mode_bits = SPI_CS_HIGH;
master->setup = altera_spi_setup;

hw = spi_master_get_devdata(master);
platform_set_drvdata(pdev, hw);
Expand All @@ -229,6 +240,7 @@ static int altera_spi_probe(struct platform_device *pdev)
hw->bitbang.master = spi_master_get(master);
if (!hw->bitbang.master)
return err;
hw->bitbang.setup_transfer = altera_spi_setupxfer;
hw->bitbang.chipselect = altera_spi_chipsel;
hw->bitbang.txrx_bufs = altera_spi_txrx;

Expand Down
13 changes: 13 additions & 0 deletions drivers/spi/spi-nuc900.c
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,17 @@ static void nuc900_spi_gobusy(struct nuc900_spi *hw)
spin_unlock_irqrestore(&hw->lock, flags);
}

static int nuc900_spi_setupxfer(struct spi_device *spi,
struct spi_transfer *t)
{
return 0;
}

static int nuc900_spi_setup(struct spi_device *spi)
{
return 0;
}

static inline unsigned int hw_txbyte(struct nuc900_spi *hw, int count)
{
return hw->tx ? hw->tx[count] : 0;
Expand Down Expand Up @@ -366,8 +377,10 @@ static int nuc900_spi_probe(struct platform_device *pdev)
master->num_chipselect = hw->pdata->num_cs;
master->bus_num = hw->pdata->bus_num;
hw->bitbang.master = hw->master;
hw->bitbang.setup_transfer = nuc900_spi_setupxfer;
hw->bitbang.chipselect = nuc900_spi_chipsel;
hw->bitbang.txrx_bufs = nuc900_spi_txrx;
hw->bitbang.master->setup = nuc900_spi_setup;

hw->res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
if (hw->res == NULL) {
Expand Down
3 changes: 3 additions & 0 deletions drivers/spi/spi-s3c64xx.c
Original file line number Diff line number Diff line change
Expand Up @@ -434,6 +434,9 @@ static int s3c64xx_spi_prepare_transfer(struct spi_master *spi)
dma_cap_mask_t mask;
int ret;

if (is_polling(sdd))
return 0;

dma_cap_zero(mask);
dma_cap_set(DMA_SLAVE, mask);

Expand Down
16 changes: 16 additions & 0 deletions drivers/spi/spi-xilinx.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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),
Expand Down

0 comments on commit f5f28b8

Please sign in to comment.