From: Thierry Reding <thierry.reding@gmail.com>
To: Philipp Zabel <p.zabel@pengutronix.de>
Cc: Jonathan Hunter <jonathanh@nvidia.com>,
linux-tegra@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH 5/5] drm/tegra: sor: Implement acquire/release for reset
Date: Thu, 21 Feb 2019 16:25:57 +0100 [thread overview]
Message-ID: <20190221152557.8534-5-thierry.reding@gmail.com> (raw)
In-Reply-To: <20190221152557.8534-1-thierry.reding@gmail.com>
From: Thierry Reding <treding@nvidia.com>
By implementing the acquire/release protocol, the SOR reset can be
shared with other drivers that also adhere to this protocol, such as the
PMC driver that uses the same reset as part of the powergate and -ungate
implementation using generic power domains.
Runtime PM makes sure that the operations are executed in the right
order, and the reset core has error handling and WARNs in place to make
sure the acquire/release protocol is followed.
Signed-off-by: Thierry Reding <treding@nvidia.com>
---
drivers/gpu/drm/tegra/sor.c | 21 ++++++++++++++++++++-
1 file changed, 20 insertions(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/tegra/sor.c b/drivers/gpu/drm/tegra/sor.c
index 40057106f5f3..5be5a0817dfe 100644
--- a/drivers/gpu/drm/tegra/sor.c
+++ b/drivers/gpu/drm/tegra/sor.c
@@ -2871,6 +2871,13 @@ static int tegra_sor_init(struct host1x_client *client)
* kernel is possible.
*/
if (sor->rst) {
+ err = reset_control_acquire(sor->rst);
+ if (err < 0) {
+ dev_err(sor->dev, "failed to acquire SOR reset: %d\n",
+ err);
+ return err;
+ }
+
err = reset_control_assert(sor->rst);
if (err < 0) {
dev_err(sor->dev, "failed to assert SOR reset: %d\n",
@@ -2894,6 +2901,8 @@ static int tegra_sor_init(struct host1x_client *client)
err);
return err;
}
+
+ reset_control_release(sor->rst);
}
err = clk_prepare_enable(sor->clk_safe);
@@ -3331,7 +3340,7 @@ static int tegra_sor_probe(struct platform_device *pdev)
goto remove;
}
- sor->rst = devm_reset_control_get(&pdev->dev, "sor");
+ sor->rst = devm_reset_control_get_exclusive_released(&pdev->dev, "sor");
if (IS_ERR(sor->rst)) {
err = PTR_ERR(sor->rst);
@@ -3519,6 +3528,8 @@ static int tegra_sor_suspend(struct device *dev)
dev_err(dev, "failed to assert reset: %d\n", err);
return err;
}
+
+ reset_control_release(sor->rst);
}
usleep_range(1000, 2000);
@@ -3542,9 +3553,17 @@ static int tegra_sor_resume(struct device *dev)
usleep_range(1000, 2000);
if (sor->rst) {
+ err = reset_control_acquire(sor->rst);
+ if (err < 0) {
+ dev_err(dev, "failed to acquire reset: %d\n", err);
+ clk_disable_unprepare(sor->clk);
+ return err;
+ }
+
err = reset_control_deassert(sor->rst);
if (err < 0) {
dev_err(dev, "failed to deassert reset: %d\n", err);
+ reset_control_release(sor->rst);
clk_disable_unprepare(sor->clk);
return err;
}
--
2.20.1
next prev parent reply other threads:[~2019-02-21 15:25 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-02-21 15:25 [PATCH 1/5] reset: add acquired/released state for exclusive reset controls Thierry Reding
2019-02-21 15:25 ` [PATCH 2/5] reset: Add acquired flag to of_reset_control_array_get() Thierry Reding
2019-02-21 15:25 ` [2/5] " Thierry Reding
2019-03-19 16:37 ` [PATCH 2/5] " Philipp Zabel
2019-03-19 16:37 ` [2/5] " Philipp Zabel
2019-03-20 6:51 ` [PATCH 2/5] " Felipe Balbi
2019-03-20 6:51 ` [2/5] " Felipe Balbi
2019-03-20 10:27 ` [PATCH 2/5] " Philipp Zabel
2019-03-20 10:27 ` [2/5] " Philipp Zabel
2019-02-21 15:25 ` [PATCH 3/5] reset: Add acquire/release support for arrays Thierry Reding
2019-03-19 16:43 ` Philipp Zabel
2019-02-21 15:25 ` [PATCH 4/5] soc/tegra: pmc: Implement acquire/release for resets Thierry Reding
2019-03-19 16:45 ` Philipp Zabel
2019-02-21 15:25 ` Thierry Reding [this message]
2019-03-19 16:45 ` [PATCH 5/5] drm/tegra: sor: Implement acquire/release for reset Philipp Zabel
2019-02-21 15:28 ` [PATCH 1/5] reset: add acquired/released state for exclusive reset controls Thierry Reding
2019-03-18 9:12 ` Thierry Reding
2019-03-18 16:40 ` Philipp Zabel
2019-03-18 16:59 ` Thierry Reding
2019-03-19 16:37 ` Philipp Zabel
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=20190221152557.8534-5-thierry.reding@gmail.com \
--to=thierry.reding@gmail.com \
--cc=jonathanh@nvidia.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-tegra@vger.kernel.org \
--cc=p.zabel@pengutronix.de \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.