Lines Matching refs:tegra

108 static struct tegra186_tmr *tegra186_tmr_create(struct tegra186_timer *tegra,  in tegra186_tmr_create()  argument
114 tmr = devm_kzalloc(tegra->dev, sizeof(*tmr), GFP_KERNEL); in tegra186_tmr_create()
118 tmr->parent = tegra; in tegra186_tmr_create()
119 tmr->regs = tegra->regs + offset; in tegra186_tmr_create()
143 struct tegra186_timer *tegra = wdt->tmr->parent; in tegra186_wdt_enable() local
148 writel(value, tegra->regs + TKEIE(wdt->tmr->hwirq)); in tegra186_wdt_enable()
245 static struct tegra186_wdt *tegra186_wdt_create(struct tegra186_timer *tegra, in tegra186_wdt_create() argument
253 offset += tegra->soc->num_timers * 0x10000 + index * 0x10000; in tegra186_wdt_create()
255 wdt = devm_kzalloc(tegra->dev, sizeof(*wdt), GFP_KERNEL); in tegra186_wdt_create()
259 wdt->regs = tegra->regs + offset; in tegra186_wdt_create()
270 wdt->tmr = tegra186_tmr_create(tegra, source); in tegra186_wdt_create()
278 wdt->base.parent = tegra->dev; in tegra186_wdt_create()
280 err = watchdog_init_timeout(&wdt->base, 5, tegra->dev); in tegra186_wdt_create()
282 dev_err(tegra->dev, "failed to initialize timeout: %d\n", err); in tegra186_wdt_create()
286 err = devm_watchdog_register_device(tegra->dev, &wdt->base); in tegra186_wdt_create()
288 dev_err(tegra->dev, "failed to register WDT: %d\n", err); in tegra186_wdt_create()
297 struct tegra186_timer *tegra = container_of(cs, struct tegra186_timer, in tegra186_timer_tsc_read() local
301 hi = readl_relaxed(tegra->regs + TKETSC1); in tegra186_timer_tsc_read()
312 lo = readl_relaxed(tegra->regs + TKETSC0); in tegra186_timer_tsc_read()
313 hi = readl_relaxed(tegra->regs + TKETSC1); in tegra186_timer_tsc_read()
319 static int tegra186_timer_tsc_init(struct tegra186_timer *tegra) in tegra186_timer_tsc_init() argument
321 tegra->tsc.name = "tsc"; in tegra186_timer_tsc_init()
322 tegra->tsc.rating = 300; in tegra186_timer_tsc_init()
323 tegra->tsc.read = tegra186_timer_tsc_read; in tegra186_timer_tsc_init()
324 tegra->tsc.mask = CLOCKSOURCE_MASK(56); in tegra186_timer_tsc_init()
325 tegra->tsc.flags = CLOCK_SOURCE_IS_CONTINUOUS; in tegra186_timer_tsc_init()
327 return clocksource_register_hz(&tegra->tsc, 31250000); in tegra186_timer_tsc_init()
332 struct tegra186_timer *tegra = container_of(cs, struct tegra186_timer, in tegra186_timer_osc_read() local
335 return readl_relaxed(tegra->regs + TKEOSC); in tegra186_timer_osc_read()
338 static int tegra186_timer_osc_init(struct tegra186_timer *tegra) in tegra186_timer_osc_init() argument
340 tegra->osc.name = "osc"; in tegra186_timer_osc_init()
341 tegra->osc.rating = 300; in tegra186_timer_osc_init()
342 tegra->osc.read = tegra186_timer_osc_read; in tegra186_timer_osc_init()
343 tegra->osc.mask = CLOCKSOURCE_MASK(32); in tegra186_timer_osc_init()
344 tegra->osc.flags = CLOCK_SOURCE_IS_CONTINUOUS; in tegra186_timer_osc_init()
346 return clocksource_register_hz(&tegra->osc, 38400000); in tegra186_timer_osc_init()
351 struct tegra186_timer *tegra = container_of(cs, struct tegra186_timer, in tegra186_timer_usec_read() local
354 return readl_relaxed(tegra->regs + TKEUSEC); in tegra186_timer_usec_read()
357 static int tegra186_timer_usec_init(struct tegra186_timer *tegra) in tegra186_timer_usec_init() argument
359 tegra->usec.name = "usec"; in tegra186_timer_usec_init()
360 tegra->usec.rating = 300; in tegra186_timer_usec_init()
361 tegra->usec.read = tegra186_timer_usec_read; in tegra186_timer_usec_init()
362 tegra->usec.mask = CLOCKSOURCE_MASK(32); in tegra186_timer_usec_init()
363 tegra->usec.flags = CLOCK_SOURCE_IS_CONTINUOUS; in tegra186_timer_usec_init()
365 return clocksource_register_hz(&tegra->usec, USEC_PER_SEC); in tegra186_timer_usec_init()
370 struct tegra186_timer *tegra = data; in tegra186_timer_irq() local
372 if (watchdog_active(&tegra->wdt->base)) { in tegra186_timer_irq()
373 tegra186_wdt_disable(tegra->wdt); in tegra186_timer_irq()
374 tegra186_wdt_enable(tegra->wdt); in tegra186_timer_irq()
383 struct tegra186_timer *tegra; in tegra186_timer_probe() local
387 tegra = devm_kzalloc(dev, sizeof(*tegra), GFP_KERNEL); in tegra186_timer_probe()
388 if (!tegra) in tegra186_timer_probe()
391 tegra->soc = of_device_get_match_data(dev); in tegra186_timer_probe()
392 dev_set_drvdata(dev, tegra); in tegra186_timer_probe()
393 tegra->dev = dev; in tegra186_timer_probe()
395 tegra->regs = devm_platform_ioremap_resource(pdev, 0); in tegra186_timer_probe()
396 if (IS_ERR(tegra->regs)) in tegra186_timer_probe()
397 return PTR_ERR(tegra->regs); in tegra186_timer_probe()
406 tegra->wdt = tegra186_wdt_create(tegra, 0); in tegra186_timer_probe()
407 if (IS_ERR(tegra->wdt)) { in tegra186_timer_probe()
408 err = PTR_ERR(tegra->wdt); in tegra186_timer_probe()
413 err = tegra186_timer_tsc_init(tegra); in tegra186_timer_probe()
419 err = tegra186_timer_osc_init(tegra); in tegra186_timer_probe()
425 err = tegra186_timer_usec_init(tegra); in tegra186_timer_probe()
432 "tegra186-timer", tegra); in tegra186_timer_probe()
441 clocksource_unregister(&tegra->usec); in tegra186_timer_probe()
443 clocksource_unregister(&tegra->osc); in tegra186_timer_probe()
445 clocksource_unregister(&tegra->tsc); in tegra186_timer_probe()
451 struct tegra186_timer *tegra = platform_get_drvdata(pdev); in tegra186_timer_remove() local
453 clocksource_unregister(&tegra->usec); in tegra186_timer_remove()
454 clocksource_unregister(&tegra->osc); in tegra186_timer_remove()
455 clocksource_unregister(&tegra->tsc); in tegra186_timer_remove()
460 struct tegra186_timer *tegra = dev_get_drvdata(dev); in tegra186_timer_suspend() local
462 if (watchdog_active(&tegra->wdt->base)) in tegra186_timer_suspend()
463 tegra186_wdt_disable(tegra->wdt); in tegra186_timer_suspend()
470 struct tegra186_timer *tegra = dev_get_drvdata(dev); in tegra186_timer_resume() local
472 if (watchdog_active(&tegra->wdt->base)) in tegra186_timer_resume()
473 tegra186_wdt_enable(tegra->wdt); in tegra186_timer_resume()