From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail.free-electrons.com (down.free-electrons.com. [37.187.137.238]) by gmr-mx.google.com with ESMTP id gt9si362629wib.2.2015.06.29.02.23.57 for ; Mon, 29 Jun 2015 02:23:57 -0700 (PDT) Date: Mon, 29 Jun 2015 11:23:54 +0200 From: Alexandre Belloni To: Philippe Reynes Cc: a.zummo@towertech.it, shawn.guo@linaro.org, kernel@pengutronix.de, linux@arm.linux.org.uk, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, rtc-linux@googlegroups.com Subject: [rtc-linux] Re: [PATCH v3 3/6] rtc: mxc: use a second rtc clock Message-ID: <20150629092354.GW485@piout.net> References: <1434820360-21935-1-git-send-email-tremyfr@gmail.com> <1434820360-21935-4-git-send-email-tremyfr@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 In-Reply-To: <1434820360-21935-4-git-send-email-tremyfr@gmail.com> Reply-To: rtc-linux@googlegroups.com List-ID: List-Post: , List-Help: , List-Archive: , List-Unsubscribe: , Hi, On 20/06/2015 at 19:12:37 +0200, Philippe Reynes wrote : > - rate = clk_get_rate(pdata->clk); > + pdata->clk_rtc = devm_clk_get(&pdev->dev, "rtc"); > + if (IS_ERR(pdata->clk_rtc)) { > + dev_err(&pdev->dev, "unable to get rtc clock!\n"); > + ret = PTR_ERR(pdata->clk_rtc); > + goto exit_put_clk; > + } > + > + rate = clk_get_rate(pdata->clk_rtc); > You have to prepare_enable() before using get_rate(). Else, it is not guaranteed to work: "clk_get_rate - obtain the current clock rate (in Hz) for a clock source. This is only valid once the clock source has been enabled." http://lxr.free-electrons.com/source/include/linux/clk.h#L269 It may work right now because the clock is enabled elsewhere. But that may change at some point in time (we had the issue on at91). -- Alexandre Belloni, Free Electrons Embedded Linux, Kernel and Android engineering http://free-electrons.com -- -- You received this message because you are subscribed to "rtc-linux". Membership options at http://groups.google.com/group/rtc-linux . Please read http://groups.google.com/group/rtc-linux/web/checklist before submitting a driver. --- You received this message because you are subscribed to the Google Groups "rtc-linux" group. To unsubscribe from this group and stop receiving emails from it, send an email to rtc-linux+unsubscribe@googlegroups.com. For more options, visit https://groups.google.com/d/optout. From mboxrd@z Thu Jan 1 00:00:00 1970 From: alexandre.belloni@free-electrons.com (Alexandre Belloni) Date: Mon, 29 Jun 2015 11:23:54 +0200 Subject: [PATCH v3 3/6] rtc: mxc: use a second rtc clock In-Reply-To: <1434820360-21935-4-git-send-email-tremyfr@gmail.com> References: <1434820360-21935-1-git-send-email-tremyfr@gmail.com> <1434820360-21935-4-git-send-email-tremyfr@gmail.com> Message-ID: <20150629092354.GW485@piout.net> To: linux-arm-kernel@lists.infradead.org List-Id: linux-arm-kernel.lists.infradead.org Hi, On 20/06/2015 at 19:12:37 +0200, Philippe Reynes wrote : > - rate = clk_get_rate(pdata->clk); > + pdata->clk_rtc = devm_clk_get(&pdev->dev, "rtc"); > + if (IS_ERR(pdata->clk_rtc)) { > + dev_err(&pdev->dev, "unable to get rtc clock!\n"); > + ret = PTR_ERR(pdata->clk_rtc); > + goto exit_put_clk; > + } > + > + rate = clk_get_rate(pdata->clk_rtc); > You have to prepare_enable() before using get_rate(). Else, it is not guaranteed to work: "clk_get_rate - obtain the current clock rate (in Hz) for a clock source. This is only valid once the clock source has been enabled." http://lxr.free-electrons.com/source/include/linux/clk.h#L269 It may work right now because the clock is enabled elsewhere. But that may change at some point in time (we had the issue on at91). -- Alexandre Belloni, Free Electrons Embedded Linux, Kernel and Android engineering http://free-electrons.com From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753378AbbF2JX7 (ORCPT ); Mon, 29 Jun 2015 05:23:59 -0400 Received: from down.free-electrons.com ([37.187.137.238]:43360 "EHLO mail.free-electrons.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752031AbbF2JX6 (ORCPT ); Mon, 29 Jun 2015 05:23:58 -0400 Date: Mon, 29 Jun 2015 11:23:54 +0200 From: Alexandre Belloni To: Philippe Reynes Cc: a.zummo@towertech.it, shawn.guo@linaro.org, kernel@pengutronix.de, linux@arm.linux.org.uk, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, rtc-linux@googlegroups.com Subject: Re: [PATCH v3 3/6] rtc: mxc: use a second rtc clock Message-ID: <20150629092354.GW485@piout.net> References: <1434820360-21935-1-git-send-email-tremyfr@gmail.com> <1434820360-21935-4-git-send-email-tremyfr@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1434820360-21935-4-git-send-email-tremyfr@gmail.com> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, On 20/06/2015 at 19:12:37 +0200, Philippe Reynes wrote : > - rate = clk_get_rate(pdata->clk); > + pdata->clk_rtc = devm_clk_get(&pdev->dev, "rtc"); > + if (IS_ERR(pdata->clk_rtc)) { > + dev_err(&pdev->dev, "unable to get rtc clock!\n"); > + ret = PTR_ERR(pdata->clk_rtc); > + goto exit_put_clk; > + } > + > + rate = clk_get_rate(pdata->clk_rtc); > You have to prepare_enable() before using get_rate(). Else, it is not guaranteed to work: "clk_get_rate - obtain the current clock rate (in Hz) for a clock source. This is only valid once the clock source has been enabled." http://lxr.free-electrons.com/source/include/linux/clk.h#L269 It may work right now because the clock is enabled elsewhere. But that may change at some point in time (we had the issue on at91). -- Alexandre Belloni, Free Electrons Embedded Linux, Kernel and Android engineering http://free-electrons.com