Hi all, I am trying to fix a bug about full duplex DMA transfer for SPI controller hang on ti-omapl138 ref borad. I read the DMA setting code of davinci SPI controller. It's in drivers/spi/davinci_spi.c:davinci_spi_bufs_dma(). There is a code snippet which I don't understand. List below:
-------------------------------------------------------------------------------- if (t->tx_buf) { t->tx_dma = dma_map_single(&spi->dev, (void *)t->tx_buf, count, DMA_TO_DEVICE); if (dma_mapping_error(&spi->dev, t->tx_dma)) { dev_dbg(sdev, "Unable to DMA map a %d bytes" " TX buffer\n", count); return -ENOMEM; } temp_count = count; } else { /* We need TX clocking for RX transaction */ t->tx_dma = dma_map_single(&spi->dev, (void *)davinci_spi->tmp_buf, count + 1, DMA_TO_DEVICE); if (dma_mapping_error(&spi->dev, t->tx_dma)) { dev_dbg(sdev, "Unable to DMA map a %d bytes" " TX tmp buffer\n", count); return -ENOMEM; } temp_count = count + 1; } ---------------------------------------------------------------------------------- My question is why the transfer count in else logic is count+1 but in if logic it's only count? When I changed it from count+1 to count and use a test program to read a spi flash, I found the DMA rx interrupt can not be triggered. The test program hung for ever. Would anybody have any idea about this? Thanks. _______________________________________________ Davinci-linux-open-source mailing list Davinci-linux-open-source@linux.davincidsp.com http://linux.davincidsp.com/mailman/listinfo/davinci-linux-open-source