public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* Writing clocksource driver, tips?
@ 2014-08-31 16:46 Oleksij Rempel
  2014-09-01  8:35 ` Thomas Gleixner
  0 siblings, 1 reply; 2+ messages in thread
From: Oleksij Rempel @ 2014-08-31 16:46 UTC (permalink / raw)
  To: linux-kernel, Thomas Gleixner, Daniel Lezcano

[-- Attachment #1: Type: text/plain, Size: 1109 bytes --]

Hello all,

currently i work on porting linux to Aplscale ASM9260,
most basic parts are done, now is the time for clocksource driver. I
never did it before, so i need some beginner tips.
My current driver clocksource provide periodic events at 100Hz rate. But
this hardvare can do more then it.
This SoC has 4 32bit-timer controller attached to 100MHz source. Each
controller has 4 separate timer register each of them can be configure
separately for scale, match and interrupt. 3 controllers can choice the
tick source.
This controller looks similar to one found on NXP LPC1311, but looks
like no similar hardware in drivers/clocksource.

For now i have fallowing questions:
- 1 timer can be used for clocksource other as  clock_event_device, how
can i use other 2 timers on same controller. and how can i use other 3
controllers?
- theoretically i can use clocksource_mmio_init to read directly
timer_counter_register. Which scale should be used on it. 100MHz is
probably too match.
- should clocksource provide interrupt on overflow or some kind of limit?

-- 
Regards,
Oleksij


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 213 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Writing clocksource driver, tips?
  2014-08-31 16:46 Writing clocksource driver, tips? Oleksij Rempel
@ 2014-09-01  8:35 ` Thomas Gleixner
  0 siblings, 0 replies; 2+ messages in thread
From: Thomas Gleixner @ 2014-09-01  8:35 UTC (permalink / raw)
  To: Oleksij Rempel; +Cc: linux-kernel, Daniel Lezcano

On Sun, 31 Aug 2014, Oleksij Rempel wrote:
> - 1 timer can be used for clocksource other as  clock_event_device, how
> can i use other 2 timers on same controller. and how can i use other 3
> controllers?

All you need is two.

One for the clocksource (free running counter):

    100MHz is fine, it gives the timekeeping code nice
    granularity. There is no need for a wrap around interrupt. The
    core code knows how to deal with it.

The second one is for the clock event device

    Avoid a match timer if possible, it's a pain in the neck. Either a
    autoreloading timer for the periodic mode or a simple downcounting
    one for one shot mode is good enough.

The other timers are not of any value for Linux. Just leave them
alone.

Thanks,

	tglx

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2014-09-01  8:35 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-08-31 16:46 Writing clocksource driver, tips? Oleksij Rempel
2014-09-01  8:35 ` Thomas Gleixner

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox