Lines Matching +full:lpc3220 +full:- +full:clk

1 // SPDX-License-Identifier: GPL-2.0
8 * time-efm32 Copyright (C) 2013 Pengutronix
9 * mach-lpc32xx/timer.c Copyright (C) 2009 - 2010 NXP Semiconductors
14 #include <linux/clk.h>
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()
88 writel_relaxed(0, ddata->base + LPC32XX_TIMER_TCR); in lpc32xx_clkevt_shutdown()
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()
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",
159 struct clk *clk; in lpc32xx_clocksource_init() local
162 clk = of_clk_get_by_name(np, "timerclk"); in lpc32xx_clocksource_init()
163 if (IS_ERR(clk)) { in lpc32xx_clocksource_init()
164 pr_err("clock get failed (%ld)\n", PTR_ERR(clk)); in lpc32xx_clocksource_init()
165 return PTR_ERR(clk); in lpc32xx_clocksource_init()
168 ret = clk_prepare_enable(clk); in lpc32xx_clocksource_init()
177 ret = -EADDRNOTAVAIL; in lpc32xx_clocksource_init()
192 rate = clk_get_rate(clk); in lpc32xx_clocksource_init()
193 ret = clocksource_mmio_init(base + LPC32XX_TIMER_TC, "lpc3220 timer", in lpc32xx_clocksource_init()
210 clk_disable_unprepare(clk); in lpc32xx_clocksource_init()
212 clk_put(clk); in lpc32xx_clocksource_init()
220 struct clk *clk; in lpc32xx_clockevent_init() local
223 clk = of_clk_get_by_name(np, "timerclk"); in lpc32xx_clockevent_init()
224 if (IS_ERR(clk)) { in lpc32xx_clockevent_init()
225 pr_err("clock get failed (%ld)\n", PTR_ERR(clk)); in lpc32xx_clockevent_init()
226 return PTR_ERR(clk); in lpc32xx_clockevent_init()
229 ret = clk_prepare_enable(clk); in lpc32xx_clockevent_init()
238 ret = -EADDRNOTAVAIL; in lpc32xx_clockevent_init()
245 ret = -ENOENT; in lpc32xx_clockevent_init()
258 rate = clk_get_rate(clk); in lpc32xx_clockevent_init()
262 rate, 1, -1); in lpc32xx_clockevent_init()
265 IRQF_TIMER | IRQF_IRQPOLL, "lpc3220 clockevent", in lpc32xx_clockevent_init()
277 clk_disable_unprepare(clk); in lpc32xx_clockevent_init()
279 clk_put(clk); in lpc32xx_clockevent_init()
310 TIMER_OF_DECLARE(lpc32xx_timer, "nxp,lpc3220-timer", lpc32xx_timer_init);