Hi Lenka,
We use original codebase as below to init sdma. Would you please advise which registers are DMA word and DMA watermark as you mentioned?
If single burst is 8 bits, DMA works fine.
If single burst equals to data length*8bits, the return data are as below (many 00 and ff)
==code to init sdma==
static int spi_imx_sdma_init(struct device *dev, struct spi_imx_data *spi_imx,
struct spi_master *master)
{
int ret;
int fifosize = spi_imx_get_fifosize(spi_imx);
spi_imx->wml = fifosize / 2;
/* Prepare for TX DMA: */
master->dma_tx = dma_request_slave_channel_reason(dev, "tx");
if (IS_ERR(master->dma_tx)) {
ret = PTR_ERR(master->dma_tx);
master->dma_tx = NULL;
if (ret == -EPROBE_DEFER)
return ret;
dev_err(dev, "can't get the TX DMA channel, error %d!\n", ret);
return ret;
}
spi_imx->tx_config.direction = DMA_MEM_TO_DEV;
spi_imx->tx_config.dst_addr = spi_imx->base_phys + MXC_CSPITXDATA;
spi_imx->tx_config.dst_maxburst = (!cspi_quirk(spi_imx, QUIRK_ERR009165) ||
(spi_imx->speed_hz > 40000000)) ? spi_imx->wml : fifosize;
//pr_err(">>>>>>>>>>>>> %s: tx maxburst %d\n", __func__, spi_imx->tx_config.dst_maxburst); // print out 32
/* Prepare for RX : */
master->dma_rx = dma_request_slave_channel_reason(dev, "rx");
if (IS_ERR(master->dma_rx)) {
ret = PTR_ERR(master->dma_rx);
dev_dbg(dev, "can't get the RX DMA channel, error %d\n", ret);
master->dma_rx = NULL;
goto err;
}
spi_imx->rx_config.direction = DMA_DEV_TO_MEM;
spi_imx->rx_config.src_addr = spi_imx->base_phys + MXC_CSPIRXDATA;
spi_imx->rx_config.src_maxburst = spi_imx->wml;
init_completion(&spi_imx->dma_rx_completion);
init_completion(&spi_imx->dma_tx_completion);
master->can_dma = spi_imx_can_dma;
master->max_dma_len = MAX_SDMA_BD_BYTES;
spi_imx->bitbang.master->flags = SPI_MASTER_MUST_RX |
SPI_MASTER_MUST_TX;
//pr_err(">>>>>>>>>>>>> %s: rx maxburst %d, master->max_dma_len %d\n", __func__, spi_imx->rx_config.src_maxburst, master->max_dma_len); // print out 32, 32768
/*
* I have no idea why this is needed, but a dma error
* happens on 1st dma without it
*/
spi_imx->tx_config.dst_addr_width = DMA_SLAVE_BUSWIDTH_1_BYTE;
ret = dmaengine_slave_config(spi_imx->bitbang.master->dma_tx,
&spi_imx->tx_config);
if (ret) {
dev_err(spi_imx->dev, "error(%d) in TX dma configuration.\n", ret);
goto err;
}
return 0;
err:
spi_imx_sdma_exit(spi_imx);
return ret;
}
==return data==
rxskb 00 00 01 00 00 00 00 00 00 00 00 00 00 00 00 00
rxskb 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
rxskb 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
rxskb 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
rxskb 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
rxskb 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
rxskb 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
rxskb 00 00 00 00 00 00 00 00 00 00 00 e5 ff ff ff ff
rxskb ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
rxskb ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
rxskb ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
rxskb ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
rxskb ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
rxskb ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
rxskb ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff