diff options
author | Jonathan Herman <hermanjl@cs.unc.edu> | 2013-01-17 16:15:55 -0500 |
---|---|---|
committer | Jonathan Herman <hermanjl@cs.unc.edu> | 2013-01-17 16:15:55 -0500 |
commit | 8dea78da5cee153b8af9c07a2745f6c55057fe12 (patch) | |
tree | a8f4d49d63b1ecc92f2fddceba0655b2472c5bd9 /Documentation/spi/spi-summary | |
parent | 406089d01562f1e2bf9f089fd7637009ebaad589 (diff) |
Patched in Tegra support.
Diffstat (limited to 'Documentation/spi/spi-summary')
-rw-r--r-- | Documentation/spi/spi-summary | 62 |
1 files changed, 14 insertions, 48 deletions
diff --git a/Documentation/spi/spi-summary b/Documentation/spi/spi-summary index 2331eb21414..4884cb33845 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 | 02-Feb-2012 | 4 | 21-May-2007 |
5 | 5 | ||
6 | What is SPI? | 6 | What is SPI? |
7 | ------------ | 7 | ------------ |
@@ -345,7 +345,7 @@ SPI protocol drivers somewhat resemble platform device drivers: | |||
345 | }, | 345 | }, |
346 | 346 | ||
347 | .probe = CHIP_probe, | 347 | .probe = CHIP_probe, |
348 | .remove = CHIP_remove, | 348 | .remove = __devexit_p(CHIP_remove), |
349 | .suspend = CHIP_suspend, | 349 | .suspend = CHIP_suspend, |
350 | .resume = CHIP_resume, | 350 | .resume = CHIP_resume, |
351 | }; | 351 | }; |
@@ -355,7 +355,7 @@ device whose board_info gave a modalias of "CHIP". Your probe() code | |||
355 | might look like this unless you're creating a device which is managing | 355 | might look like this unless you're creating a device which is managing |
356 | a bus (appearing under /sys/class/spi_master). | 356 | a bus (appearing under /sys/class/spi_master). |
357 | 357 | ||
358 | static int CHIP_probe(struct spi_device *spi) | 358 | static int __devinit CHIP_probe(struct spi_device *spi) |
359 | { | 359 | { |
360 | struct CHIP *chip; | 360 | struct CHIP *chip; |
361 | struct CHIP_platform_data *pdata; | 361 | struct CHIP_platform_data *pdata; |
@@ -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 the | 486 | publish it to the rest of the system. At that time, device nodes for |
487 | controller and any predeclared spi devices will be made available, and | 487 | the controller and any predeclared spi devices will be made available, |
488 | the driver model core will take care of binding them to drivers. | 488 | and 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,53 +521,21 @@ 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 | |||
524 | master->cleanup(struct spi_device *spi) | 530 | master->cleanup(struct spi_device *spi) |
525 | Your controller driver may use spi_device.controller_state to hold | 531 | Your controller driver may use spi_device.controller_state to hold |
526 | state it dynamically associates with that device. If you do that, | 532 | state it dynamically associates with that device. If you do that, |
527 | be sure to provide the cleanup() method to free that state. | 533 | be sure to provide the cleanup() method to free that state. |
528 | 534 | ||
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 | |||
559 | 535 | ||
560 | SPI MESSAGE QUEUE | 536 | SPI MESSAGE QUEUE |
561 | 537 | ||
562 | If you are happy with the standard queueing mechanism provided by the | 538 | The bulk of the driver will be managing the I/O queue fed by transfer(). |
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(). | ||
571 | 539 | ||
572 | That queue could be purely conceptual. For example, a driver used only | 540 | That queue could be purely conceptual. For example, a driver used only |
573 | for low-frequency sensor access might be fine using synchronous PIO. | 541 | for low-frequency sensor access might be fine using synchronous PIO. |
@@ -593,6 +561,4 @@ Stephen Street | |||
593 | Mark Underwood | 561 | Mark Underwood |
594 | Andrew Victor | 562 | Andrew Victor |
595 | Vitaly Wool | 563 | Vitaly Wool |
596 | Grant Likely | 564 | |
597 | Mark Brown | ||
598 | Linus Walleij | ||