blob: 234577836669446317e5e6c46491185e63b4a60e [file] [log] [blame]
Heinrich Schuchardt63e23f22023-06-21 21:24:55 +02001.. SPDX-License-Identifier: GPL-2.0+:
2
Heinrich Schuchardt60971e62024-01-14 14:53:13 +01003.. index::
4 single: bind (command)
5
Heinrich Schuchardt63e23f22023-06-21 21:24:55 +02006bind command
7============
8
9Synopsis
10--------
11
12::
13
14 bind <node path> <driver>
15 bind <class> <index> <driver>
16
17Description
18-----------
19
20The bind command is used to bind a device to a driver. This makes the
21device available in U-Boot.
22
23While binding to a *node path* typically provides a working device
24binding by parent node and driver may lead to a device that is only
25partially initialized.
26
27node path
28 path of the device's device-tree node
29
30class
31 device class name
32
33index
34 index of the parent device in the device class
35
36driver
37 device driver name
38
39Example
40-------
41
42Given a system with a real time clock device with device path */pl031@9010000*
43and using driver rtc-pl031 unbinding and binding of the device is demonstrated
44using the two alternative bind syntaxes.
45
46.. code-block::
47
48 => dm tree
49 Class Index Probed Driver Name
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
78 Class Index Probed Driver Name
79 -----------------------------------------------------------
80 root 0 [ + ] root_driver root_driver
81 ...
82 => bind /pl031@9010000 rtc-pl031
83 => dm tree
84 Class Index Probed Driver Name
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
96Obviously the device is not initialized correctly by the last bind command.
97
98Configuration
99-------------
100
101The bind command is only available if CONFIG_CMD_BIND=y.
102
103Return code
104-----------
105
106The return code $? is 0 (true) on success and 1 (false) on failure.