From patchwork Wed Jun 26 10:13:47 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartlomiej Zolnierkiewicz X-Patchwork-Id: 2788341 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 9657D9F3A0 for ; Wed, 26 Jun 2013 20:59:10 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 75E2F203DB for ; Wed, 26 Jun 2013 20:59:09 +0000 (UTC) Received: from casper.infradead.org (casper.infradead.org [85.118.1.10]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id E797D2038B for ; Wed, 26 Jun 2013 20:59:07 +0000 (UTC) Received: from merlin.infradead.org ([205.233.59.134]) by casper.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1UrsKd-0006GV-Iy; Wed, 26 Jun 2013 16:12:37 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1UrsIG-0006pJ-Jv; Wed, 26 Jun 2013 16:10:04 +0000 Received: from bombadil.infradead.org ([2001:1868:205::9]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1Urs28-0005IC-TR for linux-arm-kernel@merlin.infradead.org; Wed, 26 Jun 2013 15:53:24 +0000 Received: from mailout2.samsung.com ([203.254.224.25]) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1Urmki-0007pV-Lo for linux-arm-kernel@lists.infradead.org; Wed, 26 Jun 2013 10:15:05 +0000 Received: from epcpsbgm1.samsung.com (epcpsbgm1 [203.254.230.26]) by mailout2.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0MOZ00F0AWFPO801@mailout2.samsung.com> for linux-arm-kernel@lists.infradead.org; Wed, 26 Jun 2013 19:14:26 +0900 (KST) X-AuditID: cbfee61a-b7f3b6d000006edd-f8-51cabf02948f Received: from epmmp1.local.host ( [203.254.227.16]) by epcpsbgm1.samsung.com (EPCPMTA) with SMTP id 98.5D.28381.20FBAC15; Wed, 26 Jun 2013 19:14:26 +0900 (KST) Received: from mcdsrvbld02.digital.local ([106.116.37.23]) by mmp1.samsung.com (Oracle Communications Messaging Server 7u4-24.01 (7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTPA id <0MOZ0076CWFFZO80@mmp1.samsung.com>; Wed, 26 Jun 2013 19:14:26 +0900 (KST) From: Bartlomiej Zolnierkiewicz To: kgene.kim@samsung.com Subject: [PATCH 3/3] ARM: EXYNOS: move cpuidle driver to drivers/cpuidle/ Date: Wed, 26 Jun 2013 12:13:47 +0200 Message-id: <1372241627-22695-4-git-send-email-b.zolnierkie@samsung.com> X-Mailer: git-send-email 1.7.10 In-reply-to: <1372241627-22695-1-git-send-email-b.zolnierkie@samsung.com> References: <1372241627-22695-1-git-send-email-b.zolnierkie@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFlrHLMWRmVeSWpSXmKPExsVy+t9jAV2m/acCDW4tlLFY8mAKo8XGGetZ LeZ9lrWY+OEeo0XvgqtsFmeb3rBbbHp8jdXic+8RRosZ5/cxWbz5/YLdon9hL5PF+hmvWRx4 PNbMW8PocefaHjaPzUvqPfq2rGL0eLS4hdHj8ya5ALYoLpuU1JzMstQifbsErozmw8uYCn6a V2zZMYmxgXGbbhcjJ4eEgInEvf4NbBC2mMSFe+uBbC4OIYFFjBLHPz9ghHC6mCTeNBxlAali E7CSmNi+ihHEFhGQlGhq+MMMYjMLLGGS2Lu1touRg0NYwFNi/T4/kDCLgKrEjdYuVpAwr4CH ROOmdIhd8hJP7/eB7eUEql60aQHYFCGgkhVH3jNPYORdwMiwilE0tSC5oDgpPddQrzgxt7g0 L10vOT93EyM4FJ9J7WBc2WBxiFGAg1GJh1dh68lAIdbEsuLK3EOMEhzMSiK8b+afChTiTUms rEotyo8vKs1JLT7EKM3BoiTOe6DVOlBIID2xJDU7NbUgtQgmy8TBKdXAeIzF8+6/tfqJP+KC zJOTHrGse9B+/bTP5t/PZ2xeu+L4/N7r9y1mFNgWz7uXyvKl6Grd9kfc85coT3yy+uA/94Mf ZC+de+tgsHB22aLkyJZa5q9cDVMDlr3mmHt8lqoE4x3jUwtMHtl/L5VKP/2da1KjIYfftNlX Uw5cS1L2dFCbHmX8gHPB7A9KLMUZiYZazEXFiQDoR/sIQQIAAA== X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20130626_031504_885261_4971788B X-CRM114-Status: GOOD ( 15.42 ) X-Spam-Score: -6.3 (------) Cc: lorenzo.pieralisi@arm.com, linux-pm@vger.kernel.org, t.figa@samsung.com, daniel.lezcano@linaro.org, rjw@sisk.pl, kyungmin.park@samsung.com, linux-samsung-soc@vger.kernel.org, amit.kachhap@linaro.org, jc.lee@samsung.com, linux-arm-kernel@lists.infradead.org, b.zolnierkie@samsung.com X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-5.5 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP While at it: - remove "common.h" include - remove wrong comment about file path Tested on Exynos4210 (Universal C210 board). Cc: Jaecheol Lee Cc: Lorenzo Pieralisi Cc: Amit Daniel Kachhap Cc: Tomasz Figa Cc: Kukjin Kim Cc: Daniel Lezcano Cc: "Rafael J. Wysocki" Signed-off-by: Kyungmin Park Signed-off-by: Bartlomiej Zolnierkiewicz --- arch/arm/mach-exynos/Makefile | 1 - arch/arm/mach-exynos/cpuidle.c | 95 ---------------------------------------- drivers/cpuidle/Makefile | 3 ++ drivers/cpuidle/cpuidle-exynos.c | 92 ++++++++++++++++++++++++++++++++++++++ 4 files changed, 95 insertions(+), 96 deletions(-) delete mode 100644 arch/arm/mach-exynos/cpuidle.c create mode 100644 drivers/cpuidle/cpuidle-exynos.c diff --git a/arch/arm/mach-exynos/Makefile b/arch/arm/mach-exynos/Makefile index b09b027..0f91c7a 100644 --- a/arch/arm/mach-exynos/Makefile +++ b/arch/arm/mach-exynos/Makefile @@ -16,7 +16,6 @@ obj-$(CONFIG_ARCH_EXYNOS) += common.o obj-$(CONFIG_PM) += pm.o obj-$(CONFIG_PM_GENERIC_DOMAINS) += pm_domains.o -obj-$(CONFIG_CPU_IDLE) += cpuidle.o obj-$(CONFIG_ARCH_EXYNOS) += pmu.o diff --git a/arch/arm/mach-exynos/cpuidle.c b/arch/arm/mach-exynos/cpuidle.c deleted file mode 100644 index d6e5115..0000000 --- a/arch/arm/mach-exynos/cpuidle.c +++ /dev/null @@ -1,95 +0,0 @@ -/* linux/arch/arm/mach-exynos4/cpuidle.c - * - * Copyright (c) 2011 Samsung Electronics Co., Ltd. - * http://www.samsung.com - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. -*/ - -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include - -#include "common.h" - -static DEFINE_PER_CPU(struct cpuidle_device, exynos4_cpuidle_device); - -static struct cpuidle_driver exynos4_idle_driver = { - .name = "exynos4_idle", - .owner = THIS_MODULE, - .states = { - [0] = ARM_CPUIDLE_WFI_STATE, - }, - .state_count = 1, - .safe_state_index = 0, -}; - -static void __init exynos5_core_down_clk(void) -{ - unsigned int tmp; - - /* - * Enable arm clock down (in idle) and set arm divider - * ratios in WFI/WFE state. - */ - tmp = PWR_CTRL1_CORE2_DOWN_RATIO | \ - PWR_CTRL1_CORE1_DOWN_RATIO | \ - PWR_CTRL1_DIV2_DOWN_EN | \ - PWR_CTRL1_DIV1_DOWN_EN | \ - PWR_CTRL1_USE_CORE1_WFE | \ - PWR_CTRL1_USE_CORE0_WFE | \ - PWR_CTRL1_USE_CORE1_WFI | \ - PWR_CTRL1_USE_CORE0_WFI; - __raw_writel(tmp, EXYNOS5_PWR_CTRL1); - - /* - * Enable arm clock up (on exiting idle). Set arm divider - * ratios when not in idle along with the standby duration - * ratios. - */ - tmp = PWR_CTRL2_DIV2_UP_EN | \ - PWR_CTRL2_DIV1_UP_EN | \ - PWR_CTRL2_DUR_STANDBY2_VAL | \ - PWR_CTRL2_DUR_STANDBY1_VAL | \ - PWR_CTRL2_CORE2_UP_RATIO | \ - PWR_CTRL2_CORE1_UP_RATIO; - __raw_writel(tmp, EXYNOS5_PWR_CTRL2); -} - -int __init exynos4_init_cpuidle(void) -{ - int cpu_id, ret; - struct cpuidle_device *device; - - if (soc_is_exynos5250()) - exynos5_core_down_clk(); - - ret = cpuidle_register_driver(&exynos4_idle_driver); - if (ret) { - printk(KERN_ERR "CPUidle failed to register driver\n"); - return ret; - } - - for_each_online_cpu(cpu_id) { - device = &per_cpu(exynos4_cpuidle_device, cpu_id); - device->cpu = cpu_id; - - ret = cpuidle_register_device(device); - if (ret) { - printk(KERN_ERR "CPUidle register device failed\n"); - return ret; - } - } - - return 0; -} diff --git a/drivers/cpuidle/Makefile b/drivers/cpuidle/Makefile index 0d8bd55..37c6178 100644 --- a/drivers/cpuidle/Makefile +++ b/drivers/cpuidle/Makefile @@ -6,4 +6,7 @@ obj-y += cpuidle.o driver.o governor.o sysfs.o governors/ obj-$(CONFIG_ARCH_NEEDS_CPU_IDLE_COUPLED) += coupled.o obj-$(CONFIG_CPU_IDLE_CALXEDA) += cpuidle-calxeda.o +ifeq ($(CONFIG_ARCH_EXYNOS),y) + obj-y += cpuidle-exynos.o +endif obj-$(CONFIG_ARCH_KIRKWOOD) += cpuidle-kirkwood.o diff --git a/drivers/cpuidle/cpuidle-exynos.c b/drivers/cpuidle/cpuidle-exynos.c new file mode 100644 index 0000000..1c592d2 --- /dev/null +++ b/drivers/cpuidle/cpuidle-exynos.c @@ -0,0 +1,92 @@ +/* + * Copyright (c) 2011 Samsung Electronics Co., Ltd. + * http://www.samsung.com + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. +*/ + +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +static DEFINE_PER_CPU(struct cpuidle_device, exynos4_cpuidle_device); + +static struct cpuidle_driver exynos4_idle_driver = { + .name = "exynos4_idle", + .owner = THIS_MODULE, + .states = { + [0] = ARM_CPUIDLE_WFI_STATE, + }, + .state_count = 1, + .safe_state_index = 0, +}; + +static void __init exynos5_core_down_clk(void) +{ + unsigned int tmp; + + /* + * Enable arm clock down (in idle) and set arm divider + * ratios in WFI/WFE state. + */ + tmp = PWR_CTRL1_CORE2_DOWN_RATIO | \ + PWR_CTRL1_CORE1_DOWN_RATIO | \ + PWR_CTRL1_DIV2_DOWN_EN | \ + PWR_CTRL1_DIV1_DOWN_EN | \ + PWR_CTRL1_USE_CORE1_WFE | \ + PWR_CTRL1_USE_CORE0_WFE | \ + PWR_CTRL1_USE_CORE1_WFI | \ + PWR_CTRL1_USE_CORE0_WFI; + __raw_writel(tmp, EXYNOS5_PWR_CTRL1); + + /* + * Enable arm clock up (on exiting idle). Set arm divider + * ratios when not in idle along with the standby duration + * ratios. + */ + tmp = PWR_CTRL2_DIV2_UP_EN | \ + PWR_CTRL2_DIV1_UP_EN | \ + PWR_CTRL2_DUR_STANDBY2_VAL | \ + PWR_CTRL2_DUR_STANDBY1_VAL | \ + PWR_CTRL2_CORE2_UP_RATIO | \ + PWR_CTRL2_CORE1_UP_RATIO; + __raw_writel(tmp, EXYNOS5_PWR_CTRL2); +} + +int __init exynos4_init_cpuidle(void) +{ + int cpu_id, ret; + struct cpuidle_device *device; + + if (soc_is_exynos5250()) + exynos5_core_down_clk(); + + ret = cpuidle_register_driver(&exynos4_idle_driver); + if (ret) { + printk(KERN_ERR "CPUidle failed to register driver\n"); + return ret; + } + + for_each_online_cpu(cpu_id) { + device = &per_cpu(exynos4_cpuidle_device, cpu_id); + device->cpu = cpu_id; + + ret = cpuidle_register_device(device); + if (ret) { + printk(KERN_ERR "CPUidle register device failed\n"); + return ret; + } + } + + return 0; +}