Lines Matching +full:ixp4xx +full:- +full:timer

1 // SPDX-License-Identifier: GPL-2.0
3 * IXP4 timer driver
6 * Based on arch/arm/mach-ixp4xx/common.c
8 * Copyright 2003-2004 (C) MontaVista, Software, Inc.
24 * Constants to make it easy to access Timer Control/Status registers
27 #define IXP4XX_OST1_OFFSET 0x04 /* Timer 1 Timestamp */
28 #define IXP4XX_OSRT1_OFFSET 0x08 /* Timer 1 Reload */
29 #define IXP4XX_OST2_OFFSET 0x0C /* Timer 2 Timestamp */
30 #define IXP4XX_OSRT2_OFFSET 0x10 /* Timer 2 Reload */
31 #define IXP4XX_OSST_OFFSET 0x20 /* Timer Status */
34 * Timer register values and bit definitions
56 * A local singleton used by sched_clock and delay timer reads, which are
69 return __raw_readl(local_ixp4xx_timer->base + IXP4XX_OSTS_OFFSET); in ixp4xx_read_timer()
85 struct clock_event_device *evt = &tmr->clkevt; in ixp4xx_timer_interrupt()
89 tmr->base + IXP4XX_OSST_OFFSET); in ixp4xx_timer_interrupt()
91 evt->event_handler(evt); in ixp4xx_timer_interrupt()
102 val = __raw_readl(tmr->base + IXP4XX_OSRT1_OFFSET); in ixp4xx_set_next_event()
106 tmr->base + IXP4XX_OSRT1_OFFSET); in ixp4xx_set_next_event()
116 val = __raw_readl(tmr->base + IXP4XX_OSRT1_OFFSET); in ixp4xx_shutdown()
118 __raw_writel(val, tmr->base + IXP4XX_OSRT1_OFFSET); in ixp4xx_shutdown()
128 tmr->base + IXP4XX_OSRT1_OFFSET); in ixp4xx_set_oneshot()
138 val = tmr->latch & ~IXP4XX_OST_RELOAD_MASK; in ixp4xx_set_periodic()
140 __raw_writel(val, tmr->base + IXP4XX_OSRT1_OFFSET); in ixp4xx_set_periodic()
150 val = __raw_readl(tmr->base + IXP4XX_OSRT1_OFFSET); in ixp4xx_resume()
152 __raw_writel(val, tmr->base + IXP4XX_OSRT1_OFFSET); in ixp4xx_resume()
158 * IXP4xx timer tick
159 * We use OS timer1 on the CPU for the timer tick and the timestamp
171 return -ENOMEM; in ixp4xx_timer_register()
172 tmr->base = base; in ixp4xx_timer_register()
175 * The timer register doesn't allow to specify the two least in ixp4xx_timer_register()
180 tmr->latch = DIV_ROUND_CLOSEST(timer_freq, in ixp4xx_timer_register()
187 __raw_writel(0, tmr->base + IXP4XX_OSRT1_OFFSET); in ixp4xx_timer_register()
189 /* Clear any pending interrupt on timer 1 */ in ixp4xx_timer_register()
191 tmr->base + IXP4XX_OSST_OFFSET); in ixp4xx_timer_register()
193 /* Reset time-stamp counter */ in ixp4xx_timer_register()
194 __raw_writel(0, tmr->base + IXP4XX_OSTS_OFFSET); in ixp4xx_timer_register()
199 tmr->clkevt.name = "ixp4xx timer1"; in ixp4xx_timer_register()
200 tmr->clkevt.features = CLOCK_EVT_FEAT_PERIODIC | CLOCK_EVT_FEAT_ONESHOT; in ixp4xx_timer_register()
201 tmr->clkevt.rating = 200; in ixp4xx_timer_register()
202 tmr->clkevt.set_state_shutdown = ixp4xx_shutdown; in ixp4xx_timer_register()
203 tmr->clkevt.set_state_periodic = ixp4xx_set_periodic; in ixp4xx_timer_register()
204 tmr->clkevt.set_state_oneshot = ixp4xx_set_oneshot; in ixp4xx_timer_register()
205 tmr->clkevt.tick_resume = ixp4xx_resume; in ixp4xx_timer_register()
206 tmr->clkevt.set_next_event = ixp4xx_set_next_event; in ixp4xx_timer_register()
207 tmr->clkevt.cpumask = cpumask_of(0); in ixp4xx_timer_register()
208 tmr->clkevt.irq = timer_irq; in ixp4xx_timer_register()
210 IRQF_TIMER, "IXP4XX-TIMER1", tmr); in ixp4xx_timer_register()
212 pr_crit("no timer IRQ\n"); in ixp4xx_timer_register()
213 return -ENODEV; in ixp4xx_timer_register()
215 clockevents_config_and_register(&tmr->clkevt, timer_freq, in ixp4xx_timer_register()
221 /* Also use this timer for delays */ in ixp4xx_timer_register()
222 tmr->delay_timer.read_current_timer = ixp4xx_read_timer; in ixp4xx_timer_register()
223 tmr->delay_timer.freq = timer_freq; in ixp4xx_timer_register()
224 register_current_timer_delay(&tmr->delay_timer); in ixp4xx_timer_register()
231 .name = "ixp4xx-watchdog",
232 .id = -1,
236 * This probe gets called after the timer is already up and running. The main
241 struct device *dev = &pdev->dev; in ixp4xx_timer_probe()
244 ixp4xx_watchdog_device.dev.platform_data = local_ixp4xx_timer->base; in ixp4xx_timer_probe()
250 { .compatible = "intel,ixp4xx-timer", },
257 .name = "ixp4xx-timer",
272 pr_crit("IXP4xx: can't remap timer\n"); in ixp4xx_of_timer_init()
273 return -ENODEV; in ixp4xx_of_timer_init()
279 ret = -EINVAL; in ixp4xx_of_timer_init()
293 TIMER_OF_DECLARE(ixp4xx, "intel,ixp4xx-timer", ixp4xx_of_timer_init);