bind.rst 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. .. SPDX-License-Identifier: GPL-2.0+:
  2. bind command
  3. ============
  4. Synopsis
  5. --------
  6. ::
  7. bind <node path> <driver>
  8. bind <class> <index> <driver>
  9. Description
  10. -----------
  11. The bind command is used to bind a device to a driver. This makes the
  12. device available in U-Boot.
  13. While binding to a *node path* typically provides a working device
  14. binding by parent node and driver may lead to a device that is only
  15. partially initialized.
  16. node path
  17. path of the device's device-tree node
  18. class
  19. device class name
  20. index
  21. index of the parent device in the device class
  22. driver
  23. device driver name
  24. Example
  25. -------
  26. Given a system with a real time clock device with device path */pl031@9010000*
  27. and using driver rtc-pl031 unbinding and binding of the device is demonstrated
  28. using the two alternative bind syntaxes.
  29. .. code-block::
  30. => dm tree
  31. Class Index Probed Driver Name
  32. -----------------------------------------------------------
  33. root 0 [ + ] root_driver root_driver
  34. ...
  35. rtc 0 [ ] rtc-pl031 |-- pl031@9010000
  36. ...
  37. => fdt addr $fdtcontroladdr
  38. Working FDT set to 7ed7fdb0
  39. => fdt print
  40. / {
  41. interrupt-parent = <0x00008003>;
  42. model = "linux,dummy-virt";
  43. #size-cells = <0x00000002>;
  44. #address-cells = <0x00000002>;
  45. compatible = "linux,dummy-virt";
  46. ...
  47. pl031@9010000 {
  48. clock-names = "apb_pclk";
  49. clocks = <0x00008000>;
  50. interrupts = <0x00000000 0x00000002 0x00000004>;
  51. reg = <0x00000000 0x09010000 0x00000000 0x00001000>;
  52. compatible = "arm,pl031", "arm,primecell";
  53. };
  54. ...
  55. }
  56. => unbind /pl031@9010000
  57. => date
  58. Cannot find RTC: err=-19
  59. => dm tree
  60. Class Index Probed Driver Name
  61. -----------------------------------------------------------
  62. root 0 [ + ] root_driver root_driver
  63. ...
  64. => bind /pl031@9010000 rtc-pl031
  65. => dm tree
  66. Class Index Probed Driver Name
  67. -----------------------------------------------------------
  68. root 0 [ + ] root_driver root_driver
  69. ...
  70. rtc 0 [ ] rtc-pl031 |-- pl031@9010000
  71. => date
  72. Date: 2023-06-22 (Thursday) Time: 15:14:51
  73. => unbind rtc 0 rtc-pl031
  74. => bind root 0 rtc-pl031
  75. => date
  76. Date: 1980-08-19 (Tuesday) Time: 14:45:30
  77. Obviously the device is not initialized correctly by the last bind command.
  78. Configuration
  79. -------------
  80. The bind command is only available if CONFIG_CMD_BIND=y.
  81. Return code
  82. -----------
  83. The return code $? is 0 (true) on success and 1 (false) on failure.