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 B97D9C001DB for ; Fri, 4 Aug 2023 16:38:08 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id B18AC868D5; Fri, 4 Aug 2023 18:38:06 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=konsulko.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=konsulko.com header.i=@konsulko.com header.b="LR1md13+"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id D9E8C867F4; Fri, 4 Aug 2023 18:38:05 +0200 (CEST) Received: from mail-yw1-x1131.google.com (mail-yw1-x1131.google.com [IPv6:2607:f8b0:4864:20::1131]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 3F173868E5 for ; Fri, 4 Aug 2023 18:38:01 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=konsulko.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=trini@konsulko.com Received: by mail-yw1-x1131.google.com with SMTP id 00721157ae682-583b3aa4f41so25192067b3.2 for ; Fri, 04 Aug 2023 09:38:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=konsulko.com; s=google; t=1691167080; x=1691771880; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=EC2yYe6tTefBbprfG+/0YcEM9ufhxKojiAcsP6+nVPE=; b=LR1md13+waXs70vvNcYO/2DhaIDKwLWlewazUAqXm6LGqHP+DQxnAtJHrMQGS5Y01i pQQTvuc1jbOugm3G6uW+gN1Ngk0UsM/gKEYRohg4yAsypsCkdmb5oOyOEhEWI2/GB1gp IlDk+YdUuNZDaO1tytyhCpvCLl3yIyBbmVhgU= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1691167080; x=1691771880; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=EC2yYe6tTefBbprfG+/0YcEM9ufhxKojiAcsP6+nVPE=; b=k185YwzKs3gOKmSia/BEKgrCiTVdqMPhCoMkNBDvuFDxY/g2zzcvenRaVlC/RfkHcC LJNrRXEXuiwSBO3Eq8Ibl41bgMuakVVloy2LAlbGkq9M3xTUvcRlXkzkBTb/vt7vGkGc HshOYWi96voVNCU1E5hDTvf7nQ9ZQpWoK3iZhWK8VdQvGWdn33+Rob21/PfSCNKQgtKc pnkIHuZRk5j0biYDkVzFcZTeQp4Dzu9gKyPSOQT7yOO2b1rJThpvrOiaAzXafw4WnmI0 qCKXoUm+SmLnO+pmOaaD4PZjT//60pLH3PQWqcuzIPlsSAzOQXMQ0aElJVohACFnFCgN 31ag== X-Gm-Message-State: AOJu0YxRPVWM6Ry0EzrbUe0Bev6TSfXiLKwsca1nViQagUQt6xgaGakq XhEeJ7ZZKhaDSTZJdloE5FTBYg== X-Google-Smtp-Source: AGHT+IH9OkKfM0CxalAW/FLO63VKLQGTiDp/4fOKXxKsFuzBOyg7MZnuqmvIxaFjvgBuyH/Jjqf7Jg== X-Received: by 2002:a0d:d84f:0:b0:586:9ab:5cc with SMTP id a76-20020a0dd84f000000b0058609ab05ccmr2287167ywe.42.1691167079734; Fri, 04 Aug 2023 09:37:59 -0700 (PDT) Received: from bill-the-cat (2603-6081-7b00-6400-c37f-6e0c-fce7-d587.res6.spectrum.com. [2603:6081:7b00:6400:c37f:6e0c:fce7:d587]) by smtp.gmail.com with ESMTPSA id s4-20020a0dd004000000b005704c4d3579sm813784ywd.40.2023.08.04.09.37.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 04 Aug 2023 09:37:59 -0700 (PDT) Date: Fri, 4 Aug 2023 12:37:57 -0400 From: Tom Rini To: Miquel Raynal Cc: Marek Vasut , 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: <20230804163757.GS3630934@bill-the-cat> 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> <20230804171206.07faade4@xps-13> <0eb7f3fe-42da-6252-3b77-50eb3276f2ee@denx.de> <20230804180012.79c4f9ec@xps-13> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="4IUdiA7Y8Iq/RlwT" Content-Disposition: inline In-Reply-To: <20230804180012.79c4f9ec@xps-13> X-Clacks-Overhead: GNU Terry Pratchett 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 --4IUdiA7Y8Iq/RlwT Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Fri, Aug 04, 2023 at 06:00:12PM +0200, Miquel Raynal wrote: > Hi Marek, >=20 > marex@denx.de wrote on Fri, 4 Aug 2023 17:40:07 +0200: >=20 > > On 8/4/23 17:12, Miquel Raynal wrote: > > > Hi, > > >=20 > > > marex@denx.de wrote on Fri, 4 Aug 2023 17:05:01 +0200: > > > =20 > > >> On 8/4/23 17:01, Tom Rini wrote: =20 > > >>> 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 =20 > > >>>>>> 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 gad= get > > >>>>>> drivers bound to it. The unbind command has to select that speci= fic > > >>>>>> 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. Not= ice > > >>>>>> the extra 'usb_ether' addition in the 'unbind' command at the en= d. > > >>>>>> " > > >>>>>> 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 = select > > >>>>> 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 ou= tput > > >>>>> to the usb nodes for clarity): =20 > > >>>>> >>>>> =3D> dm tree =20 > > >>>>> misc 0 [ + ] ti-musb-wrapper | |-- usb@47= 400000 > > >>>>> usb 0 [ + ] ti-musb-peripheral | | |-- us= b@47401000 > > >>>>> ethernet 1 [ + ] usb_ether | | | `-= - usb_ether > > >>>>> bootdev 3 [ ] eth_bootdev | | | = `-- usb_ether.bootdev > > >>>>> usb 0 [ ] ti-musb-host | | `-- us= b@47401800 =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 > > >>> > > >>> 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 > > >> > > >> 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 any= more. =20 > >=20 > > Did you test this yet ? >=20 > Not yet, I'll send you the feedback once done. >=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@47= 400000 > > >>>>> usb 0 [ ] ti-musb-host | | `-- us= b@47401800 =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@47= 400000 > > >>>>> usb 0 [ ] ti-musb-host | | |-- us= b@47401800 > > >>>>> usb 0 [ ] ti-musb-peripheral | | `-- us= b@47401000 =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 > > >=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 =20 > >=20 > > Since with this 'unbind ethernet 0' this is orthogonal to this series, = send separate patches, thanks. >=20 > This is not orthogonal, I am sorry. >=20 > version X: > - tftp works "out of the box" > - fastboot works "out of the box" > version X+1: > - tftp works "out of the box" > - fastboot returns an obscure error >=20 > 1/ If we now *need* the bind/unbind commands, the series must take care > of it. > 2/ Without proper error message you just break fastboot for most > regular users (basically everyone but few U-Boot devs). You're missing the class of users that will be impacted here. In order for there to be a change here, you have to already be in the case where you have CONFIG_USB_ETHER=3Dy and gadget ethernet device isn't just enabled but also initialized by default by calling usb_ether_init(). That's a very small list. It's basically am33xx, two mediatek reference platforms and xilinx_zynqmp_virt. Given that am33xx defconfigs also setup DFU, I'm not really sure just how many people use gadget ethernet. The normal flow on modern devices is to be calling bind/unbind here already. --=20 Tom --4IUdiA7Y8Iq/RlwT Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQGzBAABCgAdFiEEGjx/cOCPqxcHgJu/FHw5/5Y0tywFAmTNKWEACgkQFHw5/5Y0 tyxzGQv/UrFjNOVgR8Q+BkB6/9N3PRiRf5RePWSZ5OA4c6bjjfPP+rlLHrUqAEC/ f7tBYQS7jFCDqQo0iXduOW5OC0Ho+HALYjlSh59WVDTS3X19dkx20A46enkC941I jFsXFZjIPwy7Q/UDqxd/Lfi10QiaOqd/zLOZu0Q1mrZU9IuCBtJavOjwlDY1mfCO iyLVr72Ff0thzORqYqwJwIFjD9jtWJ7SyYlN3YEH0lN7G+XkmUwQ7lU2+0Z5HQrO m0J1814kICzGMLDslJ3rOcV8AQrqlhe/tTRIOxDmOxD/8Hv0wF5+XqUEM9EnBIk5 bMX3OVmZn971bifXM4kb+vscyegtFgGM+EIKe65kxemZLnxYDCbj/CtjeUvVFXno PyGn2Oxmbh71DsyZ4cPTmhfqok+Tb0lzYpPXWeXpYUUPV2KHqWl1gNqbw7PqQSmC ioKKg3Q8QGUU2tbDHAbPcq4aXxpcZs04M7L0fs1ukJvVy/6z0g2ntEYJF/bDBJ5f CLRVLlbO =6JX8 -----END PGP SIGNATURE----- --4IUdiA7Y8Iq/RlwT--