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 A4921C433EF for ; Mon, 18 Jul 2022 14:50:47 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id D6ADC84033; Mon, 18 Jul 2022 16:50:45 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=akkea.ca 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=akkea.ca header.i=@akkea.ca header.b="CuokfGgc"; dkim=pass (1024-bit key) header.d=akkea.ca header.i=@akkea.ca header.b="CuokfGgc"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id E0D318402E; Mon, 18 Jul 2022 16:50:43 +0200 (CEST) Received: from node.akkea.ca (li1434-30.members.linode.com [45.33.107.30]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 79BE083FEA for ; Mon, 18 Jul 2022 16:50:40 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=akkea.ca Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=angus@akkea.ca Received: from localhost (localhost [127.0.0.1]) by node.akkea.ca (Postfix) with ESMTP id A6F964E200C; Mon, 18 Jul 2022 14:50:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=akkea.ca; s=mail; t=1658155838; bh=nyjf3ck+3DOHX0hqbKn5gC3bzxU7rwRU3rY54gTiF9o=; h=Date:From:To:Cc:Subject:In-Reply-To:References; b=CuokfGgcBB3LfqzEPPPXMGBCTWd+qCUeQIGBhb4W2hDJxxlZ8DSn1RwruIQULZl8h ljIDxB/2CZbrJ49Hbn200jerkca2i/v9z+vCgeF+WFnxnEq0bkCyYSOjQvtzVoBu/U Y/iPTYqotvdtlRVuHjZ+XojYES1v7pljxA0Ixo4o= Received: from node.akkea.ca ([127.0.0.1]) by localhost (mail.akkea.ca [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id hgqaIoKC7zar; Mon, 18 Jul 2022 14:50:38 +0000 (UTC) Received: from www.akkea.ca (localhost [127.0.0.1]) by node.akkea.ca (Postfix) with ESMTP id 005034E2006; Mon, 18 Jul 2022 14:50:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=akkea.ca; s=mail; t=1658155838; bh=nyjf3ck+3DOHX0hqbKn5gC3bzxU7rwRU3rY54gTiF9o=; h=Date:From:To:Cc:Subject:In-Reply-To:References; b=CuokfGgcBB3LfqzEPPPXMGBCTWd+qCUeQIGBhb4W2hDJxxlZ8DSn1RwruIQULZl8h ljIDxB/2CZbrJ49Hbn200jerkca2i/v9z+vCgeF+WFnxnEq0bkCyYSOjQvtzVoBu/U Y/iPTYqotvdtlRVuHjZ+XojYES1v7pljxA0Ixo4o= MIME-Version: 1.0 Date: Mon, 18 Jul 2022 07:50:37 -0700 From: Angus Ainslie To: Michal Simek Cc: Marek Vasut , U Boot , Michal Simek , kernel@puri.sm Subject: Re: DWC3 host support In-Reply-To: <147796d0-76af-c712-a426-1b3830691587@amd.com> References: <13226946-1652-f917-f580-e626f51c2525@denx.de> <0d799969-37a5-cafb-6d5d-8692dc5645c2@denx.de> <147796d0-76af-c712-a426-1b3830691587@amd.com> Message-ID: X-Sender: angus@akkea.ca User-Agent: Roundcube Webmail/1.3.17 Content-Type: text/plain; charset=US-ASCII; 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.6 at phobos.denx.de X-Virus-Status: Clean Hi Marek/Michal, On 2022-07-18 01:13, Michal Simek wrote: > On 7/17/22 17:23, Marek Vasut wrote: >> On 7/17/22 05:00, Angus Ainslie wrote: >>> On 2022-07-16 11:37, Marek Vasut wrote: >>>> On 7/16/22 15:02, Angus Ainslie wrote: >>>>> Hi Michal, >>>>> >>>>> I recently rebased my librem5 tree onto the latest u-boot-imx >>>>> branch >>>>> and the dwc3 host mode stopped working. >>>>> >>>>> I bisected it down to this commit: >>>>> >>>>> 142d50fbce7c364a74f5e8204dba491b9f066e6c usb: dwc3: Add support for >>>>> usb3-phy PHY configuration >>>>> >>>>> Reverting that commit allows usb host mode to work on the librem5 >>>>> again. >>>>> >>>>> Should this initialization go into an SOC specific glue_configure >>>>> function ? >>>>> >>>>> Is the imx8mq.dtsi missing something that will keep usb host >>>>> working >>>>> with this patch ? >>>>> >>>>> Does this break usb host on other imx8mq devices ? >>>> >>>> Wasn't this fixed by: >>>> 868d58f69c ("usb: dwc3: Fix non-usb3 configurations") >>>> ? >>> >>> I've got that in my tree and it still fails to probe the USB2 hub and >>> USB 2 storage. >> >> I assume you do have CONFIG_PHY_IMX8MQ_USB enabled ? >> >> What does generic_phy_get_by_name() return for you in >> drivers/usb/dwc3/dwc3-generic.c ? > > As Marek said there was one patch which fixes origin patch which > didn't handle all the error cases properly. We need to know return > value from generic_phy_get_by_name(), also if you still have usb3-phy > in DT (as is in imx8mq.dtsi) with phy DT status enabled and enabled > phy driver (CONFIG_PHY_IMX8MQ_USB). > I use the imx8mq.dtsi from the u-boot-imx tree that includes the usb3-phy https://source.denx.de/u-boot/custodians/u-boot-imx/-/blob/master/arch/arm/dts/imx8mq.dtsi#L1421 CONFIG_PHY_IMX8MQ_USB is defined in my defconfig https://source.puri.sm/angus.ainslie/uboot-imx/-/blob/upstream/librem5-uart2/configs/librem5_defconfig#L114 Here is the error path I think you're talking about https://source.puri.sm/angus.ainslie/uboot-imx/-/blob/upstream/librem5-uart2/drivers/usb/dwc3/dwc3-generic.c#L474 I modified dwc3-generic.c to print the return value @@ -475,6 +477,8 @@ static int dwc3_glue_probe(struct udevice *dev) phy.dev = NULL; } + debug("phy3 initialized %d %s\n", ret, phy.dev ? phy.dev->name : "null"); + glue->regs = dev_read_addr(dev); Here's the output from the boot U-Boot 2022.07-rc5-00014-g329f8a8ae05-dirty (Jul 18 2022 - 06:59:45 -0700) CPU: Freescale i.MX8MQ rev2.0 1500 MHz (running at 1000 MHz) CPU: Commercial temperature grade (0C to 95C) at 35C Reset cause: POR Model: Purism Librem 5r4 DRAM: 3 GiB dwc3_glue_bind: subnode name: port@0 dwc3_glue_bind: dr_mode: OTG or Peripheral dwc3_glue_bind: subnode name: port@1 dwc3_glue_bind: dr_mode: OTG or Peripheral dwc3_glue_bind: subnode name: hub@1 dwc3_glue_bind: dr_mode: HOST clk_register: failed to get device (parent of ckil) clk_register: failed to get device (parent of clock-osc-27m) clk_register: failed to get device (parent of sys1_pll) clk_register: failed to get device (parent of sys2_pll) clk_register: failed to get device (parent of sys3_pll) Enabling regulator-hub tps65982 boot successful Core: 192 devices, 25 uclasses, devicetree: separate MMC: FSL_SDHC: 0, FSL_SDHC: 1 Loading Environment from MMC... OK In: serial Out: serial Err: serial Board name: librem5 Board rev: 4 vol_down_key_pressed : 1 Net: No ethernet found. Hit any key to stop autoboot: 0 u-boot=> usb start starting USB... Bus hub@1: generic_phy_get_by_name(dev=00000000ffb19830, name=usb3-phy, phy=00000000ffb08460) generic_phy_get_by_index_nodev(node=usb@38200000, index=1, phy=00000000ffb08460) generic_phy_xlate_offs_flags(phy=00000000ffb08460) phy3 initialized 0 usb-phy@382f0040 phy3 powered on dwc3_glue_probe finished generic_phy_get_by_index_nodev(node=usb@38200000, index=0, phy=00000000ffb2b1e0) generic_phy_xlate_offs_flags(phy=00000000ffb2b1e0) generic_phy_get_by_index_nodev(node=usb@38200000, index=1, phy=00000000ffb2b1f0) generic_phy_xlate_offs_flags(phy=00000000ffb2b1f0) dwc3-generic-host hub@1: Event buf 00000000ffb2b340 dma ffb2b340 length 256 Register 2000140 NbrPorts 2 Starting the controller USB XHCI 1.10 scanning bus hub@1 for devices... cannot reset port 1!? 1 USB Device(s) found scanning usb for storage devices... 0 Storage Device(s) found u-boot=> usb info 1: Hub, USB Revision 3.0 - U-Boot XHCI Host Controller - Class: Hub - PacketSize: 512 Configurations: 1 - Vendor: 0x0000 Product 0x0000 Version 1.0 Configuration: 1 - Interfaces: 1 Self Powered 0mA Interface: 0 - Alternate Setting 0, Endpoints: 1 - Class Hub - Endpoint 1 In Interrupt MaxPacket 8 Interval 255ms Thanks Angus > Thanks, > Michal