All of lore.kernel.org
 help / color / mirror / Atom feed
From: Thara Gopinath <thara@ti.com>
To: linux-omap@vger.kernel.org
Cc: khilman@deeprootsystems.com, paul@pwsan.com, nm@ti.com,
	vishwanath.bs@ti.com, sawant@ti.com, b-cousson@ti.com,
	Thara Gopinath <thara@ti.com>
Subject: [PATCH 1/3] OMAP3: PM: Bug fix in Smartreflex driver.
Date: Mon,  8 Mar 2010 22:50:49 +0530	[thread overview]
Message-ID: <1268068851-30022-2-git-send-email-thara@ti.com> (raw)
In-Reply-To: <1268068851-30022-1-git-send-email-thara@ti.com>

This patch sets and unsets is_sr_reset is appropriate places so that
trying to enable smart reflex in a non-supported OMAP chip does not
lead to unnecessary crash

Signed-off-by: Thara Gopinath <thara@ti.com>
---
 arch/arm/mach-omap2/smartreflex.c |   31 +++++++++++++++++++++----------
 1 files changed, 21 insertions(+), 10 deletions(-)

diff --git a/arch/arm/mach-omap2/smartreflex.c b/arch/arm/mach-omap2/smartreflex.c
index ca2223d..7aa84ab 100644
--- a/arch/arm/mach-omap2/smartreflex.c
+++ b/arch/arm/mach-omap2/smartreflex.c
@@ -108,9 +108,14 @@ static int sr_clk_enable(struct omap_sr *sr)
 {
 	struct omap_smartreflex_data *pdata = sr->pdev->dev.platform_data;
 
+	if (!sr->is_sr_reset)
+		return 0;
+
 	if (pdata->device_enable)
 		pdata->device_enable(sr->pdev);
 
+	sr->is_sr_reset = 0;
+
 	return 0;
 }
 
@@ -118,6 +123,9 @@ static void sr_clk_disable(struct omap_sr *sr)
 {
 	struct omap_smartreflex_data *pdata = sr->pdev->dev.platform_data;
 
+	if (sr->is_sr_reset)
+		return;
+
 	if (pdata->device_idle)
 		pdata->device_idle(sr->pdev);
 
@@ -262,7 +270,6 @@ static void sr_configure(struct omap_sr *sr)
 			 ERRCONFIG_MCUVALIDINTEN | ERRCONFIG_MCUVALIDINTST |
 			 ERRCONFIG_MCUBOUNDINTEN | ERRCONFIG_MCUBOUNDINTST));
 	}
-	sr->is_sr_reset = 0;
 }
 
 static void sr_start_vddautocomap(int srid)
@@ -283,8 +290,7 @@ static void sr_start_vddautocomap(int srid)
 	sr->is_autocomp_active = 1;
 	if (!sr_class->enable(srid)) {
 		sr->is_autocomp_active = 0;
-		if (sr->is_sr_reset == 1)
-			sr_clk_disable(sr);
+		sr_clk_disable(sr);
 	}
 }
 
@@ -303,8 +309,10 @@ static void sr_stop_vddautocomap(int srid)
 	}
 
 	if (sr->is_autocomp_active == 1) {
-		sr_class->disable(srid);
-		sr_clk_disable(sr);
+		if (!sr->is_sr_reset) {
+			sr_class->disable(srid);
+			sr_clk_disable(sr);
+		}
 		sr->is_autocomp_active = 0;
 	}
 
@@ -357,6 +365,11 @@ int sr_enable(int srid, u32 target_opp_no)
 
 	/* Enable the clocks and configure SR */
 	sr_clk_enable(sr);
+
+	/* Check if SR is already enabled. If yes do nothing */
+	if (sr_read_reg(sr, SRCONFIG) & SRCONFIG_SRENABLE)
+		return true;
+
 	sr_configure(sr);
 
 	nvalue_reciprocal = pdata->sr_nvalue[target_opp_no - 1];
@@ -447,10 +460,8 @@ void omap_smartreflex_enable(int srid)
 	}
 
 	if (sr->is_autocomp_active == 1) {
-		if (sr->is_sr_reset == 1) {
-			if (!sr_class->enable(srid))
-				sr_clk_disable(sr);
-		}
+		if (!sr_class->enable(srid))
+			sr_clk_disable(sr);
 	}
 }
 
@@ -478,7 +489,7 @@ void omap_smartreflex_disable(int srid)
 	}
 
 	if (sr->is_autocomp_active == 1) {
-		if (sr->is_sr_reset == 0) {
+		if (!sr->is_sr_reset) {
 			sr_class->disable(srid);
 			/* Disable SR clk */
 			sr_clk_disable(sr);
-- 
1.7.0.rc1.33.g07cf0f


  reply	other threads:[~2010-03-08 17:21 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-03-08 17:20 [PATCH 0/3] OMAP3: PM: OMAP3630 support for smartreflex driver Thara Gopinath
2010-03-08 17:20 ` Thara Gopinath [this message]
2010-03-08 17:20   ` [PATCH 2/3] OMAP3: PM: Smartreflex IP update changes for OMAP3630 Thara Gopinath
2010-03-08 17:20     ` [PATCH 3/3] OMAP3: PM: Adding OMAP3630 support in smartreflex driver Thara Gopinath
2010-03-08 18:18       ` Felipe Balbi
2010-03-09  8:55         ` Gopinath, Thara
2010-03-08 17:46     ` [PATCH 2/3] OMAP3: PM: Smartreflex IP update changes for OMAP3630 Kevin Hilman
2010-03-22  7:05       ` Gopinath, Thara
2010-03-08 18:12     ` Felipe Balbi
2010-03-08 17:38   ` [PATCH 1/3] OMAP3: PM: Bug fix in Smartreflex driver Kevin Hilman
2010-03-08 18:05   ` Felipe Balbi
2010-03-08 17:36 ` [PATCH 0/3] OMAP3: PM: OMAP3630 support for smartreflex driver Kevin Hilman
2010-03-09  8:59   ` Gopinath, Thara
2010-03-09 19:04     ` Kevin Hilman

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=1268068851-30022-2-git-send-email-thara@ti.com \
    --to=thara@ti.com \
    --cc=b-cousson@ti.com \
    --cc=khilman@deeprootsystems.com \
    --cc=linux-omap@vger.kernel.org \
    --cc=nm@ti.com \
    --cc=paul@pwsan.com \
    --cc=sawant@ti.com \
    --cc=vishwanath.bs@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 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.