.. | .. |
---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
---|
1 | 2 | /* |
---|
2 | 3 | * Time related functions for Hexagon architecture |
---|
3 | 4 | * |
---|
4 | 5 | * 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. |
---|
19 | 6 | */ |
---|
20 | 7 | |
---|
21 | 8 | #include <linux/init.h> |
---|
.. | .. |
---|
30 | 17 | #include <linux/of_irq.h> |
---|
31 | 18 | #include <linux/module.h> |
---|
32 | 19 | |
---|
33 | | -#include <asm/timer-regs.h> |
---|
34 | 20 | #include <asm/hexagon_vm.h> |
---|
| 21 | + |
---|
| 22 | +#define TIMER_ENABLE BIT(0) |
---|
35 | 23 | |
---|
36 | 24 | /* |
---|
37 | 25 | * For the clocksource we need: |
---|
.. | .. |
---|
45 | 33 | cycles_t pcycle_freq_mhz; |
---|
46 | 34 | cycles_t thread_freq_mhz; |
---|
47 | 35 | 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 |
---|
48 | 43 | |
---|
49 | 44 | static struct resource rtos_timer_resources[] = { |
---|
50 | 45 | { |
---|
.. | .. |
---|
93 | 88 | iowrite32(0, &rtos_timer->clear); |
---|
94 | 89 | |
---|
95 | 90 | iowrite32(delta, &rtos_timer->match); |
---|
96 | | - iowrite32(1 << TIMER_ENABLE, &rtos_timer->enable); |
---|
| 91 | + iowrite32(TIMER_ENABLE, &rtos_timer->enable); |
---|
97 | 92 | return 0; |
---|
98 | 93 | } |
---|
99 | 94 | |
---|
.. | .. |
---|
156 | 151 | return IRQ_HANDLED; |
---|
157 | 152 | } |
---|
158 | 153 | |
---|
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 | | - |
---|
166 | 154 | /* |
---|
167 | 155 | * time_init_deferred - called by start_kernel to set up timer/clock source |
---|
168 | 156 | * |
---|
.. | .. |
---|
176 | 164 | { |
---|
177 | 165 | struct resource *resource = NULL; |
---|
178 | 166 | struct clock_event_device *ce_dev = &hexagon_clockevent_dev; |
---|
| 167 | + unsigned long flag = IRQF_TIMER | IRQF_TRIGGER_RISING; |
---|
179 | 168 | |
---|
180 | 169 | ce_dev->cpumask = cpu_all_mask; |
---|
181 | 170 | |
---|
.. | .. |
---|
208 | 197 | #endif |
---|
209 | 198 | |
---|
210 | 199 | 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"); |
---|
212 | 202 | } |
---|
213 | 203 | |
---|
214 | 204 | void __init time_init(void) |
---|