Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 750b2d7b authored by Linus Torvalds's avatar Linus Torvalds
Browse files
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
  ...
parents 3dbde57a ed893559
Loading
Loading
Loading
Loading
+26 −1
Original line number Original line Diff line number Diff line
@@ -10,7 +10,18 @@ Required properties:
			  input. The default is D0 as input and
			  input. The default is D0 as input and
			  D1 as output.
			  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 {
mcspi1: mcspi@1 {
    #address-cells = <1>;
    #address-cells = <1>;
@@ -20,3 +31,17 @@ mcspi1: mcspi@1 {
    ti,spi-num-cs = <4>;
    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";
};
+0 −1
Original line number Original line Diff line number Diff line
@@ -145,7 +145,6 @@ static struct spi_board_info timberdale_spi_8bit_board_info[] = {


static struct xspi_platform_data timberdale_xspi_platform_data = {
static struct xspi_platform_data timberdale_xspi_platform_data = {
	.num_chipselect = 3,
	.num_chipselect = 3,
	.little_endian = true,
	/* bits per word and devices will be filled in runtime depending
	/* bits per word and devices will be filled in runtime depending
	 * on the HW config
	 * on the HW config
	 */
	 */
+0 −14
Original line number Original line Diff line number Diff line
@@ -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)
static inline unsigned int hw_txbyte(struct altera_spi *hw, int count)
{
{
	if (hw->tx) {
	if (hw->tx) {
@@ -231,7 +221,6 @@ static int altera_spi_probe(struct platform_device *pdev)
	master->bus_num = pdev->id;
	master->bus_num = pdev->id;
	master->num_chipselect = 16;
	master->num_chipselect = 16;
	master->mode_bits = SPI_CS_HIGH;
	master->mode_bits = SPI_CS_HIGH;
	master->setup = altera_spi_setup;


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


@@ -285,7 +273,6 @@ static int altera_spi_probe(struct platform_device *pdev)
exit_busy:
exit_busy:
	err = -EBUSY;
	err = -EBUSY;
exit:
exit:
	platform_set_drvdata(pdev, NULL);
	spi_master_put(master);
	spi_master_put(master);
	return err;
	return err;
}
}
@@ -296,7 +283,6 @@ static int altera_spi_remove(struct platform_device *dev)
	struct spi_master *master = hw->bitbang.master;
	struct spi_master *master = hw->bitbang.master;


	spi_bitbang_stop(&hw->bitbang);
	spi_bitbang_stop(&hw->bitbang);
	platform_set_drvdata(dev, NULL);
	spi_master_put(master);
	spi_master_put(master);
	return 0;
	return 0;
}
}
+1 −5
Original line number Original line Diff line number Diff line
@@ -155,9 +155,6 @@ static int ath79_spi_setup(struct spi_device *spi)
{
{
	int status = 0;
	int status = 0;


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

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


	pdata = pdev->dev.platform_data;
	pdata = pdev->dev.platform_data;


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


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


	return 0;
	return 0;
+28 −23
Original line number Original line Diff line number Diff line
@@ -424,10 +424,15 @@ static int atmel_spi_dma_slave_config(struct atmel_spi *as,
	return err;
	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) {
	if (sl->dma_dev == chan->device->dev) {
		chan->private = sl;
		chan->private = sl;
		return true;
		return true;
@@ -438,24 +443,31 @@ static bool filter(struct dma_chan *chan, void *slave)


static int atmel_spi_configure_dma(struct atmel_spi *as)
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 dma_slave_config	slave_config;
	struct device *dev = &as->pdev->dev;
	int err;
	int err;


	if (sdata && sdata->dma_dev) {
	dma_cap_mask_t mask;
	dma_cap_mask_t mask;

		/* Try to grab two DMA channels */
	dma_cap_zero(mask);
	dma_cap_zero(mask);
	dma_cap_set(DMA_SLAVE, 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_tx = dma_request_slave_channel_compat(mask, filter,
			as->dma.chan_rx =
							   &as->dma,
				dma_request_channel(mask, filter, sdata);
							   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,
	as->dma.chan_rx = dma_request_slave_channel_compat(mask, filter,
			"DMA channel not available, SPI unable to use DMA\n");
							   &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;
		err = -EBUSY;
		goto error;
		goto error;
	}
	}
@@ -1268,13 +1280,6 @@ static int atmel_spi_setup(struct spi_device *spi)
		return -EINVAL;
		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 */
	/* see notes above re chipselect */
	if (!atmel_spi_is_v2(as)
	if (!atmel_spi_is_v2(as)
			&& spi->chip_select == 0
			&& spi->chip_select == 0
@@ -1515,7 +1520,7 @@ static int atmel_spi_probe(struct platform_device *pdev)


	/* the spi->mode bits understood by this driver: */
	/* the spi->mode bits understood by this driver: */
	master->mode_bits = SPI_CPOL | SPI_CPHA | SPI_CS_HIGH;
	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->dev.of_node = pdev->dev.of_node;
	master->bus_num = pdev->id;
	master->bus_num = pdev->id;
	master->num_chipselect = master->dev.of_node ? 0 : 4;
	master->num_chipselect = master->dev.of_node ? 0 : 4;
Loading