All of lore.kernel.org
 help / color / mirror / Atom feed
From: Tony Lindgren <tony@atomide.com>
To: Kevin Hilman <khilman@deeprootsystems.com>
Cc: "Gurav , Pramod" <pramod.gurav@ti.com>,
	"linux-omap@vger.kernel.org" <linux-omap@vger.kernel.org>
Subject: Re: struct dmtimer definition not available in header file
Date: Wed, 10 Mar 2010 14:37:52 -0800	[thread overview]
Message-ID: <20100310223752.GV2900@atomide.com> (raw)
In-Reply-To: <87lje0glhj.fsf@deeprootsystems.com>

* Kevin Hilman <khilman@deeprootsystems.com> [100310 09:14]:
> "Gurav , Pramod" <pramod.gurav@ti.com> writes:
> 
> > Hi All,
> > I am using dmtimer in my code. Code looks like this:
> >
> > {
> >         static struct omap_dm_timer *gpt;
> >         void * __iomem gpt10_counter_reg;
> >         unsigned long gpt_phys_base;
> >
> >         omap_dm_timer_init();
> >         gpt = omap_dm_timer_request();
> >         if (!gpt) {
> >                 pr_err("Could not get the gptimer\n");
> >                 return -1;
> >         }
> >         omap_dm_timer_set_source(gpt, OMAP_TIMER_SRC_SYS_CLK);
> >
> >         gpt_phys_base = gpt->phys_base;
> >
> >         gpt10_counter_reg =
> >                         OMAP2_L4_IO_ADDRESS(gpt_phys_base +
> >                                         OMAP_TIMER_COUNTER_OFFSET);

We should use ioremap for allthings like this nowadays.
There are static mappings in place for that.

> >         gt_rate = clk_get_rate(omap_dm_timer_get_fclk(gpt));
> >         omap_dm_timer_set_load_start(gpt, 0, 0);
> > 	
> > 	.
> > 	.
> > 	.
> > }
> >
> > I am not able to reference *gpt as the file does not know about struct omap_dm_timer. I have included plat/dmtimer.h.
> >
> > Why doesn't the dmtimer struct definition appear in plat/dmtimer.h ?
> > Is there any reason for this?
> 
> The declaration appears there, but the definition is hidden.
> 
> In fact, it is is hidden to prevent exactly the type of thing you're
> trying to do, and to provide all access to DM timer details via the DM
> timer API.
> 
> Looking at your example, I'm guessing you're trying to implement one
> of my ideas for the SDRC delay calculation by passing the base address
> to the assembly routine.
> 
> As I suggested in my original patch, the better way to do this would
> be to extend the dmtimer API, and use C instead of assembly.

And if it's generic code, you're better off using Linux hrtimers
instead. Otherwise there's a good chance your timer won't wake up
the system from the idle mode and you miss the timer events.

Regards,

Tony

      parent reply	other threads:[~2010-03-10 22:36 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-03-10 14:25 struct dmtimer definition not available in header file Gurav , Pramod
2010-03-10 17:00 ` Kevin Hilman
2010-03-10 20:57   ` Cousson, Benoit
2010-03-11  4:57     ` Gurav , Pramod
2010-03-11 10:24       ` Cousson, Benoit
2010-03-10 22:37   ` Tony Lindgren [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=20100310223752.GV2900@atomide.com \
    --to=tony@atomide.com \
    --cc=khilman@deeprootsystems.com \
    --cc=linux-omap@vger.kernel.org \
    --cc=pramod.gurav@ti.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.