Home | History | Annotate | Download | only in spi
History log of /src/sys/dev/spi/spivar.h
RevisionDateAuthorComments
 1.26  10-Oct-2025  brad Add another convenience wrapper function to the SPI framework.

spi_sendv(spi_handle_t sh, const struct iovec *iov,
int iovcnt)

Takes a iovec of buffers and sends them as one transaction down the
SPI bus.

There exists devices that will not handle sending the register that is
to be written to as one transaction and the data as a second
transaction. That is, use one spi_send() to send the register and a
second spi_send() to send the data. Those devices require a single
transaction with both parts in it.
 1.25  14-Sep-2025  thorpej In spi_configure() attempt to fetch transfer mode information from the
platform device tree. Implement this for FDT per the SPI controller and
periperal Device Tree bindings.
 1.24  14-Sep-2025  thorpej Make SPI direct configuration less #ifdef'y. No more checking what kind
of platform device tree; instead, use a device call to enumerate the
direct config children of the bus.
 1.23  13-Sep-2025  thorpej Re-factor the logic of attaching child devices to share more between
the direct an indirect cases.
 1.22  13-Sep-2025  thorpej Define and use spi_handle_t to drive home the point that it's an opaque
type.
 1.21  11-Sep-2025  thorpej Introduce spi_use_direct_match() which, like its i2c cousin, informs
the driver if a direct config match is in play, allowing the driver
more easily apply direct vs indirect config match logic.
 1.20  10-Sep-2025  thorpej Don't pass a "cookie" in the attach args to SPI devices. Instead,
properly initialize the child device's device handle. G/C unused
fields in spi_attach_args.
 1.19  10-Sep-2025  thorpej Put the task of getting the device array from the FDT onto the
SPI bus attach routine. This is slightly ugly now, but a prettier
solution is on the way, and this at least funnels the ugliness into
a single location.
 1.18  10-Sep-2025  thorpej - Const poison references to spi_controller.
- Don't make a copy of the spi_controller in the SPI bus softc; just take
a reference to the one we got from the back-end driver.
 1.17  10-Sep-2025  thorpej Also be explicit about the interface attribute.
 1.16  10-Sep-2025  thorpej Pass the controller's device handle down to the SPI bus instance.
 1.15  10-Sep-2025  thorpej Encapsulate what's needed to attach a SPI bus into a spibus_attach()
inline.
 1.14  10-Sep-2025  thorpej Minor formatting beautification.
 1.13  23-Feb-2024  thorpej Define mode macros for CPOL and CPHA, and define SPI_MODE_* in terms
of CPOL and CPHA. Add SPI_FREQ_*() helper macros to make setting the
transfer frequency less error prone.
 1.12  19-Jan-2022  thorpej branches: 1.12.4;
Provide a spi_compatible_lookup() function to go along with
spi_compatible_match().
 1.11  19-Jan-2022  thorpej Pass the device_t into spi_configure(), and make the API contract that
spi_configure() will print errors if they occur; the driver is off the
hook.
 1.10  04-Aug-2020  kardel branches: 1.10.6; 1.10.16;
Use mutex for lwp/interrupt coordination. using splX() simply does not work
on multiprocessor systems.

fixes PR kern/55506
 1.9  27-Nov-2019  hkenken Remove GPIO driver attach defer.
 1.8  13-Aug-2019  tnn spi: prepare for fdt direct attachment of spi slaves

Introduce sba_child_devices array in spibus_attach_args. If the parent has
populated sba_child_devices then attach them first. Then do any devices
devices the user has wired in the kernel config, if any.
 1.7  23-Feb-2019  mlelstv branches: 1.7.4;
Add userland driver to spi framework.

Previously spi would configure the controller to use the lowest speed of
all connected devices since the kernel started and to fail attempted mode
changes. This is now improved to keep individual modes and speeds for each
slave and to reconfigure the controller as necessary for each transfer.

Added man page for spi(9).
 1.6  13-Jul-2014  dholland branches: 1.6.28;
"peripheral", not "peripherial".
 1.5  28-Feb-2014  skrll branches: 1.5.2;
G/C sys/simplelock.h includes
 1.4  08-Jun-2011  rmind branches: 1.4.2; 1.4.12; 1.4.16; 1.4.20;
