Linux MIPS Architecture development
 help / color / mirror / Atom feed
From: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
To: Manuel Lauss <manuel.lauss@gmail.com>,
	Linux-MIPS <linux-mips@linux-mips.org>
Cc: Ralf Baechle <ralf@linux-mips.org>
Subject: Re: [PATCH 1/2] MIPS: Alchemy: fix Au1000/Au1500 LRCLK calculation
Date: Thu, 29 Jan 2015 13:35:45 +0300	[thread overview]
Message-ID: <54CA0D01.2080905@cogentembedded.com> (raw)
In-Reply-To: <1422525243-1756-1-git-send-email-manuel.lauss@gmail.com>

Hello.

On 1/29/2015 12:54 PM, Manuel Lauss wrote:

> The Au1000 and Au1500 calculate the LRCLK a bit differently than
> newer models: a single bit in MEM_STCFG0 selects if pclk is divided
> by 4 or 5.

> Signed-off-by: Manuel Lauss <manuel.lauss@gmail.com>
> ---
>   arch/mips/alchemy/common/clock.c | 20 +++++++++++++++-----
>   1 file changed, 15 insertions(+), 5 deletions(-)

> diff --git a/arch/mips/alchemy/common/clock.c b/arch/mips/alchemy/common/clock.c
> index 48a9dfc..428c9f0 100644
> --- a/arch/mips/alchemy/common/clock.c
> +++ b/arch/mips/alchemy/common/clock.c
> @@ -315,17 +315,27 @@ static struct clk __init *alchemy_clk_setup_mem(const char *pn, int ct)
>
>   /* lrclk: external synchronous static bus clock ***********************/
>
> -static struct clk __init *alchemy_clk_setup_lrclk(const char *pn)
> +static struct clk __init *alchemy_clk_setup_lrclk(const char *pn, int t)
>   {
> -	/* MEM_STCFG0[15:13] = divisor.
> +	/* Au1000, Au1500: MEM_STCFG0[11]: If bit is set, lrclk=pclk/5,
> +	 * otherwise lrclk=pclk/4.
> +	 * All other variants: MEM_STCFG0[15:13] = divisor.
>   	 * L/RCLK = periph_clk / (divisor + 1)
>   	 * On Au1000, Au1500, Au1100 it's called LCLK,
>   	 * on later models it's called RCLK, but it's the same thing.
>   	 */
>   	struct clk *c;
> -	unsigned long v = alchemy_rdsmem(AU1000_MEM_STCFG0) >> 13;
> +	unsigned long v;
>
> -	v = (v & 7) + 1;
> +	switch (t) {
> +	case ALCHEMY_CPU_AU1000:
> +	case ALCHEMY_CPU_AU1500:
> +		v = 4 + ((alchemy_rdsmem(AU1000_MEM_STCFG0) >> 11) & 1);
> +		break;
> +	default:	/* all other models */
> +		v = alchemy_rdsmem(AU1000_MEM_STCFG0) >> 13;

    How about reading MEM_STCFG0 only once, before *switch*?

[...]

WBR, Sergei

      parent reply	other threads:[~2015-01-29 10:35 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-29  9:54 [PATCH 1/2] MIPS: Alchemy: fix Au1000/Au1500 LRCLK calculation Manuel Lauss
2015-01-29  9:54 ` [PATCH 2/2] MIPS: Alchemy: preset loops_per_jiffy based on CPU clock Manuel Lauss
2015-01-29 10:38   ` Sergei Shtylyov
2015-01-29 10:35 ` Sergei Shtylyov [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=54CA0D01.2080905@cogentembedded.com \
    --to=sergei.shtylyov@cogentembedded.com \
    --cc=linux-mips@linux-mips.org \
    --cc=manuel.lauss@gmail.com \
    --cc=ralf@linux-mips.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