From patchwork Thu Jul 7 13:32:53 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Magnus Damm X-Patchwork-Id: 952892 Received: from smtp1.linux-foundation.org (smtp1.linux-foundation.org [140.211.169.13]) by demeter2.kernel.org (8.14.4/8.14.4) with ESMTP id p67DS5GK011948 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=FAIL) for ; Thu, 7 Jul 2011 13:28:26 GMT Received: from daredevil.linux-foundation.org (localhost [127.0.0.1]) by smtp1.linux-foundation.org (8.14.2/8.13.5/Debian-3ubuntu1.1) with ESMTP id p67DQjwf021440; Thu, 7 Jul 2011 06:26:46 -0700 Received: from mail-pv0-f175.google.com (mail-pv0-f175.google.com [74.125.83.175]) by smtp1.linux-foundation.org (8.14.2/8.13.5/Debian-3ubuntu1.1) with ESMTP id p67DOe8f021063 (version=TLSv1/SSLv3 cipher=RC4-SHA bits=128 verify=FAIL) for ; Thu, 7 Jul 2011 06:24:42 -0700 Received: by pvf24 with SMTP id 24so416478pvf.6 for ; Thu, 07 Jul 2011 06:24:40 -0700 (PDT) Received: by 10.68.4.39 with SMTP id h7mr1154810pbh.245.1310045080766; Thu, 07 Jul 2011 06:24:40 -0700 (PDT) Received: from [127.0.0.1] (FLH1Ama088.tky.mesh.ad.jp [202.225.112.88]) by mx.google.com with ESMTPS id e6sm5620361pbm.7.2011.07.07.06.24.39 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 07 Jul 2011 06:24:40 -0700 (PDT) From: Magnus Damm To: linux-sh@vger.kernel.org Date: Thu, 07 Jul 2011 22:32:53 +0900 Message-Id: <20110707133253.22347.66361.sendpatchset@t400s> In-Reply-To: <20110707133212.22347.68775.sendpatchset@t400s> References: <20110707133212.22347.68775.sendpatchset@t400s> Received-SPF: pass (localhost is always allowed.) X-Spam-Status: No, hits=-3.812 required=5 tests=AWL, BAYES_00, OSDL_HEADER_SPF_PASS, OSDL_HEADER_SUBJECT_BRACKETED X-Spam-Checker-Version: SpamAssassin 3.2.4-osdl_revision__1.47__ X-MIMEDefang-Filter: lf$Revision: 1.188 $ X-Scanned-By: MIMEDefang 2.63 on 140.211.169.21 Cc: linux-pm@lists.linux-foundation.org Subject: [linux-pm] [PATCH 05/05] ARM: mach-shmobile: sh7372 A3RV requires A4LC X-BeenThere: linux-pm@lists.linux-foundation.org X-Mailman-Version: 2.1.9 Precedence: list List-Id: Linux power management List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: linux-pm-bounces@lists.linux-foundation.org Errors-To: linux-pm-bounces@lists.linux-foundation.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter2.kernel.org [140.211.167.43]); Thu, 07 Jul 2011 13:28:26 +0000 (UTC) From: Magnus Damm Add a power domain workaround for the VPU and A3RV on sh7372. The sh7372 data sheet mentions that the VPU is located in the A3RV power domain. The A3RV power domain is not related to A4LC in any way, but testing shows that unless A3RV _and_ A4LC are powered on the VPU test program will bomb out. This issue may be caused by a more or less undocumented dependency on the MERAM block that happens to be located in A4LC. So now we know that the out-of-reset requirement of the VPU is that the MERAM is powered on. This patch adds a workaround for A3RV to make sure A4LC is powered on - this so we can use the VPU even though the LCDCs are in blanking state and A4LC is supposed to be off. Signed-off-by: Magnus Damm --- arch/arm/mach-shmobile/pm-sh7372.c | 45 +++++++++++++++++++++++++++++++++--- 1 file changed, 42 insertions(+), 3 deletions(-) --- 0006/arch/arm/mach-shmobile/pm-sh7372.c +++ work/arch/arm/mach-shmobile/pm-sh7372.c 2011-07-07 21:57:14.000000000 +0900 @@ -91,6 +91,36 @@ static int pd_power_up(struct generic_pm return ret; } +static int pd_power_up_a3rv(struct generic_pm_domain *genpd) +{ + int ret = pd_power_up(genpd); + + /* force A4LC on after A3RV has been requested on */ + pm_genpd_poweron(&sh7372_a4lc.genpd); + + return ret; +} + +static int pd_power_down_a3rv(struct generic_pm_domain *genpd) +{ + int ret = pd_power_down(genpd); + + /* try to power down A4LC after A3RV is requested off */ + pm_genpd_poweron(&sh7372_a4lc.genpd); + queue_work(pm_wq, &sh7372_a4lc.genpd.power_off_work); + + return ret; +} + +static int pd_power_down_a4lc(struct generic_pm_domain *genpd) +{ + /* only power down A4LC if A3RV is off */ + if (!(__raw_readl(PSTR) & (1 << sh7372_a3rv.bit_shift))) + return pd_power_down(genpd); + + return 0; +} + static bool pd_active_wakeup(struct device *dev) { return true; @@ -115,9 +145,18 @@ void sh7372_init_pm_domain(struct sh7372 genpd->stop_device = pm_clk_suspend; genpd->start_device = pm_clk_resume; genpd->active_wakeup = pd_active_wakeup; - genpd->power_off = pd_power_down; - genpd->power_on = pd_power_up; - pd_power_up(&sh7372_pd->genpd); + + if (sh7372_pd == &sh7372_a4lc) { + genpd->power_off = pd_power_down_a4lc; + genpd->power_on = pd_power_up; + } else if (sh7372_pd == &sh7372_a3rv) { + genpd->power_off = pd_power_down_a3rv; + genpd->power_on = pd_power_up_a3rv; + } else { + genpd->power_off = pd_power_down; + genpd->power_on = pd_power_up; + } + genpd->power_on(&sh7372_pd->genpd); shmobile_runtime_pm_late_init = sh7372_late_pm_domain_off; }