Lines Matching full:tegra
113 static struct tegra186_tmr *tegra186_tmr_create(struct tegra186_timer *tegra, in tegra186_tmr_create() argument
119 tmr = devm_kzalloc(tegra->dev, sizeof(*tmr), GFP_KERNEL); in tegra186_tmr_create()
123 tmr->parent = tegra; in tegra186_tmr_create()
124 tmr->regs = tegra->regs + offset; in tegra186_tmr_create()
148 struct tegra186_timer *tegra = wdt->tmr->parent; in tegra186_wdt_enable() local
153 writel(value, tegra->regs + TKEIE(wdt->tmr->hwirq)); in tegra186_wdt_enable()
300 static struct tegra186_wdt *tegra186_wdt_create(struct tegra186_timer *tegra, in tegra186_wdt_create() argument
308 offset += tegra->soc->num_timers * 0x10000 + index * 0x10000; in tegra186_wdt_create()
310 wdt = devm_kzalloc(tegra->dev, sizeof(*wdt), GFP_KERNEL); in tegra186_wdt_create()
314 wdt->regs = tegra->regs + offset; in tegra186_wdt_create()
325 wdt->tmr = tegra186_tmr_create(tegra, source); in tegra186_wdt_create()
333 wdt->base.parent = tegra->dev; in tegra186_wdt_create()
335 err = watchdog_init_timeout(&wdt->base, 5, tegra->dev); in tegra186_wdt_create()
339 err = devm_watchdog_register_device(tegra->dev, &wdt->base); in tegra186_wdt_create()
348 struct tegra186_timer *tegra = container_of(cs, struct tegra186_timer, in tegra186_timer_tsc_read() local
352 hi = readl_relaxed(tegra->regs + TKETSC1); in tegra186_timer_tsc_read()
363 lo = readl_relaxed(tegra->regs + TKETSC0); in tegra186_timer_tsc_read()
364 hi = readl_relaxed(tegra->regs + TKETSC1); in tegra186_timer_tsc_read()
370 static int tegra186_timer_tsc_init(struct tegra186_timer *tegra) in tegra186_timer_tsc_init() argument
372 tegra->tsc.name = "tsc"; in tegra186_timer_tsc_init()
373 tegra->tsc.rating = 300; in tegra186_timer_tsc_init()
374 tegra->tsc.read = tegra186_timer_tsc_read; in tegra186_timer_tsc_init()
375 tegra->tsc.mask = CLOCKSOURCE_MASK(56); in tegra186_timer_tsc_init()
376 tegra->tsc.flags = CLOCK_SOURCE_IS_CONTINUOUS; in tegra186_timer_tsc_init()
377 tegra->tsc.owner = THIS_MODULE; in tegra186_timer_tsc_init()
379 return clocksource_register_hz(&tegra->tsc, 31250000); in tegra186_timer_tsc_init()
384 struct tegra186_timer *tegra = container_of(cs, struct tegra186_timer, in tegra186_timer_osc_read() local
387 return readl_relaxed(tegra->regs + TKEOSC); in tegra186_timer_osc_read()
390 static int tegra186_timer_osc_init(struct tegra186_timer *tegra) in tegra186_timer_osc_init() argument
392 tegra->osc.name = "osc"; in tegra186_timer_osc_init()
393 tegra->osc.rating = 300; in tegra186_timer_osc_init()
394 tegra->osc.read = tegra186_timer_osc_read; in tegra186_timer_osc_init()
395 tegra->osc.mask = CLOCKSOURCE_MASK(32); in tegra186_timer_osc_init()
396 tegra->osc.flags = CLOCK_SOURCE_IS_CONTINUOUS; in tegra186_timer_osc_init()
397 tegra->osc.owner = THIS_MODULE; in tegra186_timer_osc_init()
399 return clocksource_register_hz(&tegra->osc, 38400000); in tegra186_timer_osc_init()
404 struct tegra186_timer *tegra = container_of(cs, struct tegra186_timer, in tegra186_timer_usec_read() local
407 return readl_relaxed(tegra->regs + TKEUSEC); in tegra186_timer_usec_read()
410 static int tegra186_timer_usec_init(struct tegra186_timer *tegra) in tegra186_timer_usec_init() argument
412 tegra->usec.name = "usec"; in tegra186_timer_usec_init()
413 tegra->usec.rating = 300; in tegra186_timer_usec_init()
414 tegra->usec.read = tegra186_timer_usec_read; in tegra186_timer_usec_init()
415 tegra->usec.mask = CLOCKSOURCE_MASK(32); in tegra186_timer_usec_init()
416 tegra->usec.flags = CLOCK_SOURCE_IS_CONTINUOUS; in tegra186_timer_usec_init()
417 tegra->usec.owner = THIS_MODULE; in tegra186_timer_usec_init()
419 return clocksource_register_hz(&tegra->usec, USEC_PER_SEC); in tegra186_timer_usec_init()
425 struct tegra186_timer *tegra; in tegra186_timer_probe() local
428 tegra = devm_kzalloc(dev, sizeof(*tegra), GFP_KERNEL); in tegra186_timer_probe()
429 if (!tegra) in tegra186_timer_probe()
432 tegra->soc = of_device_get_match_data(dev); in tegra186_timer_probe()
433 dev_set_drvdata(dev, tegra); in tegra186_timer_probe()
434 tegra->dev = dev; in tegra186_timer_probe()
436 tegra->regs = devm_platform_ioremap_resource(pdev, 0); in tegra186_timer_probe()
437 if (IS_ERR(tegra->regs)) in tegra186_timer_probe()
438 return PTR_ERR(tegra->regs); in tegra186_timer_probe()
445 tegra->wdt = tegra186_wdt_create(tegra, 0); in tegra186_timer_probe()
446 if (IS_ERR(tegra->wdt)) { in tegra186_timer_probe()
447 err = PTR_ERR(tegra->wdt); in tegra186_timer_probe()
452 err = tegra186_timer_tsc_init(tegra); in tegra186_timer_probe()
458 err = tegra186_timer_osc_init(tegra); in tegra186_timer_probe()
464 err = tegra186_timer_usec_init(tegra); in tegra186_timer_probe()
473 clocksource_unregister(&tegra->osc); in tegra186_timer_probe()
475 clocksource_unregister(&tegra->tsc); in tegra186_timer_probe()
481 struct tegra186_timer *tegra = platform_get_drvdata(pdev); in tegra186_timer_remove() local
483 clocksource_unregister(&tegra->usec); in tegra186_timer_remove()
484 clocksource_unregister(&tegra->osc); in tegra186_timer_remove()
485 clocksource_unregister(&tegra->tsc); in tegra186_timer_remove()
490 struct tegra186_timer *tegra = dev_get_drvdata(dev); in tegra186_timer_suspend() local
492 if (watchdog_active(&tegra->wdt->base)) in tegra186_timer_suspend()
493 tegra186_wdt_disable(tegra->wdt); in tegra186_timer_suspend()
500 struct tegra186_timer *tegra = dev_get_drvdata(dev); in tegra186_timer_resume() local
502 if (watchdog_active(&tegra->wdt->base)) in tegra186_timer_resume()
503 tegra186_wdt_enable(tegra->wdt); in tegra186_timer_resume()