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 96A90C001DF for ; Fri, 4 Aug 2023 14:42:17 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 6BCB6868D0; Fri, 4 Aug 2023 16:42:15 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=denx.de Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=denx.de; s=phobos-20191101; t=1691160135; bh=GcGf3uU3bJMTwB1asEsQNTGuyT28l+Ry+rrbswBjU38=; h=Date:Subject:To:Cc:References:From:In-Reply-To:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=i6r4U6SCF8paFxV/5ARdTY94mVI6Vfz79Y0VnY/XKH0O3WM7jf7SmeVnEKkeN0Mfd M3myQyfJ3Zbzfl5pDx0lo5BC/lJOrFImOj8L07JtjPhEgMPmxIbre9uUeFp+f7bTsh p5+j5AarepkLfgzI5FNLcLnlqptVUljFigz/sSbAQLWsp7wRQFp0D3afJvWfG4CdRF IQelf9d9Zw2PS24b5+zhJlAw/HgJ2929GyXFsb72e67onp6AT9U2XZEv6wJyAxInoH cDIxghbJG7MJ7ir/RBm1qslCbg48nD3XAZslOLHRkb1YumlslpDNl0y1FzI2iYLYXi 1z1g+khQKJoVQ== Received: from [127.0.0.1] (p578adb1c.dip0.t-ipconnect.de [87.138.219.28]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: marex@denx.de) by phobos.denx.de (Postfix) with ESMTPSA id CA869867F4; Fri, 4 Aug 2023 16:42:13 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=denx.de; s=phobos-20191101; t=1691160134; bh=GcGf3uU3bJMTwB1asEsQNTGuyT28l+Ry+rrbswBjU38=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=WStxdKZo9y7mziwLOzFAVwRwaWzjRlzR5lGsXNzSd/a3BsrS4tDuA2Ht4yRJoXdiZ cJrOK/ep7ixWS2ucDCCb0LtQBvoGLniVsWm4IkF+ImKRLlsvsdhxQbSbZjeoR9k8xe ZaM0IDgPNMBkjgEfS57VqB0Kz7xB9dDufEQ7RyeKk63fTgyTqG5WwN7ax28OGlSPZT GmTMyn3GfmmagQhyOeBxoZEuPGufN7LsJnbA3I8w1XZNfHBRShuRGJjnVXajEu3ySQ C2EtmC+CI2lwtnWpdbGkIkZYJomlxrb7ykGWH7zKAWz63ia4XyU81a6XvABUnmTmvv OpUh9qdbrAZXA== Message-ID: <4833722f-18ab-e885-291a-988115fe39f8@denx.de> Date: Fri, 4 Aug 2023 16:42:13 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.13.1 Subject: Re: [PATCH v4 1/4] cmd: bind: Add unbind command with driver filter To: Miquel Raynal Cc: u-boot@lists.denx.de, Kevin Hilman , Lukasz Majewski , Simon Glass References: <20230802124657.31184-1-marex@denx.de> <20230804090028.70aa780d@xps-13> Content-Language: en-US From: Marek Vasut In-Reply-To: <20230804090028.70aa780d@xps-13> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit 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 On 8/4/23 09:00, Miquel Raynal wrote: > Hi Marek, > > marex@denx.de wrote on Wed, 2 Aug 2023 14:46:54 +0200: > >> 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 > > 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 output > to the usb nodes for clarity): > > => dm tree > misc 0 [ + ] ti-musb-wrapper | |-- usb@47400000 > usb 0 [ + ] ti-musb-peripheral | | |-- usb@47401000 > ethernet 1 [ + ] usb_ether | | | `-- usb_ether > bootdev 3 [ ] eth_bootdev | | | `-- usb_ether.bootdev > usb 0 [ ] ti-musb-host | | `-- usb@47401800 > => fastboot usb 0 > couldn't find an available UDC > g_dnl_register: failed!, error: -19 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. > exit not allowed from main input shell. > => unbind /ocp/usb@47400000/usb@47401000 usb_ether Does => unbind ethernet 0 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. > Cannot find a device with path /ocp/usb@47400000/usb@47401000 > => unbind /ocp/usb@47400000/usb@47401000 > => dm tree > misc 0 [ + ] ti-musb-wrapper | |-- usb@47400000 > usb 0 [ ] ti-musb-host | | `-- usb@47401800 > => fastboot usb 0 > => bind /ocp/usb@47400000/usb@47401000 ti-musb-peripheral > => dm tree > misc 0 [ + ] ti-musb-wrapper | |-- usb@47400000 > usb 0 [ ] ti-musb-host | | |-- usb@47401800 > usb 0 [ ] ti-musb-peripheral | | `-- usb@47401000 > => fastboot usb 0 > 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? What would be your proposal ?