Lines Matching full:gtm

69 struct gtm {  struct
80 * gtm_get_timer16 - request GTM timer to use it with the rest of GTM API
83 * This function reserves GTM timer for later use. It returns gtm_timer
84 * structure to use with the rest of GTM API, you should use timer->irq
89 struct gtm *gtm; in gtm_get_timer16() argument
92 list_for_each_entry(gtm, &gtms, list_node) { in gtm_get_timer16()
93 spin_lock_irq(&gtm->lock); in gtm_get_timer16()
95 for (i = 0; i < ARRAY_SIZE(gtm->timers); i++) { in gtm_get_timer16()
96 if (!gtm->timers[i].requested) { in gtm_get_timer16()
97 gtm->timers[i].requested = true; in gtm_get_timer16()
98 spin_unlock_irq(&gtm->lock); in gtm_get_timer16()
99 return &gtm->timers[i]; in gtm_get_timer16()
103 spin_unlock_irq(&gtm->lock); in gtm_get_timer16()
113 * gtm_get_specific_timer16 - request specific GTM timer
114 * @gtm: specific GTM, pass here GTM's device_node->data
118 * This function reserves GTM timer for later use. It returns gtm_timer
119 * structure to use with the rest of GTM API, you should use timer->irq
122 struct gtm_timer *gtm_get_specific_timer16(struct gtm *gtm, in gtm_get_specific_timer16() argument
130 spin_lock_irq(&gtm->lock); in gtm_get_specific_timer16()
132 if (gtm->timers[timer].requested) in gtm_get_specific_timer16()
135 ret = &gtm->timers[timer]; in gtm_get_specific_timer16()
139 spin_unlock_irq(&gtm->lock); in gtm_get_specific_timer16()
145 * gtm_put_timer16 - release 16 bits GTM timer
149 * This function releases GTM timer so others may request it.
155 spin_lock_irq(&tmr->gtm->lock); in gtm_put_timer16()
157 spin_unlock_irq(&tmr->gtm->lock); in gtm_put_timer16()
168 struct gtm *gtm = tmr->gtm; in gtm_set_ref_timer16() local
169 int num = tmr - &gtm->timers[0]; in gtm_set_ref_timer16()
181 prescaler = gtm->clock / frequency; in gtm_set_ref_timer16()
203 spin_lock_irqsave(&gtm->lock, flags); in gtm_set_ref_timer16()
225 spin_unlock_irqrestore(&gtm->lock, flags); in gtm_set_ref_timer16()
238 * This function (re)sets the GTM timer so that it counts up to the requested
270 * This function (re)sets GTM timer so that it counts up to the requested
300 * This function simply stops the GTM timer.
304 struct gtm *gtm = tmr->gtm; in gtm_stop_timer16() local
305 int num = tmr - &gtm->timers[0]; in gtm_stop_timer16()
308 spin_lock_irqsave(&gtm->lock, flags); in gtm_stop_timer16()
313 spin_unlock_irqrestore(&gtm->lock, flags); in gtm_stop_timer16()
367 if (!of_device_is_compatible(np, "fsl,cpm2-gtm")) { in gtm_set_shortcuts()
379 for_each_compatible_node(np, NULL, "fsl,gtm") { in fsl_gtm_init()
381 struct gtm *gtm; in fsl_gtm_init() local
385 gtm = kzalloc(sizeof(*gtm), GFP_KERNEL); in fsl_gtm_init()
386 if (!gtm) { in fsl_gtm_init()
392 spin_lock_init(&gtm->lock); in fsl_gtm_init()
399 gtm->clock = *clock; in fsl_gtm_init()
401 for (i = 0; i < ARRAY_SIZE(gtm->timers); i++) { in fsl_gtm_init()
410 gtm->timers[i].irq = irq; in fsl_gtm_init()
411 gtm->timers[i].gtm = gtm; in fsl_gtm_init()
414 gtm->regs = of_iomap(np, 0); in fsl_gtm_init()
415 if (!gtm->regs) { in fsl_gtm_init()
421 gtm_set_shortcuts(np, gtm->timers, gtm->regs); in fsl_gtm_init()
422 list_add(&gtm->list_node, &gtms); in fsl_gtm_init()
425 np->data = gtm; in fsl_gtm_init()
430 kfree(gtm); in fsl_gtm_init()