AT91SAM9X25 NAND Flash and DMA

Discussion around AT91RM9200 and SAM9 Series Products.

Moderator: nferre

Posts: 1
Joined: Mon Oct 29, 2012 1:08 am

AT91SAM9X25 NAND Flash and DMA

Mon Oct 29, 2012 1:48 am

Hi Folks,

I'm using a custom 9x25 CM module based on AT91SAM9X25-EK. In overall, it's been working quite well but recently I'm observing an issue with NAND flash.

The NAND flash I'm using is Micron's MT29F2G08AAD, which is identical to the one on AT91SAM9X25-EK's CM module. So it's been working well without any driver/kernel modification.

But sometimes, especially under heavy load, the NAND MTD subsystem freezes, and everything that tries to access the NAND blocks forever. After some debugging, I came to a conclusion that the system blocks at "atmel_nand_dma_op() in atmel_nand.c", which means a DMA activity on the NAND flash never completes.

So I tested my nand flash without DMA support and it's been running without any glitch for a few days even under extreme stress.

What's more interesting is the DMA support for NAND flash for 9X5 series CPU has been removed from a seemingly more recent atmel nand driver. (please take a look at cpu_has_dma(), ... mel_nand.c).

So my question is
a) Has anyone had a similar issues with NAND flash in 9X5 sereis?
b) Am I not supposed to use DMA on the NAND flash in 9X5 series? I just wanna make sure I'm on the right path.

Thanks in advance, folks,

Posts: 15
Joined: Tue May 17, 2011 8:33 pm

Re: AT91SAM9X25 NAND Flash and DMA

Tue Nov 13, 2012 3:15 am

In my experience it is quite dangerous to treat the Atmel drivers as "black boxes". They are useful as examples but that is it really. Many of the drivers are not built for concurrency and some contains bugs. A careful inspection of the drivers (or perhaps even a re-write) could perhaps provide you with the insight needed to fix the problem.
Posts: 1
Joined: Thu Feb 04, 2016 5:48 pm

Re: AT91SAM9X25 NAND Flash and DMA

Thu Feb 04, 2016 7:46 pm

I have the problem like this (also custom board with MT29F2G08), but in my case the problem only when intensive write to MT29F2G08. After write (~200-~3000 pages), AT91SAM9X25 go down, and wathdog reboot it. It down after call atmel_write_buf(,,2048) function in the atmel_nand_pmecc_write_page function. I has been disable DMA, but it still down after write few hundred pages.

I made little change in the functions:

Code: Select all

static void atmel_write_buf(struct mtd_info *mtd, const u8 *buf, int len)
	u8  __iomem * daddr;
	u32 align;
	if (use_dma) // && len > mtd->oobsize)
		/* only use DMA for bigger than oob size: better performances */
		if (atmel_nand_dma_op(mtd, (void *)buf, len, 0) == 0)
	/* if no DMA operation possible, use PIO */
	pbuf = buf;
	 daddr=(u8  __iomem*) ((struct nand_chip *)mtd->priv)->IO_ADDR_W;
	   *daddr = *pbuf++;


Write to GPBR to detect the point when it down... Usually it is down after function, but I have few times when it down inside.

May be somebody know this problem, or any idea what to do?

Return to “SAM9 ARM9 MPU”

Who is online

Users browsing this forum: Yahoo [Bot] and 3 guests