How Can I use EDMA in DM365 SPI ?
I tyied ,but failed.
1./arch/arm/math-davinci/davinci-spi-platform.c
static struct resource dm3xx_spi_resources[] = {
[0] = {
.start = DM3XX_SPI0_BASE,
.end = DM3XX_SPI0_BASE + (SZ_4K/2) - 1,
.flags = IORESOURCE_MEM,
},
[1] = {
.start = IRQ_DM3XX_SPINT0_0,
.end = IRQ_DM3XX_SPINT0_0,
.flags = IORESOURCE_IRQ,
},
[2] = {
.start = DM365_DMA_SPI0REVT,
.end = DM365_DMA_SPI0REVT,
.flags = IORESOURCE_DMA | IORESOURCE_DMA_RX_CHAN,
},
[3] = {
.start = DM365_DMA_SPI0XEVT,
.end = DM365_DMA_SPI0XEVT,
.flags = IORESOURCE_DMA | IORESOURCE_DMA_TX_CHAN,
},
[4] = {
.start = EVENTQ_3,
.end = EVENTQ_3,
.flags = IORESOURCE_DMA | IORESOURCE_DMA_EVENT_Q,
},
};
2. I wrote a user program to read the eeprom
#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
#include <fcntl.h>
int main(){
int eepromfd;
unsigned char loop;
unsigned char data[16];
eepromfd = open("/dev/mtd5",O_RDWR );
if(eepromfd == -1){
printf("cannot open mtd5\n");
return -1;
}
printf("fd is %d\n",eepromfd);
printf("No of Bytes Read = %d\n",read(eepromfd,data,16));
for(loop=0;loop<16;loop++){
if((loop%8)==0){
printf("\n");
}
printf("%02X ",data[loop]);
}
printf("\n");
close(eepromfd);
return 0;
If I do not change dm3xx_spi_resources[] (do not use dma),I can work with the EEPROM well.
But if I change dm3xx_spi_resources[] ( use dma), I can not work with the EEPROM.
The software can not go into davinci_spi_dma_tx_callback() or davinci_spi_dma_rx_callback() in /drivers/spi/davinci_spi_master.c
What can I do to use DMA in DM365 SPI?