Received: by 2002:a25:683:0:0:0:0:0 with SMTP id 125csp1265557ybg; Thu, 4 Jun 2020 05:33:57 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzrPcGYm1hbkZaZv6nr0duP9wH2imrE9EFxUmWzBjtB4O9CcDN5SP97CvZqKP0JHuJ4NWFc X-Received: by 2002:a05:6402:c1a:: with SMTP id co26mr3927344edb.207.1591274033930; Thu, 04 Jun 2020 05:33:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1591274033; cv=none; d=google.com; s=arc-20160816; b=X5s7mEU/+njK03Gtj8jFnbpOu+XoEXtZPiwGb/T0o1YO86m852qTKppS25Jo/+yB5t Tq6UQskzHF2dL5wq+Q1l7ivGa5tShkmyBSAA22jMhvMfhckbCStMWk0V1o31lh4Fam2+ ymo2ctEEjBR373hYnYJj6MFxASKN7rQB9Ef+LM17rdVIg95gLIcupE/4X15GaTNVjZ0C vwbSx0loG2NsXDPNa6mfBBsZd9V0La7XjmvaR0GNvNIy5CB4qh4SCTgWQLmQ8MhdGc4H faL6rg3WS0RKrjEU5Ku76Bk9M+6qIAjFEk4Bjd8qM9x9LZyGILvvGX6FK7rVXbhrhzds DTYA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:message-id:date:to:cc:from :subject:references:in-reply-to:content-transfer-encoding :mime-version:dkim-signature; bh=DEKbfIfXEu9wF9Z0rkW5J6S6e0LP/FIn5jqzqOD5wDs=; b=hbTNsWm7jx6dwlnB7LIf8w37xeYaHKzLeCZN9XPsIz/W7P5rvwb/ZMIsc1wYTTxxns pq3xETDQkL390gDTpfYNrgjoWUZuSZvIkXKMUunFr9imCJJT7nfv7WVzNPFLVWOPdPer tz/iIGbRuIzrn6253c+PIOa5EevJ0KZK/ZmzBTK51D9l8EZRGvoINFXL//OLPTHY12dF XEgO26NdWsPZF7yYeyt7SkaD7IMp4Bsl5t7s7fcE17+quZ/m6z/PyxP3t5p9uqzbuJFT 3Vj7Y0xPxDXa1Gu2JiYvJg+q6C5PCSaA61eQF3HkJ9kac3gf6RxGlacxJ35k4gVarJYI ykpg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=J5RJ6b1s; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id m14si1615373eja.139.2020.06.04.05.33.29; Thu, 04 Jun 2020 05:33:53 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=J5RJ6b1s; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726711AbgFDLQg (ORCPT + 99 others); Thu, 4 Jun 2020 07:16:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51750 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726175AbgFDLQf (ORCPT ); Thu, 4 Jun 2020 07:16:35 -0400 Received: from mail-pl1-x641.google.com (mail-pl1-x641.google.com [IPv6:2607:f8b0:4864:20::641]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0D88FC03E96D for ; Thu, 4 Jun 2020 04:16:34 -0700 (PDT) Received: by mail-pl1-x641.google.com with SMTP id n9so2080382plk.1 for ; Thu, 04 Jun 2020 04:16:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=mime-version:content-transfer-encoding:in-reply-to:references :subject:from:cc:to:date:message-id:user-agent; bh=DEKbfIfXEu9wF9Z0rkW5J6S6e0LP/FIn5jqzqOD5wDs=; b=J5RJ6b1svg73OcukZzTb62hfadQTam8cpOe6CX7zl/Yqm9toweh+CzSVUszQVZxgHc MrzJlzQHPZiB/HszI+VdlKy0lFN8QKlDyAJ3lMMe45FqOCuMua5MMXQT/dYiM298BrDS PwTgQO5xtayqQSu3nBzYBqxLzKEoVkKZOC5iQ= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:content-transfer-encoding :in-reply-to:references:subject:from:cc:to:date:message-id :user-agent; bh=DEKbfIfXEu9wF9Z0rkW5J6S6e0LP/FIn5jqzqOD5wDs=; b=IHGDD+7MHpb1MTZNnoZLuQqRYuxdL5/3jGcJB8ALjW7elAzadptFe2SSQkxwwdk1Sd RJlrC3CHcL0y++k1che1I+HJ+zXieTS6D3IfTZuuWNaJzPp9qRSkP7VhdhHbQJxiby66 APPq9R4tDBnQRGG5YwWzl4oeM3YnUuiYpmJIPinqb3p9QejpzMfbBzSfzNOiMR8Xp84V lzRVDUQlLzAd27xn6qj/rhRVCyqaRXfwlVWz/Ldnd7ezd06nDg8GYqKZVbDEBO2t4Yj8 tMILLKnb+k21B4dRRwVFitT6llWvUzisS2wYI75mRljHVGRmMLR15OoixVbKi1bo33dA 7EcA== X-Gm-Message-State: AOAM532lmsU2Vf/DVb53zK7SRRQxKiL4P6wzIypqoyEaGCxn2nJcPxPC q/ATlFrZAQrqDx6F3sWkSmwPAQ== X-Received: by 2002:a17:902:aa48:: with SMTP id c8mr4478787plr.128.1591269393407; Thu, 04 Jun 2020 04:16:33 -0700 (PDT) Received: from chromium.org ([2620:15c:202:1:fa53:7765:582b:82b9]) by smtp.gmail.com with ESMTPSA id a19sm4510338pfd.165.2020.06.04.04.16.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 Jun 2020 04:16:32 -0700 (PDT) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable In-Reply-To: References: <1585718145-29537-1-git-send-email-sanm@codeaurora.org> <1585718145-29537-3-git-send-email-sanm@codeaurora.org> <159120577830.69627.13288547914742515702@swboyd.mtv.corp.google.com> Subject: Re: [PATCH v7 2/4] usb: dwc3: qcom: Add interconnect support in dwc3 driver From: Stephen Boyd Cc: linux-arm-msm@vger.kernel.org, linux-usb@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Manu Gautam , Chandana Kishori Chiluveru To: Andy Gross , Bjorn Andersson , Doug Anderson , Felipe Balbi , Greg Kroah-Hartman , Mark Rutland , Matthias Kaehlcke , Rob Herring , Sandeep Maheswaram (Temp) Date: Thu, 04 Jun 2020 04:16:31 -0700 Message-ID: <159126939154.69627.13027312816468830595@swboyd.mtv.corp.google.com> User-Agent: alot/0.9 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Quoting Sandeep Maheswaram (Temp) (2020-06-04 02:43:09) >=20 > On 6/3/2020 11:06 PM, Stephen Boyd wrote: > > Quoting Sandeep Maheswaram (2020-03-31 22:15:43) > >> diff --git a/drivers/usb/dwc3/dwc3-qcom.c b/drivers/usb/dwc3/dwc3-qcom= .c > >> index 1dfd024..d33ae86 100644 > >> --- a/drivers/usb/dwc3/dwc3-qcom.c > >> +++ b/drivers/usb/dwc3/dwc3-qcom.c > >> @@ -285,6 +307,101 @@ static int dwc3_qcom_resume(struct dwc3_qcom *qc= om) > >> return 0; > >> } > >> =20 > >> + > >> +/** > >> + * dwc3_qcom_interconnect_init() - Get interconnect path handles > >> + * @qcom: Pointer to the concerned usb core. > >> + * > >> + */ > >> +static int dwc3_qcom_interconnect_init(struct dwc3_qcom *qcom) > >> +{ > >> + struct device *dev =3D qcom->dev; > >> + int ret; > >> + > >> + if (!device_is_bound(&qcom->dwc3->dev)) > >> + return -EPROBE_DEFER; > > How is this supposed to work? I see that this was added in an earlier > > revision of this patch series but there isn't any mention of why > > device_is_bound() is used here. It would be great if there was a comment > > detailing why this is necessary. It sounds like maximum_speed is > > important? > > > > Furthermore, dwc3_qcom_interconnect_init() is called by > > dwc3_qcom_probe() which is the function that registers the device for > > qcom->dwc3->dev. If that device doesn't probe between the time it is > > registered by dwc3_qcom_probe() and this function is called then we'll > > fail dwc3_qcom_probe() with -EPROBE_DEFER. And that will remove the > > qcom->dwc3->dev device from the platform bus because we call > > of_platform_depopulate() on the error path of dwc3_qcom_probe(). > > > > So isn't this whole thing racy and can potentially lead us to a driver > > probe loop where the wrapper (dwc3_qcom) and the core (dwc3) are probing > > and we're trying to time it just right so that driver for dwc3 binds > > before we setup interconnects? I don't know if dwc3 can communicate to > > the wrapper but that would be more of a direct way to do this. Or maybe > > the wrapper should try to read the DT property for maximum speed and > > fallback to a worst case high bandwidth value if it can't figure it out > > itself without help from dwc3 core. > > > This was added in V4 to address comments from Matthias in V3 >=20 > https://patchwork.kernel.org/patch/11148587/ >=20 Yes, that why I said: "I see that this was added in an earlier revision of this patch series but there isn't any mention of why device_is_bound() is used here. It would be great if there was a comment detailing why this is necessary. It sounds like maximum_speed is important?" Can you please respond to the rest of my email?