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 3381EC001DB for ; Fri, 4 Aug 2023 18:51:18 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 73DBD86946; Fri, 4 Aug 2023 20:51:16 +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="AuN/GaTl"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id B47168662E; Fri, 4 Aug 2023 20:51:15 +0200 (CEST) Received: from mail-yb1-xb29.google.com (mail-yb1-xb29.google.com [IPv6:2607:f8b0:4864:20::b29]) (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 3D3C086946 for ; Fri, 4 Aug 2023 20:51:11 +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-yb1-xb29.google.com with SMTP id 3f1490d57ef6-d3d729a08e4so2709512276.3 for ; Fri, 04 Aug 2023 11:51:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=konsulko.com; s=google; t=1691175070; x=1691779870; 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=FUG3eaxYZZ+EfJ0+SsIrxpuD8TaXVSbJw8hK7uIkF+8=; b=AuN/GaTllwGPj+MtF3Yo4ND3Ijby7ea7OC2p/wWnGny5C7F55G+yeejMfCjyHGwJz6 rjTco7q0fUa6R1ME1BWZgcys5gSejNEyxxSJSLku2p95ZwLkGAo+6rAhh+NzTreyOc9P n4HRk0cbv+9OgqzvCdcLPrhwhfYoYt1PBKKgM= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1691175070; x=1691779870; 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=FUG3eaxYZZ+EfJ0+SsIrxpuD8TaXVSbJw8hK7uIkF+8=; b=bqT24booEhLUdgWv0TjeGo/gNGrzFJl8su1oUwphhk2H41WBdiY9MncUDHtGyeuN8O BGaOJmuafFaNpjU9r8y8Wwax25bNkctTAdoPVUnX7/DEXfO4myL2uaaGQeIe85ZVSL+w KkscTHimGpGLySnkgZBNJgZro+YvVHcnRQH6i8DAiCCD4Ngaa+Fpf/ryp9z0CL5OB1Uw qS5yBKcZ3rE1SsRIhtllEdPmPG9ppar8cwPtaE1ekpNJOe/n6Uvygqa43XgPWUAPGNjA oOueJyIc1ZUb6hblxArnLoDzq0FOToMb5Gv5svGep8Z/sC1S5t3cRl6ph0fNUQpOQ9g/ HJog== X-Gm-Message-State: AOJu0YzvA9TG0xq3YeOTggbOuffO/pTzTMuqryZ4oW6sAcElRph86Dim YqJx7P/0bkppjp/dKtLqLLulmQ== X-Google-Smtp-Source: AGHT+IEJ7NVG8+WPgYkX7z+4Cp6aLN8Lqq160lMPB//tPV1xCN6XocqvKSXTvr7WeFCTUTIYpG+EvQ== X-Received: by 2002:a25:cb8f:0:b0:d21:ef87:c1c4 with SMTP id b137-20020a25cb8f000000b00d21ef87c1c4mr2400182ybg.33.1691175069893; Fri, 04 Aug 2023 11:51:09 -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 c2-20020a258802000000b00d0c698ed6b6sm765672ybl.41.2023.08.04.11.51.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 04 Aug 2023 11:51:09 -0700 (PDT) Date: Fri, 4 Aug 2023 14:51:07 -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: <20230804185107.GZ3630934@bill-the-cat> References: <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> <20230804161515.GR3630934@bill-the-cat> <20230804190146.2595e241@xps-13> <20230804172029.GT3630934@bill-the-cat> <20230804200156.04423128@xps-13> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="pR9OY4fEKp527eqk" Content-Disposition: inline In-Reply-To: <20230804200156.04423128@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 --pR9OY4fEKp527eqk Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Fri, Aug 04, 2023 at 08:01:56PM +0200, Miquel Raynal wrote: > Hi Tom, >=20 > trini@konsulko.com wrote on Fri, 4 Aug 2023 13:20:29 -0400: >=20 > > On Fri, Aug 04, 2023 at 07:01:46PM +0200, Miquel Raynal wrote: > > > Hi Tom, > > > =20 > > > > > > >>> Well, what's needed / is it possible to get to the point wh= ere we don't > > > > > > >>> _need_ to call bind/unbind for each of these cases? Is ther= e something > > > > > > >>> we're supposed to be setting in the DT that we aren't? = =20 > > > > > > >> > > > > > > >> You do need to unbind the ethernet before using fastboot, al= ways, with the 'unbind ethernet 0', you dont need the peripheral unbind/reb= ind part, so it should behave like before. =20 > > > > > > >=20 > > > > > > > And for my own understanding, why don't we need to bind a fas= tboot > > > > > > > gadget? =20 > > > > > >=20 > > > > > > The fastboot command does that internally . =20 > > > > >=20 > > > > > This is not visible with dm tree and I did not find how to bind t= he > > > > > fastboot gadget manually. > > > > >=20 > > > > > This makes the CLI clearly uneven and the internal code badly dif= ferent > > > > > between gadgets/commands. Why can't we have them both > > > > > autoloaded/unloaded like before? I think I missed something which > > > > > explains the rationale behind this series. =20 > > > >=20 > > > > They aren't both auto-loaded currently. We have a legacy call, > > > > usb_ether_init(), in a few cases, so that gadget mode ethernet star= ts. > > > > But this leads to the ref counting problems you encountered and > > > > re-posted the rejected series for. =20 > > >=20 > > > Ok, thanks for the additional details. > > >=20 > > > I don't understand why fastboot autoloads the correct gadget driver if > > > there is none bound, while all network commands just fail to do that = if > > > we don't make the usb_ether_init() call manually. =20 > >=20 > > Because "fastboot" or "dfu" are both being told (as part of their call) > > "find usb gadget controller number X". That's doing the bind. Calling > > usb_ether_init just takes the first controller and that's that (and so > > could be / is wrong depending on the platform). >=20 > This makes total sense, thanks for pointing it out. >=20 > > > I also don't understand why I need to unbind the ethernet gadget but I > > > cannot bind the fastboot gadget. =20 > >=20 > > You can't bind fastboot while ethernet is still configured. >=20 > I guess "before this series", the ethernet would not be kept > configured, because I could use both fastboot and ethernet without > caring about which driver had to be bound. And that's maybe what lead to > the bug reports also. So you want to get rid of this. Do I get the > situation right now? We're getting rid of this path because it leads to failures, yes. > > It's in > > use. And we aren't a full blown operating system with the logic to have > > multiple end points and devices configured and exposed. I mean heck, we > > don't keep the gadget interface up between network calls so on the host > > side you need to re-configure the interface (or have something that's > > bringing it up there again each time). Which is why DFU or fastboot or > > other "treat USB like USB" options tend to be more popular than "treat > > USB like ethernet" work flows. >=20 > Yes of course. >=20 > > > My underlying question is: can we have a single approach for all > > > drivers, or is it too complex today? Could it be possible, when we > > > perform these autoloads, to look up the registered gadget and > > > potentially unbind the one already in place before? =20 > >=20 > > I would invite you to look in to this, yes. >=20 > Sounds reasonably complex now, with the reasoning you made above. >=20 > > No one objects to enhancing > > the code, but the "functionality" you see on am33xx is as you've also > > seen very broken in other ways, which is why it's not used virtually > > anywhere else and instead the "bind" command is. For example, if you > > wanted to do this workflow on the new beagle devices, that's DWC3 and > > where the "bind" command came from :) >=20 > Again to be very clear, while I felt misunderstood at the beginning and > did not accept Marek's series because it was replacing a data abort > with a non-functional setup, I now get a better understanding of the > problem (I believe) and, as said before, I am always in favor of > writing better code, easier to maintain, clearer to review. I am in > favor of such change. I just want the user life to be eased when this > happens if we break the CLI. So if you think the right approach is to > get rid of the usb_ether_init() call, alright, let's drop it off. But > we should not let the users in the dark by providing proper doc or > error messages which should compensate the extra step now required. I think it would be good if you posted a patch to update doc/board/ti/am335x_evm.rst to explain how to use the various gadget device cases. --=20 Tom --pR9OY4fEKp527eqk Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQGzBAABCgAdFiEEGjx/cOCPqxcHgJu/FHw5/5Y0tywFAmTNSJgACgkQFHw5/5Y0 tyw/zgwAjrilARHYT25mvQ8JbV5CgoNq8CmzwEWqpTrkgXPKLpvOvah8EZP7ZQEX QJ84RySpM/yLj0eyiu96E09MAXZ2pP4UkYw1LkzUFv4dJDZboLoAZ9cIBkUhXzXO /8vioOziyf8rru8mVutDgTCQYDaTTxAoEyFKHWMyW1ySMh2p4Wbu/MEVJVCPU9M3 S2A30stULl2XdMtYSr1QGVt7sNEA5ONUM/qURXwlcosoiCMArsCFe9+m7fFT35u5 DrDpWMmlF+kqZPU4mE8GFrVhVLFhYD+wUqe4EnAlkxGdLm0li7hmrwFMhy7BotuA s5TDVQXdG7WPsEdUR4EZm7pREvHk1gVXqXVRq1d+XySgA8le6gZBvRfRzjIO4wCj TDQeBBm70yusEoZjp172SDGVoLrP7NtnzHQbIi16H0NWJ0dbqk5VMvObxq32VZRQ CPnUpGSDmE3bBGLwehksQsHXkTGrMTcAUCt99Fb1FFuNfsHutlToWFWZ+rXk4bFT uYP17he+ =wXbZ -----END PGP SIGNATURE----- --pR9OY4fEKp527eqk--