- Use IPL_BIO (instead of IPL_SERIAL) for SPI.
- Convert simple_lock/ltsleep to mutex/condvar.
 1.3  08-Jan-2008  dogcow branches: 1.3.32; 1.3.42;
explicitly include simplelock.h
 1.2  07-Oct-2006  gdamore branches: 1.2.2; 1.2.4; 1.2.8; 1.2.30; 1.2.36; 1.2.44;
Add spiflash driver, and M25P instance, used for STMicro flash devices
found on Meraki Mini (for example).
 1.1  02-Oct-2006  gdamore Initial commit of SPI bus (also known as Microwire) framework, along with
a sample driver for the TI TMP121 temperature sensor. This has been
moderately tested on Au1550, and it is not enabled in sys/conf (yet). So
the change is harmless at worst, and useful at best.

Alchemy Au1550 bus driver forthcoming, along with a driver for SPI flash
devices, such as found on the Meraki Mini

This development was partially funded by the Champaign-Urbana Community
Wireless Network Project.

Note that there are some MD-specific SPI drivers that could probably be
made MI under this new framework.
 1.2.44.1  08-Jan-2008  bouyer Sync with HEAD
 1.2.36.1  18-Feb-2008  mjf Sync with HEAD.
 1.2.30.1  09-Jan-2008  matt sync with HEAD
 1.2.8.3  21-Jan-2008  yamt sync with head
 1.2.8.2  30-Dec-2006  yamt sync with head.
 1.2.8.1  07-Oct-2006  yamt file spivar.h was added on branch yamt-lazymbuf on 2006-12-30 20:49:37 +0000
 1.2.4.2  18-Nov-2006  ad Sync with head.
 1.2.4.1  07-Oct-2006  ad file spivar.h was added on branch newlock2 on 2006-11-18 21:34:50 +0000
 1.2.2.2  22-Oct-2006  yamt sync with head
 1.2.2.1  07-Oct-2006  yamt file spivar.h was added on branch yamt-splraiseipl on 2006-10-22 06:06:48 +0000
 1.3.42.1  23-Jun-2011  cherry Catchup with rmind-uvmplock merge.
 1.3.32.1  12-Jun-2011  rmind sync with head
 1.4.20.2  15-May-2013  khorben Let the bus speed of SPI devices be specified within the kernel
configuration.
 1.4.20.1  10-May-2013  khorben Just like for the I2C and GPIO buses, added an interrupt locator to the SPI
bus, so that ARM device drivers on either of these buses (like on the Nokia
N900) can register and react on system interrupts. These interrupts are
typically triggered via GPIO pins.

XXX This change is not adequate because intr_establish() is a MD interface,
so it will have to be re-designed before merging to the main tree.
 1.4.16.1  18-May-2014  rmind sync with head
 1.4.12.1  20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.4.2.1  22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.5.2.1  10-Aug-2014  tls Rebase.
 1.6.28.2  13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.6.28.1  10-Jun-2019  christos Sync with HEAD
 1.7.4.1  11-Aug-2020  martin Pull up following revision(s) (requested by 1043):

sys/dev/spi/spivar.h: revision 1.10
sys/arch/arm/broadcom/bcm2835_spi.c: revision 1.7
sys/dev/spi/spi.c: revision 1.15

Use mutex for lwp/interrupt coordination. using splX() simply does not work
on multiprocessor systems.

fixes PR kern/55506
 1.10.16.1  09-Aug-2021  thorpej Port over the changes from thorpej-i2c-spi-conf to thorpej-i2c-spi-conf2,
which is based on a newer HEAD revision.
 1.10.6.1  18-May-2021  thorpej Define a "spi-enumerate-devices" device call and use it for direct
configuration of SPI devices, rather than slinging arrays of dictionaries
around. Implement this device call for OpenFirmware / FDT, following
the SPI bindings for Device Tree.
 1.12.4.1  11-Sep-2024  martin Pull up following revision(s) (requested by rin in ticket #836):

sys/dev/spi/spivar.h: revision 1.13

Define mode macros for CPOL and CPHA, and define SPI_MODE_* in terms
of CPOL and CPHA. Add SPI_FREQ_*() helper macros to make setting the
transfer frequency less error prone.

RSS XML Feed