From patchwork Mon Jul 13 16:05:22 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Robertson X-Patchwork-Id: 11660165 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id B9FC41510 for ; Mon, 13 Jul 2020 16:06:38 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 927542076D for ; Mon, 13 Jul 2020 16:06:38 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="bmUFGMfX" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 927542076D Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=dlrobertson.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-amlogic-bounces+patchwork-linux-amlogic=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Date:Subject: Message-ID:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=Y49jJ1meuC6Bp9huv3P6cQo5xxRhfYtdOfTJBYkWj4g=; b=bmUFGMfXzA1fSbzzGhb/9A7uA Jj3xjmi77VeDpJmJqYr9tH069JNv+d0WnkV5hu/oYJDFXMFXAQXP107flYCgnHPlRavqKWfO/MorH OdCvGMIDcKlgKwhwUYzJDzmZPNT5mAUs6ThXvCmZ6ysxNgPZZzVK2l90UXBJITAgMIq52KYeqYvHb C1+n7+ZgLWwfme0+0oQ3OpTIJwx939GxDwrHzfiyxTK5j+F6EH4VbDTV3qpRcqJUlK84YrBsqjmww g+XGCZ18Ss2pZfGSTlH+j51zi7v3Cb1ozgEa8Sx90BPPcoY1AUHzKYpPL3VJxzei964Giabw+EF4t 6crcQLUTw==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jv0yK-0004x3-3b; Mon, 13 Jul 2020 16:06:28 +0000 Received: from sender4-op-o17.zoho.com ([136.143.188.17]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jv0yH-0004vT-10; Mon, 13 Jul 2020 16:06:26 +0000 ARC-Seal: i=1; a=rsa-sha256; t=1594656375; cv=none; d=zohomail.com; s=zohoarc; b=anHNvDYLVviZgCgUDUF6dCZdJfUNO2U+Z2EHMp6EDEMHzYVRUXb5aS1J3oMxSa46Dh0AWnRsafmT6ujyKL/F2EZsKdtSw9tWjpfvNEcm7WOldQNRXQvLw8ZzdoKaau2owgf6U9mQvbr+1guajb+qFcPBrNU5DmGqCFSoyeZg29A= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1594656375; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:To; bh=F8q5Lt6dWY922aSaNvVVgURPZJwVNB1Tw4FOG4FL+JA=; b=MhLuRg7qi+wUizJCQcN9boU1rtGGucp9m4AnUkWqvWdShEAV3mwCPAtZnm7mRniyrJPqX6wPATtybVc/j6Sj7hE5mQX3BWAEpQQVp5JZ1ZY3POWx5uVYsnsOO0f99cY1L2ZDW1wCDWb6OYZJ3IWuQcmnEPEg+W/G6iFheau0wQ0= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass smtp.mailfrom=dan@dlrobertson.com; dmarc=pass header.from= header.from= Received: from gothmog.test (pool-108-28-30-30.washdc.fios.verizon.net [108.28.30.30]) by mx.zohomail.com with SMTPS id 1594656373280412.43216096061997; Mon, 13 Jul 2020 09:06:13 -0700 (PDT) From: Dan Robertson To: Martin Blumenstingl , Neil Armstrong , Kevin Hilman Message-ID: <20200713160522.19345-2-dan@dlrobertson.com> Subject: [PATCH 1/1] usb: dwc3: meson-g12a: fix shared reset control use Date: Mon, 13 Jul 2020 12:05:22 -0400 X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200713160522.19345-1-dan@dlrobertson.com> References: <20200713160522.19345-1-dan@dlrobertson.com> MIME-Version: 1.0 X-ZohoMailClient: External X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200713_120625_236535_2102951E X-CRM114-Status: UNSURE ( 7.08 ) X-CRM114-Notice: Please train this message. X-Spam-Score: 0.0 (/) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (0.0 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [136.143.188.17 listed in list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record X-BeenThere: linux-amlogic@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-amlogic@lists.infradead.org, linux-usb@vger.kernel.org, Dan Robertson , linux-arm-kernel@lists.infradead.org Sender: "linux-amlogic" Errors-To: linux-amlogic-bounces+patchwork-linux-amlogic=patchwork.kernel.org@lists.infradead.org The reset is a shared reset line, but reset_control_reset is still used and reset_control_deassert is not guaranteed to have been called before the first reset_control_assert call. When suspending the following warning may be seen: WARNING: CPU: 1 PID: 5530 at drivers/reset/core.c:355 reset_control_assert+0x184/0x19c Hardware name: Hardkernel ODROID-N2 (DT) [..] pc : reset_control_assert+0x184/0x19c lr : dwc3_meson_g12a_suspend+0x68/0x7c [..] Call trace: reset_control_assert+0x184/0x19c dwc3_meson_g12a_suspend+0x68/0x7c platform_pm_suspend+0x28/0x54 __device_suspend+0x590/0xabc dpm_suspend+0x104/0x404 dpm_suspend_start+0x84/0x1bc suspend_devices_and_enter+0xc4/0x4fc pm_suspend+0x198/0x2d4 Fixes: 6d9fa35a347a87 ("usb: dwc3: meson-g12a: get the reset as shared") Signed-off-by: Dan Robertson --- drivers/usb/dwc3/dwc3-meson-g12a.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/drivers/usb/dwc3/dwc3-meson-g12a.c b/drivers/usb/dwc3/dwc3-meson-g12a.c index 1f7f4d88ed9d..88b75b5a039c 100644 --- a/drivers/usb/dwc3/dwc3-meson-g12a.c +++ b/drivers/usb/dwc3/dwc3-meson-g12a.c @@ -737,13 +737,13 @@ static int dwc3_meson_g12a_probe(struct platform_device *pdev) goto err_disable_clks; } - ret = reset_control_reset(priv->reset); + ret = reset_control_deassert(priv->reset); if (ret) - goto err_disable_clks; + goto err_assert_reset; ret = dwc3_meson_g12a_get_phys(priv); if (ret) - goto err_disable_clks; + goto err_assert_reset; ret = priv->drvdata->setup_regmaps(priv, base); if (ret) @@ -752,7 +752,7 @@ static int dwc3_meson_g12a_probe(struct platform_device *pdev) if (priv->vbus) { ret = regulator_enable(priv->vbus); if (ret) - goto err_disable_clks; + goto err_assert_reset; } /* Get dr_mode */ @@ -765,13 +765,13 @@ static int dwc3_meson_g12a_probe(struct platform_device *pdev) ret = priv->drvdata->usb_init(priv); if (ret) - goto err_disable_clks; + goto err_assert_reset; /* Init PHYs */ for (i = 0 ; i < PHY_COUNT ; ++i) { ret = phy_init(priv->phys[i]); if (ret) - goto err_disable_clks; + goto err_assert_reset; } /* Set PHY Power */ @@ -809,6 +809,9 @@ static int dwc3_meson_g12a_probe(struct platform_device *pdev) for (i = 0 ; i < PHY_COUNT ; ++i) phy_exit(priv->phys[i]); +err_assert_reset: + reset_control_assert(priv->reset); + err_disable_clks: clk_bulk_disable_unprepare(priv->drvdata->num_clks, priv->drvdata->clks);