Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Macros | Functions
dw_apb_timer.c File Reference
#include <linux/dw_apb_timer.h>
#include <linux/delay.h>
#include <linux/kernel.h>
#include <linux/interrupt.h>
#include <linux/irq.h>
#include <linux/io.h>
#include <linux/slab.h>

Go to the source code of this file.

Macros

#define APBT_MIN_PERIOD   4
 
#define APBT_MIN_DELTA_USEC   200
 
#define APBTMR_N_LOAD_COUNT   0x00
 
#define APBTMR_N_CURRENT_VALUE   0x04
 
#define APBTMR_N_CONTROL   0x08
 
#define APBTMR_N_EOI   0x0c
 
#define APBTMR_N_INT_STATUS   0x10
 
#define APBTMRS_INT_STATUS   0xa0
 
#define APBTMRS_EOI   0xa4
 
#define APBTMRS_RAW_INT_STATUS   0xa8
 
#define APBTMRS_COMP_VERSION   0xac
 
#define APBTMR_CONTROL_ENABLE   (1 << 0)
 
#define APBTMR_CONTROL_MODE_PERIODIC   (1 << 1)
 
#define APBTMR_CONTROL_INT   (1 << 2)
 

Functions

void dw_apb_clockevent_pause (struct dw_apb_clock_event_device *dw_ced)
 
: The name used for the timer and the IRQ for it.

dw_apb_clockevent_init() - use an APB timer as a clock_event_device

: The CPU the events will be targeted at.

: The rating to give the timer. : I/O base for the timer registers. : The interrupt number to use for the timer. : The frequency that the timer counts at.

This creates a clock_event_device for using with the generic clock layer but does not start and register it. This should be done with dw_apb_clockevent_register() as the next step. If this is the first time it has been called for a timer then the IRQ will be requested, if not it just be enabled to allow CPU hotplug to avoid repeatedly requesting and releasing the IRQ.

struct dw_apb_clock_event_devicedw_apb_clockevent_init (int cpu, const char *name, unsigned rating, void __iomem *base, int irq, unsigned long freq)
 
void dw_apb_clockevent_resume (struct dw_apb_clock_event_device *dw_ced)
 
void dw_apb_clockevent_stop (struct dw_apb_clock_event_device *dw_ced)
 
void dw_apb_clockevent_register (struct dw_apb_clock_event_device *dw_ced)
 
void dw_apb_clocksource_start (struct dw_apb_clocksource *dw_cs)
 
: The name for the clocksource.

dw_apb_clocksource_init() - use an APB timer as a clocksource.

: The rating to give the clocksource.

: The I/O base for the timer registers. : The frequency that the timer counts at.

This creates a clocksource using an APB timer but does not yet register it with the clocksource system. This should be done with dw_apb_clocksource_register() as the next step.

struct dw_apb_clocksourcedw_apb_clocksource_init (unsigned rating, const char *name, void __iomem *base, unsigned long freq)
 
void dw_apb_clocksource_register (struct dw_apb_clocksource *dw_cs)
 
cycle_t dw_apb_clocksource_read (struct dw_apb_clocksource *dw_cs)
 
void dw_apb_clocksource_unregister (struct dw_apb_clocksource *dw_cs)
 

Macro Definition Documentation

#define APBT_MIN_DELTA_USEC   200

Definition at line 22 of file dw_apb_timer.c.

#define APBT_MIN_PERIOD   4

Definition at line 21 of file dw_apb_timer.c.

#define APBTMR_CONTROL_ENABLE   (1 << 0)

Definition at line 35 of file dw_apb_timer.c.

#define APBTMR_CONTROL_INT   (1 << 2)

Definition at line 38 of file dw_apb_timer.c.

#define APBTMR_CONTROL_MODE_PERIODIC   (1 << 1)

Definition at line 37 of file dw_apb_timer.c.

#define APBTMR_N_CONTROL   0x08

Definition at line 26 of file dw_apb_timer.c.

#define APBTMR_N_CURRENT_VALUE   0x04

Definition at line 25 of file dw_apb_timer.c.

#define APBTMR_N_EOI   0x0c

Definition at line 27 of file dw_apb_timer.c.

#define APBTMR_N_INT_STATUS   0x10

Definition at line 28 of file dw_apb_timer.c.

#define APBTMR_N_LOAD_COUNT   0x00

Definition at line 24 of file dw_apb_timer.c.

#define APBTMRS_COMP_VERSION   0xac

Definition at line 33 of file dw_apb_timer.c.

#define APBTMRS_EOI   0xa4

Definition at line 31 of file dw_apb_timer.c.

#define APBTMRS_INT_STATUS   0xa0

Definition at line 30 of file dw_apb_timer.c.

#define APBTMRS_RAW_INT_STATUS   0xa8

Definition at line 32 of file dw_apb_timer.c.

Function Documentation

struct dw_apb_clock_event_device* dw_apb_clockevent_init ( int  cpu,
const char name,
unsigned  rating,
void __iomem base,
int  irq,
unsigned long  freq 
)
read

Definition at line 215 of file dw_apb_timer.c.

void dw_apb_clockevent_pause ( struct dw_apb_clock_event_device dw_ced)

dw_apb_clockevent_pause() - stop the clock_event_device from running

: The APB clock to stop generating events.

Definition at line 76 of file dw_apb_timer.c.

void dw_apb_clockevent_register ( struct dw_apb_clock_event_device dw_ced)

dw_apb_clockevent_register() - register the clock with the generic layer

: The APB clock to register as a clock_event_device.

Definition at line 285 of file dw_apb_timer.c.

void dw_apb_clockevent_resume ( struct dw_apb_clock_event_device dw_ced)

dw_apb_clockevent_resume() - resume a clock that has been paused.

: The APB clock to resume.

Definition at line 265 of file dw_apb_timer.c.

void dw_apb_clockevent_stop ( struct dw_apb_clock_event_device dw_ced)

dw_apb_clockevent_stop() - stop the clock_event_device and release the IRQ.

: The APB clock to stop generating the events.

Definition at line 275 of file dw_apb_timer.c.

struct dw_apb_clocksource* dw_apb_clocksource_init ( unsigned  rating,
const char name,
void __iomem base,
unsigned long  freq 
)
read

Definition at line 351 of file dw_apb_timer.c.

cycle_t dw_apb_clocksource_read ( struct dw_apb_clocksource dw_cs)

dw_apb_clocksource_read() - read the current value of a clocksource.

: The clocksource to read.

Definition at line 386 of file dw_apb_timer.c.

void dw_apb_clocksource_register ( struct dw_apb_clocksource dw_cs)

dw_apb_clocksource_register() - register the APB clocksource.

: The clocksource to register.

Definition at line 376 of file dw_apb_timer.c.

void dw_apb_clocksource_start ( struct dw_apb_clocksource dw_cs)

dw_apb_clocksource_start() - start the clocksource counting.

: The clocksource to start.

This is used to start the clocksource before registration and can be used to enable calibration of timers.

Definition at line 300 of file dw_apb_timer.c.

void dw_apb_clocksource_unregister ( struct dw_apb_clocksource dw_cs)

dw_apb_clocksource_unregister() - unregister and free a clocksource.

: The clocksource to unregister/free.

Definition at line 396 of file dw_apb_timer.c.