Skip to content

Commit

Permalink
Merge tag 'spi-v3.11' of git://git.kernel.org/pub/scm/linux/kernel/gi…
Browse files Browse the repository at this point in the history
…t/broonie/spi

Pull spi updates from Mark Brown:
 "A fairly quiet release for the SPI subsystem, the standout changes
  being:

   - Core support for implementing bits per word constraints implemented
     by Stephen Warren, factoring some code out of drivers.

   - Addition of polling mode support for the s3c64xx driver as some
     newer Exynos systems have taken the unusual step of removing
     interrupt support.

   - Use of the in-IP FIFO and generic dmaengine support for the OMAP2
     driver, providing improved performance.

   - Conversion of the mpc512x driver to use the core message queue
     infrastructure.

  The nicest thing being that all the factoring out into common code
  leads to a negative diffstat overall."

* tag 'spi-v3.11' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi: (42 commits)
  spi/s3c64xx: Rely on the compiler eliminating the OF ID table
  spi: s3c64xx: Added support for exynos5440 spi
  spi: s3c64xx: Added provision for dedicated cs pin
  spi: omap2-mcspi: add generic DMA request support to the DT binding
  spi: omap2-mcspi: convert to dma_request_slave_channel_compat()
  spi/s3c64xx: Make wait_for_timeout() function name less generic
  spi: s3c64xx: added support for polling mode
  spi: omap2-mcspi: Add FIFO buffer support
  spi: omap2-mcspi: Move bytes per word calculation to the function
  spi: spi-xilinx: cleanup a check in xilinx_spi_txrx_bufs()
  spi: spi-nuc900: Remove redundant platform_set_drvdata()
  spi: spi-fsl-lib: Make mpc8xxx_spi_work static
  spi: spi-topcliff-pch: Fix sparse warnings
  spi: spi-xilinx: Remove redundant platform_set_drvdata()
  spi: spi-xilinx: Add run run-time endian detection
  spi: mpc512x: use the SPI subsystem's message queue
  spi: mpc512x: improve throughput in the RX/TX func
  spi: mpc512x: minor prep before feature change
  spi: atmel: convert to dma_request_slave_channel_compat()
  spi: sirf: avoid uninitialized-use warning
  ...
  • Loading branch information
Linus Torvalds committed Jul 3, 2013
2 parents 3dbde57 + ed89355 commit 750b2d7
Show file tree
Hide file tree
Showing 50 changed files with 708 additions and 748 deletions.
27 changes: 26 additions & 1 deletion Documentation/devicetree/bindings/spi/omap-spi.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,18 @@ Required properties:
input. The default is D0 as input and
D1 as output.

Example:
Optional properties:
- dmas: List of DMA specifiers with the controller specific format
as described in the generic DMA client binding. A tx and rx
specifier is required for each chip select.
- dma-names: List of DMA request names. These strings correspond
1:1 with the DMA specifiers listed in dmas. The string naming
is to be "rxN" and "txN" for RX and TX requests,
respectively, where N equals the chip select number.

Examples:

[hwmod populated DMA resources]

