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 540CDC001DE for ; Fri, 4 Aug 2023 17:20:40 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id A6B09868F4; Fri, 4 Aug 2023 19:20:38 +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="chTyl3bt"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id A088E862CB; Fri, 4 Aug 2023 19:20:37 +0200 (CEST) Received: from mail-yb1-xb2d.google.com (mail-yb1-xb2d.google.com [IPv6:2607:f8b0:4864:20::b2d]) (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 3681F8693D for ; Fri, 4 Aug 2023 19:20:33 +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-xb2d.google.com with SMTP id 3f1490d57ef6-d0548cf861aso2506628276.3 for ; Fri, 04 Aug 2023 10:20:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=konsulko.com; s=google; t=1691169632; x=1691774432; 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=i+JlDPKUasdvVzNgRBQDpiCVDb7zVAqjMHc+kobCR8w=; b=chTyl3btbrTQUIWPHUBF5VsOoEfzYZ1/ZdyMcisplESuvd2flFGMkZJwfWUtIVqsRm ozHlY0hLtxVfeKFn0JVjf9C9SRXaI/qBerChwOAZ8Dxt61rtLBLbuP6uj6xy6bSm9+2f TP+sb+LBSAlQy+ApxQOFXOW7elrCb4eqmRaVc= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1691169632; x=1691774432; 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=i+JlDPKUasdvVzNgRBQDpiCVDb7zVAqjMHc+kobCR8w=; b=WkZndvx6jACUI7bSVsKNYrFnfAOSnI3uM0mDCgJExPCF4bh6k0WENwK0kjOBcktAZy UYRBnFmlQzz8m2N6SmcLMkE+5TumiwH1UmonhpasK658oHheQk7p7xA3riojOoUstIxF 3cszaxuIE+n32xkJN4rShPeg5gioZrgG2kQDsUMFnN9xXh7QD1k14gCyPPdJqq1z2XcX HxkzN8sQ6i1C5RwkUdTEadIGumvE+ra6lo3mqa4qGKfQJTU3JjK5QZOi0QLLfSvLzmxj /M/2aETNvptCYbTsh2H/ctMAdtsdVdbYB08mdtel2ldxG4IJoEqqgQfAfIn9edq1wUtR Fp0w== X-Gm-Message-State: AOJu0YxP4KsC1YVFjLi2oNiP6zTfvOz3OGh39WsWGpUhqJWOJXww6xCX aUq0RhRpJrAlp1R28TaaCaOa7Q== X-Google-Smtp-Source: AGHT+IEUnzong/j+7b12mlcGcQ96lBn+oVU3HS8Itdj56tMGZSGbHVo/ph2dQcM0f+6/xkpZBw0urw== X-Received: by 2002:a25:d0b:0:b0:d0e:c8fb:986a with SMTP id 11-20020a250d0b000000b00d0ec8fb986amr2100533ybn.42.1691169631899; Fri, 04 Aug 2023 10:20:31 -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 j11-20020a5b030b000000b00bcd91bb300esm715615ybp.54.2023.08.04.10.20.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 04 Aug 2023 10:20:31 -0700 (PDT) Date: Fri, 4 Aug 2023 13:20:29 -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: <20230804172029.GT3630934@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> <20230804161515.GR3630934@bill-the-cat> <20230804190146.2595e241@xps-13> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="6CkgPh4lp5kBHf5t" Content-Disposition: inline In-Reply-To: <20230804190146.2595e241@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 --6CkgPh4lp5kBHf5t Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable 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 where = we don't > > > > >>> _need_ to call bind/unbind for each of these cases? Is there so= mething > > > > >>> we're supposed to be setting in the DT that we aren't? =20 > > > > >> > > > > >> You do need to unbind the ethernet before using fastboot, always= , with the 'unbind ethernet 0', you dont need the peripheral unbind/rebind = part, so it should behave like before. =20 > > > > >=20 > > > > > And for my own understanding, why don't we need to bind a fastboot > > > > > 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 the > > > fastboot gadget manually. > > >=20 > > > This makes the CLI clearly uneven and the internal code badly differe= nt > > > 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 starts. > > But this leads to the ref counting problems you encountered and > > re-posted the rejected series for. >=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. 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). > I also don't understand why I need to unbind the ethernet gadget but I > cannot bind the fastboot gadget. You can't bind fastboot while ethernet is still configured. 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. > 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? I would invite you to look in to this, yes. 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 Tom --6CkgPh4lp5kBHf5t Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQGzBAABCgAdFiEEGjx/cOCPqxcHgJu/FHw5/5Y0tywFAmTNM1kACgkQFHw5/5Y0 tyxPFwv/RpnYjqZ9G19X+Z824LDb+fkSP+2W1efBbkkHGbIP0KFWV8m4pNK17j+X gbngq/yrpM0IQqmumAcr5G5beAjiOYmp9W3zKE6ZKk4W/eIDMRxyastQBCCa/hIk fuksjSmnoxE+NsqYrazXa3qwoTrnRwxfkbzJQhzypSCoUC6GIlLqZgzlXf8KIgNc 0AfDd7v7f1m9TD6IemiCisffdHaWCNKSE2oBFMsQyqOk1yy8jsVwW5fbrqBgCzBj sP8nH0fklwifXZ7iitkCrwPsrWlbIcVOksNbCerY8yJOR97cizeTKKXNL/lcGAD+ JoOXvw7w0vIz16mm6J2Cxd4sYcllX+WYUVBHzfV+Efx9EJQ0aFmCRrrEMf/y8coS vWoWtYBCDCdKhzmkRjThXWdnCdkr0OS5+Avn1BGo5b241hXhaakYtjADLjOc85sZ JFv90krN2zxQ1Db6NbMqHNCUCnQuHSdqn0biJhW2SlX5aBmfafpeRRW92RXBTkjz aTOK6oKo =uGI8 -----END PGP SIGNATURE----- --6CkgPh4lp5kBHf5t--