public inbox for linux-arm-kernel@lists.infradead.org
 help / color / mirror / Atom feed
From: mturquette@ti.com (Mike Turquette)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH] CLK: vt8500: Fix SDMMC clk special cases
Date: Fri, 9 Nov 2012 16:53:41 -0800	[thread overview]
Message-ID: <20121110005341.17381.11996@nucleus> (raw)
In-Reply-To: <1350552413-24452-1-git-send-email-linux@prisktech.co.nz>

Quoting Tony Prisk (2012-10-18 02:26:53)
> This patch adds some additional handling for the SDMMC special case
> in round_rate and set_rate which results in invalid divisor messages
> at boot time.
> 
> Signed-off-by: Tony Prisk <linux@prisktech.co.nz>

Taken into clk-next.

Thanks,
Mike

> ---
>  drivers/clk/clk-vt8500.c |   18 ++++++++++++++++++
>  1 file changed, 18 insertions(+)
> 
> diff --git a/drivers/clk/clk-vt8500.c b/drivers/clk/clk-vt8500.c
> index a885600..fe25570 100644
> --- a/drivers/clk/clk-vt8500.c
> +++ b/drivers/clk/clk-vt8500.c
> @@ -120,8 +120,17 @@ static unsigned long vt8500_dclk_recalc_rate(struct clk_hw *hw,
>  static long vt8500_dclk_round_rate(struct clk_hw *hw, unsigned long rate,
>                                 unsigned long *prate)
>  {
> +       struct clk_device *cdev = to_clk_device(hw);
>         u32 divisor = *prate / rate;
>  
> +       /*
> +        * If this is a request for SDMMC we have to adjust the divisor
> +        * when >31 to use the fixed predivisor
> +        */
> +       if ((cdev->div_mask == 0x3F) && (divisor > 31)) {
> +               divisor = 64 * ((divisor / 64) + 1);
> +       }
> +
>         return *prate / divisor;
>  }
>  
> @@ -135,6 +144,15 @@ static int vt8500_dclk_set_rate(struct clk_hw *hw, unsigned long rate,
>         if (divisor == cdev->div_mask + 1)
>                 divisor = 0;
>  
> +       /* SDMMC mask may need to be corrected before testing if its valid */
> +       if ((cdev->div_mask == 0x3F) && (divisor > 31)) {
> +               /*
> +                * Bit 5 is a fixed /64 predivisor. If the requested divisor
> +                * is >31 then correct for the fixed divisor being required.
> +                */
> +               divisor = 0x20 + (divisor / 64);
> +       }
> +
>         if (divisor > cdev->div_mask) {
>                 pr_err("%s: invalid divisor for clock\n", __func__);
>                 return -EINVAL;
> -- 
> 1.7.9.5

      reply	other threads:[~2012-11-10  0:53 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-10-18  9:26 [PATCH] CLK: vt8500: Fix SDMMC clk special cases Tony Prisk
2012-11-10  0:53 ` Mike Turquette [this message]

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=20121110005341.17381.11996@nucleus \
    --to=mturquette@ti.com \
    --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