From patchwork Wed Apr 21 01:23:07 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nishanth Menon X-Patchwork-Id: 93790 X-Patchwork-Delegate: khilman@deeprootsystems.com Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter.kernel.org (8.14.3/8.14.3) with ESMTP id o3L1NKd4003821 for ; Wed, 21 Apr 2010 01:23:20 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754733Ab0DUBXT (ORCPT ); Tue, 20 Apr 2010 21:23:19 -0400 Received: from comal.ext.ti.com ([198.47.26.152]:40865 "EHLO comal.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754250Ab0DUBXS (ORCPT ); Tue, 20 Apr 2010 21:23:18 -0400 Received: from dlep36.itg.ti.com ([157.170.170.91]) by comal.ext.ti.com (8.13.7/8.13.7) with ESMTP id o3L1NDH8026440 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Tue, 20 Apr 2010 20:23:13 -0500 Received: from legion.dal.design.ti.com (localhost [127.0.0.1]) by dlep36.itg.ti.com (8.13.8/8.13.8) with ESMTP id o3L1N9cA006952; Tue, 20 Apr 2010 20:23:09 -0500 (CDT) Received: from senorita (senorita.am.dhcp.ti.com [128.247.75.1]) by legion.dal.design.ti.com (8.11.7p1+Sun/8.11.7) with ESMTP id o3L1N8Z23933; Tue, 20 Apr 2010 20:23:08 -0500 (CDT) Received: by senorita (Postfix, from userid 1000) id 8EBE5C23E; Tue, 20 Apr 2010 20:23:08 -0500 (CDT) From: Nishanth Menon To: linux-omap Cc: Nishanth Menon , Ambresh K , Benoit Cousson , Eduardo Valentin , Kevin Hilman , Phil Carmody , Sanjeev Premi , Tero Kristo , Thara Gopinath Subject: [PM-WIP-OPP][PATCH 1/2 v3] omap3: pm: cpufreq: BUG_ON cleanup Date: Tue, 20 Apr 2010 20:23:07 -0500 Message-Id: <1271812987-14505-1-git-send-email-nm@ti.com> X-Mailer: git-send-email 1.6.3.3 Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter.kernel.org [140.211.167.41]); Wed, 21 Apr 2010 01:23:20 +0000 (UTC) diff --git a/arch/arm/mach-omap2/cpufreq34xx.c b/arch/arm/mach-omap2/cpufreq34xx.c index 189c42e..8747dd6 100644 --- a/arch/arm/mach-omap2/cpufreq34xx.c +++ b/arch/arm/mach-omap2/cpufreq34xx.c @@ -25,6 +25,7 @@ #include #include +#include "omap3-opp.h" static struct omap_opp_def __initdata omap34xx_mpu_rate_table[] = { /* OPP1 */ @@ -109,8 +110,9 @@ static struct omap_opp_def __initdata omap36xx_dsp_rate_table[] = { OMAP_OPP_DEF(0, 0, 0) }; -void __init omap3_pm_init_opp_table(void) +int __init omap3_pm_init_opp_table(void) { + int i, r; struct omap_opp_def **omap3_opp_def_list; struct omap_opp_def *omap34xx_opp_def_list[] = { omap34xx_mpu_rate_table, @@ -122,12 +124,41 @@ void __init omap3_pm_init_opp_table(void) omap36xx_l3_rate_table, omap36xx_dsp_rate_table }; + enum opp_t omap3_opps[] = { + OPP_MPU, + OPP_L3, + OPP_DSP + }; omap3_opp_def_list = cpu_is_omap3630() ? omap36xx_opp_def_list : omap34xx_opp_def_list; - BUG_ON(opp_init_list(OPP_MPU, omap3_opp_def_list[0])); - BUG_ON(opp_init_list(OPP_L3, omap3_opp_def_list[1])); - BUG_ON(opp_init_list(OPP_DSP, omap3_opp_def_list[2])); + for (i = 0; i < ARRAY_SIZE(omap3_opps); i++) { + r = opp_init_list(omap3_opps[i], omap3_opp_def_list[i]); + if (r) + break; + } + if (!r) + return 0; + + /* Cascading error handling - disable all enabled OPPs */ + pr_err("%s: Failed to register %d OPP type\n", __func__, + omap3_opps[i]); + i--; + while (i != -1) { + struct omap_opp *opp; + unsigned long freq = 0; + + do { + opp = opp_find_freq_ceil(omap3_opps[i], &freq); + if (IS_ERR(opp)) + break; + opp_disable(opp); + freq++; + } while (1); + i--; + } + + return r; } diff --git a/arch/arm/mach-omap2/omap3-opp.h b/arch/arm/mach-omap2/omap3-opp.h index 1ba85fc..3e88d8c 100644 --- a/arch/arm/mach-omap2/omap3-opp.h +++ b/arch/arm/mach-omap2/omap3-opp.h @@ -9,10 +9,11 @@ * table after the basic initialization */ #ifdef CONFIG_CPU_FREQ -extern void omap3_pm_init_opp_table(void); +extern int omap3_pm_init_opp_table(void); #else -static inline void omap3_pm_init_opp_table(void) +static inline int omap3_pm_init_opp_table(void) { + return -EINVAL; } #endif