All of lore.kernel.org
 help / color / mirror / Atom feed
From: Maarten ter Huurne <maarten@treewalker.org>
To: Sergei Shtylyov <sshtylyov@mvista.com>
Cc: Ralf Baechle <ralf@linux-mips.org>,
	Lars-Peter Clausen <lars@metafoo.de>,
	linux-mips@linux-mips.org
Subject: Re: [PATCH] MIPS: JZ4740: reset: Initialize hibernate wakeup counters.
Date: Fri, 30 Mar 2012 16:07:41 +0200	[thread overview]
Message-ID: <27793108.UosBlGQXP9@hyperion> (raw)
In-Reply-To: <4F75A5C3.9000405@mvista.com>

On Friday 30 March 2012 16:23:31 Sergei Shtylyov wrote:

[...]

> > +static void jz4740_power_off(void)
> > +{
> > +	void __iomem *rtc_base = ioremap(JZ4740_RTC_BASE_ADDR, 0x38);
> > +	unsigned long long wakeup_filter_ticks;
> > +	unsigned long long reset_counter_ticks;
> > +
> > +	/* Set minimum wakeup pin assertion time: 100 ms.
> > +	   Range is 0 to 2 sec if RTC is clocked at 32 kHz. */
> > +	wakeup_filter_ticks = (100 * jz4740_clock_bdata.rtc_rate) / 1000;
> > +	if (wakeup_filter_ticks<  JZ_RTC_WAKEUP_FILTER_MASK)
> > +		wakeup_filter_ticks&= JZ_RTC_WAKEUP_FILTER_MASK;
> > +	else
> > +		wakeup_filter_ticks = JZ_RTC_WAKEUP_FILTER_MASK;
> > +	jz4740_rtc_wait_ready(rtc_base);
> > +	writel(wakeup_filter_ticks, rtc_base + JZ_REG_RTC_WAKEUP_FILTER);
> 
>     Writing 64-bit variable to a 32-bit register?

Actually the variable can be 32-bit: rtc_rate is in kHz, so the computation 
would wrap around for an RTC clock of over 40 GHz and I'm sure that is far 
more than the hardware supports.

I'll prepare a new patch fixing this and the other issues you mentioned. 
Thanks for reviewing.

Bye,
		Maarten

  reply	other threads:[~2012-03-30 14:01 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-03-29 16:19 [PATCH] MIPS: JZ4740: reset: Initialize hibernate wakeup counters Maarten ter Huurne
2012-03-30 12:23 ` Sergei Shtylyov
2012-03-30 14:07   ` Maarten ter Huurne [this message]
2012-03-30 14:18     ` Maarten ter Huurne
2012-03-30 14:32     ` Maarten ter Huurne

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=27793108.UosBlGQXP9@hyperion \
    --to=maarten@treewalker.org \
    --cc=lars@metafoo.de \
    --cc=linux-mips@linux-mips.org \
    --cc=ralf@linux-mips.org \
    --cc=sshtylyov@mvista.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.