Lines Matching +full:apb +full:- +full:base

1 // SPDX-License-Identifier: GPL-2.0-only
3 * apb_timer.c: Driver for Langwell APB timers
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
23 * timer, but by default APB timer has higher rating than local APIC timers.
39 #include <asm/intel-mid.h>
53 * Common DW APB timer info
69 return apbt_virt_address + adev->num * APBTMRS_REG_SIZE; in adev_virt_addr()
84 pr_debug("APBT base already mapped\n"); in apbt_set_mapping()
93 apbt_address = (phys_addr_t)mtmr->phys_addr; in apbt_set_mapping()
95 printk(KERN_WARNING "No timer base from SFI, use default\n"); 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()
124 panic("Failed to setup APB system timer\n"); 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()
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()
196 cpu, adev->name, adev->cpu); in apbt_setup_secondary_clock()
199 dw_apb_clockevent_register(adev->timer); in apbt_setup_secondary_clock()
218 dw_apb_clockevent_pause(adev->timer); in apbt_cpu_dead()
223 dw_apb_clockevent_stop(adev->timer); in apbt_cpu_dead()
233 return cpuhp_setup_state(CPUHP_X86_APB_DEAD, "x86/apb:dead", NULL, in apbt_late_init()
264 } while ((now - start) < 200000UL); in apbt_clocksource_register()
315 /* kernel cmdline disable apb timer, so we will use lapic timers */ in apbt_time_init()
325 pr_debug("%s: %d APB timers used\n", __func__, apbt_num_timers_used); 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()
337 snprintf(adev->name, sizeof(adev->name) - 1, "apbt%d", i); in apbt_time_init()
346 panic("failed to enable APB timer\n"); in apbt_time_init()