Lines Matching refs:t
55 struct dmtimer_systimer t; member
61 struct dmtimer_systimer t; member
66 static bool dmtimer_systimer_revision1(struct dmtimer_systimer *t) in dmtimer_systimer_revision1() argument
68 u32 tidr = readl_relaxed(t->base); in dmtimer_systimer_revision1()
73 static void dmtimer_systimer_enable(struct dmtimer_systimer *t) in dmtimer_systimer_enable() argument
77 if (dmtimer_systimer_revision1(t)) in dmtimer_systimer_enable()
82 writel_relaxed(val, t->base + t->sysc); in dmtimer_systimer_enable()
85 static void dmtimer_systimer_disable(struct dmtimer_systimer *t) in dmtimer_systimer_disable() argument
87 if (!dmtimer_systimer_revision1(t)) in dmtimer_systimer_disable()
90 writel_relaxed(DMTIMER_TYPE1_DISABLE, t->base + t->sysc); in dmtimer_systimer_disable()
93 static int __init dmtimer_systimer_type1_reset(struct dmtimer_systimer *t) in dmtimer_systimer_type1_reset() argument
95 void __iomem *syss = t->base + OMAP_TIMER_V1_SYS_STAT_OFFSET; in dmtimer_systimer_type1_reset()
99 dmtimer_systimer_enable(t); in dmtimer_systimer_type1_reset()
100 writel_relaxed(BIT(1) | BIT(2), t->base + t->ifctrl); in dmtimer_systimer_type1_reset()
108 static int __init dmtimer_systimer_type2_reset(struct dmtimer_systimer *t) in dmtimer_systimer_type2_reset() argument
110 void __iomem *sysc = t->base + t->sysc; in dmtimer_systimer_type2_reset()
113 dmtimer_systimer_enable(t); in dmtimer_systimer_type2_reset()
122 static int __init dmtimer_systimer_reset(struct dmtimer_systimer *t) in dmtimer_systimer_reset() argument
126 if (dmtimer_systimer_revision1(t)) in dmtimer_systimer_reset()
127 ret = dmtimer_systimer_type1_reset(t); in dmtimer_systimer_reset()
129 ret = dmtimer_systimer_type2_reset(t); in dmtimer_systimer_reset()
323 static int __init dmtimer_systimer_init_clock(struct dmtimer_systimer *t, in dmtimer_systimer_init_clock() argument
352 t->ick = clock; in dmtimer_systimer_init_clock()
354 t->fck = clock; in dmtimer_systimer_init_clock()
362 struct dmtimer_systimer *t) in dmtimer_systimer_setup() argument
371 t->base = of_iomap(np, 0); in dmtimer_systimer_setup()
372 if (!t->base) in dmtimer_systimer_setup()
385 error = dmtimer_systimer_init_clock(t, np->parent, "fck", &rate); in dmtimer_systimer_setup()
389 t->rate = rate; in dmtimer_systimer_setup()
391 error = dmtimer_systimer_init_clock(t, np->parent, "ick", &rate); in dmtimer_systimer_setup()
395 if (dmtimer_systimer_revision1(t)) { in dmtimer_systimer_setup()
396 t->irq_stat = OMAP_TIMER_V1_STAT_OFFSET; in dmtimer_systimer_setup()
397 t->irq_ena = OMAP_TIMER_V1_INT_EN_OFFSET; in dmtimer_systimer_setup()
398 t->pend = _OMAP_TIMER_WRITE_PEND_OFFSET; in dmtimer_systimer_setup()
401 t->irq_stat = OMAP_TIMER_V2_IRQSTATUS; in dmtimer_systimer_setup()
402 t->irq_ena = OMAP_TIMER_V2_IRQENABLE_SET; in dmtimer_systimer_setup()
404 t->pend = regbase + _OMAP_TIMER_WRITE_PEND_OFFSET; in dmtimer_systimer_setup()
407 t->sysc = OMAP_TIMER_OCP_CFG_OFFSET; in dmtimer_systimer_setup()
408 t->load = regbase + _OMAP_TIMER_LOAD_OFFSET; in dmtimer_systimer_setup()
409 t->counter = regbase + _OMAP_TIMER_COUNTER_OFFSET; in dmtimer_systimer_setup()
410 t->ctrl = regbase + _OMAP_TIMER_CTRL_OFFSET; in dmtimer_systimer_setup()
411 t->wakeup = regbase + _OMAP_TIMER_WAKEUP_EN_OFFSET; in dmtimer_systimer_setup()
412 t->ifctrl = regbase + _OMAP_TIMER_IF_CTRL_OFFSET; in dmtimer_systimer_setup()
414 dmtimer_systimer_reset(t); in dmtimer_systimer_setup()
415 dmtimer_systimer_enable(t); in dmtimer_systimer_setup()
416 pr_debug("dmtimer rev %08x sysc %08x\n", readl_relaxed(t->base), in dmtimer_systimer_setup()
417 readl_relaxed(t->base + t->sysc)); in dmtimer_systimer_setup()
422 iounmap(t->base); in dmtimer_systimer_setup()
437 struct dmtimer_systimer *t = &clkevt->t; in dmtimer_clockevent_interrupt() local
439 writel_relaxed(OMAP_TIMER_INT_OVERFLOW, t->base + t->irq_stat); in dmtimer_clockevent_interrupt()
449 struct dmtimer_systimer *t = &clkevt->t; in dmtimer_set_next_event() local
450 void __iomem *pend = t->base + t->pend; in dmtimer_set_next_event()
454 writel_relaxed(0xffffffff - cycles, t->base + t->counter); in dmtimer_set_next_event()
458 writel_relaxed(OMAP_TIMER_CTRL_ST, t->base + t->ctrl); in dmtimer_set_next_event()
466 struct dmtimer_systimer *t = &clkevt->t; in dmtimer_clockevent_shutdown() local
467 void __iomem *ctrl = t->base + t->ctrl; in dmtimer_clockevent_shutdown()
477 udelay(3500000 / t->rate + 1); in dmtimer_clockevent_shutdown()
479 writel_relaxed(OMAP_TIMER_INT_OVERFLOW, t->base + t->irq_stat); in dmtimer_clockevent_shutdown()
487 struct dmtimer_systimer *t = &clkevt->t; in dmtimer_set_periodic() local
488 void __iomem *pend = t->base + t->pend; in dmtimer_set_periodic()
495 writel_relaxed(clkevt->period, t->base + t->load); in dmtimer_set_periodic()
499 writel_relaxed(clkevt->period, t->base + t->counter); in dmtimer_set_periodic()
504 t->base + t->ctrl); in dmtimer_set_periodic()
512 struct dmtimer_systimer *t = &clkevt->t; in omap_clockevent_idle() local
514 dmtimer_systimer_disable(t); in omap_clockevent_idle()
515 clk_disable(t->fck); in omap_clockevent_idle()
521 struct dmtimer_systimer *t = &clkevt->t; in omap_clockevent_unidle() local
524 error = clk_enable(t->fck); in omap_clockevent_unidle()
528 dmtimer_systimer_enable(t); in omap_clockevent_unidle()
529 writel_relaxed(OMAP_TIMER_INT_OVERFLOW, t->base + t->irq_ena); in omap_clockevent_unidle()
530 writel_relaxed(OMAP_TIMER_INT_OVERFLOW, t->base + t->wakeup); in omap_clockevent_unidle()
541 struct dmtimer_systimer *t; in dmtimer_clkevt_init_common() local
544 t = &clkevt->t; in dmtimer_clkevt_init_common()
565 error = dmtimer_systimer_setup(np, &clkevt->t); in dmtimer_clkevt_init_common()
569 clkevt->period = 0xffffffff - DIV_ROUND_CLOSEST(t->rate, HZ); in dmtimer_clkevt_init_common()
576 writel_relaxed(OMAP_TIMER_CTRL_POSTED, t->base + t->ifctrl); in dmtimer_clkevt_init_common()
583 writel_relaxed(OMAP_TIMER_INT_OVERFLOW, t->base + t->irq_ena); in dmtimer_clkevt_init_common()
584 writel_relaxed(OMAP_TIMER_INT_OVERFLOW, t->base + t->wakeup); in dmtimer_clkevt_init_common()
588 "always-on " : "", t->rate, np->parent); in dmtimer_clkevt_init_common()
593 iounmap(t->base); in dmtimer_clkevt_init_common()
615 clockevents_config_and_register(&clkevt->dev, clkevt->t.rate, in dmtimer_clockevent_init()
664 struct dmtimer_systimer *t = &clkevt->t; in omap_dmtimer_starting_cpu() local
666 clockevents_config_and_register(dev, t->rate, 3, ULONG_MAX); in omap_dmtimer_starting_cpu()
675 struct dmtimer_systimer *t = &clkevt->t; in dmtimer_percpu_timer_startup() local
677 if (t->sysc) { in dmtimer_percpu_timer_startup()
715 struct dmtimer_systimer *t = &clksrc->t; in dmtimer_clocksource_read_cycles() local
717 return (u64)readl_relaxed(t->base + t->counter); in dmtimer_clocksource_read_cycles()
730 struct dmtimer_systimer *t = &clksrc->t; in dmtimer_clocksource_suspend() local
732 clksrc->loadval = readl_relaxed(t->base + t->counter); in dmtimer_clocksource_suspend()
733 dmtimer_systimer_disable(t); in dmtimer_clocksource_suspend()
734 clk_disable(t->fck); in dmtimer_clocksource_suspend()
740 struct dmtimer_systimer *t = &clksrc->t; in dmtimer_clocksource_resume() local
743 error = clk_enable(t->fck); in dmtimer_clocksource_resume()
747 dmtimer_systimer_enable(t); in dmtimer_clocksource_resume()
748 writel_relaxed(clksrc->loadval, t->base + t->counter); in dmtimer_clocksource_resume()
750 t->base + t->ctrl); in dmtimer_clocksource_resume()
756 struct dmtimer_systimer *t; in dmtimer_clocksource_init() local
765 t = &clksrc->t; in dmtimer_clocksource_init()
767 error = dmtimer_systimer_setup(np, t); in dmtimer_clocksource_init()
783 writel_relaxed(0, t->base + t->counter); in dmtimer_clocksource_init()
785 t->base + t->ctrl); in dmtimer_clocksource_init()
792 dmtimer_sched_clock_counter = t->base + t->counter; in dmtimer_clocksource_init()
793 sched_clock_register(dmtimer_read_sched_clock, 32, t->rate); in dmtimer_clocksource_init()
796 if (clocksource_register_hz(dev, t->rate)) in dmtimer_clocksource_init()