aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBarry Song <Baohua.Song@csr.com>2014-02-12 11:30:19 -0500
committerMark Brown <broonie@linaro.org>2014-02-23 21:01:14 -0500
commitdd7243d6a5de6faaef30cebc554ce8b39d5a3de5 (patch)
treefd4de158ba0cb99ca47adeb8b9022bef8d2d5acd
parent8c328a262f513c042f97fcd2f2797a6d69fc0773 (diff)
spi: sirf: move to use generic dma dt-binding
sirf-dma driver enabled generic dt binding for dma channels. see here we remove self-defined dma channel prop and move to use generic dma_request_slave_channel. related changes in dts is something like: dmas = <&dmac1 9>, <&dmac1 4>; dma-names = "rx", "tx"; Signed-off-by: Barry Song <Baohua.Song@csr.com> Signed-off-by: Mark Brown <broonie@linaro.org>
-rw-r--r--drivers/spi/spi-sirf.c26
1 files changed, 2 insertions, 24 deletions
diff --git a/drivers/spi/spi-sirf.c b/drivers/spi/spi-sirf.c
index 632d2b5b821f..61e5eafac92c 100644
--- a/drivers/spi/spi-sirf.c
+++ b/drivers/spi/spi-sirf.c
@@ -22,7 +22,6 @@
22#include <linux/dmaengine.h> 22#include <linux/dmaengine.h>
23#include <linux/dma-direction.h> 23#include <linux/dma-direction.h>
24#include <linux/dma-mapping.h> 24#include <linux/dma-mapping.h>
25#include <linux/sirfsoc_dma.h>
26 25
27#define DRIVER_NAME "sirfsoc_spi" 26#define DRIVER_NAME "sirfsoc_spi"
28 27
@@ -539,8 +538,6 @@ static int spi_sirfsoc_probe(struct platform_device *pdev)
539 struct spi_master *master; 538 struct spi_master *master;
540 struct resource *mem_res; 539 struct resource *mem_res;
541 int num_cs, cs_gpio, irq; 540 int num_cs, cs_gpio, irq;
542 u32 rx_dma_ch, tx_dma_ch;
543 dma_cap_mask_t dma_cap_mask;
544 int i; 541 int i;
545 int ret; 542 int ret;
546 543
@@ -551,20 +548,6 @@ static int spi_sirfsoc_probe(struct platform_device *pdev)
551 goto err_cs; 548 goto err_cs;
552 } 549 }
553 550
554 ret = of_property_read_u32(pdev->dev.of_node,
555 "sirf,spi-dma-rx-channel", &rx_dma_ch);
556 if (ret < 0) {
557 dev_err(&pdev->dev, "Unable to get rx dma channel\n");
558 goto err_cs;
559 }
560
561 ret = of_property_read_u32(pdev->dev.of_node,
562 "sirf,spi-dma-tx-channel", &tx_dma_ch);
563 if (ret < 0) {
564 dev_err(&pdev->dev, "Unable to get tx dma channel\n");
565 goto err_cs;
566 }
567
568 master = spi_alloc_master(&pdev->dev, sizeof(*sspi) + sizeof(int) * num_cs); 551 master = spi_alloc_master(&pdev->dev, sizeof(*sspi) + sizeof(int) * num_cs);
569 if (!master) { 552 if (!master) {
570 dev_err(&pdev->dev, "Unable to allocate SPI master\n"); 553 dev_err(&pdev->dev, "Unable to allocate SPI master\n");
@@ -628,18 +611,13 @@ static int spi_sirfsoc_probe(struct platform_device *pdev)
628 sspi->bitbang.master->dev.of_node = pdev->dev.of_node; 611 sspi->bitbang.master->dev.of_node = pdev->dev.of_node;
629 612
630 /* request DMA channels */ 613 /* request DMA channels */
631 dma_cap_zero(dma_cap_mask); 614 sspi->rx_chan = dma_request_slave_channel(&pdev->dev, "rx");
632 dma_cap_set(DMA_INTERLEAVE, dma_cap_mask);
633
634 sspi->rx_chan = dma_request_channel(dma_cap_mask, (dma_filter_fn)sirfsoc_dma_filter_id,
635 (void *)rx_dma_ch);
636 if (!sspi->rx_chan) { 615 if (!sspi->rx_chan) {
637 dev_err(&pdev->dev, "can not allocate rx dma channel\n"); 616 dev_err(&pdev->dev, "can not allocate rx dma channel\n");
638 ret = -ENODEV; 617 ret = -ENODEV;
639 goto free_master; 618 goto free_master;
640 } 619 }
641 sspi->tx_chan = dma_request_channel(dma_cap_mask, (dma_filter_fn)sirfsoc_dma_filter_id, 620 sspi->tx_chan = dma_request_slave_channel(&pdev->dev, "tx");
642 (void *)tx_dma_ch);
643 if (!sspi->tx_chan) { 621 if (!sspi->tx_chan) {
644 dev_err(&pdev->dev, "can not allocate tx dma channel\n"); 622 dev_err(&pdev->dev, "can not allocate tx dma channel\n");
645 ret = -ENODEV; 623 ret = -ENODEV;