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 71AFCC4167D for ; Wed, 23 Nov 2022 15:45:36 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id C8B838523A; Wed, 23 Nov 2022 16:45:34 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=baylibre.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=baylibre-com.20210112.gappssmtp.com header.i=@baylibre-com.20210112.gappssmtp.com header.b="HhHggtmN"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 1C2F685577; Wed, 23 Nov 2022 16:45:29 +0100 (CET) Received: from mail-wr1-x429.google.com (mail-wr1-x429.google.com [IPv6:2a00:1450:4864:20::429]) (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 841518524D for ; Wed, 23 Nov 2022 16:45:26 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=baylibre.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=mkorpershoek@baylibre.com Received: by mail-wr1-x429.google.com with SMTP id g12so29954514wrs.10 for ; Wed, 23 Nov 2022 07:45:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20210112.gappssmtp.com; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:references :in-reply-to:subject:cc:to:from:from:to:cc:subject:date:message-id :reply-to; bh=UhaBtsoeRCb5s6l1CrzgyXJUzjcO8+TFgFgrXFop6yE=; b=HhHggtmN1ziRWCYcIEWgDj8Ucn8kvqNDh4d7BeiOwMuJK2wpVwkcq0VGI5/mdYXVzF c3+/EuXPoqPu8dIYRLhA/y/OqYIGTjgi4CIfTf49ITMXVxwA5bJoQ5V6Oa+1AidAgmBe 1/97d+KPFB+xFdRa7ve9Rd2xkjKrxt76fG/jPUIfAV/7zKklgUdizpGzbLIXwIid7FNh MUcV3UHhGzcOJ/6Zq+Bgj1mG6t3mSHaH2jgaZFULwzQ1lRY+SReaLiM4CZVsp1h+S6Gf ZrMIMCYcXXK9jBqQgo2mfFWdmG2haU5BU4KlQjPQYWub1b0IpHSNyvl9I9RMUt4y3o7o KeTg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:references :in-reply-to:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=UhaBtsoeRCb5s6l1CrzgyXJUzjcO8+TFgFgrXFop6yE=; b=BpLvdrZNgKMAUqmzDv6+ibs+UhfiqZyw0YkBDm4jEIgvTAc8P/9DqYVJKICvkNXAnp J9wbD6/AlB8twoIrvoG1VpK3yRX2lEe3wNzt7cu222e3pKYGD5H4viDF4ickUObftvf0 VbeqC9nP0ItoafbJRvbVZsXZP+ZK4CyJaaa+LaUS7avsd3AS25X3jwfaFo9B13S3CSDB aDyLOcHiWP31ML37aT953Owq0HfuTrXU0albsnOf+dfu13uZ83ocSV9+bJ5sDuqunW55 aAV8ozTxu8dTF7kJ8f/IuVV1hItkITVBqmqKQfFqcL3swqHegCXfDTsN+pUmwdJt8WGy MGVA== X-Gm-Message-State: ANoB5plermqehtGiWDB+XG07sM5LWbUrH1VqkRdh3Qzwk1WT230V3APe JhuuPg5WWPpgMIz+WK/KKdt1Qw== X-Google-Smtp-Source: AA0mqf41lxWli9aXsas92SdlnzoyTW/dIvKh/eV+V6thtJer/kz3eLpa+KJFMJg20hgW7laSCMOi0w== X-Received: by 2002:a5d:5955:0:b0:241:553e:5040 with SMTP id e21-20020a5d5955000000b00241553e5040mr11253870wri.578.1669218326021; Wed, 23 Nov 2022 07:45:26 -0800 (PST) Received: from localhost ([2a01:cb19:85e6:1900:2bf7:7388:731d:c4e1]) by smtp.gmail.com with ESMTPSA id i1-20020a05600c354100b003cf894c05e4sm2932191wmq.22.2022.11.23.07.45.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 23 Nov 2022 07:45:24 -0800 (PST) From: Mattijs Korpershoek To: neil.armstrong@linaro.org, Marek Vasut , Christian Hewitt , Lukasz Majewski Cc: u-boot@lists.denx.de, Simon Glass , u-boot-amlogic@groups.io Subject: Re: [PATCH v2 2/2] mach-meson: g12a: reset usb controller in reset_misc() In-Reply-To: <2fa3ba46-7a63-1a95-1961-9a1268aff709@linaro.org> References: <20220728-reset-usb-controller-v2-0-ef7657ce78b1@baylibre.com> <20220728-reset-usb-controller-v2-2-ef7657ce78b1@baylibre.com> <503f0753-e3be-6e86-5973-2843f5267f1c@denx.de> <8c083cfa-4d15-e71c-ba67-8077b282fd96@denx.de> <938b9439-9014-5ee8-1627-16af508bface@linaro.org> <6b1237b8-746c-c9aa-4be4-ef323396b2f8@denx.de> <87czay2u7p.fsf@baylibre.com> <2fa3ba46-7a63-1a95-1961-9a1268aff709@linaro.org> Date: Wed, 23 Nov 2022 16:45:23 +0100 Message-ID: <87zgch1xpo.fsf@baylibre.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable 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.6 at phobos.denx.de X-Virus-Status: Clean On Tue, Oct 11, 2022 at 19:57, neil.armstrong@linaro.org wrote: > On 11/10/2022 18:36, Mattijs Korpershoek wrote: >> On Tue, Oct 11, 2022 at 17:39, Marek Vasut wrote: >>=20 >>> On 10/11/22 09:12, neil.armstrong@linaro.org wrote: >>>> On 10/10/2022 19:16, Marek Vasut wrote: >>>>> On 10/10/22 18:22, Neil Armstrong wrote: >>>>>> Hi, >>>>> >>>>> Hi, >>>>> >>>>>> On 10/10/2022 18:09, Marek Vasut wrote: >>>>>>> On 10/7/22 11:38, Mattijs Korpershoek wrote: >>>>>>>> On some g12a boards like the VIM3L and the SEI610, with some >>>>>>>> USB cables/hosts, there is a long (5s) delay before >>>>>>>> between "fastboot reboot" and the host detecting a USB reset. >>>>>>>> >>>>>>>> This breaks tools relying on "fastboot reboot fastboot" which assu= me >>>>>>>> that 1s after the command send, the board should disconnect on usb. >>>>>>>> >>>>>>>> To reproduce, enable fastboot in U-Boot console: >>>>>>>> =3D> fastboot usb 0 >>>>>>>> >>>>>>>> Then, on the host, run: >>>>>>>> =C2=A0=C2=A0 # echo "running fastboot reboot bootloader" > /dev/k= msg && >>>>>>>> fastboot reboot bootloader >>>>>>>> =C2=A0=C2=A0 Rebooting into bootloader=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 OKAY [=C2=A0 0.003s] >>>>>>>> =C2=A0=C2=A0 Finished. Total time: 3.033s >>>>>>>> >>>>>>>> =C2=A0=C2=A0 [54074.251551] running fastboot reboot bootloader >>>>>>>> =C2=A0=C2=A0 ... there is a delay of 5s before we detect a discon= nection ... >>>>>>>> =C2=A0=C2=A0 [54079.041238] usb 1-7.4: USB disconnect, device num= ber 72 >>>>>>>> =C2=A0=C2=A0 [54079.239625] usb 1-7.4: new high-speed USB device = number 73 >>>>>>>> using xhci_hcd >>>>>>>> =C2=A0=C2=A0 [54079.359103] usb 1-7.4: New USB device found, idVe= ndor=3D1b8e, >>>>>>>> idProduct=3Dfada, bcdDevice=3D 2.27 >>>>>>>> =C2=A0=C2=A0 [54079.359110] usb 1-7.4: New USB device strings: Mf= r=3D1, >>>>>>>> Product=3D2, SerialNumber=3D3 >>>>>>>> =C2=A0=C2=A0 [54079.359112] usb 1-7.4: Product: USB download gadg= et >>>>>>>> =C2=A0=C2=A0 [54079.359114] usb 1-7.4: Manufacturer: U-Boot >>>>>>>> =C2=A0=C2=A0 [54079.359116] usb 1-7.4: SerialNumber: C8631470CC41 >>>>>>>> >>>>>>>> Note: this does not happen when we use the RST button on the board. >>>>>>>> >>>>>>>> To fix this, re-implement a platform reset which calls >>>>>>>> board_usb_cleanup() before resetting the board. >>>>>>> >>>>>>> Shouldn't that call happen somewhere in drivers/usb/ .remove() >>>>>>> callback instead ? >>>>>> >>>>>> No since dwc2 isn't DM yet, handling is done in arch/arm/mac-meson >>>>>> board_usb_*() for now >>>>> >>>>> Seems DWC2 is DM: >>>>> >>>>> $ git grep U_BOOT_DRIVER drivers/usb/ | grep dwc2 >>>>> drivers/usb/gadget/dwc2_udc_otg.c:U_BOOT_DRIVER(dwc2_udc_otg) =3D { >>>>> drivers/usb/host/dwc2.c:U_BOOT_DRIVER(usb_dwc2) =3D { >>>>> >>>> >>>> My bad, seems I missed the dwc2 otg DM wagon... >>>> >>>> We will need to switch to this now then, thanks, >>> >>> Thanks. I picked 1/2 at least, so you can only focus on 2/2 and send >>> just that. >>=20 >> Yes, thank you for picking 1/2 >>=20 >> Neil, do you want me to look into converting the meson arch which uses >> DWC2 to DM? >> I'm not sure I'm confident to do these changes properly but I'm willing >> to give it a try. >> If you plan to do it yourself, fine by me. I'll respin 2/2 after that. > > Sure, give a try, if you don't manage I can help! Done here: https://lore.kernel.org/u-boot/20221024-meson-dm-usb-v1-0-2ab077a503b9@bayl= ibre.com/ > > > Neil