Skip to content

Commit

Permalink
spi/ep93xx: add DMA support
Browse files Browse the repository at this point in the history
This patch adds DMA support for the EP93xx SPI driver. By default the DMA is
not enabled but it can be enabled by setting ep93xx_spi_info.use_dma to true
in board configuration file.

Note that the SPI driver still uses PIO for small transfers (<= 8 bytes) for
performance reasons.

Signed-off-by: Mika Westerberg <mika.westerberg@iki.fi>
Acked-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Acked-by: Vinod Koul <vinod.koul@intel.com>
Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
  • Loading branch information
Mika Westerberg authored and Grant Likely committed Jun 8, 2011
1 parent 71cebd7 commit 626a96d
Show file tree
Hide file tree
Showing 4 changed files with 308 additions and 13 deletions.
10 changes: 10 additions & 0 deletions Documentation/spi/ep93xx_spi
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,16 @@ static void __init ts72xx_init_machine(void)
ARRAY_SIZE(ts72xx_spi_devices));
}

The driver can use DMA for the transfers also. In this case ts72xx_spi_info
becomes:

static struct ep93xx_spi_info ts72xx_spi_info = {
.num_chipselect = ARRAY_SIZE(ts72xx_spi_devices),
.use_dma = true;
};

Note that CONFIG_EP93XX_DMA should be enabled as well.

Thanks to
=========
Martin Guy, H. Hartley Sweeten and others who helped me during development of
Expand Down
6 changes: 5 additions & 1 deletion arch/arm/mach-ep93xx/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -488,11 +488,15 @@ static struct resource ep93xx_spi_resources[] = {
},
};

static u64 ep93xx_spi_dma_mask = DMA_BIT_MASK(32);

static struct platform_device ep93xx_spi_device = {
.name = "ep93xx-spi",
.id = 0,
.dev = {
.platform_data = &ep93xx_spi_master_data,
.platform_data = &ep93xx_spi_master_data,
.coherent_dma_mask = DMA_BIT_MASK(32),
.dma_mask = &ep93xx_spi_dma_mask,
},
.num_resources = ARRAY_SIZE(ep93xx_spi_resources),
.resource = ep93xx_spi_resources,
Expand Down
2 changes: 2 additions & 0 deletions arch/arm/mach-ep93xx/include/mach/ep93xx_spi.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,11 @@ struct spi_device;
* struct ep93xx_spi_info - EP93xx specific SPI descriptor
* @num_chipselect: number of chip selects on this board, must be
* at least one
* @use_dma: use DMA for the transfers
*/
struct ep93xx_spi_info {
int num_chipselect;
bool use_dma;
};

/**
Expand Down
Loading

0 comments on commit 626a96d

Please sign in to comment.