From patchwork Wed Dec 9 06:17:08 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nishanth Menon X-Patchwork-Id: 65880 X-Patchwork-Delegate: paul@pwsan.com Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id nB96Homt003474 for ; Wed, 9 Dec 2009 06:17:51 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755503AbZLIGRY (ORCPT ); Wed, 9 Dec 2009 01:17:24 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1755493AbZLIGRX (ORCPT ); Wed, 9 Dec 2009 01:17:23 -0500 Received: from bear.ext.ti.com ([192.94.94.41]:59774 "EHLO bear.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754850AbZLIGRW (ORCPT ); Wed, 9 Dec 2009 01:17:22 -0500 Received: from dlep36.itg.ti.com ([157.170.170.91]) by bear.ext.ti.com (8.13.7/8.13.7) with ESMTP id nB96HPdY022479 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Wed, 9 Dec 2009 00:17:25 -0600 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 nB96HPxX010056; Wed, 9 Dec 2009 00:17:25 -0600 (CST) 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 nB96HNZ06311; Wed, 9 Dec 2009 00:17:23 -0600 (CST) Received: by senorita (Postfix, from userid 1000) id 97AB3C182; Wed, 9 Dec 2009 00:17:23 -0600 (CST) From: Nishanth Menon To: Kevin Hilman Cc: linux-omap , Nishanth Menon , Benoit Cousson , Eduardo Valentin , Kevin Hilman , Madhusudhan Chikkature Rajashekar , Paul Walmsley , Romit Dasgupta , Sanjeev Premi , Santosh Shilimkar , Sergio Alberto Aguirre Rodriguez , Tero Kristo , Thara Gopinath , Vishwanath Sripathy Subject: [PATCH 03/10 V4] omap3: pm: use opp accessor functions for omap34xx Date: Wed, 9 Dec 2009 00:17:08 -0600 Message-Id: <1260339435-20294-4-git-send-email-nm@ti.com> X-Mailer: git-send-email 1.6.3.3 In-Reply-To: <1260339435-20294-3-git-send-email-nm@ti.com> References: <1260339435-20294-1-git-send-email-nm@ti.com> <1260339435-20294-2-git-send-email-nm@ti.com> <1260339435-20294-3-git-send-email-nm@ti.com> Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org diff --git a/arch/arm/mach-omap2/board-3430sdp.c b/arch/arm/mach-omap2/board-3430sdp.c index eac529f..0ec8327 100644 --- a/arch/arm/mach-omap2/board-3430sdp.c +++ b/arch/arm/mach-omap2/board-3430sdp.c @@ -220,6 +220,7 @@ static void __init omap_3430sdp_init_irq(void) { omap_board_config = sdp3430_config; omap_board_config_size = ARRAY_SIZE(sdp3430_config); + omap3_pm_init_opp_table(); omap3_pm_init_vc(&omap3_setuptime_table); omap3_pm_init_cpuidle(omap3_cpuidle_params_table); omap2_init_common_hw(hyb18m512160af6_sdrc_params, NULL, omap3_mpu_rate_table, diff --git a/arch/arm/mach-omap2/board-omap3beagle.c b/arch/arm/mach-omap2/board-omap3beagle.c index 2ec3520..a937238 100644 --- a/arch/arm/mach-omap2/board-omap3beagle.c +++ b/arch/arm/mach-omap2/board-omap3beagle.c @@ -361,6 +361,7 @@ static void __init omap3_beagle_init_irq(void) { omap_board_config = omap3_beagle_config; omap_board_config_size = ARRAY_SIZE(omap3_beagle_config); + omap3_pm_init_opp_table(); omap2_init_common_hw(mt46h32m32lf6_sdrc_params, mt46h32m32lf6_sdrc_params, omap3_mpu_rate_table, omap3_dsp_rate_table, omap3_l3_rate_table); diff --git a/arch/arm/mach-omap2/board-omap3evm.c b/arch/arm/mach-omap2/board-omap3evm.c index 8130eca..44a5861 100644 --- a/arch/arm/mach-omap2/board-omap3evm.c +++ b/arch/arm/mach-omap2/board-omap3evm.c @@ -404,6 +404,7 @@ static void __init omap3_evm_init_irq(void) { omap_board_config = omap3_evm_config; omap_board_config_size = ARRAY_SIZE(omap3_evm_config); + omap3_pm_init_opp_table(); omap2_init_common_hw(mt46h32m32lf6_sdrc_params, NULL, omap3_mpu_rate_table, omap3_dsp_rate_table, omap3_l3_rate_table); omap_init_irq(); diff --git a/arch/arm/mach-omap2/board-rx51.c b/arch/arm/mach-omap2/board-rx51.c index 2f1c2be..997fd1c 100644 --- a/arch/arm/mach-omap2/board-rx51.c +++ b/arch/arm/mach-omap2/board-rx51.c @@ -103,6 +103,7 @@ static void __init rx51_init_irq(void) omap_board_config = rx51_config; omap_board_config_size = ARRAY_SIZE(rx51_config); + omap3_pm_init_opp_table(); omap3_pm_init_cpuidle(rx51_cpuidle_params); sdrc_params = rx51_get_sdram_timings(); omap2_init_common_hw(sdrc_params, sdrc_params, diff --git a/arch/arm/mach-omap2/board-zoom2.c b/arch/arm/mach-omap2/board-zoom2.c index dcc5fb8..9d5b078 100644 --- a/arch/arm/mach-omap2/board-zoom2.c +++ b/arch/arm/mach-omap2/board-zoom2.c @@ -24,10 +24,12 @@ #include #include "sdram-micron-mt46h32m32lf-6.h" +#include "pm.h" #include "omap3-opp.h" static void __init omap_zoom2_init_irq(void) { + omap3_pm_init_opp_table(); omap2_init_common_hw(mt46h32m32lf6_sdrc_params, mt46h32m32lf6_sdrc_params, omap3_mpu_rate_table, omap3_dsp_rate_table, omap3_l3_rate_table); diff --git a/arch/arm/mach-omap2/omap3-opp.h b/arch/arm/mach-omap2/omap3-opp.h index 42557e1..994d8d4 100644 --- a/arch/arm/mach-omap2/omap3-opp.h +++ b/arch/arm/mach-omap2/omap3-opp.h @@ -3,60 +3,8 @@ #include -/* MPU speeds */ -#define S600M 600000000 -#define S550M 550000000 -#define S500M 500000000 -#define S250M 250000000 -#define S125M 125000000 - -/* DSP speeds */ -#define S430M 430000000 -#define S400M 400000000 -#define S360M 360000000 -#define S180M 180000000 -#define S90M 90000000 - -/* L3 speeds */ -#define S83M 83000000 -#define S166M 166000000 - -static struct omap_opp omap3_mpu_rate_table[] = { - {0, 0, 0, 0}, - /*OPP1*/ - {true, S125M, VDD1_OPP1, 0x1E}, - /*OPP2*/ - {true, S250M, VDD1_OPP2, 0x26}, - /*OPP3*/ - {true, S500M, VDD1_OPP3, 0x30}, - /*OPP4*/ - {true, S550M, VDD1_OPP4, 0x36}, - /*OPP5*/ - {true, S600M, VDD1_OPP5, 0x3C}, -}; - -static struct omap_opp omap3_l3_rate_table[] = { - {0, 0, 0, 0}, - /*OPP1*/ - {false, 0, VDD2_OPP1, 0x1E}, - /*OPP2*/ - {true, S83M, VDD2_OPP2, 0x24}, - /*OPP3*/ - {true, S166M, VDD2_OPP3, 0x2C}, -}; - -static struct omap_opp omap3_dsp_rate_table[] = { - {0, 0, 0, 0}, - /*OPP1*/ - {true, S90M, VDD1_OPP1, 0x1E}, - /*OPP2*/ - {true, S180M, VDD1_OPP2, 0x26}, - /*OPP3*/ - {true, S360M, VDD1_OPP3, 0x30}, - /*OPP4*/ - {true, S400M, VDD1_OPP4, 0x36}, - /*OPP5*/ - {true, S430M, VDD1_OPP5, 0x3C}, -}; +extern struct omap_opp *omap3_mpu_rate_table; +extern struct omap_opp *omap3_dsp_rate_table; +extern struct omap_opp *omap3_l3_rate_table; #endif diff --git a/arch/arm/mach-omap2/pm.h b/arch/arm/mach-omap2/pm.h index 7bc86b6..80a1c1d 100644 --- a/arch/arm/mach-omap2/pm.h +++ b/arch/arm/mach-omap2/pm.h @@ -58,6 +58,12 @@ static inline void omap3_pm_init_cpuidle( { } #endif +/** + * omap3_pm_init_opp_table - OMAP opp table lookup called after cpu is detected. + * Initialize the basic opp table here, board files could choose to modify opp + * table after the basic initialization + */ +extern void omap3_pm_init_opp_table(void); extern int resource_set_opp_level(int res, u32 target_level, int flags); extern int resource_access_opp_lock(int res, int delta); diff --git a/arch/arm/mach-omap2/pm34xx.c b/arch/arm/mach-omap2/pm34xx.c index 627a509..e40a036 100644 --- a/arch/arm/mach-omap2/pm34xx.c +++ b/arch/arm/mach-omap2/pm34xx.c @@ -40,6 +40,7 @@ #include #include +#include #include #include @@ -52,6 +53,7 @@ #include "prm.h" #include "pm.h" #include "sdrc.h" +#include "omap3-opp.h" static int regset_save_on_suspend; @@ -100,6 +102,49 @@ static struct prm_setup_vc prm_setup = { .vdd1_off = 0x00, /* 0.6v */ }; +static struct omap_opp_def __initdata omap34xx_mpu_rate_table[] = { + /* OPP1 */ + OMAP_OPP_DEF(true, 125000000, 975000), + /* OPP2 */ + OMAP_OPP_DEF(true, 250000000, 1075000), + /* OPP3 */ + OMAP_OPP_DEF(true, 500000000, 1200000), + /* OPP4 */ + OMAP_OPP_DEF(true, 550000000, 1270000), + /* OPP5 */ + OMAP_OPP_DEF(true, 600000000, 1350000), + OMAP_OPP_DEF_TERMINATOR +}; + +static struct omap_opp_def __initdata omap34xx_l3_rate_table[] = { + /* OPP1 */ + OMAP_OPP_DEF(false, 0, 975000), + /* OPP2 */ + OMAP_OPP_DEF(true, 83000000, 1050000), + /* OPP3 */ + OMAP_OPP_DEF(true, 166000000, 1150000), + OMAP_OPP_DEF_TERMINATOR +}; + +static struct omap_opp_def __initdata omap34xx_dsp_rate_table[] = { + /* OPP1 */ + OMAP_OPP_DEF(true, 90000000, 975000), + /* OPP2 */ + OMAP_OPP_DEF(true, 180000000, 1075000), + /* OPP3 */ + OMAP_OPP_DEF(true, 360000000, 1200000), + /* OPP4 */ + OMAP_OPP_DEF(true, 400000000, 1270000), + /* OPP5 */ + OMAP_OPP_DEF(true, 430000000, 1350000), + OMAP_OPP_DEF_TERMINATOR +}; + +/* OMAP3 Rate Table */ +struct omap_opp *omap3_mpu_rate_table; +struct omap_opp *omap3_dsp_rate_table; +struct omap_opp *omap3_l3_rate_table; + static inline void omap3_per_save_context(void) { omap_gpio_save_context(); @@ -1248,6 +1293,26 @@ static void __init configure_vc(void) pm_dbg_regset_init(2); } +void __init omap3_pm_init_opp_table(void) +{ + int i; + struct omap_opp_def *omap34xx_opp_def_list[] = { + omap34xx_mpu_rate_table, + omap34xx_l3_rate_table, + omap34xx_dsp_rate_table + }; + struct omap_opp **omap3_rate_tables[] = { + &omap3_mpu_rate_table, + &omap3_l3_rate_table, + &omap3_dsp_rate_table + }; + for (i = 0; i < ARRAY_SIZE(omap3_rate_tables); i++) { + *omap3_rate_tables[i] = opp_init_list(omap34xx_opp_def_list[i]); + /* We dont want half configured system at the moment */ + BUG_ON(IS_ERR(omap3_rate_tables[i])); + } +} + static int __init omap3_pm_early_init(void) { prm_clear_mod_reg_bits(OMAP3430_OFFMODE_POL, OMAP3430_GR_MOD, diff --git a/arch/arm/plat-omap/include/plat/omap-pm.h b/arch/arm/plat-omap/include/plat/omap-pm.h index 5dc2048..aa36339 100644 --- a/arch/arm/plat-omap/include/plat/omap-pm.h +++ b/arch/arm/plat-omap/include/plat/omap-pm.h @@ -18,22 +18,7 @@ #include #include "powerdomain.h" - -/** - * struct omap_opp - clock frequency-to-OPP ID table for DSP, MPU - * @enabled: enabled if true, disabled if false - * @rate: target clock rate - * @opp_id: OPP ID - * @min_vdd: minimum VDD1 voltage (in millivolts) for this OPP - * - * Operating performance point data. Can vary by OMAP chip and board. - */ -struct omap_opp { - bool enabled; - unsigned long rate; - u8 opp_id; - u16 vsel; -}; +#include extern struct omap_opp *mpu_opps; extern struct omap_opp *dsp_opps;