Lines Matching refs:ost

69 	struct ingenic_ost *ost;
98 prescale = readl(ost_clk->ost->base + info->ostccr_reg);
112 prescale = readl(ost_clk->ost->base + info->ostccr_reg);
152 val = readl(ost_clk->ost->base + info->ostccr_reg);
155 writel(val, ost_clk->ost->base + info->ostccr_reg);
168 val = readl(ost_clk->ost->base + info->ostccr_reg);
171 writel(val, ost_clk->ost->base + info->ostccr_reg);
216 struct ingenic_ost *ost = ingenic_ost;
219 count = readl(ost->base + OST_REG_OST2CNTL);
236 struct ingenic_ost *ost = to_ingenic_ost(evt);
238 writel(OSTECR_OST1ENC, ost->base + OST_REG_OSTECR);
246 struct ingenic_ost *ost = to_ingenic_ost(evt);
248 writel((u32)~OSTFR_FFLAG, ost->base + OST_REG_OSTFR);
249 writel(next, ost->base + OST_REG_OST1DFR);
250 writel(OSTCR_OST1CLR, ost->base + OST_REG_OSTCR);
251 writel(OSTESR_OST1ENS, ost->base + OST_REG_OSTESR);
252 writel((u32)~OSTMR_FMASK, ost->base + OST_REG_OSTMR);
260 struct ingenic_ost *ost = to_ingenic_ost(evt);
262 writel(OSTECR_OST1ENC, ost->base + OST_REG_OSTECR);
270 static int __init ingenic_ost_register_clock(struct ingenic_ost *ost,
284 ost_clk->ost = ost;
287 val = readl(ost->base + info->ostccr_reg);
289 writel(val, ost->base + info->ostccr_reg);
314 struct ingenic_ost *ost)
320 ost->percpu_timer_clk = ingenic_ost_get_clock(np, channel);
321 if (IS_ERR(ost->percpu_timer_clk))
322 return PTR_ERR(ost->percpu_timer_clk);
324 err = clk_prepare_enable(ost->percpu_timer_clk);
328 rate = clk_get_rate(ost->percpu_timer_clk);
340 snprintf(ost->name, sizeof(ost->name), "OST percpu timer");
343 ost->name, &ost->cevt);
347 ost->cevt.cpumask = cpumask_of(smp_processor_id());
348 ost->cevt.features = CLOCK_EVT_FEAT_ONESHOT;
349 ost->cevt.name = ost->name;
350 ost->cevt.rating = 400;
351 ost->cevt.set_state_shutdown = ingenic_ost_cevt_set_state_shutdown;
352 ost->cevt.set_next_event = ingenic_ost_cevt_set_next;
354 clockevents_config_and_register(&ost->cevt, rate, 4, 0xffffffff);
361 clk_disable_unprepare(ost->percpu_timer_clk);
363 clk_put(ost->percpu_timer_clk);
368 struct ingenic_ost *ost)
371 struct clocksource *cs = &ost->cs;
375 ost->global_timer_clk = ingenic_ost_get_clock(np, channel);
376 if (IS_ERR(ost->global_timer_clk))
377 return PTR_ERR(ost->global_timer_clk);
379 err = clk_prepare_enable(ost->global_timer_clk);
383 rate = clk_get_rate(ost->global_timer_clk);
390 writel(OSTCR_OST2CLR, ost->base + OST_REG_OSTCR);
393 writel(OSTESR_OST2ENS, ost->base + OST_REG_OSTESR);
395 cs->name = "ingenic-ost";
408 clk_disable_unprepare(ost->global_timer_clk);
410 clk_put(ost->global_timer_clk);
419 { .compatible = "ingenic,x1000-ost", .data = &x1000_soc_info },
426 struct ingenic_ost *ost;
430 ost = kzalloc(sizeof(*ost), GFP_KERNEL);
431 if (!ost)
434 ost->base = of_io_request_and_map(np, 0, of_node_full_name(np));
435 if (IS_ERR(ost->base)) {
437 ret = PTR_ERR(ost->base);
441 ost->clk = of_clk_get_by_name(np, "ost");
442 if (IS_ERR(ost->clk)) {
443 ret = PTR_ERR(ost->clk);
448 ret = clk_prepare_enable(ost->clk);
454 ost->soc_info = id->data;
456 ost->clocks = kzalloc(struct_size(ost->clocks, hws, ost->soc_info->num_channels),
458 if (!ost->clocks) {
463 ost->clocks->num = ost->soc_info->num_channels;
465 for (i = 0; i < ost->clocks->num; i++) {
466 ret = ingenic_ost_register_clock(ost, i, &x1000_ost_clk_info[i], ost->clocks);
473 ret = of_clk_add_hw_provider(np, of_clk_hw_onecell_get, ost->clocks);
479 ingenic_ost = ost;
484 for (i = 0; i < ost->clocks->num; i++)
485 if (ost->clocks->hws[i])
486 clk_hw_unregister(ost->clocks->hws[i]);
487 kfree(ost->clocks);
489 clk_disable_unprepare(ost->clk);
491 clk_put(ost->clk);
493 kfree(ost);
499 struct ingenic_ost *ost;
511 ost = ingenic_ost;
512 if (IS_ERR(ost))
513 return PTR_ERR(ost);
515 ret = ingenic_ost_global_timer_init(np, ost);
521 ret = ingenic_ost_percpu_timer_init(np, ost);
526 rate = clk_get_rate(ost->global_timer_clk);
532 clocksource_unregister(&ost->cs);
533 clk_disable_unprepare(ost->global_timer_clk);
534 clk_put(ost->global_timer_clk);
536 kfree(ost);
540 TIMER_OF_DECLARE(x1000_ost, "ingenic,x1000-ost", ingenic_ost_init);