Custom kernel driver interrupt not being called

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Custom kernel driver interrupt not being called

Jump to solution
1,464 Views
chris_f
Contributor V

I'm writing a custom driver for the ecspi module on an imx6ull. Everything works except my interrupt handler never gets called and I'm struggling to find the problem.

I've taken what look like the right parts from spi-imx.c so the irq handler is installed with:

 irq = platform_get_irq(pdev, 0);
 ret = devm_request_irq(&pdev->dev, irq, spi_slave_isr, 0,
    dev_name(&pdev->dev), spi_data);

/proc/interrupts shows that the interrupt is installed on the right irq number (confirmed by comparison to the spi-imx driver).

I've enabled all of the interrupts in ECSPI0_INTREG. When I write to ECSPI0_TXDATA and set ECSPI0_CONREG_XCH. The SPI module outputs the data correctly (confirmed on the selected pins) so I would expect a TXFIFO empty interrupt but nothing happens.

Is there something obvious that I'm missing? Any tips gratefully received.

(I see that the serial driver calls enable_irq but that's only done during resume to reverse the disable_irq in suspend. Doesn't look like the problem.)

Labels (2)
Tags (2)
0 Kudos
1 Solution
1,266 Views
chris_f
Contributor V

Simple mistake. I was enabling the interrupts (writing ECSPI_INTREG) before enabling the module itself (ECSPI_CONREG:EN=1). Docs do say that "This bit must be set before writing to other registers or initiating an exchange.". RTFM.

View solution in original post

0 Kudos
3 Replies
1,267 Views
chris_f
Contributor V

Simple mistake. I was enabling the interrupts (writing ECSPI_INTREG) before enabling the module itself (ECSPI_CONREG:EN=1). Docs do say that "This bit must be set before writing to other registers or initiating an exchange.". RTFM.

0 Kudos
1,266 Views
igorpadykov
NXP Employee
NXP Employee

Hi chris_f

this can be debugged using existing spi-nor driver described in

Chapter 31 SPI NOR attached Linux Manual and AN4553 Using Open Source

Debugging Tools for Linux on i.MX Processors
http://www.nxp.com/assets/documents/data/en/application-notes/AN4553.pdf

Best regards
igor
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos
1,266 Views
chris_f
Contributor V

Thanks for the suggestion. I'll take a look.

0 Kudos