diff options
Diffstat (limited to 'drivers/spi')
-rw-r--r-- | drivers/spi/spi-bcm2835.c | 4 | ||||
-rw-r--r-- | drivers/spi/spi-bcm63xx.c | 2 | ||||
-rw-r--r-- | drivers/spi/spi-clps711x.c | 2 | ||||
-rw-r--r-- | drivers/spi/spi-davinci.c | 2 | ||||
-rw-r--r-- | drivers/spi/spi-dw-mid.c | 4 | ||||
-rw-r--r-- | drivers/spi/spi-fsl-cpm.c | 1 | ||||
-rw-r--r-- | drivers/spi/spi-fsl-espi.c | 10 | ||||
-rw-r--r-- | drivers/spi/spi-fsl-spi.c | 2 | ||||
-rw-r--r-- | drivers/spi/spi-mpc512x-psc.c | 5 | ||||
-rw-r--r-- | drivers/spi/spi-mxs.c | 4 | ||||
-rw-r--r-- | drivers/spi/spi-ppc4xx.c | 2 | ||||
-rw-r--r-- | drivers/spi/spi-pxa2xx.c | 5 | ||||
-rw-r--r-- | drivers/spi/spi-rspi.c | 3 | ||||
-rw-r--r-- | drivers/spi/spi-s3c64xx.c | 2 | ||||
-rw-r--r-- | drivers/spi/spi-sh-msiof.c | 2 | ||||
-rw-r--r-- | drivers/spi/spi-sirf.c | 4 | ||||
-rw-r--r-- | drivers/spi/spi-tegra114.c | 6 | ||||
-rw-r--r-- | drivers/spi/spi-tegra20-sflash.c | 2 | ||||
-rw-r--r-- | drivers/spi/spi-tegra20-slink.c | 6 | ||||
-rw-r--r-- | drivers/spi/spi-ti-qspi.c | 23 | ||||
-rw-r--r-- | drivers/spi/spi-xilinx.c | 2 | ||||
-rw-r--r-- | drivers/spi/spi.c | 41 |
22 files changed, 92 insertions, 42 deletions
diff --git a/drivers/spi/spi-bcm2835.c b/drivers/spi/spi-bcm2835.c index 4c332143a310..9025edd7dc45 100644 --- a/drivers/spi/spi-bcm2835.c +++ b/drivers/spi/spi-bcm2835.c | |||
@@ -217,7 +217,7 @@ static int bcm2835_spi_start_transfer(struct spi_device *spi, | |||
217 | cs |= spi->chip_select; | 217 | cs |= spi->chip_select; |
218 | } | 218 | } |
219 | 219 | ||
220 | INIT_COMPLETION(bs->done); | 220 | reinit_completion(&bs->done); |
221 | bs->tx_buf = tfr->tx_buf; | 221 | bs->tx_buf = tfr->tx_buf; |
222 | bs->rx_buf = tfr->rx_buf; | 222 | bs->rx_buf = tfr->rx_buf; |
223 | bs->len = tfr->len; | 223 | bs->len = tfr->len; |
@@ -377,7 +377,7 @@ out_master_put: | |||
377 | 377 | ||
378 | static int bcm2835_spi_remove(struct platform_device *pdev) | 378 | static int bcm2835_spi_remove(struct platform_device *pdev) |
379 | { | 379 | { |
380 | struct spi_master *master = spi_master_get(platform_get_drvdata(pdev)); | 380 | struct spi_master *master = platform_get_drvdata(pdev); |
381 | struct bcm2835_spi *bs = spi_master_get_devdata(master); | 381 | struct bcm2835_spi *bs = spi_master_get_devdata(master); |
382 | 382 | ||
383 | free_irq(bs->irq, master); | 383 | free_irq(bs->irq, master); |
diff --git a/drivers/spi/spi-bcm63xx.c b/drivers/spi/spi-bcm63xx.c index 80d56b214eb5..469ecd876358 100644 --- a/drivers/spi/spi-bcm63xx.c +++ b/drivers/spi/spi-bcm63xx.c | |||
@@ -435,7 +435,7 @@ out: | |||
435 | 435 | ||
436 | static int bcm63xx_spi_remove(struct platform_device *pdev) | 436 | static int bcm63xx_spi_remove(struct platform_device *pdev) |
437 | { | 437 | { |
438 | struct spi_master *master = spi_master_get(platform_get_drvdata(pdev)); | 438 | struct spi_master *master = platform_get_drvdata(pdev); |
439 | struct bcm63xx_spi *bs = spi_master_get_devdata(master); | 439 | struct bcm63xx_spi *bs = spi_master_get_devdata(master); |
440 | 440 | ||
441 | /* reset spi block */ | 441 | /* reset spi block */ |
diff --git a/drivers/spi/spi-clps711x.c b/drivers/spi/spi-clps711x.c index e2a5a426b2ef..6f03d7e6435d 100644 --- a/drivers/spi/spi-clps711x.c +++ b/drivers/spi/spi-clps711x.c | |||
@@ -105,7 +105,7 @@ static int spi_clps711x_transfer_one_message(struct spi_master *master, | |||
105 | 105 | ||
106 | gpio_set_value(cs, !!(msg->spi->mode & SPI_CS_HIGH)); | 106 | gpio_set_value(cs, !!(msg->spi->mode & SPI_CS_HIGH)); |
107 | 107 | ||
108 | INIT_COMPLETION(hw->done); | 108 | reinit_completion(&hw->done); |
109 | 109 | ||
110 | hw->count = 0; | 110 | hw->count = 0; |
111 | hw->len = xfer->len; | 111 | hw->len = xfer->len; |
diff --git a/drivers/spi/spi-davinci.c b/drivers/spi/spi-davinci.c index dd72445ba2ea..50b2d88c8190 100644 --- a/drivers/spi/spi-davinci.c +++ b/drivers/spi/spi-davinci.c | |||
@@ -554,7 +554,7 @@ static int davinci_spi_bufs(struct spi_device *spi, struct spi_transfer *t) | |||
554 | clear_io_bits(dspi->base + SPIGCR1, SPIGCR1_POWERDOWN_MASK); | 554 | clear_io_bits(dspi->base + SPIGCR1, SPIGCR1_POWERDOWN_MASK); |
555 | set_io_bits(dspi->base + SPIGCR1, SPIGCR1_SPIENA_MASK); | 555 | set_io_bits(dspi->base + SPIGCR1, SPIGCR1_SPIENA_MASK); |
556 | 556 | ||
557 | INIT_COMPLETION(dspi->done); | 557 | reinit_completion(&dspi->done); |
558 | 558 | ||
559 | if (spicfg->io_type == SPI_IO_TYPE_INTR) | 559 | if (spicfg->io_type == SPI_IO_TYPE_INTR) |
560 | set_io_bits(dspi->base + SPIINT, SPIINT_MASKINT); | 560 | set_io_bits(dspi->base + SPIINT, SPIINT_MASKINT); |
diff --git a/drivers/spi/spi-dw-mid.c b/drivers/spi/spi-dw-mid.c index b9f0192758d6..6d207afec8cb 100644 --- a/drivers/spi/spi-dw-mid.c +++ b/drivers/spi/spi-dw-mid.c | |||
@@ -150,7 +150,7 @@ static int mid_spi_dma_transfer(struct dw_spi *dws, int cs_change) | |||
150 | &dws->tx_sgl, | 150 | &dws->tx_sgl, |
151 | 1, | 151 | 1, |
152 | DMA_MEM_TO_DEV, | 152 | DMA_MEM_TO_DEV, |
153 | DMA_PREP_INTERRUPT | DMA_COMPL_SKIP_DEST_UNMAP); | 153 | DMA_PREP_INTERRUPT); |
154 | txdesc->callback = dw_spi_dma_done; | 154 | txdesc->callback = dw_spi_dma_done; |
155 | txdesc->callback_param = dws; | 155 | txdesc->callback_param = dws; |
156 | 156 | ||
@@ -173,7 +173,7 @@ static int mid_spi_dma_transfer(struct dw_spi *dws, int cs_change) | |||
173 | &dws->rx_sgl, | 173 | &dws->rx_sgl, |
174 | 1, | 174 | 1, |
175 | DMA_DEV_TO_MEM, | 175 | DMA_DEV_TO_MEM, |
176 | DMA_PREP_INTERRUPT | DMA_COMPL_SKIP_DEST_UNMAP); | 176 | DMA_PREP_INTERRUPT); |
177 | rxdesc->callback = dw_spi_dma_done; | 177 | rxdesc->callback = dw_spi_dma_done; |
178 | rxdesc->callback_param = dws; | 178 | rxdesc->callback_param = dws; |
179 | 179 | ||
diff --git a/drivers/spi/spi-fsl-cpm.c b/drivers/spi/spi-fsl-cpm.c index 58630edb8c21..54b06376f03c 100644 --- a/drivers/spi/spi-fsl-cpm.c +++ b/drivers/spi/spi-fsl-cpm.c | |||
@@ -20,6 +20,7 @@ | |||
20 | #include <linux/spi/spi.h> | 20 | #include <linux/spi/spi.h> |
21 | #include <linux/fsl_devices.h> | 21 | #include <linux/fsl_devices.h> |
22 | #include <linux/dma-mapping.h> | 22 | #include <linux/dma-mapping.h> |
23 | #include <linux/of_address.h> | ||
23 | #include <asm/cpm.h> | 24 | #include <asm/cpm.h> |
24 | #include <asm/qe.h> | 25 | #include <asm/qe.h> |
25 | 26 | ||
diff --git a/drivers/spi/spi-fsl-espi.c b/drivers/spi/spi-fsl-espi.c index 43222d7532d1..80d8f40f7e05 100644 --- a/drivers/spi/spi-fsl-espi.c +++ b/drivers/spi/spi-fsl-espi.c | |||
@@ -16,6 +16,8 @@ | |||
16 | #include <linux/fsl_devices.h> | 16 | #include <linux/fsl_devices.h> |
17 | #include <linux/mm.h> | 17 | #include <linux/mm.h> |
18 | #include <linux/of.h> | 18 | #include <linux/of.h> |
19 | #include <linux/of_address.h> | ||
20 | #include <linux/of_irq.h> | ||
19 | #include <linux/of_platform.h> | 21 | #include <linux/of_platform.h> |
20 | #include <linux/interrupt.h> | 22 | #include <linux/interrupt.h> |
21 | #include <linux/err.h> | 23 | #include <linux/err.h> |
@@ -230,7 +232,7 @@ static int fsl_espi_bufs(struct spi_device *spi, struct spi_transfer *t) | |||
230 | mpc8xxx_spi->tx = t->tx_buf; | 232 | mpc8xxx_spi->tx = t->tx_buf; |
231 | mpc8xxx_spi->rx = t->rx_buf; | 233 | mpc8xxx_spi->rx = t->rx_buf; |
232 | 234 | ||
233 | INIT_COMPLETION(mpc8xxx_spi->done); | 235 | reinit_completion(&mpc8xxx_spi->done); |
234 | 236 | ||
235 | /* Set SPCOM[CS] and SPCOM[TRANLEN] field */ | 237 | /* Set SPCOM[CS] and SPCOM[TRANLEN] field */ |
236 | if ((t->len - 1) > SPCOM_TRANLEN_MAX) { | 238 | if ((t->len - 1) > SPCOM_TRANLEN_MAX) { |
@@ -687,7 +689,7 @@ static int of_fsl_espi_probe(struct platform_device *ofdev) | |||
687 | struct device_node *np = ofdev->dev.of_node; | 689 | struct device_node *np = ofdev->dev.of_node; |
688 | struct spi_master *master; | 690 | struct spi_master *master; |
689 | struct resource mem; | 691 | struct resource mem; |
690 | struct resource irq; | 692 | unsigned int irq; |
691 | int ret = -ENOMEM; | 693 | int ret = -ENOMEM; |
692 | 694 | ||
693 | ret = of_mpc8xxx_spi_probe(ofdev); | 695 | ret = of_mpc8xxx_spi_probe(ofdev); |
@@ -702,13 +704,13 @@ static int of_fsl_espi_probe(struct platform_device *ofdev) | |||
702 | if (ret) | 704 | if (ret) |
703 | goto err; | 705 | goto err; |
704 | 706 | ||
705 | ret = of_irq_to_resource(np, 0, &irq); | 707 | irq = irq_of_parse_and_map(np, 0); |
706 | if (!ret) { | 708 | if (!ret) { |
707 | ret = -EINVAL; | 709 | ret = -EINVAL; |
708 | goto err; | 710 | goto err; |
709 | } | 711 | } |
710 | 712 | ||
711 | master = fsl_espi_probe(dev, &mem, irq.start); | 713 | master = fsl_espi_probe(dev, &mem, irq); |
712 | if (IS_ERR(master)) { | 714 | if (IS_ERR(master)) { |
713 | ret = PTR_ERR(master); | 715 | ret = PTR_ERR(master); |
714 | goto err; | 716 | goto err; |
diff --git a/drivers/spi/spi-fsl-spi.c b/drivers/spi/spi-fsl-spi.c index 2129fcd1c31b..119f7af94537 100644 --- a/drivers/spi/spi-fsl-spi.c +++ b/drivers/spi/spi-fsl-spi.c | |||
@@ -339,7 +339,7 @@ static int fsl_spi_bufs(struct spi_device *spi, struct spi_transfer *t, | |||
339 | mpc8xxx_spi->tx = t->tx_buf; | 339 | mpc8xxx_spi->tx = t->tx_buf; |
340 | mpc8xxx_spi->rx = t->rx_buf; | 340 | mpc8xxx_spi->rx = t->rx_buf; |
341 | 341 | ||
342 | INIT_COMPLETION(mpc8xxx_spi->done); | 342 | reinit_completion(&mpc8xxx_spi->done); |
343 | 343 | ||
344 | if (mpc8xxx_spi->flags & SPI_CPM_MODE) | 344 | if (mpc8xxx_spi->flags & SPI_CPM_MODE) |
345 | ret = fsl_spi_cpm_bufs(mpc8xxx_spi, t, is_dma_mapped); | 345 | ret = fsl_spi_cpm_bufs(mpc8xxx_spi, t, is_dma_mapped); |
diff --git a/drivers/spi/spi-mpc512x-psc.c b/drivers/spi/spi-mpc512x-psc.c index ee6e61cbf7f5..87676587d783 100644 --- a/drivers/spi/spi-mpc512x-psc.c +++ b/drivers/spi/spi-mpc512x-psc.c | |||
@@ -20,6 +20,7 @@ | |||
20 | #include <linux/errno.h> | 20 | #include <linux/errno.h> |
21 | #include <linux/interrupt.h> | 21 | #include <linux/interrupt.h> |
22 | #include <linux/of_address.h> | 22 | #include <linux/of_address.h> |
23 | #include <linux/of_irq.h> | ||
23 | #include <linux/of_platform.h> | 24 | #include <linux/of_platform.h> |
24 | #include <linux/completion.h> | 25 | #include <linux/completion.h> |
25 | #include <linux/io.h> | 26 | #include <linux/io.h> |
@@ -166,7 +167,7 @@ static int mpc512x_psc_spi_transfer_rxtx(struct spi_device *spi, | |||
166 | } | 167 | } |
167 | 168 | ||
168 | /* have the ISR trigger when the TX FIFO is empty */ | 169 | /* have the ISR trigger when the TX FIFO is empty */ |
169 | INIT_COMPLETION(mps->txisrdone); | 170 | reinit_completion(&mps->txisrdone); |
170 | out_be32(&fifo->txisr, MPC512x_PSC_FIFO_EMPTY); | 171 | out_be32(&fifo->txisr, MPC512x_PSC_FIFO_EMPTY); |
171 | out_be32(&fifo->tximr, MPC512x_PSC_FIFO_EMPTY); | 172 | out_be32(&fifo->tximr, MPC512x_PSC_FIFO_EMPTY); |
172 | wait_for_completion(&mps->txisrdone); | 173 | wait_for_completion(&mps->txisrdone); |
@@ -556,7 +557,7 @@ free_master: | |||
556 | 557 | ||
557 | static int mpc512x_psc_spi_do_remove(struct device *dev) | 558 | static int mpc512x_psc_spi_do_remove(struct device *dev) |
558 | { | 559 | { |
559 | struct spi_master *master = spi_master_get(dev_get_drvdata(dev)); | 560 | struct spi_master *master = dev_get_drvdata(dev); |
560 | struct mpc512x_psc_spi *mps = spi_master_get_devdata(master); | 561 | struct mpc512x_psc_spi *mps = spi_master_get_devdata(master); |
561 | 562 | ||
562 | clk_disable_unprepare(mps->clk_mclk); | 563 | clk_disable_unprepare(mps->clk_mclk); |
diff --git a/drivers/spi/spi-mxs.c b/drivers/spi/spi-mxs.c index de333059a9a7..3adebfa22e3d 100644 --- a/drivers/spi/spi-mxs.c +++ b/drivers/spi/spi-mxs.c | |||
@@ -202,7 +202,7 @@ static int mxs_spi_txrx_dma(struct mxs_spi *spi, | |||
202 | if (!dma_xfer) | 202 | if (!dma_xfer) |
203 | return -ENOMEM; | 203 | return -ENOMEM; |
204 | 204 | ||
205 | INIT_COMPLETION(spi->c); | 205 | reinit_completion(&spi->c); |
206 | 206 | ||
207 | /* Chip select was already programmed into CTRL0 */ | 207 | /* Chip select was already programmed into CTRL0 */ |
208 | ctrl0 = readl(ssp->base + HW_SSP_CTRL0); | 208 | ctrl0 = readl(ssp->base + HW_SSP_CTRL0); |
@@ -565,7 +565,7 @@ static int mxs_spi_remove(struct platform_device *pdev) | |||
565 | struct mxs_spi *spi; | 565 | struct mxs_spi *spi; |
566 | struct mxs_ssp *ssp; | 566 | struct mxs_ssp *ssp; |
567 | 567 | ||
568 | master = spi_master_get(platform_get_drvdata(pdev)); | 568 | master = platform_get_drvdata(pdev); |
569 | spi = spi_master_get_devdata(master); | 569 | spi = spi_master_get_devdata(master); |
570 | ssp = &spi->ssp; | 570 | ssp = &spi->ssp; |
571 | 571 | ||
diff --git a/drivers/spi/spi-ppc4xx.c b/drivers/spi/spi-ppc4xx.c index c57740bb70d3..5ee56726f8d0 100644 --- a/drivers/spi/spi-ppc4xx.c +++ b/drivers/spi/spi-ppc4xx.c | |||
@@ -29,6 +29,8 @@ | |||
29 | #include <linux/slab.h> | 29 | #include <linux/slab.h> |
30 | #include <linux/errno.h> | 30 | #include <linux/errno.h> |
31 | #include <linux/wait.h> | 31 | #include <linux/wait.h> |
32 | #include <linux/of_address.h> | ||
33 | #include <linux/of_irq.h> | ||
32 | #include <linux/of_platform.h> | 34 | #include <linux/of_platform.h> |
33 | #include <linux/of_gpio.h> | 35 | #include <linux/of_gpio.h> |
34 | #include <linux/interrupt.h> | 36 | #include <linux/interrupt.h> |
diff --git a/drivers/spi/spi-pxa2xx.c b/drivers/spi/spi-pxa2xx.c index cb0e1f1137ad..7765b1999537 100644 --- a/drivers/spi/spi-pxa2xx.c +++ b/drivers/spi/spi-pxa2xx.c | |||
@@ -1073,6 +1073,8 @@ pxa2xx_spi_acpi_get_pdata(struct platform_device *pdev) | |||
1073 | static struct acpi_device_id pxa2xx_spi_acpi_match[] = { | 1073 | static struct acpi_device_id pxa2xx_spi_acpi_match[] = { |
1074 | { "INT33C0", 0 }, | 1074 | { "INT33C0", 0 }, |
1075 | { "INT33C1", 0 }, | 1075 | { "INT33C1", 0 }, |
1076 | { "INT3430", 0 }, | ||
1077 | { "INT3431", 0 }, | ||
1076 | { "80860F0E", 0 }, | 1078 | { "80860F0E", 0 }, |
1077 | { }, | 1079 | { }, |
1078 | }; | 1080 | }; |
@@ -1291,6 +1293,9 @@ static int pxa2xx_spi_resume(struct device *dev) | |||
1291 | /* Enable the SSP clock */ | 1293 | /* Enable the SSP clock */ |
1292 | clk_prepare_enable(ssp->clk); | 1294 | clk_prepare_enable(ssp->clk); |
1293 | 1295 | ||
1296 | /* Restore LPSS private register bits */ | ||
1297 | lpss_ssp_setup(drv_data); | ||
1298 | |||
1294 | /* Start the queue running */ | 1299 | /* Start the queue running */ |
1295 | status = spi_master_resume(drv_data->master); | 1300 | status = spi_master_resume(drv_data->master); |
1296 | if (status != 0) { | 1301 | if (status != 0) { |
diff --git a/drivers/spi/spi-rspi.c b/drivers/spi/spi-rspi.c index 58449ad4ad0d..9e829cee7357 100644 --- a/drivers/spi/spi-rspi.c +++ b/drivers/spi/spi-rspi.c | |||
@@ -885,14 +885,13 @@ static void rspi_release_dma(struct rspi_data *rspi) | |||
885 | 885 | ||
886 | static int rspi_remove(struct platform_device *pdev) | 886 | static int rspi_remove(struct platform_device *pdev) |
887 | { | 887 | { |
888 | struct rspi_data *rspi = spi_master_get(platform_get_drvdata(pdev)); | 888 | struct rspi_data *rspi = platform_get_drvdata(pdev); |
889 | 889 | ||
890 | spi_unregister_master(rspi->master); | 890 | spi_unregister_master(rspi->master); |
891 | rspi_release_dma(rspi); | 891 | rspi_release_dma(rspi); |
892 | free_irq(platform_get_irq(pdev, 0), rspi); | 892 | free_irq(platform_get_irq(pdev, 0), rspi); |
893 | clk_put(rspi->clk); | 893 | clk_put(rspi->clk); |
894 | iounmap(rspi->addr); | 894 | iounmap(rspi->addr); |
895 | spi_master_put(rspi->master); | ||
896 | 895 | ||
897 | return 0; | 896 | return 0; |
898 | } | 897 | } |
diff --git a/drivers/spi/spi-s3c64xx.c b/drivers/spi/spi-s3c64xx.c index 9e2020df9e0f..4c4b0a1219a7 100644 --- a/drivers/spi/spi-s3c64xx.c +++ b/drivers/spi/spi-s3c64xx.c | |||
@@ -890,7 +890,7 @@ static int s3c64xx_spi_transfer_one(struct spi_master *master, | |||
890 | unsigned long flags; | 890 | unsigned long flags; |
891 | int use_dma; | 891 | int use_dma; |
892 | 892 | ||
893 | INIT_COMPLETION(sdd->xfer_completion); | 893 | reinit_completion(&sdd->xfer_completion); |
894 | 894 | ||
895 | /* Only BPW and Speed may change across transfers */ | 895 | /* Only BPW and Speed may change across transfers */ |
896 | bpw = xfer->bits_per_word; | 896 | bpw = xfer->bits_per_word; |
diff --git a/drivers/spi/spi-sh-msiof.c b/drivers/spi/spi-sh-msiof.c index 2a95435a6a11..c74298cf70e2 100644 --- a/drivers/spi/spi-sh-msiof.c +++ b/drivers/spi/spi-sh-msiof.c | |||
@@ -465,7 +465,7 @@ static int sh_msiof_spi_txrx_once(struct sh_msiof_spi_priv *p, | |||
465 | ret = ret ? ret : sh_msiof_modify_ctr_wait(p, 0, CTR_TXE); | 465 | ret = ret ? ret : sh_msiof_modify_ctr_wait(p, 0, CTR_TXE); |
466 | 466 | ||
467 | /* start by setting frame bit */ | 467 | /* start by setting frame bit */ |
468 | INIT_COMPLETION(p->done); | 468 | reinit_completion(&p->done); |
469 | ret = ret ? ret : sh_msiof_modify_ctr_wait(p, 0, CTR_TFSE); | 469 | ret = ret ? ret : sh_msiof_modify_ctr_wait(p, 0, CTR_TFSE); |
470 | if (ret) { | 470 | if (ret) { |
471 | dev_err(&p->pdev->dev, "failed to start hardware\n"); | 471 | dev_err(&p->pdev->dev, "failed to start hardware\n"); |
diff --git a/drivers/spi/spi-sirf.c b/drivers/spi/spi-sirf.c index 592b4aff651f..ed5e501c4652 100644 --- a/drivers/spi/spi-sirf.c +++ b/drivers/spi/spi-sirf.c | |||
@@ -305,8 +305,8 @@ static int spi_sirfsoc_transfer(struct spi_device *spi, struct spi_transfer *t) | |||
305 | sspi->tx = t->tx_buf ? t->tx_buf : sspi->dummypage; | 305 | sspi->tx = t->tx_buf ? t->tx_buf : sspi->dummypage; |
306 | sspi->rx = t->rx_buf ? t->rx_buf : sspi->dummypage; | 306 | sspi->rx = t->rx_buf ? t->rx_buf : sspi->dummypage; |
307 | sspi->left_tx_word = sspi->left_rx_word = t->len / sspi->word_width; | 307 | sspi->left_tx_word = sspi->left_rx_word = t->len / sspi->word_width; |
308 | INIT_COMPLETION(sspi->rx_done); | 308 | reinit_completion(&sspi->rx_done); |
309 | INIT_COMPLETION(sspi->tx_done); | 309 | reinit_completion(&sspi->tx_done); |
310 | 310 | ||
311 | writel(SIRFSOC_SPI_INT_MASK_ALL, sspi->base + SIRFSOC_SPI_INT_STATUS); | 311 | writel(SIRFSOC_SPI_INT_MASK_ALL, sspi->base + SIRFSOC_SPI_INT_STATUS); |
312 | 312 | ||
diff --git a/drivers/spi/spi-tegra114.c b/drivers/spi/spi-tegra114.c index 9146bb3c2489..aaecfb3ebf58 100644 --- a/drivers/spi/spi-tegra114.c +++ b/drivers/spi/spi-tegra114.c | |||
@@ -451,7 +451,7 @@ static void tegra_spi_dma_complete(void *args) | |||
451 | 451 | ||
452 | static int tegra_spi_start_tx_dma(struct tegra_spi_data *tspi, int len) | 452 | static int tegra_spi_start_tx_dma(struct tegra_spi_data *tspi, int len) |
453 | { | 453 | { |
454 | INIT_COMPLETION(tspi->tx_dma_complete); | 454 | reinit_completion(&tspi->tx_dma_complete); |
455 | tspi->tx_dma_desc = dmaengine_prep_slave_single(tspi->tx_dma_chan, | 455 | tspi->tx_dma_desc = dmaengine_prep_slave_single(tspi->tx_dma_chan, |
456 | tspi->tx_dma_phys, len, DMA_MEM_TO_DEV, | 456 | tspi->tx_dma_phys, len, DMA_MEM_TO_DEV, |
457 | DMA_PREP_INTERRUPT | DMA_CTRL_ACK); | 457 | DMA_PREP_INTERRUPT | DMA_CTRL_ACK); |
@@ -470,7 +470,7 @@ static int tegra_spi_start_tx_dma(struct tegra_spi_data *tspi, int len) | |||
470 | 470 | ||
471 | static int tegra_spi_start_rx_dma(struct tegra_spi_data *tspi, int len) | 471 | static int tegra_spi_start_rx_dma(struct tegra_spi_data *tspi, int len) |
472 | { | 472 | { |
473 | INIT_COMPLETION(tspi->rx_dma_complete); | 473 | reinit_completion(&tspi->rx_dma_complete); |
474 | tspi->rx_dma_desc = dmaengine_prep_slave_single(tspi->rx_dma_chan, | 474 | tspi->rx_dma_desc = dmaengine_prep_slave_single(tspi->rx_dma_chan, |
475 | tspi->rx_dma_phys, len, DMA_DEV_TO_MEM, | 475 | tspi->rx_dma_phys, len, DMA_DEV_TO_MEM, |
476 | DMA_PREP_INTERRUPT | DMA_CTRL_ACK); | 476 | DMA_PREP_INTERRUPT | DMA_CTRL_ACK); |
@@ -844,7 +844,7 @@ static int tegra_spi_transfer_one_message(struct spi_master *master, | |||
844 | list_for_each_entry(xfer, &msg->transfers, transfer_list) { | 844 | list_for_each_entry(xfer, &msg->transfers, transfer_list) { |
845 | unsigned long cmd1; | 845 | unsigned long cmd1; |
846 | 846 | ||
847 | INIT_COMPLETION(tspi->xfer_completion); | 847 | reinit_completion(&tspi->xfer_completion); |
848 | 848 | ||
849 | cmd1 = tegra_spi_setup_transfer_one(spi, xfer, is_first_msg); | 849 | cmd1 = tegra_spi_setup_transfer_one(spi, xfer, is_first_msg); |
850 | 850 | ||
diff --git a/drivers/spi/spi-tegra20-sflash.c b/drivers/spi/spi-tegra20-sflash.c index 79be8ce6a9d1..4dc8e8129459 100644 --- a/drivers/spi/spi-tegra20-sflash.c +++ b/drivers/spi/spi-tegra20-sflash.c | |||
@@ -339,7 +339,7 @@ static int tegra_sflash_transfer_one_message(struct spi_master *master, | |||
339 | msg->actual_length = 0; | 339 | msg->actual_length = 0; |
340 | single_xfer = list_is_singular(&msg->transfers); | 340 | single_xfer = list_is_singular(&msg->transfers); |
341 | list_for_each_entry(xfer, &msg->transfers, transfer_list) { | 341 | list_for_each_entry(xfer, &msg->transfers, transfer_list) { |
342 | INIT_COMPLETION(tsd->xfer_completion); | 342 | reinit_completion(&tsd->xfer_completion); |
343 | ret = tegra_sflash_start_transfer_one(spi, xfer, | 343 | ret = tegra_sflash_start_transfer_one(spi, xfer, |
344 | is_first_msg, single_xfer); | 344 | is_first_msg, single_xfer); |
345 | if (ret < 0) { | 345 | if (ret < 0) { |
diff --git a/drivers/spi/spi-tegra20-slink.c b/drivers/spi/spi-tegra20-slink.c index af0a67886ae8..e66715ba37ed 100644 --- a/drivers/spi/spi-tegra20-slink.c +++ b/drivers/spi/spi-tegra20-slink.c | |||
@@ -462,7 +462,7 @@ static void tegra_slink_dma_complete(void *args) | |||
462 | 462 | ||
463 | static int tegra_slink_start_tx_dma(struct tegra_slink_data *tspi, int len) | 463 | static int tegra_slink_start_tx_dma(struct tegra_slink_data *tspi, int len) |
464 | { | 464 | { |
465 | INIT_COMPLETION(tspi->tx_dma_complete); | 465 | reinit_completion(&tspi->tx_dma_complete); |
466 | tspi->tx_dma_desc = dmaengine_prep_slave_single(tspi->tx_dma_chan, | 466 | tspi->tx_dma_desc = dmaengine_prep_slave_single(tspi->tx_dma_chan, |
467 | tspi->tx_dma_phys, len, DMA_MEM_TO_DEV, | 467 | tspi->tx_dma_phys, len, DMA_MEM_TO_DEV, |
468 | DMA_PREP_INTERRUPT | DMA_CTRL_ACK); | 468 | DMA_PREP_INTERRUPT | DMA_CTRL_ACK); |
@@ -481,7 +481,7 @@ static int tegra_slink_start_tx_dma(struct tegra_slink_data *tspi, int len) | |||
481 | 481 | ||
482 | static int tegra_slink_start_rx_dma(struct tegra_slink_data *tspi, int len) | 482 | static int tegra_slink_start_rx_dma(struct tegra_slink_data *tspi, int len) |
483 | { | 483 | { |
484 | INIT_COMPLETION(tspi->rx_dma_complete); | 484 | reinit_completion(&tspi->rx_dma_complete); |
485 | tspi->rx_dma_desc = dmaengine_prep_slave_single(tspi->rx_dma_chan, | 485 | tspi->rx_dma_desc = dmaengine_prep_slave_single(tspi->rx_dma_chan, |
486 | tspi->rx_dma_phys, len, DMA_DEV_TO_MEM, | 486 | tspi->rx_dma_phys, len, DMA_DEV_TO_MEM, |
487 | DMA_PREP_INTERRUPT | DMA_CTRL_ACK); | 487 | DMA_PREP_INTERRUPT | DMA_CTRL_ACK); |
@@ -836,7 +836,7 @@ static int tegra_slink_transfer_one(struct spi_master *master, | |||
836 | struct tegra_slink_data *tspi = spi_master_get_devdata(master); | 836 | struct tegra_slink_data *tspi = spi_master_get_devdata(master); |
837 | int ret; | 837 | int ret; |
838 | 838 | ||
839 | INIT_COMPLETION(tspi->xfer_completion); | 839 | reinit_completion(&tspi->xfer_completion); |
840 | ret = tegra_slink_start_transfer_one(spi, xfer); | 840 | ret = tegra_slink_start_transfer_one(spi, xfer); |
841 | if (ret < 0) { | 841 | if (ret < 0) { |
842 | dev_err(tspi->dev, | 842 | dev_err(tspi->dev, |
diff --git a/drivers/spi/spi-ti-qspi.c b/drivers/spi/spi-ti-qspi.c index 0b71270fbf67..4396bd448540 100644 --- a/drivers/spi/spi-ti-qspi.c +++ b/drivers/spi/spi-ti-qspi.c | |||
@@ -161,7 +161,7 @@ static int ti_qspi_setup(struct spi_device *spi) | |||
161 | qspi->spi_max_frequency, clk_div); | 161 | qspi->spi_max_frequency, clk_div); |
162 | 162 | ||
163 | ret = pm_runtime_get_sync(qspi->dev); | 163 | ret = pm_runtime_get_sync(qspi->dev); |
164 | if (ret) { | 164 | if (ret < 0) { |
165 | dev_err(qspi->dev, "pm_runtime_get_sync() failed\n"); | 165 | dev_err(qspi->dev, "pm_runtime_get_sync() failed\n"); |
166 | return ret; | 166 | return ret; |
167 | } | 167 | } |
@@ -459,11 +459,10 @@ static int ti_qspi_probe(struct platform_device *pdev) | |||
459 | if (!of_property_read_u32(np, "num-cs", &num_cs)) | 459 | if (!of_property_read_u32(np, "num-cs", &num_cs)) |
460 | master->num_chipselect = num_cs; | 460 | master->num_chipselect = num_cs; |
461 | 461 | ||
462 | platform_set_drvdata(pdev, master); | ||
463 | |||
464 | qspi = spi_master_get_devdata(master); | 462 | qspi = spi_master_get_devdata(master); |
465 | qspi->master = master; | 463 | qspi->master = master; |
466 | qspi->dev = &pdev->dev; | 464 | qspi->dev = &pdev->dev; |
465 | platform_set_drvdata(pdev, qspi); | ||
467 | 466 | ||
468 | r = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 467 | r = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
469 | 468 | ||
@@ -517,10 +516,26 @@ free_master: | |||
517 | 516 | ||
518 | static int ti_qspi_remove(struct platform_device *pdev) | 517 | static int ti_qspi_remove(struct platform_device *pdev) |
519 | { | 518 | { |
520 | struct ti_qspi *qspi = platform_get_drvdata(pdev); | 519 | struct spi_master *master; |
520 | struct ti_qspi *qspi; | ||
521 | int ret; | ||
522 | |||
523 | master = platform_get_drvdata(pdev); | ||
524 | qspi = spi_master_get_devdata(master); | ||
525 | |||
526 | ret = pm_runtime_get_sync(qspi->dev); | ||
527 | if (ret < 0) { | ||
528 | dev_err(qspi->dev, "pm_runtime_get_sync() failed\n"); | ||
529 | return ret; | ||
530 | } | ||
521 | 531 | ||
522 | ti_qspi_write(qspi, QSPI_WC_INT_DISABLE, QSPI_INTR_ENABLE_CLEAR_REG); | 532 | ti_qspi_write(qspi, QSPI_WC_INT_DISABLE, QSPI_INTR_ENABLE_CLEAR_REG); |
523 | 533 | ||
534 | pm_runtime_put(qspi->dev); | ||
535 | pm_runtime_disable(&pdev->dev); | ||
536 | |||
537 | spi_unregister_master(master); | ||
538 | |||
524 | return 0; | 539 | return 0; |
525 | } | 540 | } |
526 | 541 | ||
diff --git a/drivers/spi/spi-xilinx.c b/drivers/spi/spi-xilinx.c index ec3a83f52ea2..6d4ce4615163 100644 --- a/drivers/spi/spi-xilinx.c +++ b/drivers/spi/spi-xilinx.c | |||
@@ -258,7 +258,7 @@ static int xilinx_spi_txrx_bufs(struct spi_device *spi, struct spi_transfer *t) | |||
258 | xspi->tx_ptr = t->tx_buf; | 258 | xspi->tx_ptr = t->tx_buf; |
259 | xspi->rx_ptr = t->rx_buf; | 259 | xspi->rx_ptr = t->rx_buf; |
260 | xspi->remaining_bytes = t->len; | 260 | xspi->remaining_bytes = t->len; |
261 | INIT_COMPLETION(xspi->done); | 261 | reinit_completion(&xspi->done); |
262 | 262 | ||
263 | 263 | ||
264 | /* Enable the transmit empty interrupt, which we use to determine | 264 | /* Enable the transmit empty interrupt, which we use to determine |
diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c index 8d05accf706c..349ebba4b199 100644 --- a/drivers/spi/spi.c +++ b/drivers/spi/spi.c | |||
@@ -245,15 +245,27 @@ EXPORT_SYMBOL_GPL(spi_bus_type); | |||
245 | static int spi_drv_probe(struct device *dev) | 245 | static int spi_drv_probe(struct device *dev) |
246 | { | 246 | { |
247 | const struct spi_driver *sdrv = to_spi_driver(dev->driver); | 247 | const struct spi_driver *sdrv = to_spi_driver(dev->driver); |
248 | struct spi_device *spi = to_spi_device(dev); | ||
249 | int ret; | ||
250 | |||
251 | acpi_dev_pm_attach(&spi->dev, true); | ||
252 | ret = sdrv->probe(spi); | ||
253 | if (ret) | ||
254 | acpi_dev_pm_detach(&spi->dev, true); | ||
248 | 255 | ||
249 | return sdrv->probe(to_spi_device(dev)); | 256 | return ret; |
250 | } | 257 | } |
251 | 258 | ||
252 | static int spi_drv_remove(struct device *dev) | 259 | static int spi_drv_remove(struct device *dev) |
253 | { | 260 | { |
254 | const struct spi_driver *sdrv = to_spi_driver(dev->driver); | 261 | const struct spi_driver *sdrv = to_spi_driver(dev->driver); |
262 | struct spi_device *spi = to_spi_device(dev); | ||
263 | int ret; | ||
255 | 264 | ||
256 | return sdrv->remove(to_spi_device(dev)); | 265 | ret = sdrv->remove(spi); |
266 | acpi_dev_pm_detach(&spi->dev, true); | ||
267 | |||
268 | return ret; | ||
257 | } | 269 | } |
258 | 270 | ||
259 | static void spi_drv_shutdown(struct device *dev) | 271 | static void spi_drv_shutdown(struct device *dev) |
@@ -345,6 +357,19 @@ struct spi_device *spi_alloc_device(struct spi_master *master) | |||
345 | } | 357 | } |
346 | EXPORT_SYMBOL_GPL(spi_alloc_device); | 358 | EXPORT_SYMBOL_GPL(spi_alloc_device); |
347 | 359 | ||
360 | static void spi_dev_set_name(struct spi_device *spi) | ||
361 | { | ||
362 | struct acpi_device *adev = ACPI_COMPANION(&spi->dev); | ||
363 | |||
364 | if (adev) { | ||
365 | dev_set_name(&spi->dev, "spi-%s", acpi_dev_name(adev)); | ||
366 | return; | ||
367 | } | ||
368 | |||
369 | dev_set_name(&spi->dev, "%s.%u", dev_name(&spi->master->dev), | ||
370 | spi->chip_select); | ||
371 | } | ||
372 | |||
348 | /** | 373 | /** |
349 | * spi_add_device - Add spi_device allocated with spi_alloc_device | 374 | * spi_add_device - Add spi_device allocated with spi_alloc_device |
350 | * @spi: spi_device to register | 375 | * @spi: spi_device to register |
@@ -371,9 +396,7 @@ int spi_add_device(struct spi_device *spi) | |||
371 | } | 396 | } |
372 | 397 | ||
373 | /* Set the bus ID string */ | 398 | /* Set the bus ID string */ |
374 | dev_set_name(&spi->dev, "%s.%u", dev_name(&spi->master->dev), | 399 | spi_dev_set_name(spi); |
375 | spi->chip_select); | ||
376 | |||
377 | 400 | ||
378 | /* We need to make sure there's no other device with this | 401 | /* We need to make sure there's no other device with this |
379 | * chipselect **BEFORE** we call setup(), else we'll trash | 402 | * chipselect **BEFORE** we call setup(), else we'll trash |
@@ -559,7 +582,7 @@ static int spi_transfer_one_message(struct spi_master *master, | |||
559 | list_for_each_entry(xfer, &msg->transfers, transfer_list) { | 582 | list_for_each_entry(xfer, &msg->transfers, transfer_list) { |
560 | trace_spi_transfer_start(msg, xfer); | 583 | trace_spi_transfer_start(msg, xfer); |
561 | 584 | ||
562 | INIT_COMPLETION(master->xfer_completion); | 585 | reinit_completion(&master->xfer_completion); |
563 | 586 | ||
564 | ret = master->transfer_one(master, msg->spi, xfer); | 587 | ret = master->transfer_one(master, msg->spi, xfer); |
565 | if (ret < 0) { | 588 | if (ret < 0) { |
@@ -1132,7 +1155,7 @@ static acpi_status acpi_spi_add_device(acpi_handle handle, u32 level, | |||
1132 | return AE_NO_MEMORY; | 1155 | return AE_NO_MEMORY; |
1133 | } | 1156 | } |
1134 | 1157 | ||
1135 | ACPI_HANDLE_SET(&spi->dev, handle); | 1158 | ACPI_COMPANION_SET(&spi->dev, adev); |
1136 | spi->irq = -1; | 1159 | spi->irq = -1; |
1137 | 1160 | ||
1138 | INIT_LIST_HEAD(&resource_list); | 1161 | INIT_LIST_HEAD(&resource_list); |
@@ -1145,8 +1168,10 @@ static acpi_status acpi_spi_add_device(acpi_handle handle, u32 level, | |||
1145 | return AE_OK; | 1168 | return AE_OK; |
1146 | } | 1169 | } |
1147 | 1170 | ||
1171 | adev->power.flags.ignore_parent = true; | ||
1148 | strlcpy(spi->modalias, acpi_device_hid(adev), sizeof(spi->modalias)); | 1172 | strlcpy(spi->modalias, acpi_device_hid(adev), sizeof(spi->modalias)); |
1149 | if (spi_add_device(spi)) { | 1173 | if (spi_add_device(spi)) { |
1174 | adev->power.flags.ignore_parent = false; | ||
1150 | dev_err(&master->dev, "failed to add SPI device %s from ACPI\n", | 1175 | dev_err(&master->dev, "failed to add SPI device %s from ACPI\n", |
1151 | dev_name(&adev->dev)); | 1176 | dev_name(&adev->dev)); |
1152 | spi_dev_put(spi); | 1177 | spi_dev_put(spi); |
@@ -1390,7 +1415,7 @@ int devm_spi_register_master(struct device *dev, struct spi_master *master) | |||
1390 | return -ENOMEM; | 1415 | return -ENOMEM; |
1391 | 1416 | ||
1392 | ret = spi_register_master(master); | 1417 | ret = spi_register_master(master); |
1393 | if (ret != 0) { | 1418 | if (!ret) { |
1394 | *ptr = master; | 1419 | *ptr = master; |
1395 | devres_add(dev, ptr); | 1420 | devres_add(dev, ptr); |
1396 | } else { | 1421 | } else { |