From patchwork Wed Jun 26 10:15:40 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartlomiej Zolnierkiewicz X-Patchwork-Id: 2786891 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 04C159F3A0 for ; Wed, 26 Jun 2013 16:10:10 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 9DFB52053E for ; Wed, 26 Jun 2013 16:10:08 +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 6FC2620543 for ; Wed, 26 Jun 2013 16:10:06 +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 1UrsHH-0005FR-Rc; Wed, 26 Jun 2013 16:09:04 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1UrsGt-0006iv-MW; Wed, 26 Jun 2013 16:08:39 +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 1Urs26-0005IC-LY for linux-arm-kernel@merlin.infradead.org; Wed, 26 Jun 2013 15:53:22 +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 1UrmmX-0000Qi-Bg for linux-arm-kernel@lists.infradead.org; Wed, 26 Jun 2013 10:16:58 +0000 Received: from epcpsbgm2.samsung.com (epcpsbgm2 [203.254.230.27]) by mailout2.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0MOZ00F57WJ7O801@mailout2.samsung.com> for linux-arm-kernel@lists.infradead.org; Wed, 26 Jun 2013 19:16:19 +0900 (KST) X-AuditID: cbfee61b-b7f8e6d00000524c-cb-51cabf728f48 Received: from epmmp2 ( [203.254.227.17]) by epcpsbgm2.samsung.com (EPCPMTA) with SMTP id DE.E3.21068.27FBAC15; Wed, 26 Jun 2013 19:16:19 +0900 (KST) Received: from mcdsrvbld02.digital.local ([106.116.37.23]) by mmp2.samsung.com (Oracle Communications Messaging Server 7u4-24.01 (7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTPA id <0MOZ008XEWIOKP80@mmp2.samsung.com>; Wed, 26 Jun 2013 19:16:18 +0900 (KST) From: Bartlomiej Zolnierkiewicz To: linux-arm-kernel@lists.infradead.org Subject: [PATCH 1/8] ARM: at91: move cpuidle driver to drivers/cpuidle/ Date: Wed, 26 Jun 2013 12:15:40 +0200 Message-id: <1372241747-21083-2-git-send-email-b.zolnierkie@samsung.com> X-Mailer: git-send-email 1.7.10 In-reply-to: <1372241747-21083-1-git-send-email-b.zolnierkie@samsung.com> References: <1372241747-21083-1-git-send-email-b.zolnierkie@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFupmkeLIzCtJLcpLzFFi42I5/e+xoG7x/lOBBj8fM1psnLGe1WLSugNM FvM+y1o0b/3KaLFq6k4Wi94FV9ks7qxgtjjb9IbdYsqf5UwWmx5fY7X43HuE0WL5iqfMFg9W v2Wz+Ha5md1if+8GJot1D18wWfQv7GWyeLpuCbPFrS1NbBavDraxWOy/4uUg6rHg11YWj29f J7F4XH/1n8nj76oXzB47Z91l93h14Q6Lx51re9g8Ni+p95h4exqLR/9fA4++LasYPR4tbmH0 +L50DbvH8RvbmTzm/PzG4vF5k1yAYBSXTUpqTmZZapG+XQJXxqWOR+wFs3UrXq84ydbAuEe1 i5GTQ0LAROL8nS/sELaYxIV769m6GLk4hASmM0qc+viWCcLpYpLYcngxWBWbgJXExPZVjCC2 iICGxJSux2BxZoF7zBL7PuZ2MXJwCAu4S0xf4g0SZhFQlehs/ssGYvMKeEhs2neZGWKZvMTT +31gcU4BT4m5M5eC2UJANUvXLmWcwMi7gJFhFaNoakFyQXFSeq6RXnFibnFpXrpecn7uJkZw FD2T3sG4qsHiEKMAB6MSD6/C1pOBQqyJZcWVuYcYJTiYlUR438w/FSjEm5JYWZValB9fVJqT WnyIUZqDRUmc92CrdaCQQHpiSWp2ampBahFMlomDU6qBsfhT6Iu1/v9+/uXoefQhd6sw78Ht P162B4bGVB9uWLdCbi3D8Yu7z7Uf2nFgs8GUHcJbdrsoZXELhL9fIZHU/qe+rfHcy66Svmsl rG80bk+6x3RGq+v6/w/XHidbpX5/uzgmTsPowqyaW0v0art5dq/a8vuondjEmmmKQVLLT/DV ef0M74ucG6PEUpyRaKjFXFScCACO+SEJngIAAA== X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20130626_031657_727424_7201638F X-CRM114-Status: GOOD ( 14.44 ) X-Spam-Score: -6.3 (------) Cc: rjw@sisk.pl, kgene.kim@samsung.com, magnus.damm@gmail.com, ben-linux@fluff.org, linux-pm@vger.kernel.org, khilman@deeprootsystems.com, nsekhar@ti.com, linus.walleij@linaro.org, swarren@wwwdotorg.org, nicolas.ferre@atmel.com, daniel.lezcano@linaro.org, tony@atomide.com, kyungmin.park@samsung.com, horms@verge.net.au, srinidhi.kasagar@stericsson.com, kernel@pengutronix.de, shawn.guo@linaro.org, plagnioj@jcrosoft.com, linux@maxim.org.za, 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 Compile tested only. Cc: Andrew Victor Cc: Nicolas Ferre Cc: Jean-Christophe Plagniol-Villard Cc: Daniel Lezcano Cc: "Rafael J. Wysocki" Signed-off-by: Kyungmin Park Signed-off-by: Bartlomiej Zolnierkiewicz --- arch/arm/mach-at91/Makefile | 1 - arch/arm/mach-at91/cpuidle.c | 68 ------------------------------------------ drivers/cpuidle/Makefile | 3 ++ drivers/cpuidle/cpuidle-at91.c | 68 ++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 71 insertions(+), 69 deletions(-) delete mode 100644 arch/arm/mach-at91/cpuidle.c create mode 100644 drivers/cpuidle/cpuidle-at91.c diff --git a/arch/arm/mach-at91/Makefile b/arch/arm/mach-at91/Makefile index 3b0a953..c1b7370 100644 --- a/arch/arm/mach-at91/Makefile +++ b/arch/arm/mach-at91/Makefile @@ -98,7 +98,6 @@ obj-y += leds.o # Power Management obj-$(CONFIG_PM) += pm.o obj-$(CONFIG_AT91_SLOW_CLOCK) += pm_slowclock.o -obj-$(CONFIG_CPU_IDLE) += cpuidle.o ifeq ($(CONFIG_PM_DEBUG),y) CFLAGS_pm.o += -DDEBUG diff --git a/arch/arm/mach-at91/cpuidle.c b/arch/arm/mach-at91/cpuidle.c deleted file mode 100644 index 69f9e3b..0000000 --- a/arch/arm/mach-at91/cpuidle.c +++ /dev/null @@ -1,68 +0,0 @@ -/* - * based on arch/arm/mach-kirkwood/cpuidle.c - * - * CPU idle support for AT91 SoC - * - * This file is licensed under the terms of the GNU General Public - * License version 2. This program is licensed "as is" without any - * warranty of any kind, whether express or implied. - * - * The cpu idle uses wait-for-interrupt and RAM self refresh in order - * to implement two idle states - - * #1 wait-for-interrupt - * #2 wait-for-interrupt and RAM self refresh - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "pm.h" - -#define AT91_MAX_STATES 2 - -/* Actual code that puts the SoC in different idle states */ -static int at91_enter_idle(struct cpuidle_device *dev, - struct cpuidle_driver *drv, - int index) -{ - if (cpu_is_at91rm9200()) - at91rm9200_standby(); - else if (cpu_is_at91sam9g45()) - at91sam9g45_standby(); - else if (cpu_is_at91sam9263()) - at91sam9263_standby(); - else - at91sam9_standby(); - - return index; -} - -static struct cpuidle_driver at91_idle_driver = { - .name = "at91_idle", - .owner = THIS_MODULE, - .states[0] = ARM_CPUIDLE_WFI_STATE, - .states[1] = { - .enter = at91_enter_idle, - .exit_latency = 10, - .target_residency = 100000, - .flags = CPUIDLE_FLAG_TIME_VALID, - .name = "RAM_SR", - .desc = "WFI and DDR Self Refresh", - }, - .state_count = AT91_MAX_STATES, -}; - -/* Initialize CPU idle by registering the idle states */ -static int __init at91_init_cpuidle(void) -{ - return cpuidle_register(&at91_idle_driver, NULL); -} - -device_initcall(at91_init_cpuidle); diff --git a/drivers/cpuidle/Makefile b/drivers/cpuidle/Makefile index 8767a7b..9dd4091 100644 --- a/drivers/cpuidle/Makefile +++ b/drivers/cpuidle/Makefile @@ -5,6 +5,9 @@ obj-y += cpuidle.o driver.o governor.o sysfs.o governors/ obj-$(CONFIG_ARCH_NEEDS_CPU_IDLE_COUPLED) += coupled.o +ifeq ($(CONFIG_ARCH_AT91),y) + obj-y += cpuidle-at91.o +endif obj-$(CONFIG_CPU_IDLE_CALXEDA) += cpuidle-calxeda.o obj-$(CONFIG_ARCH_KIRKWOOD) += cpuidle-kirkwood.o obj-$(CONFIG_CPU_IDLE_ZYNQ) += cpuidle-zynq.o diff --git a/drivers/cpuidle/cpuidle-at91.c b/drivers/cpuidle/cpuidle-at91.c new file mode 100644 index 0000000..2545218 --- /dev/null +++ b/drivers/cpuidle/cpuidle-at91.c @@ -0,0 +1,68 @@ +/* + * based on arch/arm/mach-kirkwood/cpuidle.c + * + * CPU idle support for AT91 SoC + * + * This file is licensed under the terms of the GNU General Public + * License version 2. This program is licensed "as is" without any + * warranty of any kind, whether express or implied. + * + * The cpu idle uses wait-for-interrupt and RAM self refresh in order + * to implement two idle states - + * #1 wait-for-interrupt + * #2 wait-for-interrupt and RAM self refresh + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../../arch/arm/mach-at91/pm.h" + +#define AT91_MAX_STATES 2 + +/* Actual code that puts the SoC in different idle states */ +static int at91_enter_idle(struct cpuidle_device *dev, + struct cpuidle_driver *drv, + int index) +{ + if (cpu_is_at91rm9200()) + at91rm9200_standby(); + else if (cpu_is_at91sam9g45()) + at91sam9g45_standby(); + else if (cpu_is_at91sam9263()) + at91sam9263_standby(); + else + at91sam9_standby(); + + return index; +} + +static struct cpuidle_driver at91_idle_driver = { + .name = "at91_idle", + .owner = THIS_MODULE, + .states[0] = ARM_CPUIDLE_WFI_STATE, + .states[1] = { + .enter = at91_enter_idle, + .exit_latency = 10, + .target_residency = 100000, + .flags = CPUIDLE_FLAG_TIME_VALID, + .name = "RAM_SR", + .desc = "WFI and DDR Self Refresh", + }, + .state_count = AT91_MAX_STATES, +}; + +/* Initialize CPU idle by registering the idle states */ +static int __init at91_init_cpuidle(void) +{ + return cpuidle_register(&at91_idle_driver, NULL); +} + +device_initcall(at91_init_cpuidle);