From patchwork Tue Feb 19 17:32:09 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Mack X-Patchwork-Id: 2163811 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) by patchwork2.kernel.org (Postfix) with ESMTP id 77A30DF24C for ; Tue, 19 Feb 2013 17:35:05 +0000 (UTC) Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1U7r3J-0002Sm-OL; Tue, 19 Feb 2013 17:32:25 +0000 Received: from mail-bk0-f43.google.com ([209.85.214.43]) by merlin.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1U7r3G-0002RV-EW for linux-arm-kernel@lists.infradead.org; Tue, 19 Feb 2013 17:32:23 +0000 Received: by mail-bk0-f43.google.com with SMTP id jm19so3173042bkc.2 for ; Tue, 19 Feb 2013 09:32:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:message-id:date:from:user-agent:mime-version:to:cc :subject:references:in-reply-to:x-enigmail-version:content-type; bh=aJ7+0uwcELUjuq4gaL2nT6lppwy5NdE5B5lg/MYfaiY=; b=dr9EjVSbernIu7s9PLq8G5gFIp4SVibpAs4lXZpj6SThO7Jv1Yv4u4jNROO2ebV0qf o3Q4ybKDjNeo34hTb+Oe1Jg/M+eG45nFuzZGMkDO7cm2l4cRhSJ6dgkvdJOLMEqvvnqA hzXbXP8IUBlBuMQ0DZ9D1h1xMrvHWmtkBWx5bKJNwx/Un2qKDRa8c4x5knBqHnm58E6B x5XN5XGl8mHRPoXdzO1ukBifvq0D3JseV1Wybhev+oqCBD+2P2Wy1TnsCqlxRTXF583Z MNi6BHp65Buem6U2/UUGr4BVUeEElTg4K8WjrEjWaDTKvH+mv4LXS79qnQDdVhNqovbJ kDCg== X-Received: by 10.204.8.16 with SMTP id f16mr7141607bkf.81.1361295137293; Tue, 19 Feb 2013 09:32:17 -0800 (PST) Received: from [192.168.44.145] (p5099deeb.dip0.t-ipconnect.de. [80.153.222.235]) by mx.google.com with ESMTPS id x10sm22427739bkv.13.2013.02.19.09.32.15 (version=TLSv1 cipher=RC4-SHA bits=128/128); Tue, 19 Feb 2013 09:32:16 -0800 (PST) Message-ID: <5123B719.2080300@gmail.com> Date: Tue, 19 Feb 2013 18:32:09 +0100 From: Daniel Mack User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130110 Thunderbird/17.0.2 MIME-Version: 1.0 To: Mike Turquette Subject: Re: Question about fixed-clock References: <5122BF88.1050007@gmail.com> <51234B8E.2000504@gmail.com> <20130219172246.11471.14635@quantum> In-Reply-To: <20130219172246.11471.14635@quantum> X-Enigmail-Version: 1.5 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20130219_123222_600395_14319539 X-CRM114-Status: GOOD ( 29.06 ) X-Spam-Score: -2.7 (--) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-2.7 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [209.85.214.43 listed in list.dnswl.org] 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (zonque[at]gmail.com) -0.0 SPF_PASS SPF: sender matches SPF record -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature Cc: paul@pwsan.com, Russell King , Afzal Mohammed , rnayak@ti.com, LKML , Fabio Estevam , "linux-arm-kernel@lists.infradead.org" X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: linux-arm-kernel-bounces@lists.infradead.org Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org On 19.02.2013 18:22, Mike Turquette wrote: > Quoting Daniel Mack (2013-02-19 01:53:18) >> Hi Fabio, >> Hi Afzal, >> >> On 19.02.2013 02:33, Fabio Estevam wrote: >>> On Mon, Feb 18, 2013 at 8:55 PM, Daniel Mack wrote: >>>> Hi, >>>> >>>> This might be a stupid question, but I'm somehow stuck here. I'm using a >>>> driver with the following DTS sub-node: >>>> >>>> ref25: ref25M { >>>> compatible = "fixed-clock"; >>>> #clock-cells = <0>; >>>> clock-frequency = <25000000>; >>>> }; >>>> >>>> clock-generator@0 { >>>> /* ... */ >>>> #clock-cells = <1>; >>>> clocks = <&ref25>; >>>> } >>>> >>>> The device driver for clock-generator uses something like the following >>>> call to get its clock: >>>> >>>> clk = of_clk_get(np, 0); >>>> >>>> but the return value is ERR_PTR(-ENOENT) and I also can't find this >>>> clock in the clk debugfs tree. >>>> >>>> This is on a OMAP/AM33xx device with kernel 3.8-rc7 plus the -next tips >>>> of arm-soc and omap, but with no other special clock options selected in >>>> the config. Is there anything I'm missing to correctly instantiate the >>>> dummy clock? >>> >>> Have you registered it with clk_register_fixed_rate() ? >>> >>> In imx we use imx_clk_fixed, which in turns call clk_register_fixed_rate(). >>> >>> Take a look at arch/arm/mach-imx/clk-imx51-imx53.c for a reference. >> >> Hmm no, I didn't do anything else than adding it to the DT in the first >> place, hoping that a driver will pick it up and add the clock for me. >> But it turns out that of_clk_init() is not called at all on my platform. >> >> I'm doing this now from omap_generic_init() and it works. If that's an >> appropriate place to call it, I can provide a patch. >> > > You can provide a patch, but your example above is for a dummy clock, > correct? No, it's a real clock with a fixed frequency on the board, which feeds another clock chip. I thought this is what fixed-clock is for, just like what a fixed-regulator does? Or how would you describe such a thing in DT, in order to use it as input to another device? > It would be best to post your patch along with a real-world > use for calling of_clk_init(). Not sure what you mean exactly, but the patch is attached. However, I still think I lack some understanding here - the fact that compatible strings have to be passed explicitly from generic code feels wrong. Thanks, Daniel From 850120371830ffb5e2146aeb2d21c724d6ded09e Mon Sep 17 00:00:00 2001 From: Daniel Mack Date: Tue, 19 Feb 2013 12:05:25 +0100 Subject: [PATCH] ARM: OMAP: generic: add call to of_clk_init() This is needed to instanciate fixed clocks in the DT. Signed-off-by: Daniel Mack --- arch/arm/mach-omap2/board-generic.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/arch/arm/mach-omap2/board-generic.c b/arch/arm/mach-omap2/board-generic.c index 0274ff7..3580f16 100644 --- a/arch/arm/mach-omap2/board-generic.c +++ b/arch/arm/mach-omap2/board-generic.c @@ -15,6 +15,7 @@ #include #include #include +#include #include @@ -35,6 +36,11 @@ static struct of_device_id omap_dt_match_table[] __initdata = { { } }; +static const __initconst struct of_device_id clk_match[] = { + { .compatible = "fixed-clock", .data = of_fixed_clk_setup, }, + {} +}; + static void __init omap_generic_init(void) { omap_sdrc_init(NULL, NULL); @@ -49,6 +55,7 @@ static void __init omap_generic_init(void) omap4_panda_display_init_of(); else if (of_machine_is_compatible("ti,omap4-sdp")) omap_4430sdp_display_init_of(); + of_clk_init(clk_match); } #ifdef CONFIG_SOC_OMAP2420 -- 1.8.1.2