From patchwork Wed Dec 10 15:48:25 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrzej Hajda X-Patchwork-Id: 5469861 Return-Path: X-Original-To: patchwork-dri-devel@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 3280CBEEA8 for ; Wed, 10 Dec 2014 15:49:11 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 6E64A2016C for ; Wed, 10 Dec 2014 15:49:10 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 975372012B for ; Wed, 10 Dec 2014 15:49:09 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id BCF4F6E62B; Wed, 10 Dec 2014 07:49:08 -0800 (PST) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mailout4.w1.samsung.com (mailout4.w1.samsung.com [210.118.77.14]) by gabe.freedesktop.org (Postfix) with ESMTP id A8F8A6E62D for ; Wed, 10 Dec 2014 07:49:07 -0800 (PST) Received: from eucpsbgm1.samsung.com (unknown [203.254.199.244]) by mailout4.w1.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0NGD001L8ISMPCA0@mailout4.w1.samsung.com> for dri-devel@lists.freedesktop.org; Wed, 10 Dec 2014 15:53:10 +0000 (GMT) X-AuditID: cbfec7f4-b7f126d000001e9a-ba-54886b722820 Received: from eusync1.samsung.com ( [203.254.199.211]) by eucpsbgm1.samsung.com (EUCPMTA) with SMTP id 6D.29.07834.27B68845; Wed, 10 Dec 2014 15:49:06 +0000 (GMT) Received: from AMDC1061.digital.local ([106.116.147.88]) by eusync1.samsung.com (Oracle Communications Messaging Server 7u4-23.01 (7.0.4.23.0) 64bit (built Aug 10 2011)) with ESMTPA id <0NGD00L5CIL48260@eusync1.samsung.com>; Wed, 10 Dec 2014 15:49:06 +0000 (GMT) From: Andrzej Hajda To: linux-kernel@vger.kernel.org (open list) Subject: [RFC 07/15] clk: add DT parsing function Date: Wed, 10 Dec 2014 16:48:25 +0100 Message-id: <1418226513-14105-8-git-send-email-a.hajda@samsung.com> X-Mailer: git-send-email 1.9.1 In-reply-to: <1418226513-14105-1-git-send-email-a.hajda@samsung.com> References: <1418226513-14105-1-git-send-email-a.hajda@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrOLMWRmVeSWpSXmKPExsVy+t/xy7pF2R0hBisuKlrcWneO1eLAi4Us FlMfPmGzmH8EyL3y9T2bxblXj1gsDvzZwWjRvHg9m8Wk+xNYLC487WGz+Halg8liyp/lTBab Hl9jtdg8/w+jxeVdc9gsZpzfx2Rx+zKvxdojd9ktnk64yGbRuvcIu8XPXfNYHEQ9Wpp72Dye bLrI6LFz1l12j02rOtk87lzbw+axf+4ado/73ceZPDYvqffo27KK0eP4je1MHp83yQVwR3HZ pKTmZJalFunbJXBlfDjTzV5wmqPixuyLLA2Mn9m6GDk4JARMJD7Mtepi5AQyxSQu3FsPFObi EBJYyiix+Pc1Zginj0ni/eRWRpAqNgFNib+bb7KB2CICOhLXe7rBipgFNrBLrJu+DywhLGAo 8eLWYhaQDSwCqhJfLiiChHkFnCW2XpvFCrFNTuLksclgNqeAi8Tf53vB5gsB1SzZ9p51AiPv AkaGVYyiqaXJBcVJ6bmGesWJucWleel6yfm5mxghkfFlB+PiY1aHGAU4GJV4eM0VW0OEWBPL iitzDzFKcDArifAuTO4IEeJNSaysSi3Kjy8qzUktPsTIxMEp1cBYvZOxb9LnvNntX1i9ft+Q 1ToYWhLVz6a+LOzwHRbpyNTHB/mzVvqwn2o40PFL3W1fVmNk6OGWxFy1W/r8v3j3tUmceeJl eVwg8wlD69LLbM94vLqytOaJNihe2tKnKXt5/Y5pNz43psho1Jgp/Tw4s9DC7RxTWYFX7BmJ kpyv9rvDpASLtZVYijMSDbWYi4oTAfUIKadqAgAA Cc: Alexandre Courbot , "moderated list:ARM/S5P EXYNOS AR..." , Mike Turquette , "open list:DRM PANEL DRIVERS" , "open list:GPIO SUBSYSTEM" , Greg Kroah-Hartman , Liam Girdwood , Rob Herring , Kishon Vijay Abraham I , Andrzej Hajda , "open list:OPEN FIRMWARE AND..." , Mark Brown , Grant Likely , Russell King , "moderated list:ARM/CLKDEV SUPPORT" , Marek Szyprowski X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, T_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 The patch adds function for parsing Device Tree to get clock specifier. The function could be ultimately used by clock core. Signed-off-by: Andrzej Hajda --- drivers/clk/clkdev.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/drivers/clk/clkdev.c b/drivers/clk/clkdev.c index da4bda8..bd22750 100644 --- a/drivers/clk/clkdev.c +++ b/drivers/clk/clkdev.c @@ -120,6 +120,29 @@ struct clk *of_clk_get_by_name(struct device_node *np, const char *name) return clk; } EXPORT_SYMBOL(of_clk_get_by_name); + +static int of_get_clock_spec(struct device *dev, const char *name, + struct of_phandle_args *spec) +{ + struct device_node *np = dev->of_node; + + while (np) { + int idx = 0; + + if (name) + idx = of_property_match_string(np, "clock-names", name); + + if (!of_parse_phandle_with_args(np, "clocks", "#clock-cells", + idx, spec)) + return 0; + + np = np->parent; + if (np && !of_get_property(np, "clock-ranges", NULL)) + break; + } + + return -ENOENT; +} #endif /*