From: Anton Vorontsov <avorontsov@ru.mvista.com>
To: Scott Wood <scottwood@freescale.com>
Cc: linuxppc-dev@ozlabs.org
Subject: Re: [PATCH 6/8] [POWERPC] sysdev,qe_lib: implement FSL GTM support
Date: Thu, 17 Apr 2008 19:07:55 +0400 [thread overview]
Message-ID: <20080417150755.GA29239@polina.dev.rtsoft.ru> (raw)
In-Reply-To: <20080417141903.GB21793@ld0162-tx32.am.freescale.net>
On Thu, Apr 17, 2008 at 09:19:03AM -0500, Scott Wood wrote:
> On Thu, Apr 17, 2008 at 04:52:35PM +0400, Anton Vorontsov wrote:
> > Heh. Scott, think about it. You have single 16bit timer with variable
> > frequency. To use it, you'd better know what exactly precision you need.
>
> Why? I know the timeout I need.
>
> > Then you limited to u16 for the interval for this chosen precision.
> >
> > Yes, you can implement this:
> >
> > #define MAX_PRESCALER (256 * 256 * 16)
> >
> > int gtm_reset_weird_behaving_utimer16(struct gtm_timer *tmr,
> > unsigned long long usec,
> > bool free_run)
> > {
> > int freq = 1000000;
> > int min_hz2 = (tmr->gtm->freq / MAX_PRESCALER) << 1;
> >
> > while (!(freq & 1) && !(usec & 1) && freq >= min_hz2) {
> > freq >>= 1;
> > usec >>= 1;
> > }
> >
> > if (usec > 0xffff)
> > return -EINVAL;
> >
> > return gtm_reset_ref_timer16(tmr, freq, (u16)usec, free_run);
> > }
>
> Try something like this:
>
> int gtm_reset_sane_behaving_timer(struct gtm_timer *tmr,
> u64 usec, bool free_run)
> {
> int freq = 1000000;
> int min_hz2 = (tmr->gtm->freq / MAX_PRESCALER) << 1;
>
> while (usec > 0xffff && freq >= min_hz2) {
This isn't a timer with usec precision! This is a timer that silently
crops precision as it wants to. Ahh, I see you dropped "u" prefix.
Well. I'm not going to use it anyway, so just give it some name you
prefer and I'll wrap it into the patch. Preferably, drop a line here with
kerneldoc for it, so I'll not have to document its drawbacks. :-)
> freq >>= 1;
> usec >>= 1;
> }
>
> if (usec > 0xffff)
> return -EINVAL;
>
> return gtm_reset_ref_timer16(tmr, freq, usec, free_run);
> }
>
> It could be made faster using cntlzw.
No need to cntlzw, there is fls() already. Though, here you'll need
two because of u64.
Btw, I hope you aware that single GTM timer running at 166MHz will give you
6 minutes of sleep, maximum. With cascaded timer you'll get much better
result of 310 days. Is that possible to use cascaded timer as a wakeup
event on 8313? If so, I'd suggest you to implement cascading firstly.
--
Anton Vorontsov
email: cbouatmailru@gmail.com
irc://irc.freenode.net/bd2
next prev parent reply other threads:[~2008-04-17 15:07 UTC|newest]
Thread overview: 50+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-03-11 17:21 [PATCH 0/8] A bit of new code and sparse cleanups along the way Anton Vorontsov
2008-03-11 17:23 ` [PATCH 1/8] [POWERPC] fsl_elbc_nand: factor out localbus defines Anton Vorontsov
2008-04-11 14:06 ` Kumar Gala
2008-04-11 14:06 ` Kumar Gala
2008-04-13 12:53 ` David Woodhouse
2008-04-13 12:53 ` David Woodhouse
2008-04-14 15:10 ` Kumar Gala
2008-03-11 17:24 ` [PATCH 2/8] [POWERPC] fsl_lbc: implement few routines to manage FSL UPMs Anton Vorontsov
2008-04-11 14:09 ` Kumar Gala
2008-04-11 16:13 ` Anton Vorontsov
2008-04-11 16:18 ` Scott Wood
2008-04-11 17:03 ` Anton Vorontsov
2008-04-12 4:09 ` Paul Mackerras
2008-04-14 15:11 ` Kumar Gala
2008-03-11 17:24 ` [PATCH 3/8] [POWERPC] qe_lib: implement qe_muram_offset Anton Vorontsov
2008-03-18 17:48 ` Scott Wood
2008-04-14 15:11 ` Kumar Gala
2008-03-11 17:24 ` [PATCH 4/8] [POWERPC] immap_qe.h should include asm/io.h Anton Vorontsov
2008-04-14 15:11 ` Kumar Gala
2008-03-11 17:24 ` [PATCH 5/8] [POWERPC] qe_lib: export qe_get_brg_clk() Anton Vorontsov
2008-03-11 18:36 ` Kumar Gala
2008-03-11 18:44 ` Anton Vorontsov
2008-04-14 15:11 ` Kumar Gala
2008-03-11 17:24 ` [PATCH 6/8] [POWERPC] sysdev,qe_lib: implement FSL GTM support Anton Vorontsov
2008-03-18 17:43 ` Scott Wood
2008-03-18 19:21 ` Anton Vorontsov
2008-03-18 19:55 ` Scott Wood
2008-03-18 20:27 ` Anton Vorontsov
2008-03-18 20:48 ` Scott Wood
2008-04-16 18:39 ` Anton Vorontsov
2008-04-16 18:44 ` Scott Wood
2008-04-16 21:00 ` Anton Vorontsov
2008-04-16 21:58 ` Scott Wood
2008-04-17 12:52 ` Anton Vorontsov
2008-04-17 14:19 ` Scott Wood
2008-04-17 15:07 ` Anton Vorontsov [this message]
2008-04-17 16:14 ` Scott Wood
2008-04-17 16:43 ` Anton Vorontsov
2008-04-17 14:23 ` Laurent Pinchart
2008-04-17 15:13 ` Anton Vorontsov
2008-04-17 16:12 ` Anton Vorontsov
2008-04-08 9:01 ` Laurent Pinchart
2008-04-08 11:48 ` Anton Vorontsov
2008-03-11 17:24 ` [PATCH 7/8] [POWERPC] qe_lib: add support for QE USB Anton Vorontsov
2008-04-14 20:29 ` Kumar Gala
2008-03-11 17:24 ` [PATCH 8/8] [POWERPC] qe_io: fix sparse warnings Anton Vorontsov
2008-04-14 15:12 ` Kumar Gala
2008-04-14 15:14 ` [PATCH 0/8] A bit of new code and sparse cleanups along the way Kumar Gala
2008-04-14 17:49 ` Anton Vorontsov
-- strict thread matches above, loose matches on Subject: below --
2008-04-17 16:22 [PATCH 6/8] [POWERPC] sysdev,qe_lib: implement FSL GTM support Scott Wood
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=20080417150755.GA29239@polina.dev.rtsoft.ru \
--to=avorontsov@ru.mvista.com \
--cc=linuxppc-dev@ozlabs.org \
--cc=scottwood@freescale.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.