All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] OMAP3: PM: quickly hack fix up init_opp
@ 2010-05-01 15:43 Nishanth Menon
  2010-05-03 16:15 ` Kevin Hilman
  0 siblings, 1 reply; 2+ messages in thread
From: Nishanth Menon @ 2010-05-01 15:43 UTC (permalink / raw)
  To: linux-omap; +Cc: Nishanth Menon, Peter Tseng, Kevin Hilman

init_opp is seen to crash, in resource34xx.c BUG() causes
a kernel oops when OPP layer is not registered!

Original Report:
http://marc.info/?l=linux-omap&m=127268352116119&w=2

Cc: Peter Tseng <tsenpet09@gmail.com>
Cc: Kevin Hilman <khilman@deeprootsystems.com>
Reported-by: Peter Tseng <tsenpet09@gmail.com>
Signed-off-by: Nishanth Menon <nm@ti.com>
---
IMPORTANT: Completely untested!! just for a dry-run and
srf is going to go away in a month, so this is more or
less a curio..

 arch/arm/mach-omap2/resource34xx.c |   26 ++++++++++++++++++++++++--
 1 files changed, 24 insertions(+), 2 deletions(-)

diff --git a/arch/arm/mach-omap2/resource34xx.c b/arch/arm/mach-omap2/resource34xx.c
index c6cce8b..ae8bd09 100644
--- a/arch/arm/mach-omap2/resource34xx.c
+++ b/arch/arm/mach-omap2/resource34xx.c
@@ -226,14 +226,36 @@ void init_opp(struct shared_resource *resp)
 		dpll1_clk = clk_get(NULL, "dpll1_ck");
 		dpll2_clk = clk_get(NULL, "dpll2_ck");
 		ret = freq_to_opp(&opp_id, OPP_MPU, dpll1_clk->rate);
-		BUG_ON(ret); /* TBD Cleanup handling */
+		if (ret) {
+			pr_err("%s: initializing %s failed! !match for %ld\n",
+				__func__, resp->name, dpll1_clk->rate);
+			if (dpll1_clk)
+				clk_put(dpll1_clk);
+			if (dpll2_clk)
+				clk_put(dpll2_clk);
+			dpll1_clk = NULL;
+			dpll2_clk = NULL;
+			vdd1_resp = NULL;
+			return;
+		}
 		curr_vdd1_opp = opp_id;
 	} else if (strcmp(resp->name, "vdd2_opp") == 0) {
 		vdd2_resp = resp;
 		dpll3_clk = clk_get(NULL, "dpll3_m2_ck");
 		l3_clk = clk_get(NULL, "l3_ick");
 		ret = freq_to_opp(&opp_id, OPP_L3, l3_clk->rate);
-		BUG_ON(ret); /* TBD Cleanup handling */
+		if (ret) {
+			pr_err("%s: initializing %s failed! !match for %ld\n",
+				__func__, resp->name, l3_clk->rate);
+			if (l3_clk)
+				clk_put(l3_clk);
+			if (dpll3_clk)
+				clk_put(dpll3_clk);
+			l3_clk = NULL;
+			dpll3_clk = NULL;
+			vdd2_resp = NULL;
+			return;
+		}
 		curr_vdd2_opp = opp_id;
 	}
 	resp->curr_level = opp_id;
-- 
1.7.0.4


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] OMAP3: PM: quickly hack fix up init_opp
  2010-05-01 15:43 [PATCH] OMAP3: PM: quickly hack fix up init_opp Nishanth Menon
@ 2010-05-03 16:15 ` Kevin Hilman
  0 siblings, 0 replies; 2+ messages in thread
From: Kevin Hilman @ 2010-05-03 16:15 UTC (permalink / raw)
  To: Nishanth Menon; +Cc: linux-omap, Peter Tseng

Nishanth Menon <nm@ti.com> writes:

> init_opp is seen to crash, in resource34xx.c BUG() causes
> a kernel oops when OPP layer is not registered!
>
> Original Report:
> http://marc.info/?l=linux-omap&m=127268352116119&w=2
>
> Cc: Peter Tseng <tsenpet09@gmail.com>
> Cc: Kevin Hilman <khilman@deeprootsystems.com>
> Reported-by: Peter Tseng <tsenpet09@gmail.com>
> Signed-off-by: Nishanth Menon <nm@ti.com>
> ---
> IMPORTANT: Completely untested!! just for a dry-run and
> srf is going to go away in a month, so this is more or
> less a curio..

Tested on overo without OPP init and also needed this additional bit
below to avoid another BUG.  Will merge into your patch and add to
pm-srf branch.

With this, Overo boots, but will need OPP table init in board file to
use DVFS/CPUfreq.

Kevin

diff --git a/arch/arm/mach-omap2/resource34xx.c b/arch/arm/mach-omap2/resource34xx.c
index ae8bd09..2bc5694 100644
--- a/arch/arm/mach-omap2/resource34xx.c
+++ b/arch/arm/mach-omap2/resource34xx.c
@@ -533,7 +533,7 @@ void init_freq(struct shared_resource *resp)
 {
 	char *linked_res_name;
 	int ret = -EINVAL;
-	unsigned long freq;
+	unsigned long freq = 0;
 	resp->no_of_users = 0;
 
 	linked_res_name = (char *)resp->resource_data;
@@ -546,7 +546,8 @@ void init_freq(struct shared_resource *resp)
 	else if (strcmp(resp->name, "dsp_freq") == 0)
 		/* DSP freq in Mhz */
 		ret = opp_to_freq(&freq, OPP_DSP, curr_vdd1_opp);
-	BUG_ON(ret);
+	if (ret)
+		pr_err("%s: initializing frequency failed!\n", __func__);
 
 	resp->curr_level = freq;
 	return;

^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2010-05-03 16:15 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-05-01 15:43 [PATCH] OMAP3: PM: quickly hack fix up init_opp Nishanth Menon
2010-05-03 16:15 ` Kevin Hilman

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.