From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 33265C001DB for ; Fri, 4 Aug 2023 15:12:14 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 82F1286904; Fri, 4 Aug 2023 17:12:12 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=reject dis=none) header.from=bootlin.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=bootlin.com header.i=@bootlin.com header.b="FXvSngsU"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 7E6EA86919; Fri, 4 Aug 2023 17:12:10 +0200 (CEST) Received: from relay9-d.mail.gandi.net (relay9-d.mail.gandi.net [IPv6:2001:4b98:dc4:8::229]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 487298666E for ; Fri, 4 Aug 2023 17:12:08 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=reject dis=none) header.from=bootlin.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=miquel.raynal@bootlin.com Received: by mail.gandi.net (Postfix) with ESMTPSA id 288DCFF809; Fri, 4 Aug 2023 15:12:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1691161927; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=uv/IBEMAAK/978fGdv+4Ag9A2Im9Fl/cnHkkTGdz4Eg=; b=FXvSngsUXmoCtX+4Ijy2NAVPaD91V4fzSjJpuMwK9gcRFJfsyxGl62HPgpaxlodaiy61J/ TufX3vCIa7w16r9qXUQTl+slVCXNHRPXin4hrLbwF1S4WVdhvKQor4hObYT7O9umOL0QnV 5m96VECyT2x90IUsAu7CpfOrMOtP6XoufOShk+7Op/HSUHTTA1apQ8ApNwWfhWGcM9Q0xa a6N6Cd3t/9kgWG1LkjEtqOMNt3EBWWx6kUICBsN0Qy99/URYLpC2wz3lbALvJhHOkr9zKl kFvByQO+1zjpmogY12r/d5TscdgUJmCEUaX4S3u9J5E1dgCxlXouC0OFPDJCuA== Date: Fri, 4 Aug 2023 17:12:06 +0200 From: Miquel Raynal To: Marek Vasut Cc: Tom Rini , u-boot@lists.denx.de, Kevin Hilman , Lukasz Majewski , Simon Glass Subject: Re: [PATCH v4 1/4] cmd: bind: Add unbind command with driver filter Message-ID: <20230804171206.07faade4@xps-13> In-Reply-To: <8902cf54-acba-cfb4-571b-09ba807e7a89@denx.de> References: <20230802124657.31184-1-marex@denx.de> <20230804090028.70aa780d@xps-13> <4833722f-18ab-e885-291a-988115fe39f8@denx.de> <20230804150100.GN3630934@bill-the-cat> <8902cf54-acba-cfb4-571b-09ba807e7a89@denx.de> Organization: Bootlin X-Mailer: Claws Mail 4.0.0 (GTK+ 3.24.33; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-GND-Sasl: miquel.raynal@bootlin.com X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.8 at phobos.denx.de X-Virus-Status: Clean Hi, marex@denx.de wrote on Fri, 4 Aug 2023 17:05:01 +0200: > On 8/4/23 17:01, Tom Rini wrote: > > On Fri, Aug 04, 2023 at 04:42:13PM +0200, Marek Vasut wrote: =20 > >> On 8/4/23 09:00, Miquel Raynal wrote: =20 > >>> Hi Marek, > >>> > >>> marex@denx.de wrote on Wed, 2 Aug 2023 14:46:54 +0200: > >>> =20 > >>>> Extend the driver core to perform lookup by both OF node and driver > >>>> bound to the node. Use this to look up specific device instances to > >>>> unbind from nodes in the unbind command. One example where this is > >>>> needed is USB peripheral controller, which may have multiple gadget > >>>> drivers bound to it. The unbind command has to select that specific > >>>> gadget driver instance to unbind from the controller, not unbind the > >>>> controller driver itself from the controller. > >>>> > >>>> USB ethernet gadget usage looks as follows with this change. Notice > >>>> the extra 'usb_ether' addition in the 'unbind' command at the end. > >>>> " > >>>> bind /soc/usb-otg@49000000 usb_ether > >>>> setenv ethact usb_ether > >>>> setenv loadaddr 0xc2000000 > >>>> setenv ipaddr 10.0.0.2 > >>>> setenv serverip 10.0.0.1 > >>>> setenv netmask 255.255.255.0 > >>>> tftpboot 0xc2000000 10.0.0.1:test.file > >>>> unbind /soc/usb-otg@49000000 usb_ether =20 > >>> > >>> This extra parameter does not seem to work on the BBBW. I cannot sele= ct > >>> the "usb_ether" driver like you do. > >>> > >>> Good news though, I am now able to use fastboot, but it is not > >>> straightforward: > >>> > >>> Here is my sequence right after the boot (reducing the dm tree output > >>> to the usb nodes for clarity): > >>> =20 > >>> =3D> dm tree =20 > >>> misc 0 [ + ] ti-musb-wrapper | |-- usb@47400000 > >>> usb 0 [ + ] ti-musb-peripheral | | |-- usb@474= 01000 > >>> ethernet 1 [ + ] usb_ether | | | `-- usb= _ether > >>> bootdev 3 [ ] eth_bootdev | | | `--= usb_ether.bootdev > >>> usb 0 [ ] ti-musb-host | | `-- usb@474= 01800 =20 > >>> =3D> fastboot usb 0 =20 > >>> couldn't find an available UDC > >>> g_dnl_register: failed!, error: -19 =20 > >> > >> That is expected and not a bug, since the beagle explicitly binds USB > >> ethernet to MUSB gadget in board file, which is legacy deprecated way.= =20 > >=20 > > So, we should do away with, probably all of arch_misc_init() in > > arch/arm/mach-omap2/am33xx/board.c for the non-SPL case. =20 >=20 > Yes >=20 > >>> exit not allowed from main input shell. =20 > >>> =3D> unbind /ocp/usb@47400000/usb@47401000 usb_ether =20 > >> > >> Does > >> =20 > >> =3D> unbind ethernet 0 =20 > >> > >> work ? > >> > >> If so, 1/4 in this series can be skipped altogether. > >> > >> You likely won't even need the rebinding of ti-musb-peripheral anymore. > >> =20 > >>> Cannot find a device with path /ocp/usb@47400000/usb@47401000 =20 > >>> =3D> unbind /ocp/usb@47400000/usb@47401000 > >>> =3D> dm tree =20 > >>> misc 0 [ + ] ti-musb-wrapper | |-- usb@47400000 > >>> usb 0 [ ] ti-musb-host | | `-- usb@474= 01800 =20 > >>> =3D> fastboot usb 0 > >>> =3D> bind /ocp/usb@47400000/usb@47401000 ti-musb-peripheral > >>> =3D> dm tree =20 > >>> misc 0 [ + ] ti-musb-wrapper | |-- usb@47400000 > >>> usb 0 [ ] ti-musb-host | | |-- usb@474= 01800 > >>> usb 0 [ ] ti-musb-peripheral | | `-- usb@474= 01000 =20 > >>> =3D> fastboot usb 0 =20 > >>> musb-hdrc: peripheral reset irq lost! > >>> # works! (the irq-related line above as always been there) > >>> > >>> So now, how do we make this process easy/understandable? =20 > >> > >> What would be your proposal ?=20 At least I would appreciate: - to select CMD_BIND "by default" when relevant - to make the fastboot error more readable for the regular user If you want to get rid of all the legacy code, I am not opposed, really, but that must not be the user who is responsible for understanding what changed in the "core". It must be very easily accessible to understand that now: - manual binding/unbinding is needed - which driver must be used when > > Well, what's needed / is it possible to get to the point where we don't > > _need_ to call bind/unbind for each of these cases? Is there something > > we're supposed to be setting in the DT that we aren't? =20 >=20 > You do need to unbind the ethernet before using fastboot, always, with th= e 'unbind ethernet 0', you dont need the peripheral unbind/rebind part, so = it should behave like before. And for my own understanding, why don't we need to bind a fastboot gadget? Thanks, Miqu=C3=A8l