All of lore.kernel.org
 help / color / mirror / Atom feed
From: Alexandre Belloni <alexandre.belloni@free-electrons.com>
To: Philippe Reynes <tremyfr@gmail.com>
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
Date: Mon, 29 Jun 2015 11:23:54 +0200	[thread overview]
Message-ID: <20150629092354.GW485@piout.net> (raw)
In-Reply-To: <1434820360-21935-4-git-send-email-tremyfr@gmail.com>

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.

WARNING: multiple messages have this Message-ID (diff)
From: alexandre.belloni@free-electrons.com (Alexandre Belloni)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v3 3/6] rtc: mxc: use a second rtc clock
Date: Mon, 29 Jun 2015 11:23:54 +0200	[thread overview]
Message-ID: <20150629092354.GW485@piout.net> (raw)
In-Reply-To: <1434820360-21935-4-git-send-email-tremyfr@gmail.com>

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

WARNING: multiple messages have this Message-ID (diff)
From: Alexandre Belloni <alexandre.belloni@free-electrons.com>
To: Philippe Reynes <tremyfr@gmail.com>
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
Date: Mon, 29 Jun 2015 11:23:54 +0200	[thread overview]
Message-ID: <20150629092354.GW485@piout.net> (raw)
In-Reply-To: <1434820360-21935-4-git-send-email-tremyfr@gmail.com>

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

  reply	other threads:[~2015-06-29  9:23 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-20 17:12 [rtc-linux] [PATCH v3 0/6] add device tree support for mxc rtc Philippe Reynes
2015-06-20 17:12 ` Philippe Reynes
2015-06-20 17:12 ` Philippe Reynes
2015-06-20 17:12 ` [rtc-linux] [PATCH v3 1/6] imx31: add a second rtc clock Philippe Reynes
2015-06-20 17:12   ` Philippe Reynes
2015-06-20 17:12   ` Philippe Reynes
2015-06-20 17:12 ` [rtc-linux] [PATCH v3 2/6] imx35: define two clocks for rtc Philippe Reynes
2015-06-20 17:12   ` Philippe Reynes
2015-06-20 17:12   ` Philippe Reynes
2015-06-20 17:12 ` [rtc-linux] [PATCH v3 3/6] rtc: mxc: use a second rtc clock Philippe Reynes
2015-06-20 17:12   ` Philippe Reynes
2015-06-20 17:12   ` Philippe Reynes
2015-06-29  9:23   ` Alexandre Belloni [this message]
2015-06-29  9:23     ` Alexandre Belloni
2015-06-29  9:23     ` Alexandre Belloni
2015-06-20 17:12 ` [rtc-linux] [PATCH v3 4/6] rtc: mxc: add support of device tree Philippe Reynes
2015-06-20 17:12   ` Philippe Reynes
2015-06-20 17:12   ` Philippe Reynes
2015-06-29  9:24   ` [rtc-linux] " Alexandre Belloni
2015-06-29  9:24     ` Alexandre Belloni
2015-06-29  9:24     ` Alexandre Belloni
2015-06-20 17:12 ` [rtc-linux] [PATCH v3 5/6] dt-binding: document the binding for mxc rtc Philippe Reynes
2015-06-20 17:12   ` Philippe Reynes
2015-06-20 17:12   ` Philippe Reynes
2015-06-20 17:12   ` Philippe Reynes
2015-06-22 13:59   ` [rtc-linux] " Rob Herring
2015-06-22 13:59     ` Rob Herring
2015-06-22 13:59     ` Rob Herring
2015-06-22 13:59     ` Rob Herring
2015-06-22 19:27     ` [rtc-linux] " Alexandre Belloni
2015-06-22 19:27       ` Alexandre Belloni
2015-06-22 19:27       ` Alexandre Belloni
2015-06-22 19:27       ` Alexandre Belloni
2015-06-22 21:50       ` Rob Herring
2015-06-20 17:12 ` [rtc-linux] [PATCH v3 6/6] apf27: dt: add support of internal rtc Philippe Reynes
2015-06-20 17:12   ` Philippe Reynes
2015-06-20 17:12   ` Philippe Reynes
2015-06-29  9:26   ` [rtc-linux] " Alexandre Belloni
2015-06-29  9:26     ` Alexandre Belloni
2015-06-29  9:26     ` Alexandre Belloni

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20150629092354.GW485@piout.net \
    --to=alexandre.belloni@free-electrons.com \
    --cc=a.zummo@towertech.it \
    --cc=kernel@pengutronix.de \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@arm.linux.org.uk \
    --cc=rtc-linux@googlegroups.com \
    --cc=shawn.guo@linaro.org \
    --cc=tremyfr@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.