linux-clk.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Stephen Boyd <sboyd@codeaurora.org>
To: Ralf Baechle <ralf@linux-mips.org>
Cc: Binbin Zhou <zhoubb@lemote.com>,
	Michael Turquette <mturquette@baylibre.com>,
	linux-clk@vger.kernel.org, John Crispin <john@phrozen.org>,
	"Steven J . Hill" <Steven.Hill@imgtec.com>,
	linux-mips@linux-mips.org, Fuxin Zhang <zhangfx@lemote.com>,
	Zhangjin Wu <wuzhangjin@gmail.com>,
	Kelvin Cheung <keguang.zhang@gmail.com>,
	Chunbo Cui <cuicb@lemote.com>, Huacai Chen <chenhc@lemote.com>
Subject: Re: [PATCH v3 5/8] MIPS: Loongson-1A: Workaround for pll register can't be read
Date: Fri, 22 Apr 2016 16:14:32 -0700	[thread overview]
Message-ID: <20160422231432.GE13149@codeaurora.org> (raw)
In-Reply-To: <20160404072925.GD13706@linux-mips.org>

On 04/04, Ralf Baechle wrote:
> On Tue, Mar 01, 2016 at 08:48:13AM +0800, Binbin Zhou wrote:
> > diff --git a/arch/mips/loongson32/common/platform.c b/arch/mips/loongson32/common/platform.c
> > index 97d8c01..a5bb1eb 100644
> > --- a/arch/mips/loongson32/common/platform.c
> > +++ b/arch/mips/loongson32/common/platform.c
> > @@ -63,9 +63,14 @@ struct platform_device ls1x_uart_pdev = {
> >  
> >  void __init ls1x_serial_setup(struct platform_device *pdev)
> >  {
> > -	struct clk *clk;
> >  	struct plat_serial8250_port *p;
> >  
> > +#ifdef CONFIG_CPU_LOONGSON1A
> > +	for (p = pdev->dev.platform_data; p->flags != 0; ++p)
> > +		p->uartclk = ls1a_osc_clk * 2;
> > +#else
> > +	struct clk *clk;
> > +
> >  	clk = clk_get(&pdev->dev, pdev->name);
> >  	if (IS_ERR(clk)) {
> >  		pr_err("unable to get %s clock, err=%ld",
> > @@ -76,6 +81,7 @@ void __init ls1x_serial_setup(struct platform_device *pdev)
> >  
> >  	for (p = pdev->dev.platform_data; p->flags != 0; ++p)
> >  		p->uartclk = clk_get_rate(clk);
> > +#endif

I don't understand this change. Does the framework not work well
enough to tell us the uart clk rate?

> >  }
> >  
> >  /* CPUFreq */
> > diff --git a/arch/mips/loongson32/common/time.c b/arch/mips/loongson32/common/time.c
> > index 0996b02..bba1c84 100644
> > --- a/arch/mips/loongson32/common/time.c
> > +++ b/arch/mips/loongson32/common/time.c
> > @@ -235,3 +235,19 @@ void __init plat_time_init(void)
> >  	mips_hpt_frequency = clk_get_rate(clk) / 2;
> >  #endif /* CONFIG_CEVT_CSRC_LS1X */
> >  }
> > +
> > +#ifdef CONFIG_CPU_LOONGSON1A
> > +unsigned int ls1a_osc_clk = 0, ls1a_cpu_mul = 0;
> > +
> > +static int __init get_cpu_clk(char *string)

Maybe name this function loongson_get_cpu_clk()?

> > diff --git a/drivers/clk/clk-ls1x.c b/drivers/clk/clk-ls1x.c
> > index d4c6198..18326fb 100644
> > --- a/drivers/clk/clk-ls1x.c
> > +++ b/drivers/clk/clk-ls1x.c
> > @@ -32,6 +32,14 @@ static void ls1x_pll_clk_disable(struct clk_hw *hw)
> >  static unsigned long ls1x_pll_recalc_rate(struct clk_hw *hw,
> >  					  unsigned long parent_rate)
> >  {
> > +#ifdef CONFIG_CPU_LOONGSON1A
> > +	/* workaround, loongson 1A pll register can't be read,
> > +	 * on gateway board, multi is set to 11 */
> > +	if (ls1a_osc_clk != 0 && ls1a_cpu_mul != 0)
> > +		return ls1a_osc_clk * ls1a_cpu_mul;
> > +	else
> > +		return 33333333 * 8;
> > +#else
> >  	u32 pll, rate;
> >  
> >  	pll = __raw_readl(LS1X_CLK_PLL_FREQ);
> > @@ -40,6 +48,7 @@ static unsigned long ls1x_pll_recalc_rate(struct clk_hw *hw,
> >  	rate >>= 1;
> >  
> >  	return rate;
> > +#endif
> >  }
> >  
> >  static const struct clk_ops ls1x_pll_clk_ops = {
> > @@ -107,7 +116,8 @@ void __init ls1x_clk_init(void)

Any reason we can't pass the rates to this function?

-- 
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project

      reply	other threads:[~2016-04-22 23:14 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1456793296-17120-1-git-send-email-zhoubb@lemote.com>
     [not found] ` <1456793296-17120-6-git-send-email-zhoubb@lemote.com>
2016-04-04  7:29   ` [PATCH v3 5/8] MIPS: Loongson-1A: Workaround for pll register can't be read Ralf Baechle
2016-04-22 23:14     ` Stephen Boyd [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=20160422231432.GE13149@codeaurora.org \
    --to=sboyd@codeaurora.org \
    --cc=Steven.Hill@imgtec.com \
    --cc=chenhc@lemote.com \
    --cc=cuicb@lemote.com \
    --cc=john@phrozen.org \
    --cc=keguang.zhang@gmail.com \
    --cc=linux-clk@vger.kernel.org \
    --cc=linux-mips@linux-mips.org \
    --cc=mturquette@baylibre.com \
    --cc=ralf@linux-mips.org \
    --cc=wuzhangjin@gmail.com \
    --cc=zhangfx@lemote.com \
    --cc=zhoubb@lemote.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).