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 5E627C001DE for ; Fri, 4 Aug 2023 17:01:56 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 4A78186901; Fri, 4 Aug 2023 19:01:54 +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="euf/qgfr"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 93A4F86901; Fri, 4 Aug 2023 19:01:52 +0200 (CEST) Received: from relay8-d.mail.gandi.net (relay8-d.mail.gandi.net [IPv6:2001:4b98:dc4:8::228]) (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 739EF868D9 for ; Fri, 4 Aug 2023 19:01:49 +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 664341BF206; Fri, 4 Aug 2023 17:01:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1691168509; 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=xsUmyNFXtVix1v34FU6kd/BVSRfi3JH40RX7hvfbS4s=; b=euf/qgfrlB3iAcKqW9rbIDbWkvQMyfbA6gaZy/8vJoocL1Nei914ZxoQ4ahXOIatwbx5+w iropPRdfSaHHhFA7pjNlJLxZyhQLkUOImnBaXUNDETCjseh2F6VZyvmWbG4tk6fU35eqVY 5EuPJlgNstqOqlIZPMRBGn+sFCrjOIesJmbuShmCgvxbbZGxEU2KxD31EpDH2ZXzDbK3+x xlO5Jwj0v2Bhn9RoIhHSYyQZad0w2ay3V6NEmwSZcMfKiyXYOW9ZADrcmdHfKdu7EV5Jv+ bw981YZLDa8Nxpqz90gANX00CYC/RziAron+AAGYsCa6Cz9+OoBpaEtqrSlg7g== Date: Fri, 4 Aug 2023 19:01:46 +0200 From: Miquel Raynal To: Tom Rini 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: <20230804190146.2595e241@xps-13> In-Reply-To: <20230804161515.GR3630934@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> 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 Tom, > > > >>> 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 some= thing > > > >>> 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 pa= rt, 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 different > > 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. Ok, thanks for the additional details. 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. I also don't understand why I need to unbind the ethernet gadget but I cannot bind the fastboot gadget. 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? Thanks, Miqu=C3=A8l