time.c (f83d9396d1f63048c423efa00e4e244da10a35fd) | time.c (b2d3e3354e2a0d0e912308618ea33d0337f405c3) |
---|---|
1// SPDX-License-Identifier: GPL-2.0 2/* 3 * Common time service routines for LoongArch machines. 4 * 5 * Copyright (C) 2020-2022 Loongson Technology Corporation Limited 6 */ 7#include <linux/clockchips.h> 8#include <linux/delay.h> --- 109 unchanged lines hidden (view full) --- 118static long init_timeval; 119 120void sync_counter(void) 121{ 122 /* Ensure counter begin at 0 */ 123 csr_write64(-init_timeval, LOONGARCH_CSR_CNTC); 124} 125 | 1// SPDX-License-Identifier: GPL-2.0 2/* 3 * Common time service routines for LoongArch machines. 4 * 5 * Copyright (C) 2020-2022 Loongson Technology Corporation Limited 6 */ 7#include <linux/clockchips.h> 8#include <linux/delay.h> --- 109 unchanged lines hidden (view full) --- 118static long init_timeval; 119 120void sync_counter(void) 121{ 122 /* Ensure counter begin at 0 */ 123 csr_write64(-init_timeval, LOONGARCH_CSR_CNTC); 124} 125 |
126static int get_timer_irq(void) 127{ 128 struct irq_domain *d = irq_find_matching_fwnode(cpuintc_handle, DOMAIN_BUS_ANY); 129 130 if (d) 131 return irq_create_mapping(d, EXCCODE_TIMER - EXCCODE_INT_START); 132 133 return -EINVAL; 134} 135 |
|
126int constant_clockevent_init(void) 127{ 128 unsigned int irq; 129 unsigned int cpu = smp_processor_id(); 130 unsigned long min_delta = 0x600; 131 unsigned long max_delta = (1UL << 48) - 1; 132 struct clock_event_device *cd; 133 static int timer_irq_installed = 0; 134 | 136int constant_clockevent_init(void) 137{ 138 unsigned int irq; 139 unsigned int cpu = smp_processor_id(); 140 unsigned long min_delta = 0x600; 141 unsigned long max_delta = (1UL << 48) - 1; 142 struct clock_event_device *cd; 143 static int timer_irq_installed = 0; 144 |
135 irq = EXCCODE_TIMER - EXCCODE_INT_START; | 145 irq = get_timer_irq(); 146 if (irq < 0) 147 pr_err("Failed to map irq %d (timer)\n", irq); |
136 137 cd = &per_cpu(constant_clockevent_device, cpu); 138 139 cd->name = "Constant"; 140 cd->features = CLOCK_EVT_FEAT_ONESHOT | CLOCK_EVT_FEAT_PERIODIC | CLOCK_EVT_FEAT_PERCPU; 141 142 cd->irq = irq; 143 cd->rating = 320; --- 71 unchanged lines hidden --- | 148 149 cd = &per_cpu(constant_clockevent_device, cpu); 150 151 cd->name = "Constant"; 152 cd->features = CLOCK_EVT_FEAT_ONESHOT | CLOCK_EVT_FEAT_PERIODIC | CLOCK_EVT_FEAT_PERCPU; 153 154 cd->irq = irq; 155 cd->rating = 320; --- 71 unchanged lines hidden --- |