From patchwork Thu Mar 18 18:44:51 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nishanth Menon X-Patchwork-Id: 86792 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 o2IIjLOh031828 for ; Thu, 18 Mar 2010 18:45:22 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751520Ab0CRSpV (ORCPT ); Thu, 18 Mar 2010 14:45:21 -0400 Received: from devils.ext.ti.com ([198.47.26.153]:47610 "EHLO devils.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751458Ab0CRSpU (ORCPT ); Thu, 18 Mar 2010 14:45:20 -0400 Received: from dlep36.itg.ti.com ([157.170.170.91]) by devils.ext.ti.com (8.13.7/8.13.7) with ESMTP id o2IIjI1N017349 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Thu, 18 Mar 2010 13:45:18 -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 o2IIjEMc025369; Thu, 18 Mar 2010 13:45:14 -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 o2IIjDZ10095; Thu, 18 Mar 2010 13:45:13 -0500 (CDT) Received: by senorita (Postfix, from userid 1000) id 154FCC23C; Thu, 18 Mar 2010 13:45:12 -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 4/4] omap3: srf: remove hardcoded opp dependency Date: Thu, 18 Mar 2010 13:44:51 -0500 Message-Id: <1268937891-19445-5-git-send-email-nm@ti.com> X-Mailer: git-send-email 1.6.3.3 In-Reply-To: <1268937891-19445-4-git-send-email-nm@ti.com> References: <1268937891-19445-1-git-send-email-nm@ti.com> <1268937891-19445-2-git-send-email-nm@ti.com> <1268937891-19445-3-git-send-email-nm@ti.com> <1268937891-19445-4-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 X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter.kernel.org [140.211.167.41]); Thu, 18 Mar 2010 18:45:22 +0000 (UTC) diff --git a/arch/arm/mach-omap2/cpufreq34xx.c b/arch/arm/mach-omap2/cpufreq34xx.c index f0ed3ae..b0a03fe 100644 --- a/arch/arm/mach-omap2/cpufreq34xx.c +++ b/arch/arm/mach-omap2/cpufreq34xx.c @@ -112,6 +112,8 @@ static struct omap_opp_def __initdata omap36xx_dsp_rate_table[] = { void __init omap3_pm_init_opp_table(void) { int r; + unsigned long freq, l3_thresh; + struct omap_opp *opp; struct omap_opp_def **omap3_opp_def_list; struct omap_opp_def *omap34xx_opp_def_list[] = { omap34xx_mpu_rate_table, @@ -131,5 +133,16 @@ void __init omap3_pm_init_opp_table(void) r |= opp_init_list(OPP_L3, omap3_opp_def_list[1]); r |= opp_init_list(OPP_DSP, omap3_opp_def_list[2]); BUG_ON(r); + + /* First get the l3 thresh from highest l3 opp */ + freq = ULONG_MAX; + opp = opp_find_freq_floor(OPP_L3, &freq); + l3_thresh = freq * 4 / 1000; + /* Now setup the L3 bandwidth restrictions for right mpu freqs */ + freq = cpu_is_omap3630() ? 500000000 : 600000000; + while (!IS_ERR(opp = opp_find_freq_ceil(OPP_MPU, &freq))) { + opp_store_data(opp, "l3thresh", (void *) l3_thresh); + freq++; + } } diff --git a/arch/arm/mach-omap2/resource34xx.c b/arch/arm/mach-omap2/resource34xx.c index c6cce8b..b17ce90 100644 --- a/arch/arm/mach-omap2/resource34xx.c +++ b/arch/arm/mach-omap2/resource34xx.c @@ -448,17 +448,18 @@ int set_opp(struct shared_resource *resp, u32 target_level) int ret = -EINVAL; if (resp == vdd1_resp) { - if (target_level < 3) + struct omap_opp *opp; + void *data; + opp = opp_find_by_opp_id(OPP_MPU, target_level); + data = opp_get_data(opp, "l3thresh"); + if (IS_ERR(data)) resource_release("vdd2_opp", &vdd2_dev); ret = resource_set_opp_level(VDD1_OPP, target_level, 0); - /* - * For VDD1 OPP3 and above, make sure the interconnect - * is at 100Mhz or above. - * throughput in KiB/s for 100 Mhz = 100 * 1000 * 4. - */ - if (target_level >= 3) - resource_request("vdd2_opp", &vdd2_dev, 400000); + + if (!IS_ERR(data)) + resource_request("vdd2_opp", &vdd2_dev, + (unsigned long) data); } else if (resp == vdd2_resp) { unsigned long req_l3_freq;