A customer is facing issues in using SPI and SD card simultaneously.
Please find the attached code and observations observed by the team.
1. SPI NOR Read Write
Pre-requisite: SPI NOR with DMA burst Len = 64*32, Exchange Count = 64. Logging in "SDMemory".
Operation: A. Read/write operations on SPINOR and log messages stored in SDMemory.
B. From file manager copy file >100KB file to SDMemory.
Result: SPI DMA Communication Failed, Not able to access SDMemory and got hanged.
2. SPI NOR Read Write
Pre-requisite: SPI NOR without DMA (ECSPI_Test32bit.cpp line no. 159 buscnfg.usedma = FALSE) burst Len = 64*32, Exchange Count = 64. Logging in "SDMemory".
Operation: A. Read/write operations on SPINOR and log messages stored in SDMemory.
B. From file manager copy file >100KB file to SDMemory.
Result: Works Fine. No Hang.
3. SPI NOR Read Write
Pre-requisite: SPI NOR with DMA burst Len = 64*32, Exchange Count = 64. Logging in "Hard Disk"
Operation: A. Read/write operations on SPINOR and log messages stored in "Hard Disk"(USB stick).
B. From file manager copy file >100KB file to SDMemory.
Result: Works Fine. No Hang.
In default, SD driver only uses ADMA, and by default our eCSPI driver uses non-DMA mode, so we didn't see any issue during our test.
However, we found that :
When eCSPI enables DMA mode, eCSPI uses DMA, but does not use the DMA channel interrupt. While ISR will still report eCSPI DMA channel irq number, and an improper sysintr number is mapped which is the exact SDHC1 sysintr, then OS disables SDHC1 irq interrupt by OEMInterruptDisable( ), so SDHC1 does not work.
The fix is to register eCSPI TX/RX DMA channels sysintr numbers to avoid such conflict.
Please refer to attachment