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()
326 static int __init dmtimer_systimer_init_clock(struct dmtimer_systimer *t, in dmtimer_systimer_init_clock() argument
353 t->ick = clock; in dmtimer_systimer_init_clock()
355 t->fck = clock; in dmtimer_systimer_init_clock()
363 struct dmtimer_systimer *t) in dmtimer_systimer_setup() argument
372 t->base = of_iomap(np, 0); in dmtimer_systimer_setup()
373 if (!t->base) in dmtimer_systimer_setup()
386 error = dmtimer_systimer_init_clock(t, np->parent, "fck", &rate); in dmtimer_systimer_setup()
390 t->rate = rate; in dmtimer_systimer_setup()
392 error = dmtimer_systimer_init_clock(t, np->parent, "ick", &rate); in dmtimer_systimer_setup()
396 if (dmtimer_systimer_revision1(t)) { in dmtimer_systimer_setup()
397 t->irq_stat = OMAP_TIMER_V1_STAT_OFFSET; in dmtimer_systimer_setup()
398 t->irq_ena = OMAP_TIMER_V1_INT_EN_OFFSET; in dmtimer_systimer_setup()
399 t->pend = _OMAP_TIMER_WRITE_PEND_OFFSET; in dmtimer_systimer_setup()
402 t->irq_stat = OMAP_TIMER_V2_IRQSTATUS; in dmtimer_systimer_setup()
403 t->irq_ena = OMAP_TIMER_V2_IRQENABLE_SET; in dmtimer_systimer_setup()
405 t->pend = regbase + _OMAP_TIMER_WRITE_PEND_OFFSET; in dmtimer_systimer_setup()
408 t->sysc = OMAP_TIMER_OCP_CFG_OFFSET; in dmtimer_systimer_setup()
409 t->load = regbase + _OMAP_TIMER_LOAD_OFFSET; in dmtimer_systimer_setup()
410 t->counter = regbase + _OMAP_TIMER_COUNTER_OFFSET; in dmtimer_systimer_setup()
411 t->ctrl = regbase + _OMAP_TIMER_CTRL_OFFSET; in dmtimer_systimer_setup()
412 t->wakeup = regbase + _OMAP_TIMER_WAKEUP_EN_OFFSET; in dmtimer_systimer_setup()
413 t->ifctrl = regbase + _OMAP_TIMER_IF_CTRL_OFFSET; in dmtimer_systimer_setup()
415 dmtimer_systimer_reset(t); in dmtimer_systimer_setup()
416 dmtimer_systimer_enable(t); in dmtimer_systimer_setup()
417 pr_debug("dmtimer rev %08x sysc %08x\n", readl_relaxed(t->base), in dmtimer_systimer_setup()
418 readl_relaxed(t->base + t->sysc)); in dmtimer_systimer_setup()
423 iounmap(t->base); in dmtimer_systimer_setup()
438 struct dmtimer_systimer *t = &clkevt->t; in dmtimer_clockevent_interrupt() local
440 writel_relaxed(OMAP_TIMER_INT_OVERFLOW, t->base + t->irq_stat); in dmtimer_clockevent_interrupt()
450 struct dmtimer_systimer *t = &clkevt->t; in dmtimer_set_next_event() local
451 void __iomem *pend = t->base + t->pend; in dmtimer_set_next_event()
455 writel_relaxed(0xffffffff - cycles, t->base + t->counter); in dmtimer_set_next_event()
459 writel_relaxed(OMAP_TIMER_CTRL_ST, t->base + t->ctrl); in dmtimer_set_next_event()
467 struct dmtimer_systimer *t = &clkevt->t; in dmtimer_clockevent_shutdown() local
468 void __iomem *ctrl = t->base + t->ctrl; in dmtimer_clockevent_shutdown()
478 udelay(3500000 / t->rate + 1); in dmtimer_clockevent_shutdown()
480 writel_relaxed(OMAP_TIMER_INT_OVERFLOW, t->base + t->irq_stat); in dmtimer_clockevent_shutdown()
488 struct dmtimer_systimer *t = &clkevt->t; in dmtimer_set_periodic() local
489 void __iomem *pend = t->base + t->pend; in dmtimer_set_periodic()
496 writel_relaxed(clkevt->period, t->base + t->load); in dmtimer_set_periodic()
500 writel_relaxed(clkevt->period, t->base + t->counter); in dmtimer_set_periodic()
505 t->base + t->ctrl); in dmtimer_set_periodic()
513 struct dmtimer_systimer *t = &clkevt->t; in omap_clockevent_idle() local
515 dmtimer_systimer_disable(t); in omap_clockevent_idle()
516 clk_disable(t->fck); in omap_clockevent_idle()
522 struct dmtimer_systimer *t = &clkevt->t; in omap_clockevent_unidle() local
525 error = clk_enable(t->fck); in omap_clockevent_unidle()
529 dmtimer_systimer_enable(t); in omap_clockevent_unidle()
530 writel_relaxed(OMAP_TIMER_INT_OVERFLOW, t->base + t->irq_ena); in omap_clockevent_unidle()
531 writel_relaxed(OMAP_TIMER_INT_OVERFLOW, t->base + t->wakeup); in omap_clockevent_unidle()
542 struct dmtimer_systimer *t; in dmtimer_clkevt_init_common() local
545 t = &clkevt->t; in dmtimer_clkevt_init_common()
566 error = dmtimer_systimer_setup(np, &clkevt->t); in dmtimer_clkevt_init_common()
570 clkevt->period = 0xffffffff - DIV_ROUND_CLOSEST(t->rate, HZ); in dmtimer_clkevt_init_common()
577 writel_relaxed(OMAP_TIMER_CTRL_POSTED, t->base + t->ifctrl); in dmtimer_clkevt_init_common()
584 writel_relaxed(OMAP_TIMER_INT_OVERFLOW, t->base + t->irq_ena); in dmtimer_clkevt_init_common()
585 writel_relaxed(OMAP_TIMER_INT_OVERFLOW, t->base + t->wakeup); in dmtimer_clkevt_init_common()
589 "always-on " : "", t->rate, np->parent); in dmtimer_clkevt_init_common()
594 iounmap(t->base); in dmtimer_clkevt_init_common()
616 clockevents_config_and_register(&clkevt->dev, clkevt->t.rate, in dmtimer_clockevent_init()
665 struct dmtimer_systimer *t = &clkevt->t; in omap_dmtimer_starting_cpu() local
667 clockevents_config_and_register(dev, t->rate, 3, ULONG_MAX); in omap_dmtimer_starting_cpu()
676 struct dmtimer_systimer *t = &clkevt->t; in dmtimer_percpu_timer_startup() local
678 if (t->sysc) { in dmtimer_percpu_timer_startup()
716 struct dmtimer_systimer *t = &clksrc->t; in dmtimer_clocksource_read_cycles() local
718 return (u64)readl_relaxed(t->base + t->counter); in dmtimer_clocksource_read_cycles()
731 struct dmtimer_systimer *t = &clksrc->t; in dmtimer_clocksource_suspend() local
733 clksrc->loadval = readl_relaxed(t->base + t->counter); in dmtimer_clocksource_suspend()
734 dmtimer_systimer_disable(t); in dmtimer_clocksource_suspend()
735 clk_disable(t->fck); in dmtimer_clocksource_suspend()
741 struct dmtimer_systimer *t = &clksrc->t; in dmtimer_clocksource_resume() local
744 error = clk_enable(t->fck); in dmtimer_clocksource_resume()
748 dmtimer_systimer_enable(t); in dmtimer_clocksource_resume()
749 writel_relaxed(clksrc->loadval, t->base + t->counter); in dmtimer_clocksource_resume()
751 t->base + t->ctrl); in dmtimer_clocksource_resume()
757 struct dmtimer_systimer *t; in dmtimer_clocksource_init() local
766 t = &clksrc->t; in dmtimer_clocksource_init()
768 error = dmtimer_systimer_setup(np, t); in dmtimer_clocksource_init()
784 writel_relaxed(0, t->base + t->counter); in dmtimer_clocksource_init()
786 t->base + t->ctrl); in dmtimer_clocksource_init()
793 dmtimer_sched_clock_counter = t->base + t->counter; in dmtimer_clocksource_init()
794 sched_clock_register(dmtimer_read_sched_clock, 32, t->rate); in dmtimer_clocksource_init()
797 if (clocksource_register_hz(dev, t->rate)) in dmtimer_clocksource_init()