@@ -9,7 +9,7 @@ What is SPI?
99The "Serial Peripheral Interface" (SPI) is a synchronous four wire serial
1010link used to connect microcontrollers to sensors, memory, and peripherals.
1111It's a simple "de facto" standard, not complicated enough to acquire a
12- standardization body. SPI uses a master/slave configuration.
12+ standardization body. SPI uses a host/target configuration.
1313
1414The three signal wires hold a clock (SCK, often on the order of 10 MHz),
1515and parallel data lines with "Master Out, Slave In" (MOSI) or "Master In,
@@ -19,14 +19,14 @@ commonly used. Each clock cycle shifts data out and data in; the clock
1919doesn't cycle except when there is a data bit to shift. Not all data bits
2020are used though; not every protocol uses those full duplex capabilities.
2121
22- SPI masters use a fourth "chip select" line to activate a given SPI slave
22+ SPI hosts use a fourth "chip select" line to activate a given SPI target
2323device, so those three signal wires may be connected to several chips
24- in parallel. All SPI slaves support chipselects; they are usually active
25- low signals, labeled nCSx for slave 'x' (e.g. nCS0). Some devices have
26- other signals, often including an interrupt to the master .
24+ in parallel. All SPI targets support chipselects; they are usually active
25+ low signals, labeled nCSx for target 'x' (e.g. nCS0). Some devices have
26+ other signals, often including an interrupt to the host .
2727
2828Unlike serial busses like USB or SMBus, even low level protocols for
29- SPI slave functions are usually not interoperable between vendors
29+ SPI target functions are usually not interoperable between vendors
3030(except for commodities like SPI memory chips).
3131
3232 - SPI may be used for request/response style device protocols, as with
@@ -43,10 +43,10 @@ SPI slave functions are usually not interoperable between vendors
4343
4444 - Sometimes SPI is used to daisy-chain devices, like shift registers.
4545
46- In the same way, SPI slaves will only rarely support any kind of automatic
47- discovery/enumeration protocol. The tree of slave devices accessible from
48- a given SPI master will normally be set up manually, with configuration
49- tables.
46+ In the same way, SPI targets will only rarely support any kind of automatic
47+ discovery/enumeration protocol. The tree of target devices accessible from
48+ a given SPI host controller will normally be set up manually, with
49+ configuration tables.
5050
5151SPI is only one of the names used by such four-wire protocols, and
5252most controllers have no problem handling "MicroWire" (think of it as
@@ -62,8 +62,8 @@ course they won't handle full duplex transfers. You may find such
6262chips described as using "three wire" signaling: SCK, data, nCSx.
6363(That data line is sometimes called MOMI or SISO.)
6464
65- Microcontrollers often support both master and slave sides of the SPI
66- protocol. This document (and Linux) supports both the master and slave
65+ Microcontrollers often support both host and target sides of the SPI
66+ protocol. This document (and Linux) supports both the host and target
6767sides of SPI interactions.
6868
6969
@@ -75,7 +75,7 @@ protocol supported by every MMC or SD memory card. (The older "DataFlash"
7575cards, predating MMC cards but using the same connectors and card shape,
7676support only SPI.) Some PC hardware uses SPI flash for BIOS code.
7777
78- SPI slave chips range from digital/analog converters used for analog
78+ SPI target chips range from digital/analog converters used for analog
7979sensors and codecs, to memory, to peripherals like USB controllers
8080or Ethernet adapters; and more.
8181
@@ -118,8 +118,8 @@ starting low (CPOL=0) and data stabilized for sampling during the
118118trailing clock edge (CPHA=1), that's SPI mode 1.
119119
120120Note that the clock mode is relevant as soon as the chipselect goes
121- active. So the master must set the clock to inactive before selecting
122- a slave , and the slave can tell the chosen polarity by sampling the
121+ active. So the host must set the clock to inactive before selecting
122+ a target , and the target can tell the chosen polarity by sampling the
123123clock level when its select line goes active. That's why many devices
124124support for example both modes 0 and 3: they don't care about polarity,
125125and always clock data in/out on rising clock edges.
@@ -142,13 +142,13 @@ There are two types of SPI driver, here called:
142142
143143 Controller drivers ...
144144 controllers may be built into System-On-Chip
145- processors, and often support both Master and Slave roles.
145+ processors, and often support both Controller and target roles.
146146 These drivers touch hardware registers and may use DMA.
147147 Or they can be PIO bitbangers, needing just GPIO pins.
148148
149149 Protocol drivers ...
150150 these pass messages through the controller
151- driver to communicate with a Slave or Master device on the
151+ driver to communicate with a target or Controller device on the
152152 other side of an SPI link.
153153
154154So for example one protocol driver might talk to the MTD layer to export
@@ -179,22 +179,22 @@ shows up in sysfs in several locations::
179179 /sys/bus/spi/drivers/D ... driver for one or more spi*.* devices
180180
181181 /sys/class/spi_master/spiB ... symlink to a logical node which could hold
182- class related state for the SPI master controller managing bus "B".
182+ class related state for the SPI host controller managing bus "B".
183183 All spiB.* devices share one physical SPI bus segment, with SCLK,
184184 MOSI, and MISO.
185185
186186 /sys/devices/.../CTLR/slave ... virtual file for (un)registering the
187- slave device for an SPI slave controller.
188- Writing the driver name of an SPI slave handler to this file
189- registers the slave device; writing "(null)" unregisters the slave
187+ target device for an SPI target controller.
188+ Writing the driver name of an SPI target handler to this file
189+ registers the target device; writing "(null)" unregisters the target
190190 device.
191- Reading from this file shows the name of the slave device ("(null)"
191+ Reading from this file shows the name of the target device ("(null)"
192192 if not registered).
193193
194194 /sys/class/spi_slave/spiB ... symlink to a logical node which could hold
195- class related state for the SPI slave controller on bus "B". When
195+ class related state for the SPI target controller on bus "B". When
196196 registered, a single spiB.* device is present here, possible sharing
197- the physical SPI bus segment with other SPI slave devices.
197+ the physical SPI bus segment with other SPI target devices.
198198
199199At this time, the only class-specific state is the bus number ("B" in "spiB"),
200200so those /sys/class entries are only useful to quickly identify busses.
@@ -270,10 +270,10 @@ same SOC controller is used. For example, on one board SPI might use
270270an external clock, where another derives the SPI clock from current
271271settings of some master clock.
272272
273- Declare Slave Devices
274- ^^^^^^^^^^^^^^^^^^^^^
273+ Declare target Devices
274+ ^^^^^^^^^^^^^^^^^^^^^^
275275
276- The second kind of information is a list of what SPI slave devices exist
276+ The second kind of information is a list of what SPI target devices exist
277277on the target board, often with some board-specific data needed for the
278278driver to work correctly.
279279
@@ -316,7 +316,7 @@ sharing a bus with a device that interprets chipselect "backwards" is
316316not possible until the infrastructure knows how to deselect it.
317317
318318Then your board initialization code would register that table with the SPI
319- infrastructure, so that it's available later when the SPI master controller
319+ infrastructure, so that it's available later when the SPI host controller
320320driver is registered::
321321
322322 spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info));
@@ -469,39 +469,39 @@ routines are available to allocate and zero-initialize an spi_message
469469with several transfers.
470470
471471
472- How do I write an "SPI Master Controller Driver"?
472+ How do I write an "SPI Controller Driver"?
473473-------------------------------------------------
474474An SPI controller will probably be registered on the platform_bus; write
475475a driver to bind to the device, whichever bus is involved.
476476
477- The main task of this type of driver is to provide an "spi_master".
478- Use spi_alloc_master() to allocate the master, and spi_master_get_devdata()
479- to get the driver-private data allocated for that device.
477+ The main task of this type of driver is to provide an "spi_controller".
478+ Use spi_alloc_host() to allocate the host controller, and
479+ spi_controller_get_devdata() to get the driver-private data allocated for that
480+ device.
480481
481482::
482483
483- struct spi_master *master ;
484+ struct spi_controller *ctlr ;
484485 struct CONTROLLER *c;
485486
486- master = spi_alloc_master (dev, sizeof *c);
487- if (!master )
487+ ctlr = spi_alloc_host (dev, sizeof *c);
488+ if (!ctlr )
488489 return -ENODEV;
489490
490- c = spi_master_get_devdata(master );
491+ c = spi_controller_get_devdata(ctlr );
491492
492- The driver will initialize the fields of that spi_master, including the
493- bus number (maybe the same as the platform device ID) and three methods
494- used to interact with the SPI core and SPI protocol drivers. It will
495- also initialize its own internal state. (See below about bus numbering
496- and those methods.)
493+ The driver will initialize the fields of that spi_controller, including the bus
494+ number (maybe the same as the platform device ID) and three methods used to
495+ interact with the SPI core and SPI protocol drivers. It will also initialize
496+ its own internal state. (See below about bus numbering and those methods.)
497497
498- After you initialize the spi_master , then use spi_register_master () to
498+ After you initialize the spi_controller , then use spi_register_controller () to
499499publish it to the rest of the system. At that time, device nodes for the
500500controller and any predeclared spi devices will be made available, and
501501the driver model core will take care of binding them to drivers.
502502
503- If you need to remove your SPI controller driver, spi_unregister_master ()
504- will reverse the effect of spi_register_master ().
503+ If you need to remove your SPI controller driver, spi_unregister_controller ()
504+ will reverse the effect of spi_register_controller ().
505505
506506
507507Bus Numbering
@@ -519,49 +519,49 @@ then be replaced by a dynamically assigned number. You'd then need to treat
519519this as a non-static configuration (see above).
520520
521521
522- SPI Master Methods
523- ^^^^^^^^^^^^^^^^^^
522+ SPI Host Controller Methods
523+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^
524524
525- ``master ->setup(struct spi_device *spi) ``
525+ ``ctlr ->setup(struct spi_device *spi) ``
526526 This sets up the device clock rate, SPI mode, and word sizes.
527527 Drivers may change the defaults provided by board_info, and then
528528 call spi_setup(spi) to invoke this routine. It may sleep.
529529
530- Unless each SPI slave has its own configuration registers, don't
530+ Unless each SPI target has its own configuration registers, don't
531531 change them right away ... otherwise drivers could corrupt I/O
532532 that's in progress for other SPI devices.
533533
534534 .. note ::
535535
536536 BUG ALERT: for some reason the first version of
537- many spi_master drivers seems to get this wrong.
537+ many spi_controller drivers seems to get this wrong.
538538 When you code setup(), ASSUME that the controller
539539 is actively processing transfers for another device.
540540
541- ``master ->cleanup(struct spi_device *spi) ``
541+ ``ctlr ->cleanup(struct spi_device *spi) ``
542542 Your controller driver may use spi_device.controller_state to hold
543543 state it dynamically associates with that device. If you do that,
544544 be sure to provide the cleanup() method to free that state.
545545
546- ``master ->prepare_transfer_hardware(struct spi_master *master ) ``
546+ ``ctlr ->prepare_transfer_hardware(struct spi_controller *ctlr ) ``
547547 This will be called by the queue mechanism to signal to the driver
548548 that a message is coming in soon, so the subsystem requests the
549549 driver to prepare the transfer hardware by issuing this call.
550550 This may sleep.
551551
552- ``master ->unprepare_transfer_hardware(struct spi_master *master ) ``
552+ ``ctlr ->unprepare_transfer_hardware(struct spi_controller *ctlr ) ``
553553 This will be called by the queue mechanism to signal to the driver
554554 that there are no more messages pending in the queue and it may
555555 relax the hardware (e.g. by power management calls). This may sleep.
556556
557- ``master ->transfer_one_message(struct spi_master *master , struct spi_message *mesg) ``
557+ ``ctlr ->transfer_one_message(struct spi_controller *ctlr , struct spi_message *mesg) ``
558558 The subsystem calls the driver to transfer a single message while
559559 queuing transfers that arrive in the meantime. When the driver is
560560 finished with this message, it must call
561561 spi_finalize_current_message() so the subsystem can issue the next
562562 message. This may sleep.
563563
564- ``master ->transfer_one(struct spi_master *master , struct spi_device *spi, struct spi_transfer *transfer) ``
564+ ``ctrl ->transfer_one(struct spi_controller *ctlr , struct spi_device *spi, struct spi_transfer *transfer) ``
565565 The subsystem calls the driver to transfer a single transfer while
566566 queuing transfers that arrive in the meantime. When the driver is
567567 finished with this transfer, it must call
@@ -576,15 +576,15 @@ SPI Master Methods
576576 * 0: transfer is finished
577577 * 1: transfer is still in progress
578578
579- ``master ->set_cs_timing(struct spi_device *spi, u8 setup_clk_cycles, u8 hold_clk_cycles, u8 inactive_clk_cycles) ``
580- This method allows SPI client drivers to request SPI master controller
579+ ``ctrl ->set_cs_timing(struct spi_device *spi, u8 setup_clk_cycles, u8 hold_clk_cycles, u8 inactive_clk_cycles) ``
580+ This method allows SPI client drivers to request SPI host controller
581581 for configuring device specific CS setup, hold and inactive timing
582582 requirements.
583583
584584Deprecated Methods
585585^^^^^^^^^^^^^^^^^^
586586
587- ``master ->transfer(struct spi_device *spi, struct spi_message *message) ``
587+ ``ctrl ->transfer(struct spi_device *spi, struct spi_message *message) ``
588588 This must not sleep. Its responsibility is to arrange that the
589589 transfer happens and its complete() callback is issued. The two
590590 will normally happen later, after other transfers complete, and
0 commit comments