Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp723738rwi; Thu, 27 Oct 2022 06:57:14 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4/qMkW6eD7u6p0dY4fmfP8KRHo7y/X8iLFfevRny5X5hCv6T+ufD/MwmxWS/RNEazTeBAE X-Received: by 2002:a17:907:6e9e:b0:78e:214b:e3c2 with SMTP id sh30-20020a1709076e9e00b0078e214be3c2mr41551298ejc.15.1666879034316; Thu, 27 Oct 2022 06:57:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666879034; cv=none; d=google.com; s=arc-20160816; b=wu6WQFFu3UpE97EKyQTtR/H4sgxcpYGjiRhuF3umfsYc6gNKjfN5q8hkDcB/bRzazf dQIdNom9y4QNQN9XnWqUFqb864A9+8vjllqwB0CbUgfvhXTugXM5Mcs0NB82PULkRAFx zifHVcegx1If/GGdst9x48066reHClYuLS/u4bESBt71NKCCyGeBgpXys3+u5itRI+YD qyWaifEENG5RpC3OStP9Y47f6tpP7i3RlWwWtiVwAvM2lqWYDmTqMyuDVYBGho/bidQw tOYJRyAwtpimNcsoDAhgjULJkHJsRgJ2onFRyI5J95sapG1sxard7TgP8lgtgX92WBgm AoBg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=CuMMZmmLxa5+WH6CG8j7t8f4W4ldMDRlQyMUWCV2xf8=; b=YRIscfdJpdVNAd40fpSNDQiKEk7Uhpar+68drPJzWt/aDp8/DbORm/UCHpi/r1PLD9 bznHZ/Tg2QQ4CwXM2TcvluEVstXovqWsUdOEC4i2KyWjn2b2YdyXtuLAwPfy88oMKHYe zsJYaZy9Rvhi/JlFnKn5tNUar0+AzcyhKNQMmLG1n8iHM/1rPmpfXLHQkBXBCoNSzGXI 1rpzfbBdODaKOB+5GD0XEYMqmQXTpdgHxTtDa7RSOhEB8C31QeAT0mM8k4Zjpam/TZ7v gMlSxSzK5GytZl5YXItpK4cVtWYHESRdxIDWfDU+Kn+e7bCqx/xxt/uh6p2xndlPVbmc OdVA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=GiogSBYX; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id hw20-20020a170907a0d400b0078db371355esi1349806ejc.987.2022.10.27.06.56.48; Thu, 27 Oct 2022 06:57:14 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=GiogSBYX; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235443AbiJ0Mpr (ORCPT + 99 others); Thu, 27 Oct 2022 08:45:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55912 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235387AbiJ0Mpd (ORCPT ); Thu, 27 Oct 2022 08:45:33 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 17CED4BD2A; Thu, 27 Oct 2022 05:45:32 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id AC8766229C; Thu, 27 Oct 2022 12:45:31 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 13CF5C433C1; Thu, 27 Oct 2022 12:45:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1666874731; bh=VwK3xnv7tqr64wpARnMxEPqabn4IYyL5RaDxsRoawBs=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=GiogSBYXfJ0r9+KZxe55/GEemyJGjjCmHjQtUDgImzxG7bKDiuIoQwnwncIu5fRmA Vdgw8qZtdKPbF7cVmPqsTiXrY1hNfQgyjzM7r1xCXqi9T5u2DURIO1fwD7KIXred9x N8hwc7uVYVimOc+gQ3HgHg0JEboeKXr/FOtGSVvAUGmFFaU1BvWhiNYlH+QTtcRiuu 97ykirTvwKbSF9pN1tyHyQwAv0dJk14Swxl/jDkawtwEniTwdVK88tO2pNQ6MZ4E5t nkqBtV8ZqTMxaqzwEIMBQ4A+zd4G9ShWctrswDE0x4DFzpj1y7p/8Ff39RjAaDj2MP OGtFcy8N1TNEA== Received: from johan by xi.lan with local (Exim 4.94.2) (envelope-from ) id 1oo2G3-0007iP-Cb; Thu, 27 Oct 2022 14:45:16 +0200 Date: Thu, 27 Oct 2022 14:45:15 +0200 From: Johan Hovold To: Stefan Agner Cc: Greg Kroah-Hartman , stable@vger.kernel.org, linux-kernel@vger.kernel.org, Johan Hovold , Matthias Kaehlcke , stable , regressions@lists.linux.dev, m.szyprowski@samsung.com, krzk@kernel.org Subject: Re: [PATCH stable-5.15 3/3] usb: dwc3: disable USB core PHY management Message-ID: References: <20220906120702.19219-1-johan@kernel.org> <20220906120702.19219-4-johan@kernel.org> <808bdba846bb60456adf10a3016911ee@agner.ch> <86c0f1ee8ffc94f9a53690dda6a83fbb@agner.ch> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Oct 26, 2022 at 03:11:00PM +0200, Stefan Agner wrote: > On 2022-10-21 08:54, Johan Hovold wrote: > > On Fri, Oct 21, 2022 at 12:06:12AM +0200, Stefan Agner wrote: > >> On 2022-10-19 10:59, Johan Hovold wrote: > >> > On Tue, Oct 18, 2022 at 05:27:24PM +0200, Stefan Agner wrote: > >> >> On 2022-09-06 14:07, Johan Hovold wrote: > >> >> > From: Johan Hovold > >> >> > > >> >> > commit 6000b8d900cd5f52fbcd0776d0cc396e88c8c2ea upstream. > >> >> > > >> >> > The dwc3 driver manages its PHYs itself so the USB core PHY management > >> >> > needs to be disabled. > >> >> > > >> >> > Use the struct xhci_plat_priv hack added by commits 46034a999c07 ("usb: > >> >> > host: xhci-plat: add platform data support") and f768e718911e ("usb: > >> >> > host: xhci-plat: add priv quirk for skip PHY initialization") to > >> >> > propagate the setting for now. > > > >> >> For some reason, this commit seems to break detection of the USB to > >> >> S-ATA controller on ODROID-HC1 devices (Exynos 5422). > > > >> > I think this may be related to the calibration calls added to dwc3 and > >> > later removed again by commits: > >> > > >> > d8c80bb3b55b ("phy: exynos5-usbdrd: Calibrate LOS levels for exynos5420/5800") > >> > a0a465569b45 ("usb: dwc3: remove generic PHY calibrate() calls") > >> > > >> > The removal explicitly mentions that the expectation is that USB core > >> > will do the PHY calibration. > >> > > >> > There could be other changes in the sequencing of events that this > >> > platform has been implicitly relying on, but as a start, could try > >> > adding the missing calibration calls (patch below) and see if that makes a > >> > difference? > >> > >> The patch below did not apply to 5.15.74 directly, but I think I was > >> able to get the corrected patch applied (see below) > The user reports the S-ATA disk is *not* recognized with that patch > applied. I just noticed a mistake in the instrumentation patch I sent you. Could you try moving the calibrations calls after dwc3_host_init() (e.g. as in the second chunk in the diff below)? As mentioned in the commit message for a0a465569b45 ("usb: dwc3: remove generic PHY calibrate() calls"), this may not work if the xhci-plat driver is built as a module and there are some corner cases that it does not cover. It seems we should revert the offending commit and then try to find some time to untangle this mess, but please check if the below addresses the issue first so we know what the problem is. I'll prepare a revert in the meantime. Johan diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c index 31156d4dec9f..37d49a394912 100644 --- a/drivers/usb/dwc3/core.c +++ b/drivers/usb/dwc3/core.c @@ -197,6 +197,8 @@ static void __dwc3_set_mode(struct work_struct *work) otg_set_vbus(dwc->usb2_phy->otg, true); phy_set_mode(dwc->usb2_generic_phy, PHY_MODE_USB_HOST); phy_set_mode(dwc->usb3_generic_phy, PHY_MODE_USB_HOST); + phy_calibrate(dwc->usb2_generic_phy); + phy_calibrate(dwc->usb3_generic_phy); if (dwc->dis_split_quirk) { reg = dwc3_readl(dwc->regs, DWC3_GUCTL3); reg |= DWC3_GUCTL3_SPLITDISABLE; @@ -1391,6 +1393,9 @@ static int dwc3_core_init_mode(struct dwc3 *dwc) ret = dwc3_host_init(dwc); if (ret) return dev_err_probe(dev, ret, "failed to initialize host\n"); + + phy_calibrate(dwc->usb2_generic_phy); + phy_calibrate(dwc->usb3_generic_phy); break; case USB_DR_MODE_OTG: INIT_WORK(&dwc->drd_work, __dwc3_set_mode);