1 // SPDX-License-Identifier: GPL-2.0-only
3 * Joshua Henderson <joshua.henderson@microchip.com>
4 * Copyright (C) 2015 Microchip Technology Inc. All rights reserved.
6 #include <linux/clk-provider.h>
7 #include <linux/clocksource.h>
8 #include <linux/init.h>
9 #include <linux/irqdomain.h>
11 #include <linux/of_irq.h>
15 #include "pic32mzda.h"
17 static const struct of_device_id pic32_infra_match
[] = {
18 { .compatible
= "microchip,pic32mzda-infra", },
22 #define DEFAULT_CORE_TIMER_INTERRUPT 0
24 static unsigned int pic32_xlate_core_timer_irq(void)
26 static struct device_node
*node
;
29 node
= of_find_matching_node(NULL
, pic32_infra_match
);
34 irq
= irq_of_parse_and_map(node
, 0);
42 return irq_create_mapping(NULL
, DEFAULT_CORE_TIMER_INTERRUPT
);
45 unsigned int get_c0_compare_int(void)
47 return pic32_xlate_core_timer_irq();
50 void __init
plat_time_init(void)
52 unsigned long rate
= pic32_get_pbclk(7);
56 pr_info("CPU Clock: %ldMHz\n", rate
/ 1000000);
57 mips_hpt_frequency
= rate
/ 2;