hc
2024-02-20 102a0743326a03cd1a1202ceda21e175b7d3575c
kernel/arch/mips/sgi-ip27/ip27-timer.c
....@@ -19,38 +19,13 @@
1919 #include <linux/platform_device.h>
2020
2121 #include <asm/time.h>
22
-#include <asm/pgtable.h>
2322 #include <asm/sgialib.h>
24
-#include <asm/sn/ioc3.h>
2523 #include <asm/sn/klconfig.h>
2624 #include <asm/sn/arch.h>
2725 #include <asm/sn/addrs.h>
28
-#include <asm/sn/sn_private.h>
29
-#include <asm/sn/sn0/ip27.h>
30
-#include <asm/sn/sn0/hub.h>
26
+#include <asm/sn/agent.h>
3127
32
-#define TICK_SIZE (tick_nsec / 1000)
33
-
34
-/* Includes for ioc3_init(). */
35
-#include <asm/sn/types.h>
36
-#include <asm/sn/sn0/addrs.h>
37
-#include <asm/sn/sn0/hubni.h>
38
-#include <asm/sn/sn0/hubio.h>
39
-#include <asm/pci/bridge.h>
40
-
41
-static void enable_rt_irq(struct irq_data *d)
42
-{
43
-}
44
-
45
-static void disable_rt_irq(struct irq_data *d)
46
-{
47
-}
48
-
49
-static struct irq_chip rt_irq_type = {
50
- .name = "SN HUB RT timer",
51
- .irq_mask = disable_rt_irq,
52
- .irq_unmask = enable_rt_irq,
53
-};
28
+#include "ip27-common.h"
5429
5530 static int rt_next_event(unsigned long delta, struct clock_event_device *evt)
5631 {
....@@ -64,8 +39,6 @@
6439
6540 return LOCAL_HUB_L(PI_RT_COUNT) >= cnt ? -ETIME : 0;
6641 }
67
-
68
-unsigned int rt_timer_irq;
6942
7043 static DEFINE_PER_CPU(struct clock_event_device, hub_rt_clockevent);
7144 static DEFINE_PER_CPU(char [11], hub_rt_name);
....@@ -87,6 +60,7 @@
8760
8861 struct irqaction hub_rt_irqaction = {
8962 .handler = hub_rt_counter_handler,
63
+ .percpu_dev_id = &hub_rt_clockevent,
9064 .flags = IRQF_PERCPU | IRQF_TIMER,
9165 .name = "hub-rt",
9266 };
....@@ -107,7 +81,6 @@
10781 unsigned int cpu = smp_processor_id();
10882 struct clock_event_device *cd = &per_cpu(hub_rt_clockevent, cpu);
10983 unsigned char *name = per_cpu(hub_rt_name, cpu);
110
- int irq = rt_timer_irq;
11184
11285 sprintf(name, "hub-rt %d", cpu);
11386 cd->name = name;
....@@ -118,29 +91,19 @@
11891 cd->min_delta_ns = clockevent_delta2ns(0x300, cd);
11992 cd->min_delta_ticks = 0x300;
12093 cd->rating = 200;
121
- cd->irq = irq;
94
+ cd->irq = IP27_RT_TIMER_IRQ;
12295 cd->cpumask = cpumask_of(cpu);
12396 cd->set_next_event = rt_next_event;
12497 clockevents_register_device(cd);
98
+
99
+ enable_percpu_irq(IP27_RT_TIMER_IRQ, IRQ_TYPE_NONE);
125100 }
126101
127102 static void __init hub_rt_clock_event_global_init(void)
128103 {
129
- int irq;
130
-
131
- do {
132
- smp_wmb();
133
- irq = rt_timer_irq;
134
- if (irq)
135
- break;
136
-
137
- irq = allocate_irqno();
138
- if (irq < 0)
139
- panic("Allocation of irq number for timer failed");
140
- } while (xchg(&rt_timer_irq, irq));
141
-
142
- irq_set_chip_and_handler(irq, &rt_irq_type, handle_percpu_irq);
143
- setup_irq(irq, &hub_rt_irqaction);
104
+ irq_set_handler(IP27_RT_TIMER_IRQ, handle_percpu_devid_irq);
105
+ irq_set_percpu_devid(IP27_RT_TIMER_IRQ);
106
+ setup_percpu_irq(IP27_RT_TIMER_IRQ, &hub_rt_irqaction);
144107 }
145108
146109 static u64 hub_rt_read(struct clocksource *cs)
....@@ -177,28 +140,7 @@
177140 hub_rt_clock_event_init();
178141 }
179142
180
-void cpu_time_init(void)
181
-{
182
- lboard_t *board;
183
- klcpu_t *cpu;
184
- int cpuid;
185
-
186
- /* Don't use ARCS. ARCS is fragile. Klconfig is simple and sane. */
187
- board = find_lboard(KL_CONFIG_INFO(get_nasid()), KLTYPE_IP27);
188
- if (!board)
189
- panic("Can't find board info for myself.");
190
-
191
- cpuid = LOCAL_HUB_L(PI_CPU_NUM) ? IP27_CPU0_INDEX : IP27_CPU1_INDEX;
192
- cpu = (klcpu_t *) KLCF_COMP(board, cpuid);
193
- if (!cpu)
194
- panic("No information about myself?");
195
-
196
- printk("CPU %d clock is %dMHz.\n", smp_processor_id(), cpu->cpu_speed);
197
-
198
- set_c0_status(SRB_TIMOCLK);
199
-}
200
-
201
-void hub_rtc_init(cnodeid_t cnode)
143
+void hub_rtc_init(nasid_t nasid)
202144 {
203145
204146 /*
....@@ -206,7 +148,7 @@
206148 * If this is not the current node then it is a cpuless
207149 * node and timeouts will not happen there.
208150 */
209
- if (get_compact_nodeid() == cnode) {
151
+ if (get_nasid() == nasid) {
210152 LOCAL_HUB_S(PI_RT_EN_A, 1);
211153 LOCAL_HUB_S(PI_RT_EN_B, 1);
212154 LOCAL_HUB_S(PI_PROF_EN_A, 0);
....@@ -216,23 +158,3 @@
216158 LOCAL_HUB_S(PI_RT_PEND_B, 0);
217159 }
218160 }
219
-
220
-static int __init sgi_ip27_rtc_devinit(void)
221
-{
222
- struct resource res;
223
-
224
- memset(&res, 0, sizeof(res));
225
- res.start = XPHYSADDR(KL_CONFIG_CH_CONS_INFO(master_nasid)->memory_base +
226
- IOC3_BYTEBUS_DEV0);
227
- res.end = res.start + 32767;
228
- res.flags = IORESOURCE_MEM;
229
-
230
- return IS_ERR(platform_device_register_simple("rtc-m48t35", -1,
231
- &res, 1));
232
-}
233
-
234
-/*
235
- * kludge make this a device_initcall after ioc3 resource conflicts
236
- * are resolved
237
- */
238
-late_initcall(sgi_ip27_rtc_devinit);