Lines Matching +full:ep9301 +full:- +full:timer

1 // SPDX-License-Identifier: GPL-2.0
3 * Cirrus Logic EP93xx timer driver.
6 * Based on a rewrite of arch/arm/mach-ep93xx/timer.c:
14 #include <linux/io-64-nonatomic-lo-hi.h>
24 * Timer handling for EP93xx
27 * 3 (32 bit) count down at 508 kHz, are self-reloading, and can generate
28 * an interrupt on underflow. Timer 4 (40 bit) counts down at 983.04 kHz,
29 * is free-running, and can't generate interrupts.
31 * The 508 kHz timers are ideal for use for the timer interrupt, as the
33 * timer (timer 3) to get as long sleep intervals as possible when using
36 * The higher clock rate of timer 4 makes it a better choice than the
54 * This read-only register contains the low word of the time stamp debug timer
79 return lo_hi_readq(tcu->base + EP93XX_TIMER4_VALUE_LOW) & GENMASK_ULL(39, 0); in ep93xx_clocksource_read()
95 /* Clear timer */ in ep93xx_clkevt_set_next_event()
96 writel(tmode, tcu->base + EP93XX_TIMER3_CONTROL); in ep93xx_clkevt_set_next_event()
99 writel(next, tcu->base + EP93XX_TIMER3_LOAD); in ep93xx_clkevt_set_next_event()
101 tcu->base + EP93XX_TIMER3_CONTROL); in ep93xx_clkevt_set_next_event()
108 /* Disable timer */ in ep93xx_clkevt_shutdown()
109 writel(0, tcu->base + EP93XX_TIMER3_CONTROL); in ep93xx_clkevt_shutdown()
129 /* Writing any value clears the timer interrupt */ in ep93xx_timer_interrupt()
130 writel(1, tcu->base + EP93XX_TIMER3_CLEAR); in ep93xx_timer_interrupt()
132 evt->event_handler(evt); in ep93xx_timer_interrupt()
146 return -ENOMEM; in ep93xx_timer_of_init()
148 tcu->base = of_iomap(np, 0); in ep93xx_timer_of_init()
149 if (!tcu->base) { in ep93xx_timer_of_init()
151 ret = -ENXIO; in ep93xx_timer_of_init()
159 ret = -EINVAL; in ep93xx_timer_of_init()
160 pr_err("EP93XX Timer Can't parse IRQ %d", irq); in ep93xx_timer_of_init()
164 /* Enable and register clocksource and sched_clock on timer 4 */ in ep93xx_timer_of_init()
166 tcu->base + EP93XX_TIMER4_VALUE_HIGH); in ep93xx_timer_of_init()
173 /* Set up clockevent on timer 3 */ in ep93xx_timer_of_init()
174 if (request_irq(irq, ep93xx_timer_interrupt, flags, "ep93xx timer", in ep93xx_timer_of_init()
176 pr_err("Failed to request irq %d (ep93xx timer)\n", irq); in ep93xx_timer_of_init()
189 TIMER_OF_DECLARE(ep93xx_timer, "cirrus,ep9301-timer", ep93xx_timer_of_init);