From patchwork Thu Sep 13 11:55:34 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chander Kashyap X-Patchwork-Id: 1451581 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from merlin.infradead.org (unknown [205.233.59.134]) by patchwork2.kernel.org (Postfix) with ESMTP id 3214FDF24C for ; Thu, 13 Sep 2012 12:10:05 +0000 (UTC) Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1TC82E-00079w-EK; Thu, 13 Sep 2012 11:56:42 +0000 Received: from mail-pb0-f49.google.com ([209.85.160.49]) by merlin.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1TC825-00077y-RW for linux-arm-kernel@lists.infradead.org; Thu, 13 Sep 2012 11:56:36 +0000 Received: by mail-pb0-f49.google.com with SMTP id rq8so4112899pbb.36 for ; Thu, 13 Sep 2012 04:56:33 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references :x-gm-message-state; bh=me0KIeReCkVZ38hYWGfxpf/2WA74gqaU6kPBO+ys34E=; b=MLkxt9gro58XNyUxENahk2jBKsGwvCxvy1VHYjnE0rs825p5s4XUqrFk6v4BVn8TMK Q6rNSqKJ847h7d0NMH4buS7K73hpeKN2kDexZoJCmp74Lpk+MZ5n6Xp2Yx9KzpiVB5rt aQwOVVff1bGS7gwlkB/30OBoKQ7PLh/ny9YfLEnpQ22Fay2fQQzIGVHkX2i1zaxViItY 6EsJQ/v7x2JSptcHLrwSUgaCYVDNbZkO9tNRy9fLeoUZzK8p+wRJYIgNUeKsXhOuU57h u9Bz9P8Fakhitdw9tuwzUajTRzlE1+f9kwFakZj4DAHxlUY55aIeKV4aJIzQUNvaXvtL GUNA== Received: by 10.68.217.202 with SMTP id pa10mr4566843pbc.15.1347537393539; Thu, 13 Sep 2012 04:56:33 -0700 (PDT) Received: from localhost.localdomain ([115.113.119.130]) by mx.google.com with ESMTPS id hf1sm12966518pbc.42.2012.09.13.04.56.25 (version=SSLv3 cipher=OTHER); Thu, 13 Sep 2012 04:56:31 -0700 (PDT) From: Chander Kashyap To: linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, linux-pm@vger.kernel.org Subject: [RFC] [PATCH 1/2] ARM: Exynos4: CPUIDLE: Add generic function for exynos4 cpuidle Date: Thu, 13 Sep 2012 17:25:34 +0530 Message-Id: <1347537335-26657-2-git-send-email-chander.kashyap@linaro.org> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1347537335-26657-1-git-send-email-chander.kashyap@linaro.org> References: <1347537335-26657-1-git-send-email-chander.kashyap@linaro.org> X-Gm-Message-State: ALoCoQn9mOGrHFEzdiUtZA8Ks3lAF143strPyilia7FmLyw+MeS7nsHyfBB7CI1OdpO2rbTeVU6f X-Spam-Note: CRM114 invocation failed X-Spam-Score: -2.6 (--) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-2.6 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [209.85.160.49 listed in list.dnswl.org] -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] Cc: ksoo.yu@samsung.com, kgene.kim@samsung.com, jc.lee@samsung.com, Inderpal Singh , Chander Kashyap X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: linux-arm-kernel-bounces@lists.infradead.org Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org Moved out the code from exynos4_enter_core0_aftr to a separate function "exynos4_do_idle" in order to make it usable for other idle states. Also update the wakeup mask without touching reserved bits. Signed-off-by: Inderpal Singh Signed-off-by: Chander Kashyap --- arch/arm/mach-exynos/cpuidle.c | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/arch/arm/mach-exynos/cpuidle.c b/arch/arm/mach-exynos/cpuidle.c index cff0595..5e489a7 100644 --- a/arch/arm/mach-exynos/cpuidle.c +++ b/arch/arm/mach-exynos/cpuidle.c @@ -60,9 +60,11 @@ static struct cpuidle_driver exynos4_idle_driver = { }; /* Ext-GIC nIRQ/nFIQ is the only wakeup source in AFTR */ -static void exynos4_set_wakeupmask(void) +static void exynos4_set_wakeupmask(int index) { - __raw_writel(0x0000ff3e, S5P_WAKEUP_MASK); + unsigned long mask = __raw_readl(S5P_WAKEUP_MASK) & 0xFFF00000; + if (index == 1) + __raw_writel(mask | 0x0000ff3e, S5P_WAKEUP_MASK); } static unsigned int g_pwr_ctrl, g_diag_reg; @@ -91,19 +93,17 @@ static int idle_finisher(unsigned long flags) return 1; } -static int exynos4_enter_core0_aftr(struct cpuidle_device *dev, - struct cpuidle_driver *drv, - int index) +static void exynos4_do_idle(int index, int pd_conf, int lp_mode_magic) { unsigned long tmp; - exynos4_set_wakeupmask(); + exynos4_set_wakeupmask(index); - /* Set value of power down register for aftr mode */ - exynos_sys_powerdown_conf(SYS_AFTR); + /* Set value of power down register for requested LP mode */ + exynos_sys_powerdown_conf(pd_conf); __raw_writel(virt_to_phys(s3c_cpu_resume), REG_DIRECTGO_ADDR); - __raw_writel(S5P_CHECK_AFTR, REG_DIRECTGO_FLAG); + __raw_writel(lp_mode_magic, REG_DIRECTGO_FLAG); save_cpu_arch_register(); @@ -136,7 +136,13 @@ static int exynos4_enter_core0_aftr(struct cpuidle_device *dev, /* Clear wakeup state register */ __raw_writel(0x0, S5P_WAKEUP_STAT); +} +static int exynos4_enter_core0_aftr(struct cpuidle_device *dev, + struct cpuidle_driver *drv, + int index) +{ + exynos4_do_idle(index, SYS_AFTR, S5P_CHECK_AFTR); return index; }