TIMER_OF_DECLARE(orion_timer, "marvell,orion-timer", orion_timer_init);
#include <linux/kernel.h>
#include <linux/bitops.h>
#include <linux/clockchips.h>
#include <linux/interrupt.h>
#include <linux/of_address.h>
#include <linux/of_irq.h>
#include <linux/spinlock.h>
#include <linux/sched_clock.h>
#define TIMER0_RELOAD_EN BIT(1)
#define TIMER1_RELOAD_EN BIT(3)
#define TIMER0_RELOAD 0x10
#define TIMER1_RELOAD 0x18
#define ORION_ONESHOT_MIN 1
#define ORION_ONESHOT_MAX 0xfffffffe
static void __iomem *timer_base;
static unsigned long notrace orion_read_timer(void)
return ~readl(timer_base + TIMER0_VAL);
static struct delay_timer orion_delay_timer = {
.read_current_timer = orion_read_timer,
static void orion_delay_timer_init(unsigned long rate)
orion_delay_timer.freq = rate;
register_current_timer_delay(&orion_delay_timer);
static u64 notrace orion_read_sched_clock(void)
return ~readl(timer_base + TIMER0_VAL);