Commit 38687ae67664d0f7ee907a2053d4a0663744b7b4
1 parent
f8fff9dac9
Exists in
v2017.01-smarct4x
and in
37 other branches
dm: Update documentation to include CONFIG_DM... options
Add documentation for the various driver model options that are now available. Signed-off-by: Simon Glass <sjg@chromium.org>
Showing 2 changed files with 153 additions and 10 deletions Side-by-side Diff
README
... | ... | @@ -623,6 +623,120 @@ |
623 | 623 | exists, unlike the similar options in the Linux kernel. Do not |
624 | 624 | set these options unless they apply! |
625 | 625 | |
626 | +- Driver Model | |
627 | + Driver model is a new framework for devices in U-Boot | |
628 | + introduced in early 2014. U-Boot is being progressively | |
629 | + moved over to this. It offers a consistent device structure, | |
630 | + supports grouping devices into classes and has built-in | |
631 | + handling of platform data and device tree. | |
632 | + | |
633 | + To enable transition to driver model in a relatively | |
634 | + painful fashion, each subsystem can be independently | |
635 | + switched between the legacy/ad-hoc approach and the new | |
636 | + driver model using the options below. Also, many uclass | |
637 | + interfaces include compatibility features which may be | |
638 | + removed once the conversion of that subsystem is complete. | |
639 | + As a result, the API provided by the subsystem may in fact | |
640 | + not change with driver model. | |
641 | + | |
642 | + See doc/driver-model/README.txt for more information. | |
643 | + | |
644 | + CONFIG_DM | |
645 | + | |
646 | + Enable driver model. This brings in the core support, | |
647 | + including scanning of platform data on start-up. If | |
648 | + CONFIG_OF_CONTROL is enabled, the device tree will be | |
649 | + scanned also when available. | |
650 | + | |
651 | + CONFIG_CMD_DM | |
652 | + | |
653 | + Enable driver model test commands. These allow you to print | |
654 | + out the driver model tree and the uclasses. | |
655 | + | |
656 | + CONFIG_DM_DEMO | |
657 | + | |
658 | + Enable some demo devices and the 'demo' command. These are | |
659 | + really only useful for playing around while trying to | |
660 | + understand driver model in sandbox. | |
661 | + | |
662 | + CONFIG_SPL_DM | |
663 | + | |
664 | + Enable driver model in SPL. You will need to provide a | |
665 | + suitable malloc() implementation. If you are not using the | |
666 | + full malloc() enabled by CONFIG_SYS_SPL_MALLOC_START, | |
667 | + consider using CONFIG_SYS_MALLOC_SIMPLE. In that case you | |
668 | + must provide CONFIG_SYS_MALLOC_F_LEN to set the size. | |
669 | + In most cases driver model will only allocate a few uclasses | |
670 | + and devices in SPL, so 1KB should be enable. See | |
671 | + CONFIG_SYS_MALLOC_F_LEN for more details on how to enable | |
672 | + it. | |
673 | + | |
674 | + CONFIG_DM_SERIAL | |
675 | + | |
676 | + Enable driver model for serial. This replaces | |
677 | + drivers/serial/serial.c with the serial uclass, which | |
678 | + implements serial_putc() etc. The uclass interface is | |
679 | + defined in include/serial.h. | |
680 | + | |
681 | + CONFIG_DM_GPIO | |
682 | + | |
683 | + Enable driver model for GPIO access. The standard GPIO | |
684 | + interface (gpio_get_value(), etc.) is then implemented by | |
685 | + the GPIO uclass. Drivers provide methods to query the | |
686 | + particular GPIOs that they provide. The uclass interface | |
687 | + is defined in include/asm-generic/gpio.h. | |
688 | + | |
689 | + CONFIG_DM_SPI | |
690 | + | |
691 | + Enable driver model for SPI. The SPI slave interface | |
692 | + (spi_setup_slave(), spi_xfer(), etc.) is then implemented by | |
693 | + the SPI uclass. Drivers provide methods to access the SPI | |
694 | + buses that they control. The uclass interface is defined in | |
695 | + include/spi.h. The existing spi_slave structure is attached | |
696 | + as 'parent data' to every slave on each bus. Slaves | |
697 | + typically use driver-private data instead of extending the | |
698 | + spi_slave structure. | |
699 | + | |
700 | + CONFIG_DM_SPI_FLASH | |
701 | + | |
702 | + Enable driver model for SPI flash. This SPI flash interface | |
703 | + (spi_flash_probe(), spi_flash_write(), etc.) is then | |
704 | + implemented by the SPI flash uclass. There is one standard | |
705 | + SPI flash driver which knows how to probe most chips | |
706 | + supported by U-Boot. The uclass interface is defined in | |
707 | + include/spi_flash.h, but is currently fully compatible | |
708 | + with the old interface to avoid confusion and duplication | |
709 | + during the transition parent. SPI and SPI flash must be | |
710 | + enabled together (it is not possible to use driver model | |
711 | + for one and not the other). | |
712 | + | |
713 | + CONFIG_DM_CROS_EC | |
714 | + | |
715 | + Enable driver model for the Chrome OS EC interface. This | |
716 | + allows the cros_ec SPI driver to operate with CONFIG_DM_SPI | |
717 | + but otherwise makes few changes. Since cros_ec also supports | |
718 | + I2C and LPC (which don't support driver model yet), a full | |
719 | + conversion is not yet possible. | |
720 | + | |
721 | + | |
722 | + ** Code size options: The following options are enabled by | |
723 | + default except in SPL. Enable them explicitly to get these | |
724 | + features in SPL. | |
725 | + | |
726 | + CONFIG_DM_WARN | |
727 | + | |
728 | + Enable the dm_warn() function. This can use up quite a bit | |
729 | + of space for its strings. | |
730 | + | |
731 | + CONFIG_DM_STDIO | |
732 | + | |
733 | + Enable registering a serial device with the stdio library. | |
734 | + | |
735 | + CONFIG_DM_DEVICE_REMOVE | |
736 | + | |
737 | + Enable removing of devices. | |
738 | + | |
739 | + | |
626 | 740 | - Linux Kernel Interface: |
627 | 741 | CONFIG_CLOCKS_IN_MHZ |
628 | 742 | |
... | ... | @@ -3880,6 +3994,11 @@ |
3880 | 3994 | |
3881 | 3995 | Pre-relocation malloc() is only supported on ARM and sandbox |
3882 | 3996 | at present but is fairly easy to enable for other archs. |
3997 | + | |
3998 | +- CONFIG_SYS_MALLOC_SIMPLE | |
3999 | + Provides a simple and small malloc() and calloc() for those | |
4000 | + boards which do not use the full malloc in SPL (which is | |
4001 | + enabled with CONFIG_SYS_SPL_MALLOC_START). | |
3883 | 4002 | |
3884 | 4003 | - CONFIG_SYS_BOOTM_LEN: |
3885 | 4004 | Normally compressed uImages are limited to an |
doc/driver-model/README.txt
... | ... | @@ -750,19 +750,43 @@ |
750 | 750 | pointer is saved but not made available through the driver model API). |
751 | 751 | |
752 | 752 | |
753 | -Things to punt for later | |
754 | ------------------------- | |
753 | +SPL Support | |
754 | +----------- | |
755 | 755 | |
756 | -- SPL support - this will have to be present before many drivers can be | |
757 | -converted, but it seems like we can add it once we are happy with the | |
758 | -core implementation. | |
756 | +Driver model can operate in SPL. Its efficient implementation and small code | |
757 | +size provide for a small overhead which is acceptable for all but the most | |
758 | +constrained systems. | |
759 | 759 | |
760 | -That is not to say that no thinking has gone into this - in fact there | |
761 | -is quite a lot there. However, getting these right is non-trivial and | |
762 | -there is a high cost associated with going down the wrong path. | |
760 | +To enable driver model in SPL, define CONFIG_SPL_DM. You might want to | |
761 | +consider the following option also. See the main README for more details. | |
763 | 762 | |
764 | -For SPL, it may be possible to fit in a simplified driver model with only | |
765 | -bind and probe methods, to reduce size. | |
763 | + - CONFIG_SYS_MALLOC_SIMPLE | |
764 | + - CONFIG_DM_WARN | |
765 | + - CONFIG_DM_DEVICE_REMOVE | |
766 | + - CONFIG_DM_STDIO | |
767 | + | |
768 | + | |
769 | +Enabling Driver Model | |
770 | +--------------------- | |
771 | + | |
772 | +Driver model is being brought into U-Boot gradually. As each subsystems gets | |
773 | +support, a uclass is created and a CONFIG to enable use of driver model for | |
774 | +that subsystem. | |
775 | + | |
776 | +For example CONFIG_DM_SERIAL enables driver model for serial. With that | |
777 | +defined, the old serial support is not enabled, and your serial driver must | |
778 | +conform to driver model. With that undefined, the old serial support is | |
779 | +enabled and driver model is not available for serial. This means that when | |
780 | +you convert a driver, you must either convert all its boards, or provide for | |
781 | +the driver to be compiled both with and without driver model (generally this | |
782 | +is not very hard). | |
783 | + | |
784 | +See the main README for full details of the available driver model CONFIG | |
785 | +options. | |
786 | + | |
787 | + | |
788 | +Things to punt for later | |
789 | +------------------------ | |
766 | 790 | |
767 | 791 | Uclasses are statically numbered at compile time. It would be possible to |
768 | 792 | change this to dynamic numbering, but then we would require some sort of |