From patchwork Fri Jul 25 18:31:36 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Grygorii Strashko X-Patchwork-Id: 4625171 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 09430C0338 for ; Fri, 25 Jul 2014 17:48:55 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 405A2201DD for ; Fri, 25 Jul 2014 17:48:54 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 629E7201D5 for ; Fri, 25 Jul 2014 17:48:53 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1XAjaT-0007xg-TC; Fri, 25 Jul 2014 17:47:21 +0000 Received: from devils.ext.ti.com ([198.47.26.153]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1XAja2-0007Wa-Qz for linux-arm-kernel@lists.infradead.org; Fri, 25 Jul 2014 17:46:55 +0000 Received: from dlelxv90.itg.ti.com ([172.17.2.17]) by devils.ext.ti.com (8.13.7/8.13.7) with ESMTP id s6PHkMBF014760; Fri, 25 Jul 2014 12:46:22 -0500 Received: from DFLE72.ent.ti.com (dfle72.ent.ti.com [128.247.5.109]) by dlelxv90.itg.ti.com (8.14.3/8.13.8) with ESMTP id s6PHkMvf011077; Fri, 25 Jul 2014 12:46:22 -0500 Received: from dflp32.itg.ti.com (10.64.6.15) by DFLE72.ent.ti.com (128.247.5.109) with Microsoft SMTP Server id 14.3.174.1; Fri, 25 Jul 2014 12:46:22 -0500 Received: from localhost (dlep60.itg.ti.com [157.170.170.21]) by dflp32.itg.ti.com (8.14.3/8.13.8) with ESMTP id s6PHkLv5009936; Fri, 25 Jul 2014 12:46:22 -0500 From: Grygorii Strashko To: , "Rafael J. Wysocki" , , Geert Uytterhoeven , Subject: [RFC PATCH 3/3] ARM: keystone: pm_domain: setup clk pm domain clocks from DT Date: Fri, 25 Jul 2014 21:31:36 +0300 Message-ID: <1406313096-29761-4-git-send-email-grygorii.strashko@ti.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1406313096-29761-1-git-send-email-grygorii.strashko@ti.com> References: <1406313096-29761-1-git-send-email-grygorii.strashko@ti.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140725_104654_965419_9E9D5E59 X-CRM114-Status: GOOD ( 10.69 ) X-Spam-Score: -5.0 (-----) Cc: ulf.hansson@linaro.org, Grygorii Strashko , linux-sh@vger.kernel.org, linux-kernel@vger.kernel.org, grant.likely@secretlab.ca, ben.dooks@codethink.co.uk, laurent.pinchart@ideasonboard.com, linux-arm-kernel@lists.infradead.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.18-1 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=-1.9 required=5.0 tests=BAYES_00,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 This patch implements custom pm_clk_notifier callback for Keystone 2 CLK PM domain which fills list of clocks for Device with all clocks assigned to this Device in DT. After this patch .con_ids field in pm_clk_notifier_block is not used and there are no limitation for clocks names in DT any more. Signed-off-by: Grygorii Strashko --- arch/arm/mach-keystone/pm_domain.c | 46 ++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) diff --git a/arch/arm/mach-keystone/pm_domain.c b/arch/arm/mach-keystone/pm_domain.c index ca79dda..56542d2 100644 --- a/arch/arm/mach-keystone/pm_domain.c +++ b/arch/arm/mach-keystone/pm_domain.c @@ -47,6 +47,51 @@ static int keystone_pm_runtime_resume(struct device *dev) return pm_generic_runtime_resume(dev); } + +static int keystone_pm_clk_notify(struct notifier_block *nb, + unsigned long action, void *data) +{ + struct pm_clk_notifier_block *clknb; + struct device *dev = data; + int error; + unsigned int i; + struct clk *clk; + struct device_node *np = dev->of_node; + + dev_dbg(dev, "%s() %ld\n", __func__, action); + + clknb = container_of(nb, struct pm_clk_notifier_block, nb); + + switch (action) { + case BUS_NOTIFY_BIND_DRIVER: + if (dev->pm_domain) + break; + + error = pm_clk_create(dev); + if (error) + break; + + dev->pm_domain = clknb->pm_domain; + + for (i = 0; (clk = of_clk_get(np, i)) && !IS_ERR(clk); i++) { + if (pm_clk_add_clk(dev, clk)) + clk_put(clk); + } + + break; + case BUS_NOTIFY_UNBOUND_DRIVER: + if (dev->pm_domain != clknb->pm_domain) + break; + + dev->pm_domain = NULL; + pm_clk_destroy(dev); + break; + } + + return 0; +} +#else + #endif static struct dev_pm_domain keystone_pm_domain = { @@ -59,6 +104,7 @@ static struct dev_pm_domain keystone_pm_domain = { static struct pm_clk_notifier_block platform_domain_notifier = { .pm_domain = &keystone_pm_domain, + .nb = { .notifier_call = keystone_pm_clk_notify, }, }; static struct of_device_id of_keystone_table[] = {