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 51C87C43334 for ; Tue, 19 Jul 2022 06:47:21 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id C2350839F6; Tue, 19 Jul 2022 08:47:17 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=quarantine dis=none) header.from=amd.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=amd.com header.i=@amd.com header.b="jUpyQZHX"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 05703819FC; Tue, 19 Jul 2022 08:47:16 +0200 (CEST) Received: from NAM04-DM6-obe.outbound.protection.outlook.com (mail-dm6nam04on2055.outbound.protection.outlook.com [40.107.102.55]) (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 118DE83FCE for ; Tue, 19 Jul 2022 08:47:13 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=quarantine dis=none) header.from=amd.com Authentication-Results: phobos.denx.de; spf=fail smtp.mailfrom=michal.simek@amd.com ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ifIadH+dtpnlQG44DkwcIlCrQXNKF//LHAvqbsLkchwBvVktUwG9wtG8BtDkLPBes6OKQyfi/XxYktdM61gC6stRAmsghj2R/2l6/e9tBoMtXPNVrNHokb8UuDtGn2+SGy4smG2wKo53GUvtm8no3kX/jziWbjqSS8eKH0W9GAWitvTwI+nQJN7z1DoiNVrzprZ7WeW0HgnaFmOBG9I7kKo3WRsuOid+LBU02jmvAooIzALFBNnLKYyYawRlHJvfY2fX5KDCJp/bQiZ77fIfVCErlvkA4v0vPh/avgfyRFEFhB0e6HvhKtjXjhlOZFipUGs3boeFu9EBWH9mUbcG+g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=iaVZgmticZmkqEfZBv3qcNwzOJ3qiJy/Bo/HA1PgDTE=; b=aaujWwF4khlpZZuK9RLDUQhJyDVzfbK5z8JlhiZa5ufGUBM3ESq3M/XWHme90rsmVnieyxFR1YSIddW5hcHO8FWW6MV18aJLMJk3aw7duiCiH7EhpWNhzuX4HrBj3aS228yKk2/0oGUW55C8WT5Dnp6YuNRJ8eqUil5KS1TRo2Fcn/hOySDZRS/tbf32DjYpXMC5mb9wn1jAjj+DlqKYcLqZQv7nxyckmOKbqIZnmBEjphOlA/yT9gj+QyQ1yMA2fhWVy/OZAg0aREtuO9qae7EgQmMrDHiDVsYEX+5LWiO5LyzFd0L8X2zyNVyI06AeMS/dVc4Bax/lmpzChkt4Iw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=akkea.ca smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=iaVZgmticZmkqEfZBv3qcNwzOJ3qiJy/Bo/HA1PgDTE=; b=jUpyQZHXoQqgHqgUZxy+dnjTh+98rfdhoK+lXn01lSaoJOPEQ2mz+heSVzOCc5PtNmbKUQTBpUGqp1aLtNGjgcnjkvqWQVx5rn2lgo/iQhbreW3J4re6176/QPZUlrsB5u2Znbm6YhGAdoi41DtIs6iAuOhyDpVmak5Prqbt7Gc= Received: from DS7PR03CA0160.namprd03.prod.outlook.com (2603:10b6:5:3b2::15) by BN6PR12MB1203.namprd12.prod.outlook.com (2603:10b6:404:19::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5438.14; Tue, 19 Jul 2022 06:47:09 +0000 Received: from DM6NAM11FT061.eop-nam11.prod.protection.outlook.com (2603:10b6:5:3b2:cafe::28) by DS7PR03CA0160.outlook.office365.com (2603:10b6:5:3b2::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5438.12 via Frontend Transport; Tue, 19 Jul 2022 06:47:09 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by DM6NAM11FT061.mail.protection.outlook.com (10.13.173.138) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5438.12 via Frontend Transport; Tue, 19 Jul 2022 06:47:08 +0000 Received: from [10.254.241.52] (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.28; Tue, 19 Jul 2022 01:47:06 -0500 Message-ID: Date: Tue, 19 Jul 2022 08:47:03 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.11.0 Subject: Re: DWC3 host support Content-Language: en-US To: Angus Ainslie , CC: Marek Vasut , U Boot , Michal Simek , References: <13226946-1652-f917-f580-e626f51c2525@denx.de> <0d799969-37a5-cafb-6d5d-8692dc5645c2@denx.de> <147796d0-76af-c712-a426-1b3830691587@amd.com> <33999919934dd27e026ff6b765227dbb@akkea.ca> From: Michal Simek In-Reply-To: <33999919934dd27e026ff6b765227dbb@akkea.ca> Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 8bit X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 8bde649f-ed13-4706-5718-08da69528053 X-MS-TrafficTypeDiagnostic: BN6PR12MB1203:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: NnpzE4tTPmaboGNlq+DADvseemaLCx0EJl9WvSSx96wFy+EAeXnBv2oVmfISELpRkhJB5EfbIl1dDThtfJlHlqRqIqrpGqlkKZwfCJ1KLn+H8dzRdmN0hsQ1ggcZE0WVC0MtUN10RnAT5Xglba1hfvgclpD6ZfVRAj6FF6MCEfRJWKGUcMCkWP2OZD4iQPdgGvYq5Bf3ucLJz2BoscP8hVldYawpor1s6tDHNy/r+ohOu4QN0y99fkJyvaV6k6Z3r3S/3FaOeP0E18R2Knr911rhLQ5M/pt36tuGTpl8mJpR8cLChe2/GIg3iWxHRvPsGWLeqzYUXjusy9G3BZE0HrX05POyoasL54/8etuapmYVFc2Y0/nZhn0rGwjApSOCzys4kHvczTvH35n5f9yoq/danTz0wQ/b7k3i2lSOzr2H+d/nfDyC6Ia3zsY8rZKFoRMvBE+dqvBWt3ztIgwBigmmz5Mq+Y58yYnIbO5HXhRsYu0tICbThOSS2Hz/N0WFA1b1DWEq8uY/nKUSkhze7DGWhVhDPXUoJiKlicCmYlYmWjNrT4paNGHD/5kViXr1G/L8+f6y32a+NezH4/co2YegYQPKSRhzGadK7nNyxJ8EsmNIz5yK8t0WSSTU+R00GuhVrPfzav/hL0mx3eJm2jvYztqu67N4YJTjoqYXIQBnaZ0QXoi7CSeMqPS5LSGpufO8YEZf5k2pd0Y5VpGFBGJM0qG3YzIKm4HAdv0LknpzsRJBffiXdsQp3yznj0O/cajIpePwBcV0F1IKzdQ5TesbH0td/I9a5jFlEewHK+5JlgIqIgLrajFdLzVHoKueSdRKUbqt/S4fEAfK7RyiOUNx2BTSq2dWDrEGX3sqIOuuOYb2HAkKiRFzhTLyrdSu X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB04.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230016)(4636009)(376002)(39860400002)(396003)(136003)(346002)(40470700004)(36840700001)(46966006)(31696002)(478600001)(6666004)(81166007)(53546011)(41300700001)(186003)(2616005)(356005)(36860700001)(26005)(16526019)(83380400001)(336012)(426003)(47076005)(82740400003)(2906002)(44832011)(7116003)(8936002)(5660300002)(40460700003)(316002)(36756003)(16576012)(86362001)(40480700001)(110136005)(8676002)(54906003)(31686004)(82310400005)(70586007)(70206006)(4326008)(36900700001)(43740500002); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Jul 2022 06:47:08.6589 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 8bde649f-ed13-4706-5718-08da69528053 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d; Ip=[165.204.84.17]; Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: DM6NAM11FT061.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN6PR12MB1203 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, On 7/18/22 18:23, Angus Ainslie wrote: > Hi, > > 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). >> > > Removing the usb3 phy definition also "fixes" it > > --- a/arch/arm/dts/imx8mq-librem5-r4.dts > +++ b/arch/arm/dts/imx8mq-librem5-r4.dts > @@ -33,3 +33,8 @@ >  &proximity { >         proximity-near-level = <10>; >  }; > + > +&usb_dwc3_1 { > +       phys = <&usb3_phy1>; > +       phy-names = "usb2-phy"; > +}; Log shows that phy initialization is called properly but it looks like that initialization itself has issue which should be the issue with phy driver. DWC3 driver is calling just phy_init and phy_power_on which are quite small 2 functions in phy-imx8mq-usb.c. Did usb3 work before 142d50fbce7c364a74f5e8204dba491b9f066e6c? I have no idea how imx is working but I have added to CC author of this phy driver. I see small differences between Linux and U-Boot drivers. 99 value &= ~PHY_CTRL0_SSC_RANGE_MASK; 100 value |= PHY_CTRL0_SSC_RANGE_4003PPM; And in power_on I see this in u-boot 129 /* Disable rx term override */ 130 value = readl(imx_phy->base + PHY_CTRL6); 131 value &= ~PHY_CTRL6_RXTERM_OVERRIDE_SEL; 132 writel(value, imx_phy->base + PHY_CTRL6); And Linux driver is handling regulators. Do you use any regulator? If usb3.0 works in Linux I think it should be easier for you to track this down but there are some small differences in the U-Boot driver which can be the reason why it is failing on your board. Thanks, Michal