linux/drivers/clocksource/timer-davinci.c

// SPDX-License-Identifier: GPL-2.0-only
/*
 * TI DaVinci clocksource driver
 *
 * Copyright (C) 2019 Texas Instruments
 * Author: Bartosz Golaszewski <[email protected]>
 * (with tiny parts adopted from code by Kevin Hilman <[email protected]>)
 */

#define pr_fmt(fmt)

#include <linux/clk.h>
#include <linux/clockchips.h>
#include <linux/interrupt.h>
#include <linux/kernel.h>
#include <linux/of_address.h>
#include <linux/of_irq.h>
#include <linux/sched_clock.h>

#include <clocksource/timer-davinci.h>

#define DAVINCI_TIMER_REG_TIM12
#define DAVINCI_TIMER_REG_TIM34
#define DAVINCI_TIMER_REG_PRD12
#define DAVINCI_TIMER_REG_PRD34
#define DAVINCI_TIMER_REG_TCR
#define DAVINCI_TIMER_REG_TGCR

#define DAVINCI_TIMER_TIMMODE_MASK
#define DAVINCI_TIMER_RESET_MASK
#define DAVINCI_TIMER_TIMMODE_32BIT_UNCHAINED
#define DAVINCI_TIMER_UNRESET

#define DAVINCI_TIMER_ENAMODE_MASK
#define DAVINCI_TIMER_ENAMODE_DISABLED
#define DAVINCI_TIMER_ENAMODE_ONESHOT
#define DAVINCI_TIMER_ENAMODE_PERIODIC

#define DAVINCI_TIMER_ENAMODE_SHIFT_TIM12
#define DAVINCI_TIMER_ENAMODE_SHIFT_TIM34

#define DAVINCI_TIMER_MIN_DELTA
#define DAVINCI_TIMER_MAX_DELTA

#define DAVINCI_TIMER_CLKSRC_BITS

#define DAVINCI_TIMER_TGCR_DEFAULT

struct davinci_clockevent {};

/*
 * This must be globally accessible by davinci_timer_read_sched_clock(), so
 * let's keep it here.
 */
static struct {} davinci_clocksource;

static struct davinci_clockevent *
to_davinci_clockevent(struct clock_event_device *clockevent)
{}

static unsigned int
davinci_clockevent_read(struct davinci_clockevent *clockevent,
			unsigned int reg)
{}

static void davinci_clockevent_write(struct davinci_clockevent *clockevent,
				     unsigned int reg, unsigned int val)
{}

static void davinci_tim12_shutdown(void __iomem *base)
{}

static void davinci_tim12_set_oneshot(void __iomem *base)
{}

static int davinci_clockevent_shutdown(struct clock_event_device *dev)
{}

static int davinci_clockevent_set_oneshot(struct clock_event_device *dev)
{}

static int
davinci_clockevent_set_next_event_std(unsigned long cycles,
				      struct clock_event_device *dev)
{}

static int
davinci_clockevent_set_next_event_cmp(unsigned long cycles,
				      struct clock_event_device *dev)
{}

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

static u64 notrace davinci_timer_read_sched_clock(void)
{}

static u64 davinci_clocksource_read(struct clocksource *dev)
{}

/*
 * Standard use-case: we're using tim12 for clockevent and tim34 for
 * clocksource. The default is making the former run in oneshot mode
 * and the latter in periodic mode.
 */
static void davinci_clocksource_init_tim34(void __iomem *base)
{}

/*
 * Special use-case on da830: the DSP may use tim34. We're using tim12 for
 * both clocksource and clockevent. We set tim12 to periodic and don't touch
 * tim34.
 */
static void davinci_clocksource_init_tim12(void __iomem *base)
{}

static void davinci_timer_init(void __iomem *base)
{}

int __init davinci_timer_register(struct clk *clk,
				  const struct davinci_timer_cfg *timer_cfg)
{}

static int __init of_davinci_timer_register(struct device_node *np)
{}
TIMER_OF_DECLARE(davinci_timer, "ti,da830-timer", of_davinci_timer_register);