Linux-ARM-Kernel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: linux@arm.linux.org.uk (Russell King - ARM Linux)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 5/5] clk: versatile: respect parent rate in ICST clock
Date: Mon, 20 Jan 2014 21:12:07 +0000	[thread overview]
Message-ID: <20140120211207.GI15937@n2100.arm.linux.org.uk> (raw)
In-Reply-To: <1390251332-6411-1-git-send-email-linus.walleij@linaro.org>

On Mon, Jan 20, 2014 at 09:55:32PM +0100, Linus Walleij wrote:
> If the ICST clock has a parent, respect the rate of the parent
> when calculating the clock frequency. Alter const arguments
> as this involves modifying the ICST parameter struct, and do
> not define the reference clock on the Integrator as we have
> the reference clock from the device tree. Keep it everywhere
> else.

This is not what I'd call a good idea.

> @@ -84,6 +84,8 @@ static unsigned long icst_recalc_rate(struct clk_hw *hw,
>  	struct clk_icst *icst = to_icst(hw);
>  	struct icst_vco vco;
>  
> +	if (parent_rate)
> +		icst->params->ref = parent_rate;
...
> diff --git a/drivers/clk/versatile/clk-impd1.c b/drivers/clk/versatile/clk-impd1.c
> index 6d8b8e1a080a..a3edc0463517 100644
> --- a/drivers/clk/versatile/clk-impd1.c
> +++ b/drivers/clk/versatile/clk-impd1.c
> @@ -39,7 +39,7 @@ static struct impd1_clk impd1_clks[4];
>   * There are two VCO's on the IM-PD1
>   */
>  
> -static const struct icst_params impd1_vco1_params = {
> +static struct icst_params impd1_vco1_params = {
>  	.ref		= 24000000,	/* 24 MHz */
>  	.vco_max	= ICST525_VCO_MAX_3V,
>  	.vco_min	= ICST525_VCO_MIN,
> @@ -57,7 +57,7 @@ static const struct clk_icst_desc impd1_icst1_desc = {
>  	.lock_offset = IMPD1_LOCK,
>  };
>  
> -static const struct icst_params impd1_vco2_params = {
> +static struct icst_params impd1_vco2_params = {
>  	.ref		= 24000000,	/* 24 MHz */
>  	.vco_max	= ICST525_VCO_MAX_3V,
>  	.vco_min	= ICST525_VCO_MIN,

Right, so we end up writing directly into these _shared_ _statically_
_allocated_ structures.

> diff --git a/drivers/clk/versatile/clk-realview.c b/drivers/clk/versatile/clk-realview.c
> index c8b523117fb7..a1491590e028 100644
> --- a/drivers/clk/versatile/clk-realview.c
> +++ b/drivers/clk/versatile/clk-realview.c
> @@ -21,7 +21,7 @@
>   * Implementation of the ARM RealView clock trees.
>   */
>  
> -static const struct icst_params realview_oscvco_params = {
> +static struct icst_params realview_oscvco_params = {
>  	.ref		= 24000000,

And this one is shared by two different VCOs.  Thankfully, the only
reason this isn't a problem is because they're both sourced from a
24MHz clock.

-- 
FTTC broadband for 0.8mile line: 5.8Mbps down 500kbps up.  Estimation
in database were 13.1 to 19Mbit for a good line, about 7.5+ for a bad.
Estimate before purchase was "up to 13.2Mbit".

  reply	other threads:[~2014-01-20 21:12 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-01-20 20:55 [PATCH 5/5] clk: versatile: respect parent rate in ICST clock Linus Walleij
2014-01-20 21:12 ` Russell King - ARM Linux [this message]
2014-01-20 21:16   ` Linus Walleij
2014-01-20 21:33     ` Russell King - ARM Linux

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=20140120211207.GI15937@n2100.arm.linux.org.uk \
    --to=linux@arm.linux.org.uk \
    --cc=linux-arm-kernel@lists.infradead.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox