linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: linux@arm.linux.org.uk (Russell King - ARM Linux)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 2/3] plat-nomadik: Added suspend/resume support for MTU timer.
Date: Thu, 2 Sep 2010 17:04:43 +0100	[thread overview]
Message-ID: <20100902160443.GR26319@n2100.arm.linux.org.uk> (raw)
In-Reply-To: <1283412633-9883-2-git-send-email-jonas.aberg@stericsson.com>

"Added suspend/resume support for MTU timer."

Present tense, as it is describing what the patch is doing rather than
what has been done in the past?

On Thu, Sep 02, 2010 at 09:30:32AM +0200, Jonas Aaberg wrote:
> +static void nmdk_timer_reset(void)
> +{
> +	u32 cr = MTU_CRn_32BITS | MTU_CRn_ENA;
> +	struct clk *clk0;
> +
> +	clk0 = clk_get_sys("mtu0", NULL);
> +
> +	clk_enable(clk0);
> +
> +	if (clk_get_rate(clk0) > (16 << 20))

16 * 1048576 = 16.777216MHz

> +}
> +
> +#ifdef CONFIG_PM
> +void nmdk_timer_suspend(void)
> +{
> +	struct clk *clk0;
...
> +	clk0 = clk_get_sys("mtu0", NULL);
> +
> +	clk_disable(clk0);
> +}
>  void __init nmdk_timer_init(void)
>  {
>  	unsigned long rate;
>  	struct clk *clk0;
> -	u32 cr;
>  
> +	/*
> +	 * On MTU block 0: timer0 is used as source,
> +	 * timer1 is used for events.
> +	 */
>  	clk0 = clk_get_sys("mtu0", NULL);
>  	BUG_ON(IS_ERR(clk0));
>  
> -	clk_enable(clk0);
> -

Given all these calls to clk_get_sys() vs the 4 bytes consumed by having
a static clk0 pointer, is it really worth repeatedly using clk_get_sys() ?
Wouldn't the static pointer be more efficient?

>  	/*
> -	 * Tick rate is 2.4MHz for Nomadik and 110MHz for ux500:
> +	 * Tick rate is 2.4MHz for Nomadik and 100 or 133MHz for ux500:
>  	 * use a divide-by-16 counter if it's more than 16MHz
>  	 */
> -	cr = MTU_CRn_32BITS;;
>  	rate = clk_get_rate(clk0);
> -	if (rate > 16 << 20) {
> +	if (rate > (16 << 20))

n << 20 doesn't give you MHz, so this code doesn't match the comments.
Do you mean 16MHz or 16.777216MHz ?

  parent reply	other threads:[~2010-09-02 16:04 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-09-02  7:30 [PATCH 1/3] plat-nomadik: MTU timer Jonas Aaberg
2010-09-02  7:30 ` [PATCH 2/3] plat-nomadik: Added suspend/resume support for " Jonas Aaberg
2010-09-02  7:30   ` [PATCH 3/3] mach-ux500: Added nomadik mtu timer suspend/resume hooks Jonas Aaberg
2010-09-02 16:07     ` Russell King - ARM Linux
2010-09-06  7:27       ` Jonas Aaberg
2010-09-02 16:04   ` Russell King - ARM Linux [this message]
2010-09-02 19:30     ` [PATCH 2/3] plat-nomadik: Added suspend/resume support for MTU timer Linus Walleij
2010-09-03 11:49     ` Alessandro Rubini
2010-09-03 17:37       ` Linus Walleij
2010-09-06  7:20         ` Armando Visconti
2010-09-02 19:44   ` Linus Walleij
2010-09-02 19:45   ` Linus Walleij

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=20100902160443.GR26319@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;
as well as URLs for NNTP newsgroup(s).