linux/drivers/clocksource/dw_apb_timer.c

// SPDX-License-Identifier: GPL-2.0-only
/*
 * (C) Copyright 2009 Intel Corporation
 * Author: Jacob Pan ([email protected])
 *
 * Shared with ARM platforms, Jamie Iles, Picochip 2011
 *
 * Support for the Synopsys DesignWare APB Timers.
 */
#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>

#define APBT_MIN_PERIOD
#define APBT_MIN_DELTA_USEC

#define APBTMR_N_LOAD_COUNT
#define APBTMR_N_CURRENT_VALUE
#define APBTMR_N_CONTROL
#define APBTMR_N_EOI
#define APBTMR_N_INT_STATUS

#define APBTMRS_INT_STATUS
#define APBTMRS_EOI
#define APBTMRS_RAW_INT_STATUS
#define APBTMRS_COMP_VERSION

#define APBTMR_CONTROL_ENABLE
/* 1: periodic, 0:free running. */
#define APBTMR_CONTROL_MODE_PERIODIC
#define APBTMR_CONTROL_INT

static inline struct dw_apb_clock_event_device *
ced_to_dw_apb_ced(struct clock_event_device *evt)
{}

static inline struct dw_apb_clocksource *
clocksource_to_dw_apb_clocksource(struct clocksource *cs)
{}

static inline u32 apbt_readl(struct dw_apb_timer *timer, unsigned long offs)
{}

static inline void apbt_writel(struct dw_apb_timer *timer, u32 val,
			unsigned long offs)
{}

static inline u32 apbt_readl_relaxed(struct dw_apb_timer *timer, unsigned long offs)
{}

static inline void apbt_writel_relaxed(struct dw_apb_timer *timer, u32 val,
			unsigned long offs)
{}

static void apbt_disable_int(struct dw_apb_timer *timer)
{}

/**
 * dw_apb_clockevent_pause() - stop the clock_event_device from running
 *
 * @dw_ced:	The APB clock to stop generating events.
 */
void dw_apb_clockevent_pause(struct dw_apb_clock_event_device *dw_ced)
{}

static void apbt_eoi(struct dw_apb_timer *timer)
{}

static irqreturn_t dw_apb_clockevent_irq(int irq, void *data)
{}

static void apbt_enable_int(struct dw_apb_timer *timer)
{}

static int apbt_shutdown(struct clock_event_device *evt)
{}

static int apbt_set_oneshot(struct clock_event_device *evt)
{}

static int apbt_set_periodic(struct clock_event_device *evt)
{}

static int apbt_resume(struct clock_event_device *evt)
{}

static int apbt_next_event(unsigned long delta,
			   struct clock_event_device *evt)
{}

/**
 * dw_apb_clockevent_init() - use an APB timer as a clock_event_device
 *
 * @cpu:	The CPU the events will be targeted at or -1 if CPU affiliation
 *		isn't required.
 * @name:	The name used for the timer and the IRQ for it.
 * @rating:	The rating to give the timer.
 * @base:	I/O base for the timer registers.
 * @irq:	The interrupt number to use for the timer.
 * @freq:	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_device *
dw_apb_clockevent_init(int cpu, const char *name, unsigned rating,
		       void __iomem *base, int irq, unsigned long freq)
{}

/**
 * dw_apb_clockevent_resume() - resume a clock that has been paused.
 *
 * @dw_ced:	The APB clock to resume.
 */
void dw_apb_clockevent_resume(struct dw_apb_clock_event_device *dw_ced)
{}

/**
 * dw_apb_clockevent_stop() - stop the clock_event_device and release the IRQ.
 *
 * @dw_ced:	The APB clock to stop generating the events.
 */
void dw_apb_clockevent_stop(struct dw_apb_clock_event_device *dw_ced)
{}

/**
 * dw_apb_clockevent_register() - register the clock with the generic layer
 *
 * @dw_ced:	The APB clock to register as a clock_event_device.
 */
void dw_apb_clockevent_register(struct dw_apb_clock_event_device *dw_ced)
{}

/**
 * dw_apb_clocksource_start() - start the clocksource counting.
 *
 * @dw_cs:	The clocksource to start.
 *
 * This is used to start the clocksource before registration and can be used
 * to enable calibration of timers.
 */
void dw_apb_clocksource_start(struct dw_apb_clocksource *dw_cs)
{}

static u64 __apbt_read_clocksource(struct clocksource *cs)
{}

static void apbt_restart_clocksource(struct clocksource *cs)
{}

/**
 * dw_apb_clocksource_init() - use an APB timer as a clocksource.
 *
 * @rating:	The rating to give the clocksource.
 * @name:	The name for the clocksource.
 * @base:	The I/O base for the timer registers.
 * @freq:	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_clocksource *
dw_apb_clocksource_init(unsigned rating, const char *name, void __iomem *base,
			unsigned long freq)
{}

/**
 * dw_apb_clocksource_register() - register the APB clocksource.
 *
 * @dw_cs:	The clocksource to register.
 */
void dw_apb_clocksource_register(struct dw_apb_clocksource *dw_cs)
{}

/**
 * dw_apb_clocksource_read() - read the current value of a clocksource.
 *
 * @dw_cs:	The clocksource to read.
 */
u64 dw_apb_clocksource_read(struct dw_apb_clocksource *dw_cs)
{}