mirror of
https://github.com/edk2-porting/linux-next.git
synced 2025-01-05 20:24:09 +08:00
04dc82e116
Based on 1 normalized pattern(s): this program is free software you can distribute it and or modify it under the terms of the gnu general public license version 2 as published by the free software foundation this program is distributed in the hope it will be useful but without any warranty without even the implied warranty of merchantability or fitness for a particular purpose see the gnu general public license for more details extracted by the scancode license scanner the SPDX license identifier GPL-2.0-only has been chosen to replace the boilerplate/reference in 24 file(s). Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Reviewed-by: Armijn Hemel <armijn@tjaldur.nl> Reviewed-by: Allison Randal <allison@lohutok.net> Cc: linux-spdx@vger.kernel.org Link: https://lkml.kernel.org/r/20190531190115.872212424@linutronix.de Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
61 lines
1.2 KiB
C
61 lines
1.2 KiB
C
// SPDX-License-Identifier: GPL-2.0-only
|
|
/*
|
|
* Joshua Henderson <joshua.henderson@microchip.com>
|
|
* Copyright (C) 2015 Microchip Technology Inc. All rights reserved.
|
|
*/
|
|
#include <linux/clk-provider.h>
|
|
#include <linux/clocksource.h>
|
|
#include <linux/init.h>
|
|
#include <linux/irqdomain.h>
|
|
#include <linux/of.h>
|
|
#include <linux/of_irq.h>
|
|
|
|
#include <asm/time.h>
|
|
|
|
#include "pic32mzda.h"
|
|
|
|
static const struct of_device_id pic32_infra_match[] = {
|
|
{ .compatible = "microchip,pic32mzda-infra", },
|
|
{ },
|
|
};
|
|
|
|
#define DEFAULT_CORE_TIMER_INTERRUPT 0
|
|
|
|
static unsigned int pic32_xlate_core_timer_irq(void)
|
|
{
|
|
static struct device_node *node;
|
|
unsigned int irq;
|
|
|
|
node = of_find_matching_node(NULL, pic32_infra_match);
|
|
|
|
if (WARN_ON(!node))
|
|
goto default_map;
|
|
|
|
irq = irq_of_parse_and_map(node, 0);
|
|
if (!irq)
|
|
goto default_map;
|
|
|
|
return irq;
|
|
|
|
default_map:
|
|
|
|
return irq_create_mapping(NULL, DEFAULT_CORE_TIMER_INTERRUPT);
|
|
}
|
|
|
|
unsigned int get_c0_compare_int(void)
|
|
{
|
|
return pic32_xlate_core_timer_irq();
|
|
}
|
|
|
|
void __init plat_time_init(void)
|
|
{
|
|
unsigned long rate = pic32_get_pbclk(7);
|
|
|
|
of_clk_init(NULL);
|
|
|
|
pr_info("CPU Clock: %ldMHz\n", rate / 1000000);
|
|
mips_hpt_frequency = rate / 2;
|
|
|
|
timer_probe();
|
|
}
|