diff options
Diffstat (limited to 'Documentation/DocBook')
| -rw-r--r-- | Documentation/DocBook/kernel-api.tmpl | 63 |
1 files changed, 63 insertions, 0 deletions
diff --git a/Documentation/DocBook/kernel-api.tmpl b/Documentation/DocBook/kernel-api.tmpl index b61dfc79e1b8..a2b2b4d187c5 100644 --- a/Documentation/DocBook/kernel-api.tmpl +++ b/Documentation/DocBook/kernel-api.tmpl | |||
| @@ -576,4 +576,67 @@ X!Idrivers/video/console/fonts.c | |||
| 576 | !Edrivers/input/ff-core.c | 576 | !Edrivers/input/ff-core.c |
| 577 | !Edrivers/input/ff-memless.c | 577 | !Edrivers/input/ff-memless.c |
| 578 | </chapter> | 578 | </chapter> |
| 579 | |||
| 580 | <chapter id="spi"> | ||
| 581 | <title>Serial Peripheral Interface (SPI)</title> | ||
| 582 | <para> | ||
| 583 | SPI is the "Serial Peripheral Interface", widely used with | ||
| 584 | embedded systems because it is a simple and efficient | ||
| 585 | interface: basically a multiplexed shift register. | ||
| 586 | Its three signal wires hold a clock (SCK, often in the range | ||
| 587 | of 1-20 MHz), a "Master Out, Slave In" (MOSI) data line, and | ||
| 588 | a "Master In, Slave Out" (MISO) data line. | ||
| 589 | SPI is a full duplex protocol; for each bit shifted out the | ||
| 590 | MOSI line (one per clock) another is shifted in on the MISO line. | ||
| 591 | Those bits are assembled into words of various sizes on the | ||
| 592 | way to and from system memory. | ||
| 593 | An additional chipselect line is usually active-low (nCS); | ||
| 594 | four signals are normally used for each peripheral, plus | ||
| 595 | sometimes an interrupt. | ||
| 596 | </para> | ||
| 597 | <para> | ||
| 598 | The SPI bus facilities listed here provide a generalized | ||
| 599 | interface to declare SPI busses and devices, manage them | ||
| 600 | according to the standard Linux driver model, and perform | ||
| 601 | input/output operations. | ||
| 602 | At this time, only "master" side interfaces are supported, | ||
| 603 | where Linux talks to SPI peripherals and does not implement | ||
| 604 | such a peripheral itself. | ||
| 605 | (Interfaces to support implementing SPI slaves would | ||
| 606 | necessarily look different.) | ||
| 607 | </para> | ||
| 608 | <para> | ||
| 609 | The programming interface is structured around two kinds of driver, | ||
| 610 | and two kinds of device. | ||
| 611 | A "Controller Driver" abstracts the controller hardware, which may | ||
| 612 | be as simple as a set of GPIO pins or as complex as a pair of FIFOs | ||
| 613 | connected to dual DMA engines on the other side of the SPI shift | ||
| 614 | register (maximizing throughput). Such drivers bridge between | ||
| 615 | whatever bus they sit on (often the platform bus) and SPI, and | ||
| 616 | expose the SPI side of their device as a | ||
| 617 | <structname>struct spi_master</structname>. | ||
| 618 | SPI devices are children of that master, represented as a | ||
| 619 | <structname>struct spi_device</structname> and manufactured from | ||
| 620 | <structname>struct spi_board_info</structname> descriptors which | ||
| 621 | are usually provided by board-specific initialization code. | ||
| 622 | A <structname>struct spi_driver</structname> is called a | ||
| 623 | "Protocol Driver", and is bound to a spi_device using normal | ||
| 624 | driver model calls. | ||
| 625 | </para> | ||
| 626 | <para> | ||
| 627 | The I/O model is a set of queued messages. Protocol drivers | ||
| 628 | submit one or more <structname>struct spi_message</structname> | ||
| 629 | objects, which are processed and completed asynchronously. | ||
| 630 | (There are synchronous wrappers, however.) Messages are | ||
| 631 | built from one or more <structname>struct spi_transfer</structname> | ||
| 632 | objects, each of which wraps a full duplex SPI transfer. | ||
| 633 | A variety of protocol tweaking options are needed, because | ||
| 634 | different chips adopt very different policies for how they | ||
| 635 | use the bits transferred with SPI. | ||
| 636 | </para> | ||
| 637 | !Iinclude/linux/spi/spi.h | ||
| 638 | !Fdrivers/spi/spi.c spi_register_board_info | ||
| 639 | !Edrivers/spi/spi.c | ||
| 640 | </chapter> | ||
| 641 | |||
| 579 | </book> | 642 | </book> |
