From mboxrd@z Thu Jan 1 00:00:00 1970 From: Simon Glass Date: Fri, 29 Jun 2018 21:19:42 -0700 Subject: [U-Boot] [PATCH v3 7/7] cmd: Add bind/unbind commands to bind a device to a driver from the command line In-Reply-To: <242671f8-f197-7b51-a419-be4e6f36b66f@xilinx.com> References: <1529670334-21974-1-git-send-email-jjhiblot@ti.com> <1529670334-21974-8-git-send-email-jjhiblot@ti.com> <242671f8-f197-7b51-a419-be4e6f36b66f@xilinx.com> Message-ID: List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de On 27 June 2018 at 07:13, Michal Simek wrote: > On 22.6.2018 14:25, Jean-Jacques Hiblot wrote: >> In some cases it can be useful to be able to bind a device to a driver from >> the command line. >> The obvious example is for versatile devices such as USB gadget. >> Another use case is when the devices are not yet ready at startup and >> require some setup before the drivers are bound (ex: FPGA which bitsream is >> fetched from a mass storage or ethernet) >> >> usage example: >> >> bind usb_dev_generic 0 usb_ether >> unbind usb_dev_generic 0 usb_ether >> or >> unbind eth 1 >> >> bind /ocp/omap_dwc3 at 48380000/usb at 48390000 usb_ether >> unbind /ocp/omap_dwc3 at 48380000/usb at 48390000 >> >> Signed-off-by: Jean-Jacques Hiblot >> >> --- >> >> Changes in v3: >> - factorize code based on comments from ML >> - remove the devices before unbinding them >> - use device_find_global_by_ofnode() to get a device by its node. >> - Added tests >> >> Changes in v2: >> - Make the bind/unbind command generic, not specific to usb device. >> - Update the API to be able to bind/unbind based on DTS node path >> - Add a Kconfig option to select the bind/unbind commands >> >> arch/sandbox/dts/test.dts | 11 ++ >> cmd/Kconfig | 9 ++ >> cmd/Makefile | 1 + >> cmd/bind.c | 255 +++++++++++++++++++++++++++++++++++++++++++++ >> configs/sandbox_defconfig | 1 + >> test/py/tests/test_bind.py | 178 +++++++++++++++++++++++++++++++ >> 6 files changed, 455 insertions(+) >> create mode 100644 cmd/bind.c >> create mode 100644 test/py/tests/test_bind.py Reviewed-by: Simon Glass Nice work [...] > > I have tested bind/unbind with dwc3 on zynqmp for ethernet gadget and it > is working fine for me. > I have also tried to use bind/unbind for gpio zynqmp driver and it is > also working fine. > > It means > Tested-by: Michal Simek > > I would prefer if these commands are called as dm bind and dm unbind > instead of simply bind/unbind which should also fit to dm command > description "dm - Driver model low level access". Yes i can see the point. But after thinking about it, maybe it is best as it is? After all driver model is fundamental to U-Boot and it's not clear what else we might bind/unbind. I'd like to get other opinions here, too. Regards, Simon