Received: by 2002:ac0:e350:0:0:0:0:0 with SMTP id g16csp104681imn; Wed, 3 Aug 2022 21:52:38 -0700 (PDT) X-Google-Smtp-Source: AA6agR4bml+X1wDALEyhBdtMArrf0KxvAMKGingrY5+bSOuDsIFeBOa/5YWmRUmuS6DbYufrHTlL X-Received: by 2002:a05:6402:520f:b0:43e:5cf1:d1 with SMTP id s15-20020a056402520f00b0043e5cf100d1mr179967edd.22.1659588758021; Wed, 03 Aug 2022 21:52:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1659588758; cv=none; d=google.com; s=arc-20160816; b=mRE61GRlegObGHHygk2hlFgAvzxwI8p8k0PZRYEytaOG20YBGz9WdYDi1cYWKZMxb5 EKd7xW7kMLD9eQWQwjq2c34NCM9UXSX7Yda8R5UsXGGtQGqyZyDnmGSC6asbOCU8rS7K fk9ye1kvjpyYFAMssFWZHiAr5GbupnhLBIWUY9H3y0jGEmo7sD59x8PGXOCeMkcDBZC/ 41wzEJ8jLxJhrSQCs2dXVgTNZMOYEA0po6/RxFD7VMAdgtw3Fg2zTJDqO1Fh9tW2jQ00 pKc0L+0lafkMf7EmfFtDau6FsGn2GwNTPiHPW+vNwGRQkNX7HaNI8C83u3rUMuOxt33W bceg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=kaFm7WB45/t+ZVt6kFh6saY9zhjnV9Zkq3YgVtfmQEo=; b=ACc2BJK1+ej7Pek1mOH8eQomV03LAjAs2EUuC8l3KwPnyo+06Ly4wY6+GvaHFuAC2S X5QnU2RHDPyAKBhyhb+08NZr4KOd+W/18snHHvmeTS2ivp9bCnz2YApL8nPFqGJWxhhL gX+51daDb78XPthFkkuCI7IkgNnghwwZaG3X+HjDEC+odGmPJJnRCn4NuT9lMCsnvmcZ 73iKDclovjgr4plQByT4DBL3w66TmlryXuN2U9Byn2HZ+0gWyCXYduUdw9MGYOoghHI1 1P0ZIBGwlZ9QKOqaMlvWmSnIAdpO6L24xHGHI+Rpimom35xcAAlU0CSZEkfEDGZ93G2B fVWw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcdkim header.b="qx/2RFpH"; 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=quicinc.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id i15-20020a1709064fcf00b0073075179ad5si14138001ejw.460.2022.08.03.21.52.13; Wed, 03 Aug 2022 21:52:38 -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=@quicinc.com header.s=qcdkim header.b="qx/2RFpH"; 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=quicinc.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238639AbiHDEu3 (ORCPT + 99 others); Thu, 4 Aug 2022 00:50:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45854 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230477AbiHDEu2 (ORCPT ); Thu, 4 Aug 2022 00:50:28 -0400 Received: from alexa-out.qualcomm.com (alexa-out.qualcomm.com [129.46.98.28]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1CE80186E8; Wed, 3 Aug 2022 21:50:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; i=@quicinc.com; q=dns/txt; s=qcdkim; t=1659588627; x=1691124627; h=message-id:date:mime-version:subject:to:cc:references: from:in-reply-to:content-transfer-encoding; bh=kaFm7WB45/t+ZVt6kFh6saY9zhjnV9Zkq3YgVtfmQEo=; b=qx/2RFpHkRSYhcKYQARM82X/5kWrB0EWVZjeBKdsD11FQzXzH6F3xczF zjGvxp8uP9hYOcJ8ErOseb571JyKHOA69B7YN0nybCrLLkdX2teMq1fNx dNmCgO/0aY7qmliwuFjG89F8WUtgC/qYiAjGHWVzFjTa6ULYr/BV1O81X E=; Received: from ironmsg09-lv.qualcomm.com ([10.47.202.153]) by alexa-out.qualcomm.com with ESMTP; 03 Aug 2022 21:50:27 -0700 X-QCInternal: smtphost Received: from nasanex01c.na.qualcomm.com ([10.47.97.222]) by ironmsg09-lv.qualcomm.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 Aug 2022 21:50:26 -0700 Received: from nalasex01a.na.qualcomm.com (10.47.209.196) by nasanex01c.na.qualcomm.com (10.47.97.222) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.22; Wed, 3 Aug 2022 21:50:26 -0700 Received: from [10.216.16.162] (10.80.80.8) by nalasex01a.na.qualcomm.com (10.47.209.196) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.22; Wed, 3 Aug 2022 21:50:23 -0700 Message-ID: <284b0697-e630-8900-9ed6-d83d2f99619c@quicinc.com> Date: Thu, 4 Aug 2022 10:20:20 +0530 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.12.0 Subject: Re: [PATCH v2] usb: dwc3: qcom: Defer dwc3-qcom probe if dwc3 isn't probed properly Content-Language: en-US To: Johan Hovold CC: Andy Gross , Bjorn Andersson , Felipe Balbi , "Greg Kroah-Hartman" , Philipp Zabel , , , References: <1657891312-21748-1-git-send-email-quic_kriskura@quicinc.com> From: Krishna Kurapati PSSNV In-Reply-To: Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 8bit X-Originating-IP: [10.80.80.8] X-ClientProxiedBy: nasanex01b.na.qualcomm.com (10.46.141.250) To nalasex01a.na.qualcomm.com (10.47.209.196) X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,RCVD_IN_DNSWL_MED, 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 8/2/2022 9:40 PM, Johan Hovold wrote: > On Fri, Jul 15, 2022 at 06:51:52PM +0530, Krishna Kurapati wrote: >> On SC7180 devices, it is observed that dwc3 probing is deferred >> because device_links_check_suppliers() finds that '88e3000.phy' >> isn't ready yet. >> >> As a part of its probe call, dwc3-qcom driver checks if dwc3 core >> is wakeup capable or not. If the dwc3 core is wakeup capable, driver >> configures dwc-qcom's power domain to be always ON. Also it configures >> dp/dm interrupts accordingly to support wakeup from system suspend. >> >> More info regarding the same can be found at: >> commit d9be8d5c5b03 ("usb: dwc3: qcom: Keep power domain on to retain controller status") >> commit 6895ea55c385 ("usb: dwc3: qcom: Configure wakeup interrupts during suspend") >> >> In the event, dwc3 probe gets deferred and is processed after dwc3-qcom >> probe, driver ends up reading the wakeup capability of dwc3 core as false >> leading to instability in suspend/resume path. >> >> To avoid this scenario, ensure dwc3_probe is successful by checking >> if appropriate driver is assigned to it or not after the of_platform_populate >> call. If it isn't then defer dwc3-qcom probe as well. >> >> Fixes: 649f5c842ba3 ("usb: dwc3: core: Host wake up support from system suspend") >> Signed-off-by: Krishna Kurapati >> --- >> v2: Set return value to EPROBE_DEFER to drop reference to dwc3 node >> >> drivers/usb/dwc3/dwc3-qcom.c | 3 +++ >> 1 file changed, 3 insertions(+) >> >> diff --git a/drivers/usb/dwc3/dwc3-qcom.c b/drivers/usb/dwc3/dwc3-qcom.c >> index 7703655..6676b39 100644 >> --- a/drivers/usb/dwc3/dwc3-qcom.c >> +++ b/drivers/usb/dwc3/dwc3-qcom.c >> @@ -722,6 +722,9 @@ static int dwc3_qcom_of_register_core(struct platform_device *pdev) >> dev_err(dev, "failed to get dwc3 platform device\n"); >> } >> >> + if (!qcom->dwc3->dev.driver) >> + ret = -EPROBE_DEFER; >> + >> node_put: >> of_node_put(dwc3_np); > NAK. > > We should not be adding hacks like this to the driver. > > There are other ways to avoid this, but please take a look at the > following series which makes the problem identified by this patch go > away first: > > https://lore.kernel.org/all/20220802151404.1797-1-johan+linaro@kernel.org > > Johan Hi Johan,  Thanks for the review and patches. Agreed that if we are moving wakeup-source to glue driver, dwc3 probe getting deferred won't be an issue. Regards, Krishna,