blob: 67a0405bab531f6e23e08f5d67bc886c09be967a [file] [log] [blame]
Heinrich Schuchardt921e0a02023-06-21 21:24:55 +02001.. SPDX-License-Identifier: GPL-2.0+:
2
Heinrich Schuchardt1b0c3162024-01-14 14:53:13 +01003.. index::
4 single: bind (command)
5
Heinrich Schuchardt921e0a02023-06-21 21:24:55 +02006bind command
7============
8
9Synopsis
10--------
11
12::
13
14 bind <node path> <driver>
Zixun LI12e97b72024-08-02 11:28:13 +020015 bind <class> <seq> <driver>
Heinrich Schuchardt921e0a02023-06-21 21:24:55 +020016
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
Zixun LI12e97b72024-08-02 11:28:13 +020033seq
34 sequence number of the parent device in the device class
Heinrich Schuchardt921e0a02023-06-21 21:24:55 +020035
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
Zixun LI12e97b72024-08-02 11:28:13 +020049 Class Seq Probed Driver Name
Heinrich Schuchardt921e0a02023-06-21 21:24:55 +020050 -----------------------------------------------------------
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 LI12e97b72024-08-02 11:28:13 +020078 Class Seq Probed Driver Name
Heinrich Schuchardt921e0a02023-06-21 21:24:55 +020079 -----------------------------------------------------------
80 root 0 [ + ] root_driver root_driver
81 ...
82 => bind /pl031@9010000 rtc-pl031
83 => dm tree
Zixun LI12e97b72024-08-02 11:28:13 +020084 Class Seq Probed Driver Name
Heinrich Schuchardt921e0a02023-06-21 21:24:55 +020085 -----------------------------------------------------------
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.