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