From patchwork Fri Nov 13 00:05:06 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amjad Ouled-Ameur X-Patchwork-Id: 11902313 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 D67EE697 for ; Fri, 13 Nov 2020 00:06:33 +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 325F9207BB for ; Fri, 13 Nov 2020 00:06:32 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="xjUGHd9L"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=baylibre-com.20150623.gappssmtp.com header.i=@baylibre-com.20150623.gappssmtp.com header.b="eRuvBfW/" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 325F9207BB Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=baylibre.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:MIME-Version:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:References:In-Reply-To:Message-Id:Date:Subject:To: From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=Fd3Gd5FfU20wywk9m2UafLDav1JwwRuGNFoNb/EkiGM=; b=xjUGHd9LUuJW6DQimwwoEeU03f h8zMR25ZhOSgrzh9+Qw7MdUy19uojANUUTGf5ejYl/nKLcH4DRBI4aFJYUYzi5mojVAzfRiGnIWnO y5uen4b02A3tmUnNf5+McmEfje6vcCuLBesaXDuWqpRRbbdO9ULeBmglT3f1rPlQl+zAsF0OIsFzV 2PSBY5ToGSrG24keismGbq5XOrgxz/TpyDvh9sQfThFVf4qCOK7Z0McxBvRnQSooreEFkDOa4u/fM yejHcfOl0gxsb+JB2wf+IlldVKi2z166LOldJFzs1lrFZKkjxeyxKyKWa2UxpvKR6aGwnsLLm/Vul qbAQjMLg==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kdMba-0000Wn-Sd; Fri, 13 Nov 2020 00:06:18 +0000 Received: from mail-wr1-x441.google.com ([2a00:1450:4864:20::441]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kdMbY-0000W7-MX for linux-amlogic@lists.infradead.org; Fri, 13 Nov 2020 00:06:17 +0000 Received: by mail-wr1-x441.google.com with SMTP id p1so7837097wrf.12 for ; Thu, 12 Nov 2020 16:06:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=SvCqmojrOXPepsO1Q95hNkBgZWVIPjMyxB/8gJJcRy8=; b=eRuvBfW/w0YfQpAsNIggfETPocDNMewqXmrdbtLfYLawNTApaaz3vjA7PFcQiYyjG9 dBaxdtuJUg9MvD94wZ1pZgIO5iK27fR6W3rhtr0P6/If0yO5Ixg++OgCzU1y6YuiIYMb RvZT6p6bWEzkirTINIWVSbRKEhpBxs0wCRrXHX+6ENfirp6DHb/QAJGUPG835JL+Hirv r9f4IUXkJGDCv0hWhbNA0Pm+27sLmdQZC8z+QFlDozejv74Mg0tbyowPRl9pSAm0ZWhD TO/mORp1bpQJuaXWlt1mXhXvDxXodpShZoiDAEIPwxEytiZiaJpyvWvGhxxWN6pxeZM6 a8Kg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=SvCqmojrOXPepsO1Q95hNkBgZWVIPjMyxB/8gJJcRy8=; b=c3Z7f+hn1wD67d8YUWr/VFH/PYJHmR67Fsm/RkSjTS0Emu4ICuKI550+E5WFMyqb0q 7sxQG/N525sHueORH8V3GpYBZJcdSe/YULD4ILrgsHd8ZtrE3XwCOh7By8OuZ4rw2Lf2 hDSk5CKEIMt9fzdX8LVRD9triM5jMHA5VaJxnAU8NiOXlfND78DCT4E4D664R1vo9r6Q xmeAf12+Fx8OSswx3aHMRGdNmTsFLnHNtNSHghWaDzYp28q3mOG6ccWlDSf6Y0ubBlDM fffTKA004P7K3L4kg69shnNDj4d36alwnuKbJ+dS4KYyaLZdfGcGbLUCjU+5oEG1jwcl 4MfQ== X-Gm-Message-State: AOAM532TIdc29AFRfz3QBC77Y+oU202zJNL4zKCRU7S4WejbRdQW3uSb 9otjBE20PL8Q2mEDkeiRaJOICg== X-Google-Smtp-Source: ABdhPJzAFcpXiDgVQFWzpsy/4A2RLg4B3ufujHE7pwk5uARBCcBmbVQ4mOIR9n0l9zMSEXD2xN1i9g== X-Received: by 2002:a5d:654c:: with SMTP id z12mr2349004wrv.46.1605225975556; Thu, 12 Nov 2020 16:06:15 -0800 (PST) Received: from localhost.localdomain ([2001:861:3a84:7260:5d3c:83d5:8524:33ca]) by smtp.googlemail.com with ESMTPSA id t11sm2010114wrm.8.2020.11.12.16.06.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 12 Nov 2020 16:06:14 -0800 (PST) From: Amjad Ouled-Ameur To: Kevin Hilman Subject: [PATCH 1/3] phy: amlogic: phy-meson-gxl-usb2: fix shared reset controller use Date: Fri, 13 Nov 2020 01:05:06 +0100 Message-Id: <20201113000508.14702-2-aouledameur@baylibre.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20201113000508.14702-1-aouledameur@baylibre.com> References: <20201113000508.14702-1-aouledameur@baylibre.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201112_190616_763697_32130899 X-CRM114-Status: GOOD ( 15.01 ) 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 [2a00:1450:4864:20:0:0:0:441 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 -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid 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: Felipe Balbi , linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, Amjad Ouled-Ameur , Philipp Zabel , linux-amlogic@lists.infradead.org, Jerome Brunet MIME-Version: 1.0 Sender: "linux-amlogic" Errors-To: linux-amlogic-bounces+patchwork-linux-amlogic=patchwork.kernel.org@lists.infradead.org Use reset_control_rearm() call if an error occurs in case phy_meson_gxl_usb2_init() fails after reset() has been called ; or in case phy_meson_gxl_usb2_exit() is called i.e the resource is no longer used and the reset line may be triggered again by other devices. reset_control_rearm() keeps use of triggered_count sane in the reset framework. Therefore, use of reset_control_reset() on shared reset line should be balanced with reset_control_rearm(). Signed-off-by: Amjad Ouled-Ameur Reported-by: Jerome Brunet --- Important: Please DO NOT merge before this patch [0] is merged, it adds reset_control_rearm() call to the reset framework API. [0] https://lore.kernel.org/lkml/20201112230043.28987-1-aouledameur@baylib re.com/ drivers/phy/amlogic/phy-meson-gxl-usb2.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/phy/amlogic/phy-meson-gxl-usb2.c b/drivers/phy/amlogic/phy-meson-gxl-usb2.c index 43ec9bf24abf..e366c0b1e339 100644 --- a/drivers/phy/amlogic/phy-meson-gxl-usb2.c +++ b/drivers/phy/amlogic/phy-meson-gxl-usb2.c @@ -114,8 +114,10 @@ static int phy_meson_gxl_usb2_init(struct phy *phy) return ret; ret = clk_prepare_enable(priv->clk); - if (ret) + if (ret) { + reset_control_rearm(priv->reset); return ret; + } return 0; } @@ -124,6 +126,7 @@ static int phy_meson_gxl_usb2_exit(struct phy *phy) { struct phy_meson_gxl_usb2_priv *priv = phy_get_drvdata(phy); + reset_control_rearm(priv->reset); clk_disable_unprepare(priv->clk); return 0; From patchwork Fri Nov 13 00:05:07 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amjad Ouled-Ameur X-Patchwork-Id: 11902315 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 E34D3697 for ; Fri, 13 Nov 2020 00:06:47 +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 8EDD6207BB for ; Fri, 13 Nov 2020 00:06:47 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="Je/H39y3"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=baylibre-com.20150623.gappssmtp.com header.i=@baylibre-com.20150623.gappssmtp.com header.b="niMmvWPE" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 8EDD6207BB Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=baylibre.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:MIME-Version:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:References:In-Reply-To:Message-Id:Date:Subject:To: From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=dnsYIEVHkCjmZWDo6UHXOhQZud10qA2/R43mxjQIrUc=; b=Je/H39y3xHB8L9H49FmG9nBPbu jpViMhzkWzOm7R0EAHVm37dejyMMt2btg/BO846hu0PFB38vjrPoqQPykTjyRdNuRRlmgfLaI2BrB X687iny+1sLhxk0XO4iETjhQyFjsMBshcS83eI0eSmuHX0Ma+q1W6B6QbOpP2Bcg7plUI6EseBAfA BgyCdh7/K/Sim1y/BBNQznSTSfUi9oqW/F2p7jM7oMl6DNmOA+/ybQhegE36+0CTIR3bjcbTbCThq TnXcokjljd+RozN0RrV42aYV+6FeMgpE1L/ac6CYRfs2nMgSWAPgQTxySNa6Tn4JG+TV/JrRbgROO knbwyBNg==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kdMbs-0000a5-Dt; Fri, 13 Nov 2020 00:06:36 +0000 Received: from mail-wr1-x442.google.com ([2a00:1450:4864:20::442]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kdMbq-0000ZZ-K0 for linux-amlogic@lists.infradead.org; Fri, 13 Nov 2020 00:06:35 +0000 Received: by mail-wr1-x442.google.com with SMTP id d12so7829163wrr.13 for ; Thu, 12 Nov 2020 16:06:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=ZVUOLs2+wec7oUYLZkwPoiWAkG2vGu94t71XbGuqA0A=; b=niMmvWPEl0fnMO6tMTcfpoR9YBUgH9zZ+Dt+igR122IRwmctAz3bKbFzybFAGY4KTn rBgHRqd+5WTm1+K4iHBPxBXjNjxewOhhq3oGz6A12hEUj5QytNgYQc7zZZPTM937L6b9 lEOGfiE06I38tAMZxkJMGCb0D7EryshByXQUhSVfAo2CFCgwzcJh909decva2s/PSriB MkdMo50zmMS/bWfNuECwrXRWxamjBQJ/f7EM+wzu0BCr/N5nOHvprUi2hKLOvG4PZ6ie bXk+lvywpWHOm1vL/5Y2ZAF9yEdl4HAxALCaKk/gg6n+JLKgWdBegvdV+Fj9yjwIlyJV xcnQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=ZVUOLs2+wec7oUYLZkwPoiWAkG2vGu94t71XbGuqA0A=; b=gEaB3J3XTflZnatmr/1vb9qdsaADLNUqVGIo/H8BF3oYCabCNz7ECmHgTjCrijAtDV A0RUZEKhTSOzzhrOGPTGi2Jj10e1xoWSCXhPmxxvXqL2elbeUcaXV5Rb+djCP12adahh qTTLJNpNORcKRq7nZLD7m7cAFgjJz+uWvKPEO4m+nY10vyinXaISXyg2+CIDbNQShK/t bOvNCQz3cx+TcSRMBS8f3dThbaKixtb4HAhncBqkGXY7wdXY+iMiGxQp6lEwRsHu1Jgl oi51P3YBAIf1pAEOYGiC2ZX/JamOqueZHeyhZ6jWUCAGOKw2pvOcxQ5vhFcMUV6zjXpC WWBw== X-Gm-Message-State: AOAM530akYdTjU2RROIlunBvOO0SLW0Zv3X23NBxSsJFatCstLmdQa8t dsK2CRpsRmrBOYzqrR9BqXI/kQ== X-Google-Smtp-Source: ABdhPJz5fA46WACqLV9OOTCsKZrq/SjPVyoU2kKp5ypsUk30uRkroMV0nCS3uH3iuH+sVFpdC+luNA== X-Received: by 2002:adf:f083:: with SMTP id n3mr2382435wro.391.1605225993485; Thu, 12 Nov 2020 16:06:33 -0800 (PST) Received: from localhost.localdomain ([2001:861:3a84:7260:5d3c:83d5:8524:33ca]) by smtp.googlemail.com with ESMTPSA id t11sm2010114wrm.8.2020.11.12.16.06.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 12 Nov 2020 16:06:33 -0800 (PST) From: Amjad Ouled-Ameur To: Felipe Balbi Subject: [PATCH 2/3] usb: dwc3: meson-g12a: fix shared reset control use Date: Fri, 13 Nov 2020 01:05:07 +0100 Message-Id: <20201113000508.14702-3-aouledameur@baylibre.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20201113000508.14702-1-aouledameur@baylibre.com> References: <20201113000508.14702-1-aouledameur@baylibre.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201112_190634_683712_A71B3E2A X-CRM114-Status: GOOD ( 16.42 ) 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 [2a00:1450:4864:20:0:0:0:442 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 -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid 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: Kevin Hilman , linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, Amjad Ouled-Ameur , Philipp Zabel , linux-amlogic@lists.infradead.org, Jerome Brunet MIME-Version: 1.0 Sender: "linux-amlogic" Errors-To: linux-amlogic-bounces+patchwork-linux-amlogic=patchwork.kernel.org@lists.infradead.org reset_control_(de)assert() calls are called on a shared reset line when reset_control_reset has been used. This is not allowed by the reset framework. Use reset_control_rearm() call in suspend() and remove() as a way to state that the resource is no longer used, hence the shared reset line may be triggered again by other devices. Use reset_control_rearm() also in case probe fails after reset() has been called. reset_control_rearm() keeps use of triggered_count sane in the reset framework, use of reset_control_reset() on shared reset line should be balanced with reset_control_rearm(). Signed-off-by: Amjad Ouled-Ameur Reported-by: Jerome Brunet --- Important: Please DO NOT merge before this patch [0] is merged, it adds reset_control_rearm() call to the reset framework API. [0] https://lore.kernel.org/lkml/20201112230043.28987-1-aouledameur@baylib re.com/ drivers/usb/dwc3/dwc3-meson-g12a.c | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/drivers/usb/dwc3/dwc3-meson-g12a.c b/drivers/usb/dwc3/dwc3-meson-g12a.c index 417e05381b5d..3fec8f591c93 100644 --- a/drivers/usb/dwc3/dwc3-meson-g12a.c +++ b/drivers/usb/dwc3/dwc3-meson-g12a.c @@ -750,7 +750,7 @@ static int dwc3_meson_g12a_probe(struct platform_device *pdev) ret = dwc3_meson_g12a_get_phys(priv); if (ret) - goto err_disable_clks; + goto err_rearm; ret = priv->drvdata->setup_regmaps(priv, base); if (ret) @@ -759,7 +759,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_rearm; } /* Get dr_mode */ @@ -772,13 +772,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_rearm; /* Init PHYs */ for (i = 0 ; i < PHY_COUNT ; ++i) { ret = phy_init(priv->phys[i]); if (ret) - goto err_disable_clks; + goto err_rearm; } /* Set PHY Power */ @@ -816,6 +816,9 @@ static int dwc3_meson_g12a_probe(struct platform_device *pdev) for (i = 0 ; i < PHY_COUNT ; ++i) phy_exit(priv->phys[i]); +err_rearm: + reset_control_rearm(priv->reset); + err_disable_clks: clk_bulk_disable_unprepare(priv->drvdata->num_clks, priv->drvdata->clks); @@ -843,6 +846,8 @@ static int dwc3_meson_g12a_remove(struct platform_device *pdev) pm_runtime_put_noidle(dev); pm_runtime_set_suspended(dev); + reset_control_rearm(priv->reset); + clk_bulk_disable_unprepare(priv->drvdata->num_clks, priv->drvdata->clks); @@ -883,7 +888,7 @@ static int __maybe_unused dwc3_meson_g12a_suspend(struct device *dev) phy_exit(priv->phys[i]); } - reset_control_assert(priv->reset); + reset_control_rearm(priv->reset); return 0; } @@ -893,7 +898,9 @@ static int __maybe_unused dwc3_meson_g12a_resume(struct device *dev) struct dwc3_meson_g12a *priv = dev_get_drvdata(dev); int i, ret; - reset_control_deassert(priv->reset); + ret = reset_control_reset(priv->reset); + if (ret) + return ret; ret = priv->drvdata->usb_init(priv); if (ret) From patchwork Fri Nov 13 00:05:08 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amjad Ouled-Ameur X-Patchwork-Id: 11902321 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 B3611138B for ; Fri, 13 Nov 2020 00:07:06 +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 53D7D2085B for ; Fri, 13 Nov 2020 00:07:05 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="IlP61gOa"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=baylibre-com.20150623.gappssmtp.com header.i=@baylibre-com.20150623.gappssmtp.com header.b="Shcm3pj2" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 53D7D2085B Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=baylibre.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:MIME-Version:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:References:In-Reply-To:Message-Id:Date:Subject:To: From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=LJDocWZf0lIHpT0ZiG2JMUZIVaJXdK9bhZ+4DMzMRkU=; b=IlP61gOa4CltSBKIN9miMP89Ob WgCgmFene+HhOYNwWbiZLW6eZqq/4sg/CFMBnyTtGA5DXtag7H9w29bcAQ+0k2TC6UC5uRS7ZQFzQ RAqdTT0QqfAKQtTYrWJT0LROUUG1goCUiQRDO6ic8Df2mbfYbvwDV+942OekqGIParJhppXKmVqAk ur/2YitNDVnevkpKdYU68EmlVNng6/9OUKVJCD8WP3EPOkoBye0axN2Yib9t59DfBSCUnWr4bZeT6 /nV8HUIK4VKEsM4jisX+uFvqWOO/wib8kSgvgNoOWeq3Dik2CBytK8dvoUrzII/TZ2c380dXVgYSr TWFPzOQQ==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kdMcB-0000cu-1V; Fri, 13 Nov 2020 00:06:55 +0000 Received: from mail-wr1-x443.google.com ([2a00:1450:4864:20::443]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kdMc8-0000cE-FU for linux-amlogic@lists.infradead.org; Fri, 13 Nov 2020 00:06:53 +0000 Received: by mail-wr1-x443.google.com with SMTP id c17so7829549wrc.11 for ; Thu, 12 Nov 2020 16:06:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=QaQFi8Mdamg7GyyTVitR5xuLU194FCgV474jmD+Lyb4=; b=Shcm3pj2Uvc3XBjCZRyitzZxAEnuJLPvO+5voLfyqAbAjNB9CQ6Jm5rWY+2CU9ofVF mFbzhtbNTXLwCLrJ+au4Af/0NLPei492LW8qtAj2qhVQviPXrZELa01A0h+ITsaoy5wx mzJgPC/CCp6QgrpUjwjiDenZT3tUubjls6hZ5MHzkawKluASBWU45FIXz33GjmLlLJWm V7q4smKL2nW0cqPrve2FjM7b0oRCQG8qMPWnfGOTFtp6jTP0awC0hGvBKGpOipKGVumn QRcbLnLRvVhicUwyraGCLX845/1tWmRi/KyKoRl8NlGSztUeNqDtDQ9id8T410ipuxpf h1fw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=QaQFi8Mdamg7GyyTVitR5xuLU194FCgV474jmD+Lyb4=; b=FlrhmI3dFqthfgLNWB0+RuNC9YnJDopzDa+tfTgMXj0UG2QeKa0dHADt9HDgJy1mZO 7+M5DIUASIL+TtRYaDXBvOx0h2H9HPXxqV4VmaYC2VszJF60cNfqwf6uKC4HpR1h9VSM 5+0lL6ST0Py9olW0lbKQhafpJB1FeyXM3Z+Hb7qzQvlLImtTGyZnHfPIhNoO6hZYui90 6uE1ypbe0YLpqMERu/0qDfaL+5/Zp0lDfgnqaHuV+/ERYmDfryujSVsLFl4M7fyD1G18 M4Xhf/+MJdEPsW1MvAenbfZ83DNjARgDa5/j+UDck6kYXF9JNm/45zXV236Xok++ub8n fNvQ== X-Gm-Message-State: AOAM532ZEC0yl/6OouwBL+Rweri7ctxM1V9oCHPSISHqDDq/1DLVj/67 lHlFJAP9aGR1+Nn+L2+8yciNRg== X-Google-Smtp-Source: ABdhPJxZ1ra0ZfKE6leDhsxONvD1vjbTzP3c9vegGedkTs74gyZWSSsupIzIjbUB9vjMC64hdvHkFQ== X-Received: by 2002:adf:b109:: with SMTP id l9mr2305827wra.279.1605226011626; Thu, 12 Nov 2020 16:06:51 -0800 (PST) Received: from localhost.localdomain ([2001:861:3a84:7260:5d3c:83d5:8524:33ca]) by smtp.googlemail.com with ESMTPSA id t11sm2010114wrm.8.2020.11.12.16.06.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 12 Nov 2020 16:06:51 -0800 (PST) From: Amjad Ouled-Ameur To: Kevin Hilman Subject: [PATCH 3/3] phy: amlogic: meson8b-usb2: fix shared reset control use Date: Fri, 13 Nov 2020 01:05:08 +0100 Message-Id: <20201113000508.14702-4-aouledameur@baylibre.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20201113000508.14702-1-aouledameur@baylibre.com> References: <20201113000508.14702-1-aouledameur@baylibre.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201112_190652_527744_E3E18EBD X-CRM114-Status: GOOD ( 13.26 ) 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 [2a00:1450:4864:20:0:0:0:443 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 -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid 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: Felipe Balbi , linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, Amjad Ouled-Ameur , Philipp Zabel , linux-amlogic@lists.infradead.org, Jerome Brunet MIME-Version: 1.0 Sender: "linux-amlogic" Errors-To: linux-amlogic-bounces+patchwork-linux-amlogic=patchwork.kernel.org@lists.infradead.org Use reset_control_rearm() call if an error occurs in case phy_meson8b_usb2_power_on() fails after reset() has been called, or in case phy_meson8b_usb2_power_off() is called i.e the resource is no longer used and the reset line may be triggered again by other devices. reset_control_rearm() keeps use of triggered_count sane in the reset framework, use of reset_control_reset() on shared reset line should be balanced with reset_control_rearm(). Signed-off-by: Amjad Ouled-Ameur Reported-by: Jerome Brunet --- Important: Please DO NOT merge before this patch [0] is merged, it adds reset_control_rearm() call to the reset framework API. drivers/phy/amlogic/phy-meson8b-usb2.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/phy/amlogic/phy-meson8b-usb2.c b/drivers/phy/amlogic/phy-meson8b-usb2.c index 03c061dd5f0d..2a6c53f52423 100644 --- a/drivers/phy/amlogic/phy-meson8b-usb2.c +++ b/drivers/phy/amlogic/phy-meson8b-usb2.c @@ -154,12 +154,14 @@ static int phy_meson8b_usb2_power_on(struct phy *phy) ret = clk_prepare_enable(priv->clk_usb_general); if (ret) { dev_err(&phy->dev, "Failed to enable USB general clock\n"); + reset_control_rearm(priv->reset); return ret; } ret = clk_prepare_enable(priv->clk_usb); if (ret) { dev_err(&phy->dev, "Failed to enable USB DDR clock\n"); + reset_control_rearm(priv->reset); clk_disable_unprepare(priv->clk_usb_general); return ret; } @@ -197,6 +199,7 @@ static int phy_meson8b_usb2_power_on(struct phy *phy) regmap_read(priv->regmap, REG_ADP_BC, ®); if (reg & REG_ADP_BC_ACA_PIN_FLOAT) { dev_warn(&phy->dev, "USB ID detect failed!\n"); + reset_control_rearm(priv->reset); clk_disable_unprepare(priv->clk_usb); clk_disable_unprepare(priv->clk_usb_general); return -EINVAL; @@ -216,6 +219,7 @@ static int phy_meson8b_usb2_power_off(struct phy *phy) REG_DBG_UART_SET_IDDQ, REG_DBG_UART_SET_IDDQ); + reset_control_rearm(priv->reset); clk_disable_unprepare(priv->clk_usb); clk_disable_unprepare(priv->clk_usb_general);