Commit 057e1ae7 authored by Mark Brown's avatar Mark Brown

spi: dw: DW SPI DMA Driver updates

Merge series from Joy Chakraborty <joychakr@google.com>:

This Patch series adds support for 32 bits per word trasfers using DMA
and some defensive checks around dma controller capabilities.
parents dd69654c d2ae5d42
...@@ -198,6 +198,20 @@ static irqreturn_t dw_spi_dma_transfer_handler(struct dw_spi *dws) ...@@ -198,6 +198,20 @@ static irqreturn_t dw_spi_dma_transfer_handler(struct dw_spi *dws)
return IRQ_HANDLED; return IRQ_HANDLED;
} }
static enum dma_slave_buswidth dw_spi_dma_convert_width(u8 n_bytes)
{
switch (n_bytes) {
case 1:
return DMA_SLAVE_BUSWIDTH_1_BYTE;
case 2:
return DMA_SLAVE_BUSWIDTH_2_BYTES;
case 4:
return DMA_SLAVE_BUSWIDTH_4_BYTES;
default:
return DMA_SLAVE_BUSWIDTH_UNDEFINED;
}
}
static bool dw_spi_can_dma(struct spi_controller *master, static bool dw_spi_can_dma(struct spi_controller *master,
struct spi_device *spi, struct spi_transfer *xfer) struct spi_device *spi, struct spi_transfer *xfer)
{ {
...@@ -206,16 +220,6 @@ static bool dw_spi_can_dma(struct spi_controller *master, ...@@ -206,16 +220,6 @@ static bool dw_spi_can_dma(struct spi_controller *master,
return xfer->len > dws->fifo_len; return xfer->len > dws->fifo_len;
} }
static enum dma_slave_buswidth dw_spi_dma_convert_width(u8 n_bytes)
{
if (n_bytes == 1)
return DMA_SLAVE_BUSWIDTH_1_BYTE;
else if (n_bytes == 2)
return DMA_SLAVE_BUSWIDTH_2_BYTES;
return DMA_SLAVE_BUSWIDTH_UNDEFINED;
}
static int dw_spi_dma_wait(struct dw_spi *dws, unsigned int len, u32 speed) static int dw_spi_dma_wait(struct dw_spi *dws, unsigned int len, u32 speed)
{ {
unsigned long long ms; unsigned long long ms;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment