Writing clocksource driver, tips?

From: Oleksij Rempel
Date: Sun Aug 31 2014 - 12:46:28 EST


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: signature.asc
Description: OpenPGP digital signature