#include <linux/clockchips.h>
#include <linux/clocksource.h>
#include <linux/interrupt.h>
#include <linux/of_address.h>
#include <linux/of_irq.h>
#define TIMER_NAME "timer-keystone"
#define TCR_ENAMODE_MASK 0xC0
#define TCR_ENAMODE_ONESHOT_MASK 0x40
#define TCR_ENAMODE_PERIODIC_MASK 0x80
#define TGCR_TIM_UNRESET_MASK 0x03
#define INTCTLSTAT_ENINT_MASK 0x01
static struct keystone_timer {
struct clock_event_device event_dev;
static inline u32 keystone_timer_readl(unsigned long rg)
return readl_relaxed(timer.base + rg);
static inline void keystone_timer_writel(u32 val, unsigned long rg)
writel_relaxed(val, timer.base + rg);