Lines Matching full:spi
1 Overview of Linux kernel SPI support
6 What is SPI?
8 The "Serial Peripheral Interface" (SPI) is a synchronous four wire serial
11 standardization body. SPI uses a master/slave configuration.
21 SPI masters use a fourth "chip select" line to activate a given SPI slave
23 in parallel. All SPI slaves support chipselects; they are usually active
28 SPI slave functions are usually not interoperable between vendors
29 (except for commodities like SPI memory chips).
31 - SPI may be used for request/response style device protocols, as with
43 - Sometimes SPI is used to daisy-chain devices, like shift registers.
45 In the same way, SPI slaves will only rarely support any kind of automatic
47 a given SPI master will normally be set up manually, with configuration
50 SPI is only one of the names used by such four-wire protocols, and
52 half-duplex SPI, for request/response protocols), SSP ("Synchronous
58 some SPI chips have this signal mode as a strapping option. These
59 can be accessed using the same programming interface as SPI, but of
64 Microcontrollers often support both master and slave sides of the SPI
66 side of SPI interactions.
71 Linux developers using SPI are probably writing device drivers for embedded
72 systems boards. SPI is used to control external chips, and it is also a
75 support only SPI.) Some PC hardware uses SPI flash for BIOS code.
77 SPI slave chips range from digital/analog converters used for analog
81 Most systems using SPI will integrate a few devices on a mainboard.
82 Some provide SPI links on expansion connectors; in cases where no
83 dedicated SPI controller exists, GPIO pins can be used to create a
84 low speed "bitbanging" adapter. Very few systems will "hotplug" an SPI
85 controller; the reasons to use SPI focus on low cost and simple operation,
90 interfaces with SPI modes. Given SPI support, they could use MMC or SD
94 I'm confused. What are these four SPI "clock modes"?
111 Chip specs won't always say "uses SPI mode X" in as many words,
114 In the SPI mode number, CPOL is the high order bit and CPHA is the
117 trailing clock edge (CPHA=1), that's SPI mode 1.
129 The <linux/spi/spi.h> header file includes kerneldoc, as does the
134 SPI requests always go into I/O queues. Requests for a given SPI device
140 There are two types of SPI driver, here called:
149 other side of an SPI link.
152 data to filesystems stored on SPI flash like DataFlash; and others might
161 There is a minimal core of SPI programming interfaces, focussing on
163 device tables provided by board specific initialization code. SPI
166 /sys/devices/.../CTLR ... physical node for a given SPI controller
171 /sys/bus/spi/devices/spiB.C ... symlink to that physical
177 /sys/bus/spi/drivers/D ... driver for one or more spi*.* devices
182 physical SPI bus segment, with SCLK, MOSI, and MISO.
190 How does board-specific init code declare SPI devices?
192 Linux needs several kinds of information to properly configure SPI devices.
198 The first kind of information is a list of what SPI controllers exist.
204 Platforms will often abstract the "register SPI controller" operation,
208 SPI-capable controllers, and only the ones actually usable on a given
213 #include <mach/spi.h> /* for mysoc_spi_data */
223 /* this board only uses SPI controller #2 */
230 #include <mach/spi.h>
255 same SOC controller is used. For example, on one board SPI might use
256 an external clock, where another derives the SPI clock from current
262 The second kind of information is a list of what SPI slave devices exist
267 listing the SPI devices on each board. (This would typically be only a
289 several types. This example shows generic constraints like the fastest SPI
304 Then your board initialization code would register that table with the SPI
305 infrastructure, so that it's available later when the SPI master controller
316 certainly includes SPI devices hooked up through the card connectors!
322 example is the potential need to hotplug SPI devices and/or controllers.
325 up the spi bus master, and will likely need spi_new_device() to provide the
329 When Linux includes support for MMC/SD/SDIO/DataFlash cards through SPI, those
334 How do I write an "SPI Protocol Driver"?
336 Most SPI drivers are currently kernel drivers, but there's also support
339 SPI protocol drivers somewhat resemble platform device drivers:
353 The driver core will automatically attempt to bind this driver to any SPI
358 static int __devinit CHIP_probe(struct spi_device *spi)
364 pdata = &spi->dev.platform_data;
372 spi_set_drvdata(spi, chip);
379 the SPI device using "struct spi_message". When remove() returns,
384 as one atomic sequence. SPI driver controls include:
445 of interacting with SPI devices.
461 How do I write an "SPI Master Controller Driver"?
463 An SPI controller will probably be registered on the platform_bus; write
481 used to interact with the SPI core and SPI protocol drivers. It will
487 the controller and any predeclared spi devices will be made available,
490 If you need to remove your SPI controller driver, spi_unregister_master()
497 SPI bus (shared SCK, MOSI, MISO). Valid bus numbers start at zero. On
508 SPI MASTER METHODS
510 master->setup(struct spi_device *spi)
511 This sets up the device clock rate, SPI mode, and word sizes.
513 call spi_setup(spi) to invoke this routine. It may sleep.
515 Unless each SPI slave has its own configuration registers, don't
517 that's in progress for other SPI devices.
524 master->transfer(struct spi_device *spi, struct spi_message *message)
530 master->cleanup(struct spi_device *spi)
536 SPI MESSAGE QUEUE
544 often DMA (especially if the root filesystem is in SPI flash), and
554 Contributors to Linux-SPI discussions include (in alphabetical order,