Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 26 May 2016 19:00:48 -0700
From:      Adrian Chadd <adrian@freebsd.org>
To:        "freebsd-embedded@freebsd.org" <freebsd-embedded@freebsd.org>
Subject:   spibus: migrate to bus acquire/release semantics
Message-ID:  <CAJ-VmomT=tfs4-vQt9MCQMu9P4SROOzmLEg_cxmh8vVSV3Vk3Q@mail.gmail.com>

next in thread | raw e-mail | index | archive | help
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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAJ-VmomT=tfs4-vQt9MCQMu9P4SROOzmLEg_cxmh8vVSV3Vk3Q>