#include <linux/bitfield.h>
#include <linux/bitops.h>
#include <linux/clk.h>
#include <linux/clk-provider.h>
#include <linux/clockchips.h>
#include <linux/clocksource.h>
#include <linux/interrupt.h>
#include <linux/mfd/syscon.h>
#include <linux/of_address.h>
#include <linux/of_irq.h>
#include <linux/sched_clock.h>
#include <linux/slab.h>
#include <linux/syscore_ops.h>
#include <dt-bindings/clock/ingenic,sysost.h>
#define OST_REG_OSTCCR …
#define OST_REG_OSTCR …
#define OST_REG_OSTFR …
#define OST_REG_OSTMR …
#define OST_REG_OST1DFR …
#define OST_REG_OST1CNT …
#define OST_REG_OST2CNTL …
#define OST_REG_OSTCNT2HBUF …
#define OST_REG_OSTESR …
#define OST_REG_OSTECR …
#define OSTCCR_PRESCALE1_MASK …
#define OSTCCR_PRESCALE2_MASK …
#define OSTCR_OST1CLR …
#define OSTCR_OST2CLR …
#define OSTFR_FFLAG …
#define OSTMR_FMASK …
#define OSTESR_OST1ENS …
#define OSTESR_OST2ENS …
#define OSTECR_OST1ENC …
#define OSTECR_OST2ENC …
struct ingenic_soc_info { … };
struct ingenic_ost_clk_info { … };
struct ingenic_ost_clk { … };
struct ingenic_ost { … };
static struct ingenic_ost *ingenic_ost;
static inline struct ingenic_ost_clk *to_ost_clk(struct clk_hw *hw)
{ … }
static unsigned long ingenic_ost_percpu_timer_recalc_rate(struct clk_hw *hw,
unsigned long parent_rate)
{ … }
static unsigned long ingenic_ost_global_timer_recalc_rate(struct clk_hw *hw,
unsigned long parent_rate)
{ … }
static u8 ingenic_ost_get_prescale(unsigned long rate, unsigned long req_rate)
{ … }
static long ingenic_ost_round_rate(struct clk_hw *hw, unsigned long req_rate,
unsigned long *parent_rate)
{ … }
static int ingenic_ost_percpu_timer_set_rate(struct clk_hw *hw, unsigned long req_rate,
unsigned long parent_rate)
{ … }
static int ingenic_ost_global_timer_set_rate(struct clk_hw *hw, unsigned long req_rate,
unsigned long parent_rate)
{ … }
static const struct clk_ops ingenic_ost_percpu_timer_ops = …;
static const struct clk_ops ingenic_ost_global_timer_ops = …;
static const char * const ingenic_ost_clk_parents[] = …;
static const struct ingenic_ost_clk_info x1000_ost_clk_info[] = …;
static u64 notrace ingenic_ost_global_timer_read_cntl(void)
{ … }
static u64 notrace ingenic_ost_clocksource_read(struct clocksource *cs)
{ … }
static inline struct ingenic_ost *to_ingenic_ost(struct clock_event_device *evt)
{ … }
static int ingenic_ost_cevt_set_state_shutdown(struct clock_event_device *evt)
{ … }
static int ingenic_ost_cevt_set_next(unsigned long next,
struct clock_event_device *evt)
{ … }
static irqreturn_t ingenic_ost_cevt_cb(int irq, void *dev_id)
{ … }
static int __init ingenic_ost_register_clock(struct ingenic_ost *ost,
unsigned int idx, const struct ingenic_ost_clk_info *info,
struct clk_hw_onecell_data *clocks)
{ … }
static struct clk * __init ingenic_ost_get_clock(struct device_node *np, int id)
{ … }
static int __init ingenic_ost_percpu_timer_init(struct device_node *np,
struct ingenic_ost *ost)
{ … }
static int __init ingenic_ost_global_timer_init(struct device_node *np,
struct ingenic_ost *ost)
{ … }
static const struct ingenic_soc_info x1000_soc_info = …;
static const struct of_device_id __maybe_unused ingenic_ost_of_matches[] __initconst = …;
static int __init ingenic_ost_probe(struct device_node *np)
{ … }
static int __init ingenic_ost_init(struct device_node *np)
{ … }
TIMER_OF_DECLARE(x1000_ost, "ingenic,x1000-ost", ingenic_ost_init);