TMDS64EVM: Using DMA transfer on GPMC

Part Number: TMDS64EVM

Tool/software:

Hello, 

I'm using GPMC to read an external NAND memory.

My dts file is as follows:

&gpmc0 {
	status = "okay";
	pinctrl-names = "default";
	pinctrl-0 = <&mygpmc1_pins_default>;
	#address-cells = <2>;
	#size-cells = <1>;
	ranges = <2 0 0x00 0x50000000 0x1000000>; /* CS2 @addr 0x50000000, size 0x1000000 */
	
	nand@2,0 {
		compatible = "ti, am64-nand";
		reg = <2 0 0x100>; //cs2
		bank-width = <2>;
		nand-bus-width = <16>;
		
		gpmc,mux-add-data = <2>; // 2 for address-data multiplexing mode.
		gpmc,cs-on-ns = <0>;
		gpmc,cs-rd-off-ns = <190>;
		gpmc,cs-wr-off-ns = <190>; 
		gpmc,adv-on-ns = <0>;
		gpmc,adv-rd-off-ns = <40>;
		gpmc,adv-wr-off-ns = <40>;
		gpmc,oe-on-ns = <80>;
		gpmc,oe-off-ns = <190>;
		gpmc,we-on-ns = <80>;
		gpmc,we-off-ns = <170>;
		gpmc,rd-cycle-ns = <190>;
		gpmc,wr-cycle-ns = <190>;
		gpmc,access-ns = <150>;
		gpmc,page-burst-access-ns = <6>;
		gpmc,bus-turnaround-ns = <12>;
		gpmc,cycle2cycle-delay-ns = <20>;
		gpmc,wr-data-mux-bus-ns = <90>;
		gpmc,wr-access-ns = <190>;
		gpmc,cycle2cycle-samecsen;
		gpmc,cycle2cycle-diffcsen;
	};
}

Using memcpy in my code to read the memory, this part seems to work fine.

I was wondering how I should implement the DMA transfer in order to speed up the reading of my memory.

Is adding  the following line in the dts file sufficient? 

		ti,nand-xfer-type = "prefetch-dma";

By adding that line, the CPU load appears to be the same, and I was hoping that this load would decrease with the use of DMA transfer.

Is there any example of DMA implementation on GPMC for an AM64 processor?

Best regards, 

Julien

  • Hi Julien,

    The kernel dmaegine has an API dmaengine_prep_dma_memcpy() which can be used to setup a DMA channel for memcpy. You might try it to replace the CPU memcpy.

    You can use kernel driver - drivers/mtd/nand/onenand/onenand_omap2.c, or drivers/spi/spi-cadence-quadspi.c as an example.