Commit f3af3dc7 authored by Claudiu Beznea's avatar Claudiu Beznea Committed by Daniel Lezcano
Browse files

clocksource/drivers/timer-microchip-pit64b: Add delay timer

parent d19c8b2e
Loading
Loading
Loading
Loading
+12 −0
Original line number Diff line number Diff line
@@ -9,6 +9,7 @@

#include <linux/clk.h>
#include <linux/clockchips.h>
#include <linux/delay.h>
#include <linux/interrupt.h>
#include <linux/of_address.h>
#include <linux/of_irq.h>
@@ -92,6 +93,8 @@ struct mchp_pit64b_clksrc {
static void __iomem *mchp_pit64b_cs_base;
/* Default cycles for clockevent timer. */
static u64 mchp_pit64b_ce_cycles;
/* Delay timer. */
static struct delay_timer mchp_pit64b_dt;

static inline u64 mchp_pit64b_cnt_read(void __iomem *base)
{
@@ -169,6 +172,11 @@ static u64 notrace mchp_pit64b_sched_read_clk(void)
	return mchp_pit64b_cnt_read(mchp_pit64b_cs_base);
}

static unsigned long notrace mchp_pit64b_dt_read(void)
{
	return mchp_pit64b_cnt_read(mchp_pit64b_cs_base);
}

static int mchp_pit64b_clkevt_shutdown(struct clock_event_device *cedev)
{
	struct mchp_pit64b_timer *timer = clkevt_to_mchp_pit64b_timer(cedev);
@@ -376,6 +384,10 @@ static int __init mchp_pit64b_init_clksrc(struct mchp_pit64b_timer *timer,

	sched_clock_register(mchp_pit64b_sched_read_clk, 64, clk_rate);

	mchp_pit64b_dt.read_current_timer = mchp_pit64b_dt_read;
	mchp_pit64b_dt.freq = clk_rate;
	register_current_timer_delay(&mchp_pit64b_dt);

	return 0;
}