Pull button into test branch
[linux-drm-fsl-dcu.git] / arch / mips / sgi-ip27 / ip27-timer.c
index 257ce118e380fd2dd7d4e104c4eb02c87a4ec20f..c20e9899b34b49fba2d95cdfa5688ea242287080 100644 (file)
@@ -89,7 +89,7 @@ static int set_rtc_mmss(unsigned long nowtime)
 
 static unsigned int rt_timer_irq;
 
-void ip27_rt_timer_interrupt(struct pt_regs *regs)
+void ip27_rt_timer_interrupt(void)
 {
        int cpu = smp_processor_id();
        int cpuA = cputoslice(cpu) == 0;
@@ -111,7 +111,7 @@ again:
        if (cpu == 0)
                do_timer(1);
 
-       update_process_times(user_mode(regs));
+       update_process_times(user_mode(get_irq_regs()));
 
        /*
         * If we have an externally synchronized Linux clock, then update
@@ -134,13 +134,6 @@ again:
        irq_exit();
 }
 
-unsigned long ip27_do_gettimeoffset(void)
-{
-       unsigned long ct_cur1;
-       ct_cur1 = REMOTE_HUB_L(cputonasid(0), PI_RT_COUNT) + CYCLES_PER_JIFFY;
-       return (ct_cur1 - ct_cur[0]) * NSEC_PER_CYCLE / 1000;
-}
-
 /* Includes for ioc3_init().  */
 #include <asm/sn/types.h>
 #include <asm/sn/sn0/addrs.h>
@@ -179,15 +172,6 @@ static __init unsigned long get_m48t35_time(void)
         return mktime(year, month, date, hour, min, sec);
 }
 
-static unsigned int startup_rt_irq(unsigned int irq)
-{
-       return 0;
-}
-
-static void shutdown_rt_irq(unsigned int irq)
-{
-}
-
 static void enable_rt_irq(unsigned int irq)
 {
 }
@@ -196,22 +180,13 @@ static void disable_rt_irq(unsigned int irq)
 {
 }
 
-static void mask_and_ack_rt(unsigned int irq)
-{
-}
-
-static void end_rt_irq(unsigned int irq)
-{
-}
-
 static struct irq_chip rt_irq_type = {
        .typename       = "SN HUB RT timer",
-       .startup        = startup_rt_irq,
-       .shutdown       = shutdown_rt_irq,
-       .enable         = enable_rt_irq,
-       .disable        = disable_rt_irq,
-       .ack            = mask_and_ack_rt,
-       .end            = end_rt_irq,
+       .ack            = disable_rt_irq,
+       .mask           = disable_rt_irq,
+       .mask_ack       = disable_rt_irq,
+       .unmask         = enable_rt_irq,
+       .eoi            = enable_rt_irq,
 };
 
 static struct irqaction rt_irqaction = {
@@ -221,8 +196,6 @@ static struct irqaction rt_irqaction = {
        .name           = "timer"
 };
 
-extern int allocate_irqno(void);
-
 void __init plat_timer_setup(struct irqaction *irq)
 {
        int irqno  = allocate_irqno();
@@ -230,10 +203,7 @@ void __init plat_timer_setup(struct irqaction *irq)
        if (irqno < 0)
                panic("Can't allocate interrupt number for timer interrupt");
 
-       irq_desc[irqno].status  = IRQ_DISABLED;
-       irq_desc[irqno].action  = NULL;
-       irq_desc[irqno].depth   = 1;
-       irq_desc[irqno].chip    = &rt_irq_type;
+       set_irq_chip_and_handler(irqno, &rt_irq_type, handle_percpu_irq);
 
        /* over-write the handler, we use our own way */
        irq->handler = no_action;
@@ -248,12 +218,17 @@ void __init plat_timer_setup(struct irqaction *irq)
        setup_irq(irqno, &rt_irqaction);
 }
 
+static cycle_t ip27_hpt_read(void)
+{
+       return REMOTE_HUB_L(cputonasid(0), PI_RT_COUNT);
+}
+
 void __init ip27_time_init(void)
 {
+       clocksource_mips.read = ip27_hpt_read;
+       mips_hpt_frequency = CYCLES_PER_SEC;
        xtime.tv_sec = get_m48t35_time();
        xtime.tv_nsec = 0;
-
-       do_gettimeoffset = ip27_do_gettimeoffset;
 }
 
 void __init cpu_time_init(void)