From patchwork Thu Nov 10 21:11:32 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ferry Toth X-Patchwork-Id: 18323 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp383717wru; Thu, 10 Nov 2022 13:27:00 -0800 (PST) X-Google-Smtp-Source: AMsMyM743JLvocoRXXtO+1PqAWJcmNu9TvnFnBfeXzUpZeS+jbZLhbzjCPEYFVELR4CIHln27Ne2 X-Received: by 2002:a17:90a:854b:b0:213:5a4d:8138 with SMTP id a11-20020a17090a854b00b002135a4d8138mr2070684pjw.17.1668115620417; Thu, 10 Nov 2022 13:27:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668115620; cv=none; d=google.com; s=arc-20160816; b=OS57rIcUciloFCPKvUBS9b9ZevBJRj/OkoqhbHAYvaMj6r08rJaTBr9KjRLdFdSIut IOcpWDqYuvwx5cr8qGDI/RL69/9iZPVwQL5tvVBThCupHhysc8zIoLv0yVU40yUHeGsm JLrGy9ZWw/+xdZHLFfSIMJt0HzhoddHr2fg0inMnRznCZD/PprlC7J2pzvnm346nf0/k XsKn3E4vupb6ZjNDDp3ZpSUIe4BGN9ij5z3gT6r9RuvqN8Wf7iQx18MpfpDun9F9m5/D 6yIZYkcz5Ty6jqPzczK1XSSj+5RH72e0rdWio4E3B0uJ6Xy07SPEqGfn7byERY2qOYZt +j/Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=A4MtRV/Oz/92ZR5qGyeTjm00+NMx36cJ5lbhoagSP70=; b=P+Qi3gl8duCCXHR/exFRexKQo4uxaIRCMr8Ly09n5nobc5G0/WwYHfo45P3R824NR7 /6ciTHZVa777B0BuPZDkrqGznPE2+riwq3VvatFLKf/iZp5ce1CqaY7SbDTP/cHJF8pJ r34SYANngl0pWUiMZ2yqMd+Wjtv2LG8Jw98CT6BgWqvZXvd5ZKdh1+F/p33sBeM0qrOz USr0C/qs0qj3gW06PKVfecQWiD7NWNjI7ROc69vIO5d41ogcwT5d4zNemkBPZDeEXlpP TsPg5D4Tl3N4iWo1x+NpfAs73ZXcGqNT3RSiOmLLXtzyKQyUTxQQ2e3H09u5GazDQoEs 0WOA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@exalondelft.nl header.s=whs1 header.b=Mv7dlS1S; 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=exalondelft.nl Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id t3-20020a056a0021c300b00561fb25a42asi283501pfj.303.2022.11.10.13.26.45; Thu, 10 Nov 2022 13:27:00 -0800 (PST) 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=@exalondelft.nl header.s=whs1 header.b=Mv7dlS1S; 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=exalondelft.nl Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231511AbiKJVNs (ORCPT + 99 others); Thu, 10 Nov 2022 16:13:48 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34944 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232182AbiKJVNV (ORCPT ); Thu, 10 Nov 2022 16:13:21 -0500 Received: from mailfilter05-out40.webhostingserver.nl (mailfilter05-out40.webhostingserver.nl [195.211.74.36]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A3F885E3DA for ; Thu, 10 Nov 2022 13:13:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=exalondelft.nl; s=whs1; h=content-transfer-encoding:mime-version:references:in-reply-to:message-id:date: subject:cc:to:from:from; bh=A4MtRV/Oz/92ZR5qGyeTjm00+NMx36cJ5lbhoagSP70=; b=Mv7dlS1SmB5BpnCMLPauvzc5SGhClRH8tqUa1YhqKZsA9nFJTZk6I5VX/EcvmTFDsEo9BBEAiC+sB eCjKeZr8JwGdRLXgtoDNe6HSZFOxP9bjE8BAobx94xsx5KJV0dnPAFnEp90Xd2snK4xRdBWL3tRBH4 XHj3yDb3ahhc8f3UTUhA8uqvDKG+wQHnIox56svGnnPmGOTyuwQBAgjltW96d0LP7R6tEdS0luUeFZ SSzeqipG02o+WRR+ZoE/vZ7oitBhMTlxjkHRb8eGO1urOXGY24CF7Z1CHoaHHo4u4YO5POtlF1bcn8 yKtsUCgu0viJsXgB4oRgSk/Rfx+pJmg== X-Halon-ID: 580cd1a3-613c-11ed-9686-001a4a4cb933 Received: from s198.webhostingserver.nl (s198.webhostingserver.nl [141.138.168.154]) by mailfilter05.webhostingserver.nl (Halon) with ESMTPSA id 580cd1a3-613c-11ed-9686-001a4a4cb933; Thu, 10 Nov 2022 22:12:12 +0100 (CET) Received: from 2a02-a466-68ed-1-7ff6-3899-7171-85b5.fixed6.kpn.net ([2a02:a466:68ed:1:7ff6:3899:7171:85b5] helo=delfion.fritz.box) by s198.webhostingserver.nl with esmtpa (Exim 4.96) (envelope-from ) id 1otEqJ-005Dpg-3B; Thu, 10 Nov 2022 22:12:12 +0100 From: Ferry Toth To: linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Heikki Krogerus , Greg Kroah-Hartman , Thinh Nguyen , Sean Anderson , Liu Shixin , Ferry Toth , Andrey Smirnov , Andy Shevchenko , Ferry Toth Subject: [PATCH v2 2/2] usb: dwc3: core: defer probe on ulpi_read_id timeout Date: Thu, 10 Nov 2022 22:11:32 +0100 Message-Id: <20221110211132.297512-3-ftoth@exalondelft.nl> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221110211132.297512-1-ftoth@exalondelft.nl> References: <20221110211132.297512-1-ftoth@exalondelft.nl> MIME-Version: 1.0 X-Antivirus-Scanner: Clean mail though you should still use an Antivirus X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW,SPF_HELO_PASS, SPF_PASS autolearn=unavailable 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1749145911191171966?= X-GMAIL-MSGID: =?utf-8?q?1749146004813131443?= Since commit 0f010171 Dual Role support on Intel Merrifield platform broke due to rearranging the call to dwc3_get_extcon(). It appears to be caused by ulpi_read_id() masking the timeout on the first test write. In the past dwc3 probe continued by calling dwc3_core_soft_reset() followed by dwc3_get_extcon() which happend to return -EPROBE_DEFER. On deferred probe ulpi_read_id() finally succeeded. As we now changed ulpi_read_id() to return -ETIMEDOUT in this case, we need to handle the error by calling dwc3_core_soft_reset() and request -EPROBE_DEFER. On deferred probe ulpi_read_id() is retried and succeeds. Signed-off-by: Ferry Toth --- drivers/usb/dwc3/core.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c index 648f1c570021..2779f17bffaf 100644 --- a/drivers/usb/dwc3/core.c +++ b/drivers/usb/dwc3/core.c @@ -1106,8 +1106,13 @@ static int dwc3_core_init(struct dwc3 *dwc) if (!dwc->ulpi_ready) { ret = dwc3_core_ulpi_init(dwc); - if (ret) + if (ret) { + if (ret == -ETIMEDOUT) { + dwc3_core_soft_reset(dwc); + ret = -EPROBE_DEFER; + } goto err0; + } dwc->ulpi_ready = true; }