Commit e69be8c2 authored by Linus Torvalds's avatar Linus Torvalds

Merge tag 'spi-fix-v4.4-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi

Pull spi fixes from Mark Brown:
 "There's one fix for the core here, we weren't reinitialising the
  actual transferred length in messages when they get reused which meant
  that we'd just keep adding to the length if a message is reused.  This
  has limited impact since it's only used in error handling cases but
  will really mess anything that tries to use it up when it triggers.

  As ever there's a small collection of driver specific fixes too"

* tag 'spi-fix-v4.4-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi:
  spi: bugfix: spi_message.transfer_length does not get reset
  spi: pl022: handle EPROBE_DEFER for dma
  spi: bcm63xx: use correct format string for printing a resource
  spi: mediatek: single device does not require cs_gpios
  spi: Add missing kerneldoc description for parameter
parents 25364a9e a057d737
...@@ -562,8 +562,8 @@ static int bcm63xx_spi_probe(struct platform_device *pdev) ...@@ -562,8 +562,8 @@ static int bcm63xx_spi_probe(struct platform_device *pdev)
goto out_clk_disable; goto out_clk_disable;
} }
dev_info(dev, "at 0x%08x (irq %d, FIFOs size %d)\n", dev_info(dev, "at %pr (irq %d, FIFOs size %d)\n",
r->start, irq, bs->fifo_size); r, irq, bs->fifo_size);
return 0; return 0;
......
...@@ -410,7 +410,7 @@ static int mtk_spi_setup(struct spi_device *spi) ...@@ -410,7 +410,7 @@ static int mtk_spi_setup(struct spi_device *spi)
if (!spi->controller_data) if (!spi->controller_data)
spi->controller_data = (void *)&mtk_default_chip_info; spi->controller_data = (void *)&mtk_default_chip_info;
if (mdata->dev_comp->need_pad_sel) if (mdata->dev_comp->need_pad_sel && gpio_is_valid(spi->cs_gpio))
gpio_direction_output(spi->cs_gpio, !(spi->mode & SPI_CS_HIGH)); gpio_direction_output(spi->cs_gpio, !(spi->mode & SPI_CS_HIGH));
return 0; return 0;
...@@ -632,13 +632,23 @@ static int mtk_spi_probe(struct platform_device *pdev) ...@@ -632,13 +632,23 @@ static int mtk_spi_probe(struct platform_device *pdev)
goto err_put_master; goto err_put_master;
} }
for (i = 0; i < master->num_chipselect; i++) { if (!master->cs_gpios && master->num_chipselect > 1) {
ret = devm_gpio_request(&pdev->dev, master->cs_gpios[i], dev_err(&pdev->dev,
dev_name(&pdev->dev)); "cs_gpios not specified and num_chipselect > 1\n");
if (ret) { ret = -EINVAL;
dev_err(&pdev->dev, goto err_put_master;
"can't get CS GPIO %i\n", i); }
goto err_put_master;
if (master->cs_gpios) {
for (i = 0; i < master->num_chipselect; i++) {
ret = devm_gpio_request(&pdev->dev,
master->cs_gpios[i],
dev_name(&pdev->dev));
if (ret) {
dev_err(&pdev->dev,
"can't get CS GPIO %i\n", i);
goto err_put_master;
}
} }
} }
} }
......
...@@ -1171,19 +1171,31 @@ static int pl022_dma_probe(struct pl022 *pl022) ...@@ -1171,19 +1171,31 @@ static int pl022_dma_probe(struct pl022 *pl022)
static int pl022_dma_autoprobe(struct pl022 *pl022) static int pl022_dma_autoprobe(struct pl022 *pl022)
{ {
struct device *dev = &pl022->adev->dev; struct device *dev = &pl022->adev->dev;
struct dma_chan *chan;
int err;
/* automatically configure DMA channels from platform, normally using DT */ /* automatically configure DMA channels from platform, normally using DT */
pl022->dma_rx_channel = dma_request_slave_channel(dev, "rx"); chan = dma_request_slave_channel_reason(dev, "rx");
if (!pl022->dma_rx_channel) if (IS_ERR(chan)) {
err = PTR_ERR(chan);
goto err_no_rxchan; goto err_no_rxchan;
}
pl022->dma_rx_channel = chan;
pl022->dma_tx_channel = dma_request_slave_channel(dev, "tx"); chan = dma_request_slave_channel_reason(dev, "tx");
if (!pl022->dma_tx_channel) if (IS_ERR(chan)) {
err = PTR_ERR(chan);
goto err_no_txchan; goto err_no_txchan;
}
pl022->dma_tx_channel = chan;
pl022->dummypage = kmalloc(PAGE_SIZE, GFP_KERNEL); pl022->dummypage = kmalloc(PAGE_SIZE, GFP_KERNEL);
if (!pl022->dummypage) if (!pl022->dummypage) {
err = -ENOMEM;
goto err_no_dummypage; goto err_no_dummypage;
}
return 0; return 0;
...@@ -1194,7 +1206,7 @@ static int pl022_dma_autoprobe(struct pl022 *pl022) ...@@ -1194,7 +1206,7 @@ static int pl022_dma_autoprobe(struct pl022 *pl022)
dma_release_channel(pl022->dma_rx_channel); dma_release_channel(pl022->dma_rx_channel);
pl022->dma_rx_channel = NULL; pl022->dma_rx_channel = NULL;
err_no_rxchan: err_no_rxchan:
return -ENODEV; return err;
} }
static void terminate_dma(struct pl022 *pl022) static void terminate_dma(struct pl022 *pl022)
...@@ -2236,6 +2248,10 @@ static int pl022_probe(struct amba_device *adev, const struct amba_id *id) ...@@ -2236,6 +2248,10 @@ static int pl022_probe(struct amba_device *adev, const struct amba_id *id)
/* Get DMA channels, try autoconfiguration first */ /* Get DMA channels, try autoconfiguration first */
status = pl022_dma_autoprobe(pl022); status = pl022_dma_autoprobe(pl022);
if (status == -EPROBE_DEFER) {
dev_dbg(dev, "deferring probe to get DMA channel\n");
goto err_no_irq;
}
/* If that failed, use channels from platform_info */ /* If that failed, use channels from platform_info */
if (status == 0) if (status == 0)
......
...@@ -376,6 +376,7 @@ static void spi_drv_shutdown(struct device *dev) ...@@ -376,6 +376,7 @@ static void spi_drv_shutdown(struct device *dev)
/** /**
* __spi_register_driver - register a SPI driver * __spi_register_driver - register a SPI driver
* @owner: owner module of the driver to register
* @sdrv: the driver to register * @sdrv: the driver to register
* Context: can sleep * Context: can sleep
* *
...@@ -2130,6 +2131,7 @@ static int __spi_validate(struct spi_device *spi, struct spi_message *message) ...@@ -2130,6 +2131,7 @@ static int __spi_validate(struct spi_device *spi, struct spi_message *message)
* Set transfer tx_nbits and rx_nbits as single transfer default * Set transfer tx_nbits and rx_nbits as single transfer default
* (SPI_NBITS_SINGLE) if it is not set for this transfer. * (SPI_NBITS_SINGLE) if it is not set for this transfer.
*/ */
message->frame_length = 0;
list_for_each_entry(xfer, &message->transfers, transfer_list) { list_for_each_entry(xfer, &message->transfers, transfer_list) {
message->frame_length += xfer->len; message->frame_length += xfer->len;
if (!xfer->bits_per_word) if (!xfer->bits_per_word)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment