hc
2024-12-19 9370bb92b2d16684ee45cf24e879c93c509162da
kernel/arch/hexagon/kernel/time.c
....@@ -1,21 +1,8 @@
1
+// SPDX-License-Identifier: GPL-2.0-only
12 /*
23 * Time related functions for Hexagon architecture
34 *
45 * Copyright (c) 2010-2011, The Linux Foundation. All rights reserved.
5
- *
6
- * This program is free software; you can redistribute it and/or modify
7
- * it under the terms of the GNU General Public License version 2 and
8
- * only version 2 as published by the Free Software Foundation.
9
- *
10
- * This program is distributed in the hope that it will be useful,
11
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
- * GNU General Public License for more details.
14
- *
15
- * You should have received a copy of the GNU General Public License
16
- * along with this program; if not, write to the Free Software
17
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
18
- * 02110-1301, USA.
196 */
207
218 #include <linux/init.h>
....@@ -30,8 +17,9 @@
3017 #include <linux/of_irq.h>
3118 #include <linux/module.h>
3219
33
-#include <asm/timer-regs.h>
3420 #include <asm/hexagon_vm.h>
21
+
22
+#define TIMER_ENABLE BIT(0)
3523
3624 /*
3725 * For the clocksource we need:
....@@ -45,6 +33,13 @@
4533 cycles_t pcycle_freq_mhz;
4634 cycles_t thread_freq_mhz;
4735 cycles_t sleep_clk_freq;
36
+
37
+/*
38
+ * 8x50 HDD Specs 5-8. Simulator co-sim not fixed until
39
+ * release 1.1, and then it's "adjustable" and probably not defaulted.
40
+ */
41
+#define RTOS_TIMER_INT 3
42
+#define RTOS_TIMER_REGS_ADDR 0xAB000000UL
4843
4944 static struct resource rtos_timer_resources[] = {
5045 {
....@@ -93,7 +88,7 @@
9388 iowrite32(0, &rtos_timer->clear);
9489
9590 iowrite32(delta, &rtos_timer->match);
96
- iowrite32(1 << TIMER_ENABLE, &rtos_timer->enable);
91
+ iowrite32(TIMER_ENABLE, &rtos_timer->enable);
9792 return 0;
9893 }
9994
....@@ -156,13 +151,6 @@
156151 return IRQ_HANDLED;
157152 }
158153
159
-/* This should also be pulled from devtree */
160
-static struct irqaction rtos_timer_intdesc = {
161
- .handler = timer_interrupt,
162
- .flags = IRQF_TIMER | IRQF_TRIGGER_RISING,
163
- .name = "rtos_timer"
164
-};
165
-
166154 /*
167155 * time_init_deferred - called by start_kernel to set up timer/clock source
168156 *
....@@ -176,6 +164,7 @@
176164 {
177165 struct resource *resource = NULL;
178166 struct clock_event_device *ce_dev = &hexagon_clockevent_dev;
167
+ unsigned long flag = IRQF_TIMER | IRQF_TRIGGER_RISING;
179168
180169 ce_dev->cpumask = cpu_all_mask;
181170
....@@ -208,7 +197,8 @@
208197 #endif
209198
210199 clockevents_register_device(ce_dev);
211
- setup_irq(ce_dev->irq, &rtos_timer_intdesc);
200
+ if (request_irq(ce_dev->irq, timer_interrupt, flag, "rtos_timer", NULL))
201
+ pr_err("Failed to register rtos_timer interrupt\n");
212202 }
213203
214204 void __init time_init(void)