Lines Matching +full:armv8 +full:- +full:based
1 // SPDX-License-Identifier: GPL-2.0-only
99 writel_relaxed(val, timer->base + CNTP_CTL); in arch_timer_reg_write()
102 writel_relaxed(val, timer->base + CNTP_TVAL); in arch_timer_reg_write()
109 writel_relaxed(val, timer->base + CNTV_CTL); in arch_timer_reg_write()
112 writel_relaxed(val, timer->base + CNTV_TVAL); in arch_timer_reg_write()
130 val = readl_relaxed(timer->base + CNTP_CTL); in arch_timer_reg_read()
133 val = readl_relaxed(timer->base + CNTP_TVAL); in arch_timer_reg_read()
140 val = readl_relaxed(timer->base + CNTV_CTL); in arch_timer_reg_read()
143 val = readl_relaxed(timer->base + CNTV_TVAL); in arch_timer_reg_read()
174 * Default to cp15 based access because arm64 uses this function for
223 _retries--; \
269 _retries--; \
270 } while (unlikely((_new - _old) >> 5) && _retries); \
344 * (7ff -> 000 -> 800) and forward (7ff -> fff -> 800), ignore register values
354 _retries--; \
373 return read_sysreg(cntp_cval_el0) - sun50i_a64_read_cntpct_el0(); in sun50i_a64_read_cntp_tval_el0()
378 return read_sysreg(cntv_cval_el0) - sun50i_a64_read_cntvct_el0(); in sun50i_a64_read_cntv_tval_el0()
427 .id = "fsl,erratum-a008585",
440 .id = "hisilicon,erratum-161010101",
473 .id = "allwinner,erratum-unknown1",
502 return of_property_read_bool(np, wa->id); in arch_timer_check_dt_erratum()
509 return this_cpu_has_cap((uintptr_t)wa->id); in arch_timer_check_local_cap_erratum()
518 const struct ate_acpi_oem_info *info = wa->id; in arch_timer_check_acpi_oem_erratum()
523 if (!memcmp(info->oem_id, table->oem_id, ACPI_OEM_ID_SIZE) && in arch_timer_check_acpi_oem_erratum()
524 !memcmp(info->oem_table_id, table->oem_table_id, ACPI_OEM_TABLE_ID_SIZE) && in arch_timer_check_acpi_oem_erratum()
525 info->oem_revision == table->oem_revision) in arch_timer_check_acpi_oem_erratum()
565 if (wa->read_cntvct_el0 || wa->read_cntpct_el0) in arch_timer_enable_workaround()
570 * out-of-line counter accessor. We may change our mind pretty in arch_timer_enable_workaround()
571 * late in the game (with a per-CPU erratum, for example), so in arch_timer_enable_workaround()
574 if (wa->read_cntvct_el0) { in arch_timer_enable_workaround()
577 } else if (wa->disable_compat_vdso && vdso_default != VDSO_CLOCKMODE_NONE) { in arch_timer_enable_workaround()
613 wa->desc, __wa->desc); in arch_timer_check_ool_workaround()
620 local ? "local" : "global", wa->desc); in arch_timer_check_ool_workaround()
647 evt->event_handler(evt); in timer_handler()
756 clk->features = CLOCK_EVT_FEAT_ONESHOT; in __arch_timer_setup()
759 typeof(clk->set_next_event) sne; in __arch_timer_setup()
764 clk->features |= CLOCK_EVT_FEAT_C3STOP; in __arch_timer_setup()
765 clk->name = "arch_sys_timer"; in __arch_timer_setup()
766 clk->rating = 450; in __arch_timer_setup()
767 clk->cpumask = cpumask_of(smp_processor_id()); in __arch_timer_setup()
768 clk->irq = arch_timer_ppi[arch_timer_uses_ppi]; in __arch_timer_setup()
771 clk->set_state_shutdown = arch_timer_shutdown_virt; in __arch_timer_setup()
772 clk->set_state_oneshot_stopped = arch_timer_shutdown_virt; in __arch_timer_setup()
778 clk->set_state_shutdown = arch_timer_shutdown_phys; in __arch_timer_setup()
779 clk->set_state_oneshot_stopped = arch_timer_shutdown_phys; in __arch_timer_setup()
786 clk->set_next_event = sne; in __arch_timer_setup()
788 clk->features |= CLOCK_EVT_FEAT_DYNIRQ; in __arch_timer_setup()
789 clk->name = "arch_mem_timer"; in __arch_timer_setup()
790 clk->rating = 400; in __arch_timer_setup()
791 clk->cpumask = cpu_possible_mask; in __arch_timer_setup()
793 clk->set_state_shutdown = arch_timer_shutdown_virt_mem; in __arch_timer_setup()
794 clk->set_state_oneshot_stopped = arch_timer_shutdown_virt_mem; in __arch_timer_setup()
795 clk->set_next_event = in __arch_timer_setup()
798 clk->set_state_shutdown = arch_timer_shutdown_phys_mem; in __arch_timer_setup()
799 clk->set_state_oneshot_stopped = arch_timer_shutdown_phys_mem; in __arch_timer_setup()
800 clk->set_next_event = in __arch_timer_setup()
805 clk->set_state_shutdown(clk); in __arch_timer_setup()
837 lsb = fls(evt_stream_div) - 1; in arch_timer_configure_evtstream()
838 if (lsb > 0 && (evt_stream_div & BIT(lsb - 1))) in arch_timer_configure_evtstream()
915 return -EINVAL; in validate_timer_rate()
924 * For historical reasons, when probing with DT we use whichever (non-zero)
926 * probed has a clock-frequency property, this overrides the HW register.
934 if (of_property_read_u32(np, "clock-frequency", &arch_timer_rate)) in arch_timer_of_configure_rate()
999 /* Register the CP15 based counter if we have one */ in arch_counter_register()
1037 pr_debug("disable IRQ%d cpu #%d\n", clk->irq, smp_processor_id()); in arch_timer_stop()
1043 clk->set_state_shutdown(clk); in arch_timer_stop()
1106 err = -ENOMEM; in arch_timer_register()
1177 return -ENOMEM; in arch_timer_mem_register()
1179 t->base = base; in arch_timer_mem_register()
1180 t->evt.irq = irq; in arch_timer_mem_register()
1181 __arch_timer_setup(ARCH_TIMER_TYPE_MEM, &t->evt); in arch_timer_mem_register()
1188 ret = request_irq(irq, func, IRQF_TIMER, "arch_mem_timer", &t->evt); in arch_timer_mem_register()
1198 { .compatible = "arm,armv7-timer", },
1199 { .compatible = "arm,armv8-timer", },
1204 { .compatible = "arm,armv7-timer-mem", },
1214 /* We have two timers, and both device-tree nodes are probed. */ in arch_timer_needs_of_probing()
1220 * check if we have another type of timer node in device-tree. in arch_timer_needs_of_probing()
1243 * arch_timer_select_ppi() - Select suitable PPI for the current system.
1249 * On ARMv8.1 with VH extensions, the kernel runs in HYP. VHE
1300 arch_timer_c3stop = !of_property_read_bool(np, "always-on"); in arch_timer_of_init()
1310 of_property_read_bool(np, "arm,cpu-registers-not-fw-configured")) in arch_timer_of_init()
1317 return -EINVAL; in arch_timer_of_init()
1322 "arm,no-tick-in-suspend"); in arch_timer_of_init()
1333 TIMER_OF_DECLARE(armv7_arch_timer, "arm,armv7-timer", arch_timer_of_init);
1334 TIMER_OF_DECLARE(armv8_arch_timer, "arm,armv8-timer", arch_timer_of_init);
1342 base = ioremap(frame->cntbase, frame->size); in arch_timer_mem_frame_get_cntfrq()
1344 pr_err("Unable to map frame @ %pa\n", &frame->cntbase); in arch_timer_mem_frame_get_cntfrq()
1363 cntctlbase = ioremap(timer_mem->cntctlbase, timer_mem->size); in arch_timer_mem_find_best_frame()
1366 &timer_mem->cntctlbase); in arch_timer_mem_find_best_frame()
1380 frame = &timer_mem->frame[i]; in arch_timer_mem_find_best_frame()
1381 if (!frame->valid) in arch_timer_mem_find_best_frame()
1413 irq = frame->virt_irq; in arch_timer_mem_frame_register()
1415 irq = frame->phys_irq; in arch_timer_mem_frame_register()
1420 return -EINVAL; in arch_timer_mem_frame_register()
1423 if (!request_mem_region(frame->cntbase, frame->size, in arch_timer_mem_frame_register()
1425 return -EBUSY; in arch_timer_mem_frame_register()
1427 base = ioremap(frame->cntbase, frame->size); in arch_timer_mem_frame_register()
1430 return -ENXIO; in arch_timer_mem_frame_register()
1451 int ret = -EINVAL; in arch_timer_mem_of_init()
1456 return -ENOMEM; in arch_timer_mem_of_init()
1460 timer_mem->cntctlbase = res.start; in arch_timer_mem_of_init()
1461 timer_mem->size = resource_size(&res); in arch_timer_mem_of_init()
1467 if (of_property_read_u32(frame_node, "frame-number", &n)) { in arch_timer_mem_of_init()
1468 pr_err(FW_BUG "Missing frame-number.\n"); in arch_timer_mem_of_init()
1473 pr_err(FW_BUG "Wrong frame-number, only 0-%u are permitted.\n", in arch_timer_mem_of_init()
1474 ARCH_TIMER_MEM_MAX_FRAMES - 1); in arch_timer_mem_of_init()
1478 frame = &timer_mem->frame[n]; in arch_timer_mem_of_init()
1480 if (frame->valid) { in arch_timer_mem_of_init()
1481 pr_err(FW_BUG "Duplicated frame-number.\n"); in arch_timer_mem_of_init()
1490 frame->cntbase = res.start; in arch_timer_mem_of_init()
1491 frame->size = resource_size(&res); in arch_timer_mem_of_init()
1493 frame->virt_irq = irq_of_parse_and_map(frame_node, in arch_timer_mem_of_init()
1495 frame->phys_irq = irq_of_parse_and_map(frame_node, in arch_timer_mem_of_init()
1498 frame->valid = true; in arch_timer_mem_of_init()
1504 &timer_mem->cntctlbase); in arch_timer_mem_of_init()
1505 ret = -EINVAL; in arch_timer_mem_of_init()
1519 TIMER_OF_DECLARE(armv7_arch_timer_mem, "arm,armv7-timer-mem",
1531 frame = &timer_mem->frame[i]; in arch_timer_mem_verify_cntfrq()
1533 if (!frame->valid) in arch_timer_mem_verify_cntfrq()
1541 &frame->cntbase, in arch_timer_mem_verify_cntfrq()
1544 return -EINVAL; in arch_timer_mem_verify_cntfrq()
1559 return -ENOMEM; in arch_timer_mem_acpi_init()
1588 &timer->cntctlbase); in arch_timer_mem_acpi_init()
1598 /* Initialize per-processor generic timer and memory-mapped timer(if present) */
1605 return -EINVAL; in arch_timer_acpi_init()
1639 return -EINVAL; in arch_timer_acpi_init()
1642 /* Always-on capability */ in arch_timer_acpi_init()
1654 pr_err("Failed to initialize memory-mapped timer.\n"); in arch_timer_acpi_init()