static int kona_tick_set_next_event(unsigned long cycles, struct clock_event_device *evt) { struct kona_td *kona_td; kona_td = (struct kona_td *)&__get_cpu_var(percpu_kona_td); if (likely(cpu_online(smp_processor_id()))) kona_timer_set_match_start(kona_td->kona_timer, cycles); return 0; }
static int kona_tick_set_next_event(unsigned long cycles, struct clock_event_device *evt) { struct kona_td *kona_td; int ret = -1; kona_td = (struct kona_td *)&__get_cpu_var(percpu_kona_td); ret = kona_timer_set_match_start(kona_td->kona_timer, cycles); return ret; }
static ssize_t kona_timer_start_test(struct device *dev, struct device_attribute *attr, const char *buf, size_t n) { unsigned int ch_num, mode, count; char name[255]; if (sscanf(buf, "%s %d %d %d", name, &ch_num, &mode, &count) == 4) { pr_info("channel_num:%d mode(0-periodic 1-oneshot):%d " "count:%d\n", ch_num, mode, count); if (kt == NULL) kt = kona_timer_request(name, ch_num); if (kt == NULL) { pr_err("kona_timer_request returned error\n"); goto out; } cfg.mode = mode; cfg.arg = kt; cfg.cb = timer_callback; cfg.reload = count; if (kona_timer_config(kt, &cfg) < 0) { pr_err("kona_timer_config returned error\n"); goto out; } if (kona_timer_set_match_start(kt, count) < 0) { pr_err("kona_timer_set_match_start returned error\n"); goto out; } pr_info("Timer test started\n"); out: return n; } pr_info("\nusage: echo [name (aon-timer/slave-timer)] " "[channel num (0-3)] [mode(0-periodic" "1-oneshot)] [count value] > /sys/bcm/timer_start_test\n"); return -EINVAL; }
static int gptimer_set_next_event(unsigned long clc, struct clock_event_device *unused) { /* gptimer (0) is disabled by the timer interrupt already *so, here we reload the next event value and re-enable *the timer * * This way, we are potentially losing the time between *timer-interrupt->set_next_event. CPU local timers, when *they come in should get rid of skew */ #ifdef CONFIG_GP_TIMER_CLOCK_OFF_FIX { volatile unsigned int i; kona_timer_disable_and_clear(gpt_evt); for (i = 0; i < 1800; i++) { } } #endif kona_timer_set_match_start(gpt_evt, clc); return 0; }
static int kona_timer_unit_test_program(struct kona_timer *lkt, enum timer_mode mode, unsigned long count) { struct timer_ch_cfg lcfg; lcfg.mode = mode; lcfg.arg = lkt; lcfg.cb = timer_callback; if (kona_timer_config(lkt, &lcfg) < 0) { pr_err("kona_timer_config returned error.\n"); goto error; } if (kona_timer_set_match_start(lkt, count) < 0) { pr_err("kona_timer_set_match_start returned error.\n"); goto error; } return 0; error: return -1; }