diff options
Diffstat (limited to 'Documentation/spi/spi-summary')
| -rw-r--r-- | Documentation/spi/spi-summary | 58 |
1 files changed, 46 insertions, 12 deletions
diff --git a/Documentation/spi/spi-summary b/Documentation/spi/spi-summary index 4884cb33845..7312ec14dd8 100644 --- a/Documentation/spi/spi-summary +++ b/Documentation/spi/spi-summary | |||
| @@ -1,7 +1,7 @@ | |||
| 1 | Overview of Linux kernel SPI support | 1 | Overview of Linux kernel SPI support |
| 2 | ==================================== | 2 | ==================================== |
| 3 | 3 | ||
| 4 | 21-May-2007 | 4 | 02-Feb-2012 |
| 5 | 5 | ||
| 6 | What is SPI? | 6 | What is SPI? |
| 7 | ------------ | 7 | ------------ |
| @@ -483,9 +483,9 @@ also initialize its own internal state. (See below about bus numbering | |||
| 483 | and those methods.) | 483 | and those methods.) |
| 484 | 484 | ||
| 485 | After you initialize the spi_master, then use spi_register_master() to | 485 | After you initialize the spi_master, then use spi_register_master() to |
| 486 | publish it to the rest of the system. At that time, device nodes for | 486 | publish it to the rest of the system. At that time, device nodes for the |
| 487 | the controller and any predeclared spi devices will be made available, | 487 | controller and any predeclared spi devices will be made available, and |
| 488 | and the driver model core will take care of binding them to drivers. | 488 | the driver model core will take care of binding them to drivers. |
| 489 | 489 | ||
| 490 | If you need to remove your SPI controller driver, spi_unregister_master() | 490 | If you need to remove your SPI controller driver, spi_unregister_master() |
| 491 | will reverse the effect of spi_register_master(). | 491 | will reverse the effect of spi_register_master(). |
| @@ -521,21 +521,53 @@ SPI MASTER METHODS | |||
| 521 | ** When you code setup(), ASSUME that the controller | 521 | ** When you code setup(), ASSUME that the controller |
| 522 | ** is actively processing transfers for another device. | 522 | ** is actively processing transfers for another device. |
| 523 | 523 | ||
| 524 | master->transfer(struct spi_device *spi, struct spi_message *message) | ||
| 525 | This must not sleep. Its responsibility is arrange that the | ||
| 526 | transfer happens and its complete() callback is issued. The two | ||
| 527 | will normally happen later, after other transfers complete, and | ||
| 528 | if the controller is idle it will need to be kickstarted. | ||
| 529 | |||
| 530 | master->cleanup(struct spi_device *spi) | 524 | master->cleanup(struct spi_device *spi) |
| 531 | Your controller driver may use spi_device.controller_state to hold | 525 | Your controller driver may use spi_device.controller_state to hold |
| 532 | state it dynamically associates with that device. If you do that, | 526 | state it dynamically associates with that device. If you do that, |
| 533 | be sure to provide the cleanup() method to free that state. | 527 | be sure to provide the cleanup() method to free that state. |
| 534 | 528 | ||
| 529 | master->prepare_transfer_hardware(struct spi_master *master) | ||
| 530 | This will be called by the queue mechanism to signal to the driver | ||
| 531 | that a message is coming in soon, so the subsystem requests the | ||
| 532 | driver to prepare the transfer hardware by issuing this call. | ||
| 533 | This may sleep. | ||
| 534 | |||
| 535 | master->unprepare_transfer_hardware(struct spi_master *master) | ||
| 536 | This will be called by the queue mechanism to signal to the driver | ||
| 537 | that there are no more messages pending in the queue and it may | ||
| 538 | relax the hardware (e.g. by power management calls). This may sleep. | ||
| 539 | |||
| 540 | master->transfer_one_message(struct spi_master *master, | ||
| 541 | struct spi_message *mesg) | ||
| 542 | The subsystem calls the driver to transfer a single message while | ||
| 543 | queuing transfers that arrive in the meantime. When the driver is | ||
| 544 | finished with this message, it must call | ||
| 545 | spi_finalize_current_message() so the subsystem can issue the next | ||
| 546 | transfer. This may sleep. | ||
| 547 | |||
| 548 | DEPRECATED METHODS | ||
| 549 | |||
| 550 | master->transfer(struct spi_device *spi, struct spi_message *message) | ||
| 551 | This must not sleep. Its responsibility is arrange that the | ||
| 552 | transfer happens and its complete() callback is issued. The two | ||
| 553 | will normally happen later, after other transfers complete, and | ||
| 554 | if the controller is idle it will need to be kickstarted. This | ||
| 555 | method is not used on queued controllers and must be NULL if | ||
| 556 | transfer_one_message() and (un)prepare_transfer_hardware() are | ||
| 557 | implemented. | ||
| 558 | |||
| 535 | 559 | ||
| 536 | SPI MESSAGE QUEUE | 560 | SPI MESSAGE QUEUE |
| 537 | 561 | ||
| 538 | The bulk of the driver will be managing the I/O queue fed by transfer(). | 562 | If you are happy with the standard queueing mechanism provided by the |
| 563 | SPI subsystem, just implement the queued methods specified above. Using | ||
| 564 | the message queue has the upside of centralizing a lot of code and | ||
| 565 | providing pure process-context execution of methods. The message queue | ||
| 566 | can also be elevated to realtime priority on high-priority SPI traffic. | ||
| 567 | |||
| 568 | Unless the queueing mechanism in the SPI subsystem is selected, the bulk | ||
| 569 | of the driver will be managing the I/O queue fed by the now deprecated | ||
| 570 | function transfer(). | ||
| 539 | 571 | ||
| 540 | That queue could be purely conceptual. For example, a driver used only | 572 | That queue could be purely conceptual. For example, a driver used only |
| 541 | for low-frequency sensor access might be fine using synchronous PIO. | 573 | for low-frequency sensor access might be fine using synchronous PIO. |
| @@ -561,4 +593,6 @@ Stephen Street | |||
| 561 | Mark Underwood | 593 | Mark Underwood |
| 562 | Andrew Victor | 594 | Andrew Victor |
| 563 | Vitaly Wool | 595 | Vitaly Wool |
| 564 | 596 | Grant Likely | |
| 597 | Mark Brown | ||
| 598 | Linus Walleij | ||
