Writing software for undocumented hardware is always fun;) A
patch series has been submitted to the MMC and SH Linux kernel lists, adding the DMA capability to the SDHI SD-card host driver, found on various SuperH and sh-mobile ARM SoCs. The SDHI driver consists of a multi-function device (MFD) glue driver and uses the tmio_mmc SD/MMC driver at the bottom level. The tmio_mmc driver is also used by several other MFD drivers. Fortunately, the SuperH DMA driver uses the kernel standard dmaengine API, so, adding support for it to tmio_mmc didn't make this driver platform-dependent. Unfortunately, I have only been able to make DMA work with SDHI by using both DMA and additional SDHI interrupts, which normally shouldn't be necessary with DMA. Usually, once the DMA operation has completed, the next one can be submitted for execution. However, this isn't the case with SDHI: here, after receiving a DMA completion event, you have to first wait for an additional interrupt from SDHI, signaling, that the interface is ready for the next IO operation. Only then you can safely submit the next DMA request. This, of course, slows data transfers down, but shouldn't add significant CPU load, because the overhead of setting up a new IRQ and handling it is minimal. I still have to benchmark SDHI performance in DMA and PIO modes, once done, I'll update this post. In yet another
patch I also added SDHI DMA support to an sh-mobile ARM platform.