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) ?