From patchwork Thu Aug 29 23:36:44 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Santosh Shilimkar X-Patchwork-Id: 2851684 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 7A3EB9F2F4 for ; Thu, 29 Aug 2013 23:39:15 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id A7B312049C for ; Thu, 29 Aug 2013 23:39:14 +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 AB72620494 for ; Thu, 29 Aug 2013 23:39:13 +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 1VFBnC-0004OL-8R; Thu, 29 Aug 2013 23:38:22 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1VFBms-0005Nj-JJ; Thu, 29 Aug 2013 23:38:02 +0000 Received: from bear.ext.ti.com ([192.94.94.41]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1VFBmM-0005J8-MG for linux-arm-kernel@lists.infradead.org; Thu, 29 Aug 2013 23:37:33 +0000 Received: from dlelxv90.itg.ti.com ([172.17.2.17]) by bear.ext.ti.com (8.13.7/8.13.7) with ESMTP id r7TNbAj2026601; Thu, 29 Aug 2013 18:37:10 -0500 Received: from DFLE73.ent.ti.com (dfle73.ent.ti.com [128.247.5.110]) by dlelxv90.itg.ti.com (8.14.3/8.13.8) with ESMTP id r7TNbAZk031895; Thu, 29 Aug 2013 18:37:10 -0500 Received: from dlep33.itg.ti.com (157.170.170.75) by DFLE73.ent.ti.com (128.247.5.110) with Microsoft SMTP Server id 14.2.342.3; Thu, 29 Aug 2013 18:37:10 -0500 Received: from ula0393909.am.dhcp.ti.com (ileax41-snat.itg.ti.com [10.172.224.153]) by dlep33.itg.ti.com (8.14.3/8.13.8) with ESMTP id r7TNaknF023134; Thu, 29 Aug 2013 18:37:10 -0500 From: Santosh Shilimkar To: Subject: [PATCH v2 4/4] ARM: keystone: add PM bus support for clock management Date: Thu, 29 Aug 2013 19:36:44 -0400 Message-ID: <1377819404-9671-5-git-send-email-santosh.shilimkar@ti.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1377819404-9671-1-git-send-email-santosh.shilimkar@ti.com> References: <1377819404-9671-1-git-send-email-santosh.shilimkar@ti.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20130829_193731_061969_D9E4EF7F X-CRM114-Status: GOOD ( 16.95 ) X-Spam-Score: -9.4 (---------) Cc: arm@kernel.org, Santosh Shilimkar , khilman@linaro.org 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: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-6.7 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 Add runtime PM core support to Keystone SOCs by using the pm_clk infrastructure of the PM core. Patch is based on Kevin's pm_domain work on DaVinci SOCs. Keystone SOC doesn't have depedency to enable clocks in early in the boot and hence the clock and PM bus initialisation is done at subsys_init() level. Cc: Kevin Hilman Signed-off-by: Santosh Shilimkar --- drivers/bus/Makefile | 2 ++ drivers/bus/keystone_pm_bus.c | 70 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 72 insertions(+) create mode 100644 drivers/bus/keystone_pm_bus.c diff --git a/drivers/bus/Makefile b/drivers/bus/Makefile index 8947bdd..cb7f304 100644 --- a/drivers/bus/Makefile +++ b/drivers/bus/Makefile @@ -10,3 +10,5 @@ obj-$(CONFIG_OMAP_OCP2SCP) += omap-ocp2scp.o obj-$(CONFIG_OMAP_INTERCONNECT) += omap_l3_smx.o omap_l3_noc.o # CCI cache coherent interconnect for ARM platforms obj-$(CONFIG_ARM_CCI) += arm-cci.o +# PM bus driver for Keystone SOCs +obj-$(CONFIG_ARCH_KEYSTONE) += keystone_pm_bus.o diff --git a/drivers/bus/keystone_pm_bus.c b/drivers/bus/keystone_pm_bus.c new file mode 100644 index 0000000..6cc56f1 --- /dev/null +++ b/drivers/bus/keystone_pm_bus.c @@ -0,0 +1,70 @@ +/* + * PM Bus driver for Keystone2 devices + * + * Copyright 2013 Texas Instruments, Inc. + * Santosh Shilimkar + * + * Based on Kevins work on DAVINCI SOCs + * Kevin Hilman + * + * This program is free software; you can redistribute it and/or modify it + * under the terms and conditions of the GNU General Public License, + * version 2, as published by the Free Software Foundation. + */ + +#include +#include +#include +#include +#include + +#ifdef CONFIG_PM_RUNTIME +static int keystone_pm_runtime_suspend(struct device *dev) +{ + int ret; + + dev_dbg(dev, "%s\n", __func__); + + ret = pm_generic_runtime_suspend(dev); + if (ret) + return ret; + + ret = pm_clk_suspend(dev); + if (ret) { + pm_generic_runtime_resume(dev); + return ret; + } + + return 0; +} + +static int keystone_pm_runtime_resume(struct device *dev) +{ + dev_dbg(dev, "%s\n", __func__); + + pm_clk_resume(dev); + + return pm_generic_runtime_resume(dev); +} +#endif + +static struct dev_pm_domain keystone_pm_bus = { + .ops = { + SET_RUNTIME_PM_OPS(keystone_pm_runtime_suspend, + keystone_pm_runtime_resume, NULL) + USE_PLATFORM_PM_SLEEP_OPS + }, +}; + +static struct pm_clk_notifier_block platform_bus_notifier = { + .pm_domain = &keystone_pm_bus, +}; + +int __init keystone_pm_runtime_init(void) +{ + of_clk_init(NULL); + pm_clk_add_notifier(&platform_bus_type, &platform_bus_notifier); + + return 0; +} +subsys_initcall(keystone_pm_runtime_init);