/* If the other done */
if (!(dws->state & TXBUSY))
{
- complete(&dws->xfer_completion);
- DBG_SPI("%s:complete\n", __FUNCTION__);
//DMA could not lose intterupt
dw_spi_xfer_done(dws);
+ complete(&dws->xfer_completion);
+ DBG_SPI("%s:complete\n", __FUNCTION__);
}
}
spin_unlock_irqrestore(&dws->lock, flags);
/* If the other done */
- if (!(dws->state & RXBUSY))
+ if (!(dws->state & RXBUSY))
{
- complete(&dws->xfer_completion);
- DBG_SPI("%s:complete\n", __FUNCTION__);
-
//DMA could not lose intterupt
dw_spi_xfer_done(dws);
+ complete(&dws->xfer_completion);
+ DBG_SPI("%s:complete\n", __FUNCTION__);
}
}
/* 2. Prepare the TX dma transfer */
txconf.direction = DMA_MEM_TO_DEV;
txconf.dst_addr = dws->tx_dma_addr;
- txconf.dst_maxburst = dws->dma_width;
+ txconf.dst_maxburst = dws->dmatdlr;//dws->dma_width;
//txconf.src_addr_width = width;
txconf.dst_addr_width = width;
//txconf.device_fc = false;
memset(&dws->tx_sgl, 0, sizeof(dws->tx_sgl));
dws->tx_sgl.dma_address = dws->tx_dma;
+#ifdef CONFIG_NEED_SG_DMA_LENGTH
+ dws->tx_sgl.dma_length = dws->len;
+#else
dws->tx_sgl.length = dws->len;
-
+#endif
txdesc = dmaengine_prep_slave_sg(txchan,
&dws->tx_sgl,
1,
txdesc->callback = dw_spi_dma_txcb;
txdesc->callback_param = dws;
- DBG_SPI("%s:dst_addr=0x%p,tx_dma=0x%p,len=%d,burst=%d,width=%d\n",__func__,(int *)dws->tx_dma_addr, (int *)dws->tx_dma, dws->len,dws->dma_width, width);
+ DBG_SPI("%s:dst_addr=0x%p,tx_dma=0x%p,len=%ld,burst=%d,width=%d\n"
+ ,__func__,(int *)dws->tx_dma_addr, (int *)dws->tx_dma, (long)dws->len,txconf.dst_maxburst, width);
}
if (dws->rx)
/* 3. Prepare the RX dma transfer */
rxconf.direction = DMA_DEV_TO_MEM;
rxconf.src_addr = dws->rx_dma_addr;
- rxconf.src_maxburst = dws->dma_width;
+ rxconf.src_maxburst = dws->dmardlr + 1;//dws->dma_width;
//rxconf.dst_addr_width = width;
rxconf.src_addr_width = width;
//rxconf.device_fc = false;
memset(&dws->rx_sgl, 0, sizeof(dws->rx_sgl));
dws->rx_sgl.dma_address = dws->rx_dma;
- dws->rx_sgl.length = dws->len;
+#ifdef CONFIG_NEED_SG_DMA_LENGTH
+ dws->rx_sgl.dma_length = dws->len;
+#else
+ dws->rx_sgl.length = dws->len;
+#endif
rxdesc = dmaengine_prep_slave_sg(rxchan,
&dws->rx_sgl,
rxdesc->callback = dw_spi_dma_rxcb;
rxdesc->callback_param = dws;
- DBG_SPI("%s:src_addr=0x%p,rx_dma=0x%p,len=%d,burst=%d,width=%d\n",__func__, (int *)dws->rx_dma_addr, (int *)dws->rx_dma, dws->len, dws->dma_width, width);
+ DBG_SPI("%s:src_addr=0x%p,rx_dma=0x%p,len=%ld,burst=%d,width=%d\n"
+ ,__func__, (int *)dws->rx_dma_addr, (int *)dws->rx_dma, (long)dws->len, rxconf.src_maxburst, width);
}
+
+ if(!dws->tx)
+ spi_enable_chip(dws, 1);
/* rx must be started before tx due to spi instinct */
if (dws->rx)