0

I'm working on a project which includes an imx28 from freescale and linux 2.6.35. To communicate with an external peripheral (EXAR xr20m1280), I need to write a kernel driver which use the SPI bus.

This component is a bridge SPI <-> fast UART (16Mbit/s) and the difficulty in the development of the driver is to read the data enough fast to avoid overwriting. During the test I saw some issues because an interruption is process when I read the data.

I know that it's not a good idea to disable an interruption but I don't find another solution. But to program this with the most elegant way, I have some questions :

  • is it the best way to use disable_irq() and enable_irq() ? I tryed spinlock_irqsave() but that crashs the system.
  • is there a structure (or something like that) in kernel space where I can read all the enabled interruptions ?
  • If not, is there a solution to create a generic driver (without the number of the interruption in the driver code) ?
vic2gre
  • 1
  • 1
  • You may consider a [*FIQ*](http://stackoverflow.com/questions/973933/what-is-the-difference-between-fiq-and-irq-interrupt-system), [Accessing FIQ data](http://stackoverflow.com/questions/18690715/accessing-kernel-driver-data-from-fiq-interrupt-handler-failing), [Critical timing on imx28](http://stackoverflow.com/questions/17115082/critical-timing-in-an-arm-linux-kernel-driver). The **ARM** has a global enable. See `arch_local_irq_enable` and `arch_local_irq_disable` in in [*irqflag.h*](https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/arch/arm/include/asm/irqflags.h#n73). – artless noise Jul 08 '14 at 15:39
  • *"...read the data enough fast to avoid **overwriting**"* -- Don't you mean "overrun"? "Read" and "write" operations are usually from the the perspective of the CPU. Are you using PIO to read the SPI data? Have you tried DMA chaining? – sawdust Jul 08 '14 at 20:32
  • @sawdust DMA is not supported in 2.6.35; you need at least 3.0+ to get the SDMA support. I think [Sascha Hauer wrote it](https://lkml.org/lkml/2012/1/9/85). I guess he can try to port the patches. – artless noise Jul 09 '14 at 15:05

0 Answers0