@@ -793,6 +793,7 @@ static void omap2_mcspi_work(struct work_struct *work)
int par_override = 0;
int status = 0;
u32 chconf;
+ u32 dma_min_bytes = DMA_MIN_BYTES;
m = container_of(mcspi->msg_queue.next, struct spi_message,
queue);
@@ -803,6 +804,9 @@ static void omap2_mcspi_work(struct work_struct *work)
spi = m->spi;
cs = spi->controller_state;
+ if (spi->dma_min_bytes)
+ dma_min_bytes = spi->dma_min_bytes;
+
omap2_mcspi_set_enable(spi, 1);
list_for_each_entry(t, &m->transfers, transfer_list) {
if (t->tx_buf == NULL && t->rx_buf == NULL && t->len) {
@@ -839,7 +843,7 @@ static void omap2_mcspi_work(struct work_struct *work)
__raw_writel(0, cs->base
+ OMAP2_MCSPI_TX0);
- if (m->is_dma_mapped || t->len >= DMA_MIN_BYTES)
+ if (m->is_dma_mapped || t->len >= dma_min_bytes)
count = omap2_mcspi_txrx_dma(spi, t);
else
count = omap2_mcspi_txrx_pio(spi, t);
@@ -889,6 +893,7 @@ static int omap2_mcspi_transfer(struct spi_device *spi, struct spi_message *m)
struct omap2_mcspi *mcspi;
unsigned long flags;
struct spi_transfer *t;
+ u32 dma_min_bytes;
m->actual_length = 0;
m->status = 0;
@@ -896,6 +901,9 @@ static int omap2_mcspi_transfer(struct spi_device *spi, struct spi_message *m)
/* reject invalid messages and transfers */
if (list_empty(&m->transfers) || !m->complete)
return -EINVAL;
+
+ dma_min_bytes = spi->dma_min_bytes ? spi->dma_min_bytes : DMA_MIN_BYTES;
+
list_for_each_entry(t, &m->transfers, transfer_list) {
const void *tx_buf = t->tx_buf;
void *rx_buf = t->rx_buf;
@@ -921,7 +929,7 @@ static int omap2_mcspi_transfer(struct spi_device *spi, struct spi_message *m)
return -EINVAL;
}
- if (m->is_dma_mapped || len < DMA_MIN_BYTES)
+ if (m->is_dma_mapped || len < dma_min_bytes)
continue;
/* Do DMA mapping "early" for better error reporting and