linux-amlogic.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: Dan Robertson <dan@dlrobertson.com>
To: Martin Blumenstingl <martin.blumenstingl@googlemail.com>,
	Neil Armstrong <narmstrong@baylibre.com>,
	Kevin Hilman <khilman@baylibre.com>
Cc: linux-amlogic@lists.infradead.org, linux-usb@vger.kernel.org,
	Dan Robertson <dan@dlrobertson.com>,
	linux-arm-kernel@lists.infradead.org
Subject: [PATCH 1/1] usb: dwc3: meson-g12a: fix shared reset control use
Date: Mon, 13 Jul 2020 12:05:22 -0400	[thread overview]
Message-ID: <20200713160522.19345-2-dan@dlrobertson.com> (raw)
In-Reply-To: <20200713160522.19345-1-dan@dlrobertson.com>

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 <dan@dlrobertson.com>
---
 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);


_______________________________________________
linux-amlogic mailing list
linux-amlogic@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-amlogic

  reply	other threads:[~2020-07-13 16:06 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-13 16:05 [PATCH 0/1] usb: dwc3: meson-g12a: fix shared reset control use Dan Robertson
2020-07-13 16:05 ` Dan Robertson [this message]
2020-07-18  8:47   ` [PATCH 1/1] " Neil Armstrong
2020-07-18 22:57     ` Dan Robertson
2020-08-19 15:03   ` Jerome Brunet
2020-08-20 18:02     ` Kevin Hilman
2020-08-20 18:27       ` Jerome Brunet
2020-08-20 18:49         ` Kevin Hilman
2020-08-20 18:44     ` Dan Robertson
2020-08-24  8:14       ` Jerome Brunet
2020-08-24 10:24     ` Philipp Zabel
2020-08-24 14:26       ` Jerome Brunet
2020-08-25 10:20         ` Philipp Zabel
2020-08-25 14:20           ` Jerome Brunet
2020-08-26  8:14             ` Philipp Zabel
2020-08-26  8:34               ` Jerome Brunet
2020-08-29 15:25           ` Martin Blumenstingl
2020-09-02 14:13             ` Amjad Ouled-Ameur
2020-09-07  8:31               ` Jerome Brunet
2020-09-07  8:33                 ` Amjad Ouled-Ameur
2020-07-14  6:56 ` [PATCH 0/1] " Anand Moon
2020-07-14 13:30   ` Dan Robertson
2020-07-14 15:27     ` Anand Moon
2020-07-15  2:58       ` Dan Robertson
2020-07-15 16:23         ` Anand Moon
2020-07-17  9:01           ` Anand Moon
2020-07-17 16:38             ` Anand Moon
2020-07-18  6:31               ` Anand Moon
2020-07-18  8:46                 ` Neil Armstrong
2020-07-18  9:54                   ` Anand Moon
2020-08-17 17:48 ` patchwork-bot+linux-amlogic

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200713160522.19345-2-dan@dlrobertson.com \
    --to=dan@dlrobertson.com \
    --cc=khilman@baylibre.com \
    --cc=linux-amlogic@lists.infradead.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=martin.blumenstingl@googlemail.com \
    --cc=narmstrong@baylibre.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).