How to use DMA mode in SPI transfer for HiKey960?


#1

Timing is critical in my SPI transfer and the inter-byte delay during SPI transfer is quit large sometimes.
After debugging spi-pl022.c, it seems that it used polling mode for SPI transfer in default setting.
I tried to change “com_mode” setting to DMA_TRANSFER but failed.
Might I know how to use DMA mode for SPI transfer correctly in HiKey960? Thanks in advance!


#2

Hi @alanlissl, from previous experience I learned the lesson, I suggest you could summary the detailed info for the issue, like debugging log, register setting, the reproduce method, etc; and you could file a bug in the bug tracking file system: bugs.96boards.org; so this is best way to follow bugs and issues from landing team and Hisilicon.


#3

when I google the DMA SPI mode in hi6220, I found the below info.

It seems that hi6220 used K3-DMA driver for DMA SPI mode but it was not enable in hikey960 (i.e. hi3660) by default. Do I need to use K3-DMA driver again on hi3660 for activating DMA SPI mode? If yes, what is the channel number for SPI RX/TX DMA?


#4

I cannot find any info for DMA channel used for SPI port, so file a bug for tracking this: https://bugs.96boards.org/show_bug.cgi?id=555


#5

Hi,

I am trying to enable DMA_Mode for SPI transfer. I see there is a config option CONFIG_DMA_ENGINE. And .com_mode in pl022_default_chip_info in spi-pl022.c can be set to DMA_TRANSFER. Besides these changes, do I need to add any device tree entry?

I really appreciate if someone can help.

Thanks!


#6

Hi @guodong,

From the bug (https://bugs.96boards.org/show_bug.cgi?id=555), I understand that there were some dma-related changes that were going to be upstreamed. Did that happed? Could you point to the changes that I can try?

Thank you!