From patchwork Thu Jul 18 18:34:59 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Shiyan X-Patchwork-Id: 2829775 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 2F178C0318 for ; Thu, 18 Jul 2013 18:54:19 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 12EF32004F for ; Thu, 18 Jul 2013 18:54:18 +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 B5D2D20124 for ; Thu, 18 Jul 2013 18:54:16 +0000 (UTC) Received: from merlin.infradead.org ([2001:4978:20e::2]) by casper.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1Uzt8T-0008LW-D1; Thu, 18 Jul 2013 18:41:06 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1Uzt7w-0001Tt-JR; Thu, 18 Jul 2013 18:40:32 +0000 Received: from smtp49.i.mail.ru ([94.100.177.109]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1Uzt7p-0001TF-5E for linux-arm-kernel@lists.infradead.org; Thu, 18 Jul 2013 18:40:30 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mail.ru; s=mail2; h=References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From; bh=KIrynTl8X7x8hMrNNjKgKeiQoBfHfUbcmI+esbE+cks=; b=IxUXzZAidkwDs99TtFS4qpIX3o5FLMeFPbkjmey1qsNDH6r7e/GfD/5ILT0yZi0/3dREvv4BjHfq0EQ2nGw3oz9/vSpaNnPr8Z57jm/rqC6wPgyR/at0OZPYi7f1VltUTxhmWcywbWwh9yGYgr382ib0eL/Zee6areMae7hWdgU=; Received: from [188.134.40.128] (port=48263 helo=shc.zet) by smtp49.i.mail.ru with esmtpa (envelope-from ) id 1Uzt4h-0007tN-KT; Thu, 18 Jul 2013 22:37:19 +0400 From: Alexander Shiyan To: linux-arm-kernel@lists.infradead.org Subject: [PATCH 08/10] ARM: clps711x: Add CLPS711X cpuidle driver Date: Thu, 18 Jul 2013 22:34:59 +0400 Message-Id: <1374172501-26796-9-git-send-email-shc_work@mail.ru> X-Mailer: git-send-email 1.8.1.5 In-Reply-To: <1374172501-26796-1-git-send-email-shc_work@mail.ru> References: <1374172501-26796-1-git-send-email-shc_work@mail.ru> X-Mras: Ok X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20130718_144025_501361_4C2A8DA8 X-CRM114-Status: GOOD ( 16.94 ) X-Spam-Score: -2.0 (--) Cc: Mike Turquette , Alexander Shiyan , Arnd Bergmann , Daniel Lezcano , "Rafael J. Wysocki" , Olof Johansson , Russell King 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=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, FREEMAIL_FROM,RCVD_IN_DNSWL_MED,RP_MATCHES_RCVD,T_DKIM_INVALID, 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 This adds the cpuidle driver for Cirrus Logic CLPS711X series SoCs. Designed primarily for migration CLPS711X subarch for multiplatform & DT. Signed-off-by: Alexander Shiyan --- drivers/cpuidle/Kconfig | 6 +++ drivers/cpuidle/Makefile | 1 + drivers/cpuidle/cpuidle-clps711x.c | 80 ++++++++++++++++++++++++++++++++++++++ 3 files changed, 87 insertions(+) create mode 100644 drivers/cpuidle/cpuidle-clps711x.c diff --git a/drivers/cpuidle/Kconfig b/drivers/cpuidle/Kconfig index 0e2cd5c..c68a0cf 100644 --- a/drivers/cpuidle/Kconfig +++ b/drivers/cpuidle/Kconfig @@ -36,6 +36,12 @@ config CPU_IDLE_CALXEDA help Select this to enable cpuidle on Calxeda processors. +config CPU_IDLE_CLPS711X + bool "CPU Idle Driver for CLPS711X processors" + depends on ARCH_CLPS711X + help + Select this to enable cpuidle on Cirrus Logic CLPS711X processors. + config CPU_IDLE_ZYNQ bool "CPU Idle Driver for Xilinx Zynq processors" depends on ARCH_ZYNQ diff --git a/drivers/cpuidle/Makefile b/drivers/cpuidle/Makefile index 8767a7b..d07d2cb 100644 --- a/drivers/cpuidle/Makefile +++ b/drivers/cpuidle/Makefile @@ -6,5 +6,6 @@ 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 +obj-$(CONFIG_CPU_IDLE_CLPS711X) += cpuidle-clps711x.o obj-$(CONFIG_ARCH_KIRKWOOD) += cpuidle-kirkwood.o obj-$(CONFIG_CPU_IDLE_ZYNQ) += cpuidle-zynq.o diff --git a/drivers/cpuidle/cpuidle-clps711x.c b/drivers/cpuidle/cpuidle-clps711x.c new file mode 100644 index 0000000..9f0129f --- /dev/null +++ b/drivers/cpuidle/cpuidle-clps711x.c @@ -0,0 +1,80 @@ +/* + * CLPS711X CPU idle driver + * + * Copyright (C) 2013 Alexander Shiyan + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + */ + +#include +#include +#include +#include +#include +#include + +static void __iomem *clps711x_halt; + +static int clps711x_cpuidle_halt(struct cpuidle_device *dev, + struct cpuidle_driver *drv, int index) +{ + writel(1, clps711x_halt); + asm volatile ("mov r0, r0"); + asm volatile ("mov r0, r0"); + + return index; +} + +static struct cpuidle_driver clps711x_idle_driver = { + .name = "clps711x_idle", + .owner = THIS_MODULE, + .state_count = 1, + .states[0] = { + .name = "HALT", + .desc = "CLPS711X WFI", + .enter = clps711x_cpuidle_halt, + .exit_latency = 1, + }, +}; + +static int __init clps711x_cpuidle_probe(struct platform_device *pdev) +{ + struct resource *res; + + res = platform_get_resource(pdev, IORESOURCE_MEM, 0); + clps711x_halt = devm_ioremap_resource(&pdev->dev, res); + if (IS_ERR(clps711x_halt)) + return PTR_ERR(clps711x_halt); + + return cpuidle_register(&clps711x_idle_driver, NULL); +} + +static int clps711x_cpuidle_remove(struct platform_device *pdev) +{ + cpuidle_unregister(&clps711x_idle_driver); + + return 0; +} + +static const struct of_device_id clps711x_cpuidle_dt_ids[] = { + { .compatible = "cirrus,clps711x-cpuidle", }, + { } +}; +MODULE_DEVICE_TABLE(of, clps711x_cpuidle_dt_ids); + +static struct platform_driver clps711x_cpuidle_driver = { + .driver = { + .name = "clps711x-cpuidle", + .owner = THIS_MODULE, + .of_match_table = clps711x_cpuidle_dt_ids, + }, + .remove = clps711x_cpuidle_remove, +}; +module_platform_driver_probe(clps711x_cpuidle_driver, clps711x_cpuidle_probe); + +MODULE_AUTHOR("Alexander Shiyan "); +MODULE_DESCRIPTION("CLPS711X CPU idle driver"); +MODULE_LICENSE("GPL");