mcspi1: mcspi@1 {
#address-cells = <1>;
Expand All @@ -20,3 +31,17 @@ mcspi1: mcspi@1 {
ti,spi-num-cs = <4>;
};

[generic DMA request binding]

mcspi1: mcspi@1 {
#address-cells = <1>;
#size-cells = <0>;
compatible = "ti,omap4-mcspi";
ti,hwmods = "mcspi1";
ti,spi-num-cs = <2>;
dmas = <&edma 42
&edma 43
&edma 44
&edma 45>;
dma-names = "tx0", "rx0", "tx1", "rx1";
};
1 change: 0 additions & 1 deletion drivers/mfd/timberdale.c
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,6 @@ static struct spi_board_info timberdale_spi_8bit_board_info[] = {

static struct xspi_platform_data timberdale_xspi_platform_data = {
.num_chipselect = 3,
.little_endian = true,
/* bits per word and devices will be filled in runtime depending
* on the HW config
*/
Expand Down
14 changes: 0 additions & 14 deletions drivers/spi/spi-altera.c
Original file line number Diff line number Diff line change
Expand Up @@ -103,16 +103,6 @@ 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 @@ -231,7 +221,6 @@ 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 @@ -240,7 +229,6 @@ 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 Expand Up @@ -285,7 +273,6 @@ static int altera_spi_probe(struct platform_device *pdev)
exit_busy:
err = -EBUSY;
exit:
platform_set_drvdata(pdev, NULL);
spi_master_put(master);
return err;
}
Expand All @@ -296,7 +283,6 @@ static int altera_spi_remove(struct platform_device *dev)
struct spi_master *master = hw->bitbang.master;

spi_bitbang_stop(&hw->bitbang);
platform_set_drvdata(dev, NULL);
spi_master_put(master);
return 0;
}
Expand Down
6 changes: 1 addition & 5 deletions drivers/spi/spi-ath79.c
Original file line number Diff line number Diff line change
Expand Up @@ -155,9 +155,6 @@ static int ath79_spi_setup(struct spi_device *spi)
{
int status = 0;

if (spi->bits_per_word > 32)
return -EINVAL;

if (!spi->controller_state) {
status = ath79_spi_setup_cs(spi);
if (status)
Expand Down Expand Up @@ -226,6 +223,7 @@ static int ath79_spi_probe(struct platform_device *pdev)

pdata = pdev->dev.platform_data;

master->bits_per_word_mask = SPI_BPW_RANGE_MASK(1, 32);
master->setup = ath79_spi_setup;
master->cleanup = ath79_spi_cleanup;
if (pdata) {
Expand Down Expand Up @@ -287,7 +285,6 @@ static int ath79_spi_probe(struct platform_device *pdev)
err_unmap:
iounmap(sp->base);
err_put_master:
platform_set_drvdata(pdev, NULL);
spi_master_put(sp->bitbang.master);

return ret;
Expand All @@ -302,7 +299,6 @@ static int ath79_spi_remove(struct platform_device *pdev)
clk_disable(sp->clk);
clk_put(sp->clk);
iounmap(sp->base);
platform_set_drvdata(pdev, NULL);
spi_master_put(sp->bitbang.master);

return 0;
Expand Down
51 changes: 28 additions & 23 deletions drivers/spi/spi-atmel.c
Original file line number Diff line number Diff line change
Expand Up @@ -424,10 +424,15 @@ static int atmel_spi_dma_slave_config(struct atmel_spi *as,
return err;
}

static bool filter(struct dma_chan *chan, void *slave)
static bool filter(struct dma_chan *chan, void *pdata)
{
struct at_dma_slave *sl = slave;
struct atmel_spi_dma *sl_pdata = pdata;
struct at_dma_slave *sl;

if (!sl_pdata)
return false;

sl = &sl_pdata->dma_slave;
if (sl->dma_dev == chan->device->dev) {
chan->private = sl;
return true;
Expand All @@ -438,24 +443,31 @@ static bool filter(struct dma_chan *chan, void *slave)

static int atmel_spi_configure_dma(struct atmel_spi *as)
{
struct at_dma_slave *sdata = &as->dma.dma_slave;
struct dma_slave_config slave_config;
struct device *dev = &as->pdev->dev;
int err;

if (sdata && sdata->dma_dev) {
dma_cap_mask_t mask;
dma_cap_mask_t mask;
dma_cap_zero(mask);
dma_cap_set(DMA_SLAVE, mask);

/* Try to grab two DMA channels */
dma_cap_zero(mask);
dma_cap_set(DMA_SLAVE, mask);
as->dma.chan_tx = dma_request_channel(mask, filter, sdata);
if (as->dma.chan_tx)
as->dma.chan_rx =
dma_request_channel(mask, filter, sdata);
as->dma.chan_tx = dma_request_slave_channel_compat(mask, filter,
&as->dma,
dev, "tx");
if (!as->dma.chan_tx) {
dev_err(dev,
"DMA TX channel not available, SPI unable to use DMA\n");
err = -EBUSY;
goto error;
}
if (!as->dma.chan_rx || !as->dma.chan_tx) {
dev_err(&as->pdev->dev,
"DMA channel not available, SPI unable to use DMA\n");

as->dma.chan_rx = dma_request_slave_channel_compat(mask, filter,
&as->dma,
dev, "rx");

if (!as->dma.chan_rx) {
dev_err(dev,
"DMA RX channel not available, SPI unable to use DMA\n");
err = -EBUSY;
goto error;
}
Expand Down Expand Up @@ -1268,13 +1280,6 @@ static int atmel_spi_setup(struct spi_device *spi)
return -EINVAL;
}

if (bits < 8 || bits > 16) {
dev_dbg(&spi->dev,
"setup: invalid bits_per_word %u (8 to 16)\n",
bits);
return -EINVAL;
}

/* see notes above re chipselect */
if (!atmel_spi_is_v2(as)
&& spi->chip_select == 0
Expand Down Expand Up @@ -1515,7 +1520,7 @@ static int atmel_spi_probe(struct platform_device *pdev)

/* the spi->mode bits understood by this driver: */
master->mode_bits = SPI_CPOL | SPI_CPHA | SPI_CS_HIGH;

master->bits_per_word_mask = SPI_BPW_RANGE_MASK(8, 16);
master->dev.of_node = pdev->dev.of_node;
master->bus_num = pdev->id;
master->num_chipselect = master->dev.of_node ? 0 : 4;
Expand Down
14 changes: 1 addition & 13 deletions drivers/spi/spi-au1550.c
Original file line number Diff line number Diff line change
Expand Up @@ -248,11 +248,6 @@ static int au1550_spi_setupxfer(struct spi_device *spi, struct spi_transfer *t)
hz = t->speed_hz;
}

if (bpw < 4 || bpw > 24) {
dev_err(&spi->dev, "setupxfer: invalid bits_per_word=%d\n",
bpw);
return -EINVAL;
}
if (hz > spi->max_speed_hz || hz > hw->freq_max || hz < hw->freq_min) {
dev_err(&spi->dev, "setupxfer: clock rate=%d out of range\n",
hz);
Expand Down Expand Up @@ -296,12 +291,6 @@ static int au1550_spi_setup(struct spi_device *spi)
{
struct au1550_spi *hw = spi_master_get_devdata(spi->master);

if (spi->bits_per_word < 4 || spi->bits_per_word > 24) {
dev_err(&spi->dev, "setup: invalid bits_per_word=%d\n",
spi->bits_per_word);
return -EINVAL;
}

if (spi->max_speed_hz == 0)
spi->max_speed_hz = hw->freq_max;
if (spi->max_speed_hz > hw->freq_max
Expand Down Expand Up @@ -782,6 +771,7 @@ static int au1550_spi_probe(struct platform_device *pdev)

/* the spi->mode bits understood by this driver: */
master->mode_bits = SPI_CPOL | SPI_CPHA | SPI_CS_HIGH | SPI_LSB_FIRST;
master->bits_per_word_mask = SPI_BPW_RANGE_MASK(4, 24);

hw = spi_master_get_devdata(master);

Expand Down Expand Up @@ -987,8 +977,6 @@ static int au1550_spi_remove(struct platform_device *pdev)
au1xxx_dbdma_chan_free(hw->dma_tx_ch);
}

platform_set_drvdata(pdev, NULL);

spi_master_put(hw->master);
return 0;
}
Expand Down
7 changes: 3 additions & 4 deletions drivers/spi/spi-bcm2835.c
Original file line number Diff line number Diff line change
Expand Up @@ -331,10 +331,9 @@ static int bcm2835_spi_probe(struct platform_device *pdev)
goto out_master_put;
}

bs->regs = devm_request_and_ioremap(&pdev->dev, res);
if (!bs->regs) {
dev_err(&pdev->dev, "could not request/map memory region\n");
err = -ENODEV;
bs->regs = devm_ioremap_resource(&pdev->dev, res);
if (IS_ERR(bs->regs)) {
err = PTR_ERR(bs->regs);
goto out_master_put;
}

Expand Down
23 changes: 1 addition & 22 deletions drivers/spi/spi-bcm63xx.c
Original file line number Diff line number Diff line change
Expand Up @@ -124,17 +124,6 @@ static void bcm63xx_spi_setup_transfer(struct spi_device *spi,
/* the spi->mode bits understood by this driver: */
#define MODEBITS (SPI_CPOL | SPI_CPHA)

static int bcm63xx_spi_setup(struct spi_device *spi)
{
if (spi->bits_per_word != 8) {
dev_err(&spi->dev, "%s, unsupported bits_per_word=%d\n",
__func__, spi->bits_per_word);
return -EINVAL;
}

return 0;
}

static int bcm63xx_txrx_bufs(struct spi_device *spi, struct spi_transfer *first,
unsigned int num_transfers)
{
Expand Down Expand Up @@ -277,13 +266,6 @@ static int bcm63xx_spi_transfer_one(struct spi_master *master,
* full-duplex transfers.
*/
list_for_each_entry(t, &m->transfers, transfer_list) {
if (t->bits_per_word != 8) {
dev_err(&spi->dev, "%s, unsupported bits_per_word=%d\n",
__func__, t->bits_per_word);
status = -EINVAL;
goto exit;
}

if (!first)
first = t;

Expand Down Expand Up @@ -430,11 +412,11 @@ static int bcm63xx_spi_probe(struct platform_device *pdev)

master->bus_num = pdata->bus_num;
master->num_chipselect = pdata->num_chipselect;
master->setup = bcm63xx_spi_setup;
master->prepare_transfer_hardware = bcm63xx_spi_prepare_transfer;
master->unprepare_transfer_hardware = bcm63xx_spi_unprepare_transfer;
master->transfer_one_message = bcm63xx_spi_transfer_one;
master->mode_bits = MODEBITS;
master->bits_per_word_mask = SPI_BPW_MASK(8);
bs->msg_type_shift = pdata->msg_type_shift;
bs->msg_ctl_width = pdata->msg_ctl_width;
bs->tx_io = (u8 *)(bs->regs + bcm63xx_spireg(SPI_MSG_DATA));
Expand Down Expand Up @@ -469,7 +451,6 @@ static int bcm63xx_spi_probe(struct platform_device *pdev)
out_clk_disable:
clk_disable_unprepare(clk);
out_err:
platform_set_drvdata(pdev, NULL);
spi_master_put(master);
out_clk:
clk_put(clk);
Expand All @@ -491,8 +472,6 @@ static int bcm63xx_spi_remove(struct platform_device *pdev)
clk_disable_unprepare(bs->clk);
clk_put(bs->clk);

platform_set_drvdata(pdev, 0);

spi_master_put(master);

return 0;
Expand Down
13 changes: 2 additions & 11 deletions drivers/spi/spi-bfin-sport.c
Original file line number Diff line number Diff line change
Expand Up @@ -417,7 +417,7 @@ bfin_sport_spi_pump_transfers(unsigned long data)

/* Bits per word setup */
bits_per_word = transfer->bits_per_word;
if (bits_per_word % 16 == 0)
if (bits_per_word == 16)
drv_data->ops = &bfin_sport_transfer_ops_u16;
else
drv_data->ops = &bfin_sport_transfer_ops_u8;
Expand Down Expand Up @@ -600,13 +600,6 @@ bfin_sport_spi_setup(struct spi_device *spi)
}
}

if (spi->bits_per_word % 8) {
dev_err(&spi->dev, "%d bits_per_word is not supported\n",
spi->bits_per_word);
ret = -EINVAL;
goto error;
}

/* translate common spi framework into our register
* following configure contents are same for tx and rx.
*/
Expand Down Expand Up @@ -778,6 +771,7 @@ static int bfin_sport_spi_probe(struct platform_device *pdev)
drv_data->pin_req = platform_info->pin_req;

master->mode_bits = SPI_CPOL | SPI_CPHA | SPI_LSB_FIRST;
master->bits_per_word_mask = SPI_BPW_MASK(8) | SPI_BPW_MASK(16);
master->bus_num = pdev->id;
master->num_chipselect = platform_info->num_chipselect;
master->cleanup = bfin_sport_spi_cleanup;
Expand Down Expand Up @@ -882,9 +876,6 @@ static int bfin_sport_spi_remove(struct platform_device *pdev)

peripheral_free_list(drv_data->pin_req);

/* Prevent double remove */
platform_set_drvdata(pdev, NULL);

return 0;
}

Expand Down
Loading

0 comments on commit 750b2d7

Please sign in to comment.