Commit 99769a52 authored by Dhruva Gole's avatar Dhruva Gole Committed by Mark Brown

spi: Update the "master/slave" terminology in documentation

Update the master/slave terminology wherever possible to adopt usage of
the controller/host/target. Some parts have been left untouched because
they were sysfs entries and will probably end up being inaccurate if
simply replaced here.
Signed-off-by: default avatarDhruva Gole <d-gole@ti.com>
Link: https://msgid.link/r/20240215085404.1711976-1-d-gole@ti.comSigned-off-by: default avatarMark Brown <broonie@kernel.org>
parent 125b28b1
...@@ -19,14 +19,14 @@ commonly used. Each clock cycle shifts data out and data in; the clock ...@@ -19,14 +19,14 @@ commonly used. Each clock cycle shifts data out and data in; the clock
doesn't cycle except when there is a data bit to shift. Not all data bits doesn't cycle except when there is a data bit to shift. Not all data bits
are used though; not every protocol uses those full duplex capabilities. are used though; not every protocol uses those full duplex capabilities.
SPI hosts use a fourth "chip select" line to activate a given SPI slave SPI hosts use a fourth "chip select" line to activate a given SPI target
device, so those three signal wires may be connected to several chips device, so those three signal wires may be connected to several chips
in parallel. All SPI slaves support chipselects; they are usually active in parallel. All SPI targets support chipselects; they are usually active
low signals, labeled nCSx for slave 'x' (e.g. nCS0). Some devices have low signals, labeled nCSx for target 'x' (e.g. nCS0). Some devices have
other signals, often including an interrupt to the host. other signals, often including an interrupt to the host.
Unlike serial busses like USB or SMBus, even low level protocols for Unlike serial busses like USB or SMBus, even low level protocols for
SPI slave functions are usually not interoperable between vendors SPI target functions are usually not interoperable between vendors
(except for commodities like SPI memory chips). (except for commodities like SPI memory chips).
- SPI may be used for request/response style device protocols, as with - SPI may be used for request/response style device protocols, as with
...@@ -43,8 +43,8 @@ SPI slave functions are usually not interoperable between vendors ...@@ -43,8 +43,8 @@ SPI slave functions are usually not interoperable between vendors
- Sometimes SPI is used to daisy-chain devices, like shift registers. - Sometimes SPI is used to daisy-chain devices, like shift registers.
In the same way, SPI slaves will only rarely support any kind of automatic In the same way, SPI targets will only rarely support any kind of automatic
discovery/enumeration protocol. The tree of slave devices accessible from discovery/enumeration protocol. The tree of target devices accessible from
a given SPI host controller will normally be set up manually, with a given SPI host controller will normally be set up manually, with
configuration tables. configuration tables.
...@@ -75,7 +75,7 @@ protocol supported by every MMC or SD memory card. (The older "DataFlash" ...@@ -75,7 +75,7 @@ protocol supported by every MMC or SD memory card. (The older "DataFlash"
cards, predating MMC cards but using the same connectors and card shape, cards, predating MMC cards but using the same connectors and card shape,
support only SPI.) Some PC hardware uses SPI flash for BIOS code. support only SPI.) Some PC hardware uses SPI flash for BIOS code.
SPI slave chips range from digital/analog converters used for analog SPI target chips range from digital/analog converters used for analog
sensors and codecs, to memory, to peripherals like USB controllers sensors and codecs, to memory, to peripherals like USB controllers
or Ethernet adapters; and more. or Ethernet adapters; and more.
...@@ -119,7 +119,7 @@ trailing clock edge (CPHA=1), that's SPI mode 1. ...@@ -119,7 +119,7 @@ trailing clock edge (CPHA=1), that's SPI mode 1.
Note that the clock mode is relevant as soon as the chipselect goes Note that the clock mode is relevant as soon as the chipselect goes
active. So the host must set the clock to inactive before selecting active. So the host must set the clock to inactive before selecting
a slave, and the slave can tell the chosen polarity by sampling the a target, and the target can tell the chosen polarity by sampling the
clock level when its select line goes active. That's why many devices clock level when its select line goes active. That's why many devices
support for example both modes 0 and 3: they don't care about polarity, support for example both modes 0 and 3: they don't care about polarity,
and always clock data in/out on rising clock edges. and always clock data in/out on rising clock edges.
...@@ -142,13 +142,13 @@ There are two types of SPI driver, here called: ...@@ -142,13 +142,13 @@ There are two types of SPI driver, here called:
Controller drivers ... Controller drivers ...
controllers may be built into System-On-Chip controllers may be built into System-On-Chip
processors, and often support both Master and Slave roles. processors, and often support both Controller and target roles.
These drivers touch hardware registers and may use DMA. These drivers touch hardware registers and may use DMA.
Or they can be PIO bitbangers, needing just GPIO pins. Or they can be PIO bitbangers, needing just GPIO pins.
Protocol drivers ... Protocol drivers ...
these pass messages through the controller these pass messages through the controller
driver to communicate with a Slave or Master device on the driver to communicate with a target or Controller device on the
other side of an SPI link. other side of an SPI link.
So for example one protocol driver might talk to the MTD layer to export So for example one protocol driver might talk to the MTD layer to export
...@@ -184,17 +184,17 @@ shows up in sysfs in several locations:: ...@@ -184,17 +184,17 @@ shows up in sysfs in several locations::
MOSI, and MISO. MOSI, and MISO.
/sys/devices/.../CTLR/slave ... virtual file for (un)registering the /sys/devices/.../CTLR/slave ... virtual file for (un)registering the
slave device for an SPI slave controller. target device for an SPI target controller.
Writing the driver name of an SPI slave handler to this file Writing the driver name of an SPI target handler to this file
registers the slave device; writing "(null)" unregisters the slave registers the target device; writing "(null)" unregisters the target
device. device.
Reading from this file shows the name of the slave device ("(null)" Reading from this file shows the name of the target device ("(null)"
if not registered). if not registered).
/sys/class/spi_slave/spiB ... symlink to a logical node which could hold /sys/class/spi_slave/spiB ... symlink to a logical node which could hold
class related state for the SPI slave controller on bus "B". When class related state for the SPI target controller on bus "B". When
registered, a single spiB.* device is present here, possible sharing registered, a single spiB.* device is present here, possible sharing
the physical SPI bus segment with other SPI slave devices. the physical SPI bus segment with other SPI target devices.
At this time, the only class-specific state is the bus number ("B" in "spiB"), At this time, the only class-specific state is the bus number ("B" in "spiB"),
so those /sys/class entries are only useful to quickly identify busses. so 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 ...@@ -270,10 +270,10 @@ same SOC controller is used. For example, on one board SPI might use
an external clock, where another derives the SPI clock from current an external clock, where another derives the SPI clock from current
settings of some master clock. settings of some master clock.
Declare Slave Devices Declare target Devices
^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^
The second kind of information is a list of what SPI slave devices exist The second kind of information is a list of what SPI target devices exist
on the target board, often with some board-specific data needed for the on the target board, often with some board-specific data needed for the
driver to work correctly. driver to work correctly.
...@@ -469,7 +469,7 @@ routines are available to allocate and zero-initialize an spi_message ...@@ -469,7 +469,7 @@ routines are available to allocate and zero-initialize an spi_message
with several transfers. with several transfers.
How do I write an "SPI Master Controller Driver"? How do I write an "SPI Controller Driver"?
------------------------------------------------- -------------------------------------------------
An SPI controller will probably be registered on the platform_bus; write An SPI controller will probably be registered on the platform_bus; write
a driver to bind to the device, whichever bus is involved. a driver to bind to the device, whichever bus is involved.
...@@ -527,7 +527,7 @@ SPI Host Controller Methods ...@@ -527,7 +527,7 @@ SPI Host Controller Methods
Drivers may change the defaults provided by board_info, and then Drivers may change the defaults provided by board_info, and then
call spi_setup(spi) to invoke this routine. It may sleep. call spi_setup(spi) to invoke this routine. It may sleep.
Unless each SPI slave has its own configuration registers, don't Unless each SPI target has its own configuration registers, don't
change them right away ... otherwise drivers could corrupt I/O change them right away ... otherwise drivers could corrupt I/O
that's in progress for other SPI devices. that's in progress for other SPI devices.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment