Panic in spi driver
Thomas Skibo
thomasskibo at yahoo.com
Sun Mar 4 19:38:21 UTC 2018
I’m developing a qspi driver for Zynq/Zedboard and running into a problem that might affect other spi drivers. When my driver does its attach, it triggers the attach of the flash driver, dev/flash/mx25l.c, through spibus. In turn, the flash driver attempts to read the flash device ident by calling back to my driver’s transfer function. My driver initiates the transfer and then sleeps on its lock with a timeout (mtx_sleep(…, 2 * hz)). That panics the system: “panic: timed sleep before timers are working”. I’ve attached the stack backtrace.
I loosely based my driver on bcm2835_spi.c which also sleeps with a timeout in its transfer function. I tried greping through a few other spi drivers and noticed dev/intel/spi.c does it too.
Okay, before I hit send, I noticed that the other flash driver, at45d.c, uses some hook to do a delayed attach with the comment “We’ll see what kind of flash we have later…”. Maybe mx25l.c needs something like this.
My other idea is to create a “fast transfer” function that doesn’t use interrupts to be used for trivial transfers. That would take care of the IDENT and READ_STATUS commands that happen in the flash driver’s attach routine. It might be a nice optimization too.
—Thomas
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: panic.txt
URL: <http://lists.freebsd.org/pipermail/freebsd-arm/attachments/20180304/b664aa3b/attachment.txt>
More information about the freebsd-arm
mailing list