]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commit
atmel_spi: fix hang due to missed interrupt
authorGerard Kam <gerardk5@verizon.net>
Mon, 4 Aug 2008 20:41:12 +0000 (13:41 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Mon, 4 Aug 2008 23:58:45 +0000 (16:58 -0700)
commitdc329442b9fd365bec95718013586c07ff600c34
treef965829f4421afd65932ad0782502b9583037b39
parent5aa6cf302c2758702348aab7457e516d3a5121b9
atmel_spi: fix hang due to missed interrupt

For some time my at91sam9260 board with JFFS2 on serial flash (m25p80)
would hang when accessing the serial flash and SPI bus.  Slowing the SPI
clock down to 9 MHz reduced the occurrence of the hang from "always"
during boot to a nuisance level that allowed other SW development to
continue.  Finally had to address this issue when an application stresses
the I/O to always cause a hang.

Hang seems to be caused by a missed SPI interrupt, so that the task ends
up waiting forever after calling spi_sync().  The fix has 2 parts.  First
is to halt the DMA engine before the "current" PDC registers are loaded.
This ensures that the "next" registers are loaded before the DMA operation
takes off.  The second part of the fix is a kludge that adds a
"completion" interrupt in case the ENDRX interrupt for the last segment of
the DMA chaining operation was missed.

The patch allows the SPI clock for the serial flash to be increased from 9
MHz to 15 MHz (or more?).  No hangs or SPI overruns were encountered.

Haavard: while this patch does indeed improve things, I still see overruns
and CRC errors on my NGW100 board when running the DataFlash at 10 MHz.
However, I think some improvement is better than nothing, so I'm passing
this on for inclusion in 2.6.27.

Signed-off-by: Gerard Kam <gerardk5@verizon.net>
Signed-off-by: Haavard Skinnemoen <haavard.skinnemoen@atmel.com>
Cc: David Brownell <david-b@pacbell.net>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
drivers/spi/atmel_spi.c