Files
kernel-spacemit-k1/include/linux/dw_apb_timer.h
Nell e9e49ad9ee cpuidle: adapt code for CPUidle functionality
1. dw_apb_timer: revert the change-id:I586ebcec8e3b03cec44a1845b1bee36b79c14d0e and add a spinlock
    in funcion: apbt_next_event & dw_apb_clockevent_irq
2. irq-sifive-plic: Modify the basic address offset and size to fit the SPACEMIT plat
3. irq-sifive-plic: when performing irq binding operations, it is best
     to write down the sclaim register

Change-Id: Id13e5e17384726183fd98d232b5edfab838f6134
2024-11-28 18:26:46 +08:00

54 lines
1.6 KiB
C

/* SPDX-License-Identifier: GPL-2.0-only */
/*
* (C) Copyright 2009 Intel Corporation
* Author: Jacob Pan (jacob.jun.pan@intel.com)
*
* Shared with ARM platforms, Jamie Iles, Picochip 2011
*
* Support for the Synopsys DesignWare APB Timers.
*/
#ifndef __DW_APB_TIMER_H__
#define __DW_APB_TIMER_H__
#include <linux/clockchips.h>
#include <linux/clocksource.h>
#include <linux/spinlock.h>
#include <linux/interrupt.h>
#define APBTMRS_REG_SIZE 0x14
struct dw_apb_timer {
void __iomem *base;
unsigned long freq;
int irq;
};
struct dw_apb_clock_event_device {
struct clock_event_device ced;
struct dw_apb_timer timer;
void (*eoi)(struct dw_apb_timer *);
raw_spinlock_t timer_lock;
};
struct dw_apb_clocksource {
struct dw_apb_timer timer;
struct clocksource cs;
};
void dw_apb_clockevent_register(struct dw_apb_clock_event_device *dw_ced);
void dw_apb_clockevent_pause(struct dw_apb_clock_event_device *dw_ced);
void dw_apb_clockevent_resume(struct dw_apb_clock_event_device *dw_ced);
void dw_apb_clockevent_stop(struct dw_apb_clock_event_device *dw_ced);
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);
struct dw_apb_clocksource *
dw_apb_clocksource_init(unsigned rating, const char *name, void __iomem *base,
unsigned long freq);
void dw_apb_clocksource_register(struct dw_apb_clocksource *dw_cs);
void dw_apb_clocksource_start(struct dw_apb_clocksource *dw_cs);
u64 dw_apb_clocksource_read(struct dw_apb_clocksource *dw_cs);
#endif /* __DW_APB_TIMER_H__ */