Lines Matching +full:gxp +full:- +full:timer
1 // SPDX-License-Identifier: GPL-2.0
2 /* Copyright (C) 2022 Hewlett-Packard Enterprise Development Company, L.P. */
18 /* TCS Stands for Timer Control/Status: these are masks to be used in */
19 /* the Timer Count Registers */
47 struct gxp_timer *timer = to_gxp_timer(evt_dev); in gxp_time_set_next_event() local
50 writeb_relaxed(MASK_TCS_TC, timer->control); in gxp_time_set_next_event()
51 writel_relaxed(event, timer->counter); in gxp_time_set_next_event()
52 writeb_relaxed(MASK_TCS_TC | MASK_TCS_ENABLE, timer->control); in gxp_time_set_next_event()
59 struct gxp_timer *timer = (struct gxp_timer *)dev_id; in gxp_timer_interrupt() local
61 if (!(readb_relaxed(timer->control) & MASK_TCS_TC)) in gxp_timer_interrupt()
64 writeb_relaxed(MASK_TCS_TC, timer->control); in gxp_timer_interrupt()
66 timer->evt.event_handler(&timer->evt); in gxp_timer_interrupt()
80 ret = -ENOMEM; in gxp_timer_init()
100 ret = -ENXIO; in gxp_timer_init()
101 pr_err("Can't map timer base registers"); in gxp_timer_init()
105 /* Set the offsets to the clock register and timer registers */ in gxp_timer_init()
106 gxp_timer->counter = base + GXP_TIMER_CNT_OFS; in gxp_timer_init()
107 gxp_timer->control = base + GXP_TIMER_CTRL_OFS; in gxp_timer_init()
110 gxp_timer->evt.name = node->name; in gxp_timer_init()
111 gxp_timer->evt.rating = 300; in gxp_timer_init()
112 gxp_timer->evt.features = CLOCK_EVT_FEAT_ONESHOT; in gxp_timer_init()
113 gxp_timer->evt.set_next_event = gxp_time_set_next_event; in gxp_timer_init()
114 gxp_timer->evt.cpumask = cpumask_of(0); in gxp_timer_init()
118 ret = -EINVAL; in gxp_timer_init()
119 pr_err("GXP Timer Can't parse IRQ %d", irq); in gxp_timer_init()
125 ret = clocksource_mmio_init(system_clock, node->name, freq, in gxp_timer_init()
136 ret = -EINVAL; in gxp_timer_init()
141 clockevents_config_and_register(&gxp_timer->evt, TIMER0_FREQ, in gxp_timer_init()
145 node->name, gxp_timer); in gxp_timer_init()
151 pr_debug("gxp: system timer (irq = %d)\n", irq); in gxp_timer_init()
166 * This probe gets called after the timer is already up and running. This will create
173 struct device *dev = &pdev->dev; in gxp_timer_probe()
177 pr_err("Gxp Timer not initialized, cannot create watchdog"); in gxp_timer_probe()
178 return -ENOMEM; in gxp_timer_probe()
181 gxp_watchdog_device = platform_device_alloc("gxp-wdt", -1); in gxp_timer_probe()
183 pr_err("Timer failed to allocate gxp-wdt"); in gxp_timer_probe()
184 return -ENOMEM; in gxp_timer_probe()
188 gxp_watchdog_device->dev.platform_data = gxp_timer->counter; in gxp_timer_probe()
189 gxp_watchdog_device->dev.parent = dev; in gxp_timer_probe()
199 { .compatible = "hpe,gxp-timer", },
206 .name = "gxp-timer",
214 TIMER_OF_DECLARE(gxp, "hpe,gxp-timer", gxp_timer_init);