diff options
author | David Brownell <david-b@pacbell.net> | 2007-06-16 13:16:08 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-06-16 16:16:16 -0400 |
commit | f5a9c77df45b113d21b64cbc2bf6c72a0da48998 (patch) | |
tree | c68315e2d5e3e3b8075bfbe01fab054efc1d9bf2 | |
parent | ed45666271f4fafa95b9d8ad44050e9a9bd2376e (diff) |
spi doc updates
Update two points in the SPI interface documentation:
- Update description of the "chip stays selected after message ends"
mode. In some cases it's required for correctness; it isn't just a
performance tweak. (Yes: to use this mode on mult-device busses, another
programming interface will be needed. One draft has been circulated
already.)
- Clarify spi_setup(), highlighting that callers must ensure that no
requests are queued (can't change configuration except between I/Os), and
that the device must be deselected when this returns (which is a key part
of why it's called during device init).
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r-- | include/linux/spi/spi.h | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/include/linux/spi/spi.h b/include/linux/spi/spi.h index b6bedc3ee95c..1be5ea059477 100644 --- a/include/linux/spi/spi.h +++ b/include/linux/spi/spi.h | |||
@@ -341,9 +341,14 @@ extern struct spi_master *spi_busnum_to_master(u16 busnum); | |||
341 | * chip transactions together. | 341 | * chip transactions together. |
342 | * | 342 | * |
343 | * (ii) When the transfer is the last one in the message, the chip may | 343 | * (ii) When the transfer is the last one in the message, the chip may |
344 | * stay selected until the next transfer. This is purely a performance | 344 | * stay selected until the next transfer. On multi-device SPI busses |
345 | * hint; the controller driver may need to select a different device | 345 | * with nothing blocking messages going to other devices, this is just |
346 | * for the next message. | 346 | * a performance hint; starting a message to another device deselects |
347 | * this one. But in other cases, this can be used to ensure correctness. | ||
348 | * Some devices need protocol transactions to be built from a series of | ||
349 | * spi_message submissions, where the content of one message is determined | ||
350 | * by the results of previous messages and where the whole transaction | ||
351 | * ends when the chipselect goes intactive. | ||
347 | * | 352 | * |
348 | * The code that submits an spi_message (and its spi_transfers) | 353 | * The code that submits an spi_message (and its spi_transfers) |
349 | * to the lower layers is responsible for managing its memory. | 354 | * to the lower layers is responsible for managing its memory. |
@@ -480,14 +485,15 @@ static inline void spi_message_free(struct spi_message *m) | |||
480 | /** | 485 | /** |
481 | * spi_setup - setup SPI mode and clock rate | 486 | * spi_setup - setup SPI mode and clock rate |
482 | * @spi: the device whose settings are being modified | 487 | * @spi: the device whose settings are being modified |
483 | * Context: can sleep | 488 | * Context: can sleep, and no requests are queued to the device |
484 | * | 489 | * |
485 | * SPI protocol drivers may need to update the transfer mode if the | 490 | * SPI protocol drivers may need to update the transfer mode if the |
486 | * device doesn't work with the mode 0 default. They may likewise need | 491 | * device doesn't work with its default. They may likewise need |
487 | * to update clock rates or word sizes from initial values. This function | 492 | * to update clock rates or word sizes from initial values. This function |
488 | * changes those settings, and must be called from a context that can sleep. | 493 | * changes those settings, and must be called from a context that can sleep. |
489 | * The changes take effect the next time the device is selected and data | 494 | * Except for SPI_CS_HIGH, which takes effect immediately, the changes take |
490 | * is transferred to or from it. | 495 | * effect the next time the device is selected and data is transferred to |
496 | * or from it. When this function returns, the spi device is deselected. | ||
491 | * | 497 | * |
492 | * Note that this call will fail if the protocol driver specifies an option | 498 | * Note that this call will fail if the protocol driver specifies an option |
493 | * that the underlying controller or its driver does not support. For | 499 | * that the underlying controller or its driver does not support. For |