spibus: migrate to bus acquire/release semantics
Adrian Chadd
adrian at freebsd.org
Fri May 27 02:00:49 UTC 2016
hi,
Here's the first part of the work needed to bring mmcspi into the
tree. It also fixes concurrent SPI controller accesses for a variety
of controllers which currently don't consistently implement it -
AR71xx spi doesn't, but brcm2835 spi does.
https://reviews.freebsd.org/D6588
I'd appreciate some feedback and testing.
Now, this doesn't implement it for all of the controllers, only the
simple ones. The broadcom and other arm ones aren't migrated, because
CS is asserted in a variety of different ways there. Now, it's not a
/huge/ deal, it just means that CS isn't asserted for the entirety of
a transaction set. For mmcspi (which I think assumes this is the
case), we may have to add a controller ivar that indicates if it
supports it or not, so mmcspi and other devices can implement it
appropriately.
Another good example of this would be an LCD controller. Ideally you'd do this:
* acquire SPI bus
* assert command line
* do SPI transaction, with CS asserted
* deassert command line, assert data line
* do SPI transaction, with CS asserted
* release SPI bus
Now, CS doesn't have to be asserted between transactions, but the
command/data commands have to happen together like that.
Thanks!
-adrian
More information about the freebsd-embedded
mailing list