diff options
Diffstat (limited to 'drivers/spi')
-rw-r--r-- | drivers/spi/spi-mxs.c | 3 | ||||
-rw-r--r-- | drivers/spi/spi-pl022.c | 3 | ||||
-rw-r--r-- | drivers/spi/spi-rspi.c | 56 |
3 files changed, 36 insertions, 26 deletions
diff --git a/drivers/spi/spi-mxs.c b/drivers/spi/spi-mxs.c index edf1360ab09e..86dd04d6bc87 100644 --- a/drivers/spi/spi-mxs.c +++ b/drivers/spi/spi-mxs.c | |||
@@ -323,6 +323,7 @@ static int mxs_spi_txrx_dma(struct mxs_spi *spi, int cs, | |||
323 | if (!ret) { | 323 | if (!ret) { |
324 | dev_err(ssp->dev, "DMA transfer timeout\n"); | 324 | dev_err(ssp->dev, "DMA transfer timeout\n"); |
325 | ret = -ETIMEDOUT; | 325 | ret = -ETIMEDOUT; |
326 | dmaengine_terminate_all(ssp->dmach); | ||
326 | goto err_vmalloc; | 327 | goto err_vmalloc; |
327 | } | 328 | } |
328 | 329 | ||
@@ -480,7 +481,7 @@ static int mxs_spi_transfer_one(struct spi_master *master, | |||
480 | first = last = 0; | 481 | first = last = 0; |
481 | } | 482 | } |
482 | 483 | ||
483 | m->status = 0; | 484 | m->status = status; |
484 | spi_finalize_current_message(master); | 485 | spi_finalize_current_message(master); |
485 | 486 | ||
486 | return status; | 487 | return status; |
diff --git a/drivers/spi/spi-pl022.c b/drivers/spi/spi-pl022.c index 919464102d33..a1db91a99b89 100644 --- a/drivers/spi/spi-pl022.c +++ b/drivers/spi/spi-pl022.c | |||
@@ -2186,8 +2186,6 @@ pl022_probe(struct amba_device *adev, const struct amba_id *id) | |||
2186 | printk(KERN_INFO "pl022: mapped registers from 0x%08x to %p\n", | 2186 | printk(KERN_INFO "pl022: mapped registers from 0x%08x to %p\n", |
2187 | adev->res.start, pl022->virtbase); | 2187 | adev->res.start, pl022->virtbase); |
2188 | 2188 | ||
2189 | pm_runtime_resume(dev); | ||
2190 | |||
2191 | pl022->clk = devm_clk_get(&adev->dev, NULL); | 2189 | pl022->clk = devm_clk_get(&adev->dev, NULL); |
2192 | if (IS_ERR(pl022->clk)) { | 2190 | if (IS_ERR(pl022->clk)) { |
2193 | status = PTR_ERR(pl022->clk); | 2191 | status = PTR_ERR(pl022->clk); |
@@ -2292,7 +2290,6 @@ pl022_remove(struct amba_device *adev) | |||
2292 | 2290 | ||
2293 | clk_disable(pl022->clk); | 2291 | clk_disable(pl022->clk); |
2294 | clk_unprepare(pl022->clk); | 2292 | clk_unprepare(pl022->clk); |
2295 | pm_runtime_disable(&adev->dev); | ||
2296 | amba_release_regions(adev); | 2293 | amba_release_regions(adev); |
2297 | tasklet_disable(&pl022->pump_transfers); | 2294 | tasklet_disable(&pl022->pump_transfers); |
2298 | spi_unregister_master(pl022->master); | 2295 | spi_unregister_master(pl022->master); |
diff --git a/drivers/spi/spi-rspi.c b/drivers/spi/spi-rspi.c index 4894bde4bbff..30faf6d4ab91 100644 --- a/drivers/spi/spi-rspi.c +++ b/drivers/spi/spi-rspi.c | |||
@@ -147,8 +147,6 @@ struct rspi_data { | |||
147 | unsigned char spsr; | 147 | unsigned char spsr; |
148 | 148 | ||
149 | /* for dmaengine */ | 149 | /* for dmaengine */ |
150 | struct sh_dmae_slave dma_tx; | ||
151 | struct sh_dmae_slave dma_rx; | ||
152 | struct dma_chan *chan_tx; | 150 | struct dma_chan *chan_tx; |
153 | struct dma_chan *chan_rx; | 151 | struct dma_chan *chan_rx; |
154 | int irq; | 152 | int irq; |
@@ -663,20 +661,16 @@ static irqreturn_t rspi_irq(int irq, void *_sr) | |||
663 | return ret; | 661 | return ret; |
664 | } | 662 | } |
665 | 663 | ||
666 | static bool rspi_filter(struct dma_chan *chan, void *filter_param) | 664 | static int __devinit rspi_request_dma(struct rspi_data *rspi, |
667 | { | 665 | struct platform_device *pdev) |
668 | chan->private = filter_param; | ||
669 | return true; | ||
670 | } | ||
671 | |||
672 | static void __devinit rspi_request_dma(struct rspi_data *rspi, | ||
673 | struct platform_device *pdev) | ||
674 | { | 666 | { |
675 | struct rspi_plat_data *rspi_pd = pdev->dev.platform_data; | 667 | struct rspi_plat_data *rspi_pd = pdev->dev.platform_data; |
676 | dma_cap_mask_t mask; | 668 | dma_cap_mask_t mask; |
669 | struct dma_slave_config cfg; | ||
670 | int ret; | ||
677 | 671 | ||
678 | if (!rspi_pd) | 672 | if (!rspi_pd) |
679 | return; | 673 | return 0; /* The driver assumes no error. */ |
680 | 674 | ||
681 | rspi->dma_width_16bit = rspi_pd->dma_width_16bit; | 675 | rspi->dma_width_16bit = rspi_pd->dma_width_16bit; |
682 | 676 | ||
@@ -684,21 +678,35 @@ static void __devinit rspi_request_dma(struct rspi_data *rspi, | |||
684 | if (rspi_pd->dma_rx_id && rspi_pd->dma_tx_id) { | 678 | if (rspi_pd->dma_rx_id && rspi_pd->dma_tx_id) { |
685 | dma_cap_zero(mask); | 679 | dma_cap_zero(mask); |
686 | dma_cap_set(DMA_SLAVE, mask); | 680 | dma_cap_set(DMA_SLAVE, mask); |
687 | rspi->dma_rx.slave_id = rspi_pd->dma_rx_id; | 681 | rspi->chan_rx = dma_request_channel(mask, shdma_chan_filter, |
688 | rspi->chan_rx = dma_request_channel(mask, rspi_filter, | 682 | (void *)rspi_pd->dma_rx_id); |
689 | &rspi->dma_rx); | 683 | if (rspi->chan_rx) { |
690 | if (rspi->chan_rx) | 684 | cfg.slave_id = rspi_pd->dma_rx_id; |
691 | dev_info(&pdev->dev, "Use DMA when rx.\n"); | 685 | cfg.direction = DMA_DEV_TO_MEM; |
686 | ret = dmaengine_slave_config(rspi->chan_rx, &cfg); | ||
687 | if (!ret) | ||
688 | dev_info(&pdev->dev, "Use DMA when rx.\n"); | ||
689 | else | ||
690 | return ret; | ||
691 | } | ||
692 | } | 692 | } |
693 | if (rspi_pd->dma_tx_id) { | 693 | if (rspi_pd->dma_tx_id) { |
694 | dma_cap_zero(mask); | 694 | dma_cap_zero(mask); |
695 | dma_cap_set(DMA_SLAVE, mask); | 695 | dma_cap_set(DMA_SLAVE, mask); |
696 | rspi->dma_tx.slave_id = rspi_pd->dma_tx_id; | 696 | rspi->chan_tx = dma_request_channel(mask, shdma_chan_filter, |
697 | rspi->chan_tx = dma_request_channel(mask, rspi_filter, | 697 | (void *)rspi_pd->dma_tx_id); |
698 | &rspi->dma_tx); | 698 | if (rspi->chan_tx) { |
699 | if (rspi->chan_tx) | 699 | cfg.slave_id = rspi_pd->dma_tx_id; |
700 | dev_info(&pdev->dev, "Use DMA when tx\n"); | 700 | cfg.direction = DMA_MEM_TO_DEV; |
701 | ret = dmaengine_slave_config(rspi->chan_tx, &cfg); | ||
702 | if (!ret) | ||
703 | dev_info(&pdev->dev, "Use DMA when tx\n"); | ||
704 | else | ||
705 | return ret; | ||
706 | } | ||
701 | } | 707 | } |
708 | |||
709 | return 0; | ||
702 | } | 710 | } |
703 | 711 | ||
704 | static void __devexit rspi_release_dma(struct rspi_data *rspi) | 712 | static void __devexit rspi_release_dma(struct rspi_data *rspi) |
@@ -788,7 +796,11 @@ static int __devinit rspi_probe(struct platform_device *pdev) | |||
788 | } | 796 | } |
789 | 797 | ||
790 | rspi->irq = irq; | 798 | rspi->irq = irq; |
791 | rspi_request_dma(rspi, pdev); | 799 | ret = rspi_request_dma(rspi, pdev); |
800 | if (ret < 0) { | ||
801 | dev_err(&pdev->dev, "rspi_request_dma failed.\n"); | ||
802 | goto error4; | ||
803 | } | ||
792 | 804 | ||
793 | ret = spi_register_master(master); | 805 | ret = spi_register_master(master); |
794 | if (ret < 0) { | 806 | if (ret < 0) { |