Lines Matching +full:lpc3220 +full:- +full:timer
1 // SPDX-License-Identifier: GPL-2.0
3 * Clocksource driver for NXP LPC32xx/18xx/43xx timer
8 * time-efm32 Copyright (C) 2013 Pengutronix
9 * mach-lpc32xx/timer.c Copyright (C) 2009 - 2010 NXP Semiconductors
70 * Place timer in reset and program the delta in the match in lpc32xx_clkevt_next_event()
71 * channel 0 (MR0). When the timer counter matches the value in lpc32xx_clkevt_next_event()
73 * After setup the timer is released from reset and enabled. in lpc32xx_clkevt_next_event()
75 writel_relaxed(LPC32XX_TIMER_TCR_CRST, ddata->base + LPC32XX_TIMER_TCR); in lpc32xx_clkevt_next_event()
76 writel_relaxed(delta, ddata->base + LPC32XX_TIMER_MR0); in lpc32xx_clkevt_next_event()
77 writel_relaxed(LPC32XX_TIMER_TCR_CEN, ddata->base + LPC32XX_TIMER_TCR); in lpc32xx_clkevt_next_event()
87 /* Disable the timer */ in lpc32xx_clkevt_shutdown()
88 writel_relaxed(0, ddata->base + LPC32XX_TIMER_TCR); in lpc32xx_clkevt_shutdown()
99 * When using oneshot, we must also disable the timer in lpc32xx_clkevt_oneshot()
102 writel_relaxed(0, ddata->base + LPC32XX_TIMER_TCR); in lpc32xx_clkevt_oneshot()
106 LPC32XX_TIMER_MCR_MR0S, ddata->base + LPC32XX_TIMER_MCR); in lpc32xx_clkevt_oneshot()
117 ddata->base + LPC32XX_TIMER_MCR); in lpc32xx_clkevt_periodic()
120 * Place timer in reset and program the delta in the match in lpc32xx_clkevt_periodic()
123 writel_relaxed(LPC32XX_TIMER_TCR_CRST, ddata->base + LPC32XX_TIMER_TCR); in lpc32xx_clkevt_periodic()
124 writel_relaxed(ddata->ticks_per_jiffy, ddata->base + LPC32XX_TIMER_MR0); in lpc32xx_clkevt_periodic()
125 writel_relaxed(LPC32XX_TIMER_TCR_CEN, ddata->base + LPC32XX_TIMER_TCR); in lpc32xx_clkevt_periodic()
135 writel_relaxed(LPC32XX_TIMER_IR_MR0INT, ddata->base + LPC32XX_TIMER_IR); in lpc32xx_clock_event_handler()
137 ddata->evtdev.event_handler(&ddata->evtdev); in lpc32xx_clock_event_handler()
144 .name = "lpc3220 clockevent",
177 ret = -EADDRNOTAVAIL; in lpc32xx_clocksource_init()
182 * Disable and reset timer then set it to free running timer in lpc32xx_clocksource_init()
184 * After setup the timer is released from reset and enabled. in lpc32xx_clocksource_init()
193 ret = clocksource_mmio_init(base + LPC32XX_TIMER_TC, "lpc3220 timer", in lpc32xx_clocksource_init()
238 ret = -EADDRNOTAVAIL; in lpc32xx_clockevent_init()
245 ret = -ENOENT; in lpc32xx_clockevent_init()
250 * Disable timer and clear any pending interrupt (IR) on match in lpc32xx_clockevent_init()
262 rate, 1, -1); in lpc32xx_clockevent_init()
265 IRQF_TIMER | IRQF_IRQPOLL, "lpc3220 clockevent", in lpc32xx_clockevent_init()
310 TIMER_OF_DECLARE(lpc32xx_timer, "nxp,lpc3220-timer", lpc32xx_timer_init);