]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
davinci: spi: move event queue parameter to platform data
authorMichael Williamson <michael.williamson@criticallink.com>
Tue, 8 Feb 2011 12:59:55 +0000 (07:59 -0500)
committerKevin Hilman <khilman@ti.com>
Mon, 28 Feb 2011 22:53:29 +0000 (14:53 -0800)
For DMA operation, the davinci spi driver needs an event queue number.
Currently, this number is passed as a IORESOURCE_DMA.  This is not
correct, as the event queue is not a DMA channel.  Pass the event queue
via the platform data structure instead.

On dm355 and dm365, move the eventq assignment for spi0 out of resources
array and into platform data.

Signed-off-by: Michael Williamson <michael.williamson@criticallink.com>
Acked-by: Sekhar Nori <nsekhar@ti.com>
Acked-by: Grant Likely <grant.likely@secretlab.ca>
Signed-off-by: Kevin Hilman <khilman@ti.com>
arch/arm/mach-davinci/dm355.c
arch/arm/mach-davinci/dm365.c
arch/arm/mach-davinci/include/mach/spi.h
drivers/spi/davinci_spi.c

index a5f8a80c1f281112513a404eebbed824e9360dd2..76364d1345df3fe24ec23dd26a75746211b3cbb0 100644 (file)
@@ -403,16 +403,13 @@ static struct resource dm355_spi0_resources[] = {
                .start = 16,
                .flags = IORESOURCE_DMA,
        },
-       {
-               .start = EVENTQ_1,
-               .flags = IORESOURCE_DMA,
-       },
 };
 
 static struct davinci_spi_platform_data dm355_spi0_pdata = {
        .version        = SPI_VERSION_1,
        .num_chipselect = 2,
        .cshold_bug     = true,
+       .dma_event_q    = EVENTQ_1,
 };
 static struct platform_device dm355_spi0_device = {
        .name = "spi_davinci",
index 02d2cc380df730bec88fb6fe428da6dac2c0139f..4604e72d7d9947bce4263d7c52b72e66e7620018 100644 (file)
@@ -625,6 +625,7 @@ static u64 dm365_spi0_dma_mask = DMA_BIT_MASK(32);
 static struct davinci_spi_platform_data dm365_spi0_pdata = {
        .version        = SPI_VERSION_1,
        .num_chipselect = 2,
+       .dma_event_q    = EVENTQ_3,
 };
 
 static struct resource dm365_spi0_resources[] = {
@@ -645,10 +646,6 @@ static struct resource dm365_spi0_resources[] = {
                .start = 16,
                .flags = IORESOURCE_DMA,
        },
-       {
-               .start = EVENTQ_3,
-               .flags = IORESOURCE_DMA,
-       },
 };
 
 static struct platform_device dm365_spi0_device = {
index 38f4da5ca135cfa32adeda31fc29bd27e04d8405..7af305b3786886ff5059fdccac2a45a92bc42fa4 100644 (file)
@@ -19,6 +19,8 @@
 #ifndef __ARCH_ARM_DAVINCI_SPI_H
 #define __ARCH_ARM_DAVINCI_SPI_H
 
+#include <mach/edma.h>
+
 #define SPI_INTERN_CS  0xFF
 
 enum {
@@ -39,13 +41,16 @@ enum {
  *             to populate if all chip-selects are internal.
  * @cshold_bug:        set this to true if the SPI controller on your chip requires
  *             a write to CSHOLD bit in between transfers (like in DM355).
+ * @dma_event_q: DMA event queue to use if SPI_IO_TYPE_DMA is used for any
+ *             device on the bus.
  */
 struct davinci_spi_platform_data {
-       u8      version;
-       u8      num_chipselect;
-       u8      intr_line;
-       u8      *chip_sel;
-       bool    cshold_bug;
+       u8                      version;
+       u8                      num_chipselect;
+       u8                      intr_line;
+       u8                      *chip_sel;
+       bool                    cshold_bug;
+       enum dma_event_q        dma_event_q;
 };
 
 /**
index 6beab99bf95b82ceacada96d20117678995eeded..166a879fd9e8d3fe017882e258221d74d79f8fa2 100644 (file)
@@ -790,7 +790,6 @@ static int davinci_spi_probe(struct platform_device *pdev)
        struct resource *r, *mem;
        resource_size_t dma_rx_chan = SPI_NO_RESOURCE;
        resource_size_t dma_tx_chan = SPI_NO_RESOURCE;
-       resource_size_t dma_eventq = SPI_NO_RESOURCE;
        int i = 0, ret = 0;
        u32 spipc0;
 
@@ -878,17 +877,13 @@ static int davinci_spi_probe(struct platform_device *pdev)
        r = platform_get_resource(pdev, IORESOURCE_DMA, 1);
        if (r)
                dma_tx_chan = r->start;
-       r = platform_get_resource(pdev, IORESOURCE_DMA, 2);
-       if (r)
-               dma_eventq = r->start;
 
        dspi->bitbang.txrx_bufs = davinci_spi_bufs;
        if (dma_rx_chan != SPI_NO_RESOURCE &&
-           dma_tx_chan != SPI_NO_RESOURCE &&
-           dma_eventq != SPI_NO_RESOURCE) {
+           dma_tx_chan != SPI_NO_RESOURCE) {
                dspi->dma.rx_channel = dma_rx_chan;
                dspi->dma.tx_channel = dma_tx_chan;
-               dspi->dma.eventq = dma_eventq;
+               dspi->dma.eventq = pdata->dma_event_q;
 
                ret = davinci_spi_request_dma(dspi);
                if (ret)
@@ -897,7 +892,7 @@ static int davinci_spi_probe(struct platform_device *pdev)
                dev_info(&pdev->dev, "DMA: supported\n");
                dev_info(&pdev->dev, "DMA: RX channel: %d, TX channel: %d, "
                                "event queue: %d\n", dma_rx_chan, dma_tx_chan,
-                               dma_eventq);
+                               pdata->dma_event_q);
        }
 
        dspi->get_rx = davinci_spi_rx_buf_u8;