Lines Matching +full:per +full:- +full:cpu

1 // SPDX-License-Identifier: GPL-2.0-only
17 * - timer 0 - NR_CPUs for per cpu timer
18 * - one timer for clocksource
19 * - one timer for watchdog driver.
20 * It is also worth notice that APB timer does not support true one-shot mode,
21 * free-running mode will be used here to emulate one-shot mode.
22 * APB timer can also be used as broadcast timer along with per cpu local APIC
34 #include <linux/cpu.h>
39 #include <asm/intel-mid.h>
60 int cpu; member
69 return apbt_virt_address + adev->num * APBTMRS_REG_SIZE; in adev_virt_addr()
93 apbt_address = (phys_addr_t)mtmr->phys_addr; in apbt_set_mapping()
104 apbt_freq = mtmr->freq_hz; in apbt_set_mapping()
114 (int)(mtmr->phys_addr & 0xff) / APBTMRS_REG_SIZE); in apbt_set_mapping()
115 phy_cs_timer_id = (unsigned int)(mtmr->phys_addr & 0xff) / in apbt_set_mapping()
143 return -ENODEV; in apbt_clockevent_register()
146 adev->num = smp_processor_id(); in apbt_clockevent_register()
147 adev->timer = dw_apb_clockevent_init(smp_processor_id(), "apbt0", in apbt_clockevent_register()
149 APBT_CLOCKEVENT_RATING - 100 : APBT_CLOCKEVENT_RATING, in apbt_clockevent_register()
152 adev->timer->eoi = NULL; in apbt_clockevent_register()
155 global_clock_event = &adev->timer->ced; in apbt_clockevent_register()
157 global_clock_event->name); in apbt_clockevent_register()
160 dw_apb_clockevent_register(adev->timer); in apbt_clockevent_register()
170 irq_modify_status(adev->irq, 0, IRQ_MOVE_PCNTXT); in apbt_setup_irq()
171 irq_set_affinity(adev->irq, cpumask_of(adev->cpu)); in apbt_setup_irq()
174 /* Should be called with per cpu */
178 int cpu; in apbt_setup_secondary_clock() local
180 /* Don't register boot CPU clockevent */ in apbt_setup_secondary_clock()
181 cpu = smp_processor_id(); in apbt_setup_secondary_clock()
182 if (!cpu) in apbt_setup_secondary_clock()
186 if (!adev->timer) { in apbt_setup_secondary_clock()
187 adev->timer = dw_apb_clockevent_init(cpu, adev->name, in apbt_setup_secondary_clock()
189 adev->irq, apbt_freq); in apbt_setup_secondary_clock()
190 adev->timer->eoi = NULL; in apbt_setup_secondary_clock()
192 dw_apb_clockevent_resume(adev->timer); in apbt_setup_secondary_clock()
195 printk(KERN_INFO "Registering CPU %d clockevent device %s, cpu %08x\n", in apbt_setup_secondary_clock()
196 cpu, adev->name, adev->cpu); in apbt_setup_secondary_clock()
199 dw_apb_clockevent_register(adev->timer); in apbt_setup_secondary_clock()
205 * this notify handler process CPU hotplug events. in case of S0i3, nonboot
207 * per cpu timer irq registered so that we do need to do free_irq/request_irq.
210 * without the notifier chain. currently, cpu 0 may get interrupts from other
211 * cpu timers during the offline process due to the ordering of notification.
214 static int apbt_cpu_dead(unsigned int cpu) in apbt_cpu_dead() argument
216 struct apbt_dev *adev = &per_cpu(cpu_apbt_dev, cpu); in apbt_cpu_dead()
218 dw_apb_clockevent_pause(adev->timer); in apbt_cpu_dead()
220 pr_debug("skipping APBT CPU %u offline\n", cpu); in apbt_cpu_dead()
222 pr_debug("APBT clockevent for cpu %u offline\n", cpu); in apbt_cpu_dead()
223 dw_apb_clockevent_stop(adev->timer); in apbt_cpu_dead()
264 } while ((now - start) < 200000UL); in apbt_clocksource_register()
277 * per CPU timer if possible.
278 * returns 1 if per cpu apbt is setup
279 * returns 0 if no per cpu apbt is chosen
317 printk(KERN_INFO "apbt: disabled per cpu timer\n"); in apbt_time_init()
327 /* here we set up per CPU timer data structure */ in apbt_time_init()
330 adev->num = i; in apbt_time_init()
331 adev->cpu = i; in apbt_time_init()
334 adev->irq = p_mtmr->irq; in apbt_time_init()
336 printk(KERN_ERR "Failed to get timer for cpu %d\n", i); in apbt_time_init()
337 snprintf(adev->name, sizeof(adev->name) - 1, "apbt%d", i); in apbt_time_init()