From 76cb841cb886eef6b3bee341a2266c76578724ad Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Mon, 6 May 2024 03:02:30 +0200 Subject: Adding upstream version 4.19.249. Signed-off-by: Daniel Baumann --- arch/mips/kernel/i8253.c | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 arch/mips/kernel/i8253.c (limited to 'arch/mips/kernel/i8253.c') diff --git a/arch/mips/kernel/i8253.c b/arch/mips/kernel/i8253.c new file mode 100644 index 000000000..df7ddd246 --- /dev/null +++ b/arch/mips/kernel/i8253.c @@ -0,0 +1,41 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * i8253.c 8253/PIT functions + * + */ +#include +#include +#include +#include +#include + +#include + +static irqreturn_t timer_interrupt(int irq, void *dev_id) +{ + i8253_clockevent.event_handler(&i8253_clockevent); + + return IRQ_HANDLED; +} + +static struct irqaction irq0 = { + .handler = timer_interrupt, + .flags = IRQF_NOBALANCING | IRQF_TIMER, + .name = "timer" +}; + +void __init setup_pit_timer(void) +{ + clockevent_i8253_init(true); + setup_irq(0, &irq0); +} + +static int __init init_pit_clocksource(void) +{ + if (num_possible_cpus() > 1 || /* PIT does not scale! */ + !clockevent_state_periodic(&i8253_clockevent)) + return 0; + + return clocksource_i8253_init(); +} +arch_initcall(init_pit_clocksource); -- cgit v1.2.3