linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: Tony Lindgren <tony@atomide.com>
To: linux-omap@vger.kernel.org
Cc: Nishanth Menon <nm@ti.com>, Tero Kristo <t-kristo@ti.com>,
	Dave Gerlach <d-gerlach@ti.com>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	linux-kernel@vger.kernel.org,
	Peter Ujfalusi <peter.ujfalusi@ti.com>,
	devicetree@vger.kernel.org, Faiz Abbas <faiz_abbas@ti.com>,
	Keerthy <j-keerthy@ti.com>, Suman Anna <s-anna@ti.com>,
	Rob Herring <robh@kernel.org>,
	linux-arm-kernel@lists.infradead.org,
	Roger Quadros <rogerq@ti.com>
Subject: [PATCH 08/12] bus: ti-sysc: Add support for disabling module without legacy mode
Date: Mon, 27 May 2019 05:13:44 -0700	[thread overview]
Message-ID: <20190527121348.45251-9-tony@atomide.com> (raw)
In-Reply-To: <20190527121348.45251-1-tony@atomide.com>

We must not assert reset for modules with no child device drivers
until in runtime_suspend. Otherwise register access will fail without
legacy mode helping us.

Let's add a flag for disable_on_idle and move the reset driver
handling to runtime suspend and resume. We can then also use the
disable_on_idle flag to reconfigure sysconfig register for PM
modes requesting it.

Let's also make the other flags use bitfield while at it instead of
bool.

Signed-off-by: Tony Lindgren <tony@atomide.com>
---
 drivers/bus/ti-sysc.c | 21 +++++++++++++++++----
 1 file changed, 17 insertions(+), 4 deletions(-)

diff --git a/drivers/bus/ti-sysc.c b/drivers/bus/ti-sysc.c
--- a/drivers/bus/ti-sysc.c
+++ b/drivers/bus/ti-sysc.c
@@ -89,9 +89,10 @@ struct sysc {
 	struct ti_sysc_cookie cookie;
 	const char *name;
 	u32 revision;
-	bool enabled;
-	bool needs_resume;
-	bool child_needs_resume;
+	unsigned int enabled:1;
+	unsigned int needs_resume:1;
+	unsigned int child_needs_resume:1;
+	unsigned int disable_on_idle:1;
 	struct delayed_work idle_work;
 };
 
@@ -1007,6 +1008,9 @@ static int __maybe_unused sysc_runtime_suspend_legacy(struct device *dev,
 		dev_err(dev, "%s: could not idle: %i\n",
 			__func__, error);
 
+	if (ddata->disable_on_idle)
+		reset_control_assert(ddata->rsts);
+
 	return 0;
 }
 
@@ -1016,6 +1020,9 @@ static int __maybe_unused sysc_runtime_resume_legacy(struct device *dev,
 	struct ti_sysc_platform_data *pdata;
 	int error;
 
+	if (ddata->disable_on_idle)
+		reset_control_deassert(ddata->rsts);
+
 	pdata = dev_get_platdata(ddata->dev);
 	if (!pdata)
 		return 0;
@@ -1063,6 +1070,9 @@ static int __maybe_unused sysc_runtime_suspend(struct device *dev)
 err_allow_idle:
 	sysc_clkdm_allow_idle(ddata);
 
+	if (ddata->disable_on_idle)
+		reset_control_assert(ddata->rsts);
+
 	return error;
 }
 
@@ -1076,6 +1086,9 @@ static int __maybe_unused sysc_runtime_resume(struct device *dev)
 	if (ddata->enabled)
 		return 0;
 
+	if (ddata->disable_on_idle)
+		reset_control_deassert(ddata->rsts);
+
 	sysc_clkdm_deny_idle(ddata);
 
 	if (sysc_opt_clks_needed(ddata)) {
@@ -2293,7 +2306,7 @@ static int sysc_probe(struct platform_device *pdev)
 	}
 
 	if (!of_get_available_child_count(ddata->dev->of_node))
-		reset_control_assert(ddata->rsts);
+		ddata->disable_on_idle = true;
 
 	return 0;
 
-- 
2.21.0

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

  parent reply	other threads:[~2019-05-27 12:16 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-27 12:13 [PATCH 00/12] ti-sysc driver changes to drop custom hwmods property Tony Lindgren
2019-05-27 12:13 ` [PATCH 01/12] bus: ti-sysc: Support 16-bit writes too Tony Lindgren
2019-05-28 11:06   ` David Laight
2019-05-28 12:27     ` Tony Lindgren
2019-05-27 12:13 ` [PATCH 02/12] bus: ti-sysc: Make OCP reset work for sysstatus and sysconfig reset bits Tony Lindgren
2019-05-27 12:13 ` [PATCH 03/12] bus: ti-sysc: Allow QUIRK_LEGACY_IDLE even if legacy_mode is not set Tony Lindgren
2019-05-27 12:13 ` [PATCH 04/12] bus: ti-sysc: Enable interconnect target module autoidle bit on enable Tony Lindgren
2019-05-27 12:13 ` [PATCH 05/12] bus: ti-sysc: Handle clockactivity for enable and disable Tony Lindgren
2019-05-27 12:13 ` [PATCH 06/12] bus: ti-sysc: Handle swsup idle mode quirks Tony Lindgren
2019-05-27 12:13 ` [PATCH 07/12] bus: ti-sysc: Set ENAWAKEUP if available Tony Lindgren
2019-05-27 12:13 ` Tony Lindgren [this message]
2019-05-27 12:13 ` [PATCH 09/12] bus: ti-sysc: Do rstctrl reset handling in two phases Tony Lindgren
2019-05-27 12:13 ` [PATCH 10/12] bus: ti-sysc: Detect uarts also on omap34xx Tony Lindgren
2019-05-27 12:13 ` [PATCH 11/12] ARM: dts: Drop legacy custom hwmods property for omap4 uart Tony Lindgren
2019-05-27 12:13 ` [PATCH 12/12] ARM: dts: Drop legacy custom hwmods property for omap4 mmc Tony Lindgren
2019-05-28  0:58 ` [PATCH 00/12] ti-sysc driver changes to drop custom hwmods property Keerthy
2019-05-28  6:16   ` Tony Lindgren

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=20190527121348.45251-9-tony@atomide.com \
    --to=tony@atomide.com \
    --cc=d-gerlach@ti.com \
    --cc=devicetree@vger.kernel.org \
    --cc=faiz_abbas@ti.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=j-keerthy@ti.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-omap@vger.kernel.org \
    --cc=nm@ti.com \
    --cc=peter.ujfalusi@ti.com \
    --cc=robh@kernel.org \
    --cc=rogerq@ti.com \
    --cc=s-anna@ti.com \
    --cc=t-kristo@ti.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).