]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - arch/mips/jmr3927/rbhma3100/setup.c
Merge master.kernel.org:/pub/scm/linux/kernel/git/bart/ide-2.6
[linux-2.6-omap-h63xx.git] / arch / mips / jmr3927 / rbhma3100 / setup.c
index d1ef2895d5640c1e1669399e9499ac1d25f18a32..edb9e59248ecea7860dde0f16c5623a54d00e16b 100644 (file)
@@ -1,15 +1,4 @@
-/***********************************************************************
- *
- * Copyright 2001 MontaVista Software Inc.
- * Author: MontaVista Software, Inc.
- *              ahennessy@mvista.com
- *
- * Based on arch/mips/ddb5xxx/ddb5477/setup.c
- *
- *     Setup file for JMR3927.
- *
- * Copyright (C) 2000-2001 Toshiba Corporation
- *
+/*
  *  This program is free software; you can redistribute  it and/or modify it
  *  under  the terms of  the GNU General  Public License as published by the
  *  Free Software Foundation;  either version 2 of the  License, or (at your
  *  with this program; if not, write  to the Free Software Foundation, Inc.,
  *  675 Mass Ave, Cambridge, MA 02139, USA.
  *
- ***********************************************************************
+ * Copyright 2001 MontaVista Software Inc.
+ * Author: MontaVista Software, Inc.
+ *              ahennessy@mvista.com
+ *
+ * Copyright (C) 2000-2001 Toshiba Corporation
+ * Copyright (C) 2007 Ralf Baechle (ralf@linux-mips.org)
  */
 
+#include <linux/clockchips.h>
 #include <linux/init.h>
 #include <linux/kernel.h>
 #include <linux/kdev_t.h>
@@ -104,27 +99,60 @@ static cycle_t jmr3927_hpt_read(void)
        return jiffies * (JMR3927_TIMER_CLK / HZ) + jmr3927_tmrptr->trr;
 }
 
-static void jmr3927_timer_ack(void)
+static void jmr3927_set_mode(enum clock_event_mode mode,
+       struct clock_event_device *evt)
 {
+       /* Nothing to do here */
+}
+
+struct clock_event_device jmr3927_clock_event_device = {
+       .name           = "MIPS",
+       .features       = CLOCK_EVT_FEAT_PERIODIC,
+       .shift          = 32,
+       .rating         = 300,
+       .cpumask        = CPU_MASK_CPU0,
+       .irq            = JMR3927_IRQ_TICK,
+       .set_mode       = jmr3927_set_mode,
+};
+
+static irqreturn_t jmr3927_timer_interrupt(int irq, void *dev_id)
+{
+       struct clock_event_device *cd = &jmr3927_clock_event_device;
+
        jmr3927_tmrptr->tisr = 0;       /* ack interrupt */
+
+       cd->event_handler(cd);
+
+       return IRQ_HANDLED;
 }
 
-static void __init jmr3927_time_init(void)
+static struct irqaction jmr3927_timer_irqaction = {
+       .handler        = jmr3927_timer_interrupt,
+       .flags          = IRQF_DISABLED | IRQF_PERCPU,
+       .name           = "jmr3927-timer",
+};
+
+void __init plat_time_init(void)
 {
+       struct clock_event_device *cd;
+
        clocksource_mips.read = jmr3927_hpt_read;
-       mips_timer_ack = jmr3927_timer_ack;
        mips_hpt_frequency = JMR3927_TIMER_CLK;
-}
 
-void __init plat_timer_setup(struct irqaction *irq)
-{
        jmr3927_tmrptr->cpra = JMR3927_TIMER_CLK / HZ;
        jmr3927_tmrptr->itmr = TXx927_TMTITMR_TIIE | TXx927_TMTITMR_TZCE;
        jmr3927_tmrptr->ccdr = JMR3927_TIMER_CCD;
        jmr3927_tmrptr->tcr =
                TXx927_TMTCR_TCE | TXx927_TMTCR_CCDE | TXx927_TMTCR_TMODE_ITVL;
 
-       setup_irq(JMR3927_IRQ_TICK, irq);
+       cd = &jmr3927_clock_event_device;
+       /* Calculate the min / max delta */
+       cd->mult = div_sc((unsigned long) JMR3927_IMCLK, NSEC_PER_SEC, 32);
+       cd->max_delta_ns        = clockevent_delta2ns(0x7fffffff, cd);
+       cd->min_delta_ns        = clockevent_delta2ns(0x300, cd);
+       clockevents_register_device(cd);
+
+       setup_irq(JMR3927_IRQ_TICK, &jmr3927_timer_irqaction);
 }
 
 #define DO_WRITE_THROUGH
@@ -141,8 +169,6 @@ void __init plat_mem_setup(void)
 
        set_io_port_base(JMR3927_PORT_BASE + JMR3927_PCIIO);
 
-       board_time_init = jmr3927_time_init;
-
        _machine_restart = jmr3927_machine_restart;
        _machine_halt = jmr3927_machine_halt;
        pm_power_off = jmr3927_machine_power_off;
@@ -290,19 +316,6 @@ static void __init tx3927_setup(void)
               tx3927_ccfgptr->crir,
               tx3927_ccfgptr->ccfg, tx3927_ccfgptr->pcfg);
 
-       /* IRC */
-       /* disable interrupt control */
-       tx3927_ircptr->cer = 0;
-       /* mask all IRC interrupts */
-       tx3927_ircptr->imr = 0;
-       for (i = 0; i < TX3927_NUM_IR / 2; i++) {
-               tx3927_ircptr->ilr[i] = 0;
-       }
-       /* setup IRC interrupt mode (Low Active) */
-       for (i = 0; i < TX3927_NUM_IR / 8; i++) {
-               tx3927_ircptr->cr[i] = 0;
-       }
-
        /* TMR */
        /* disable all timers */
        for (i = 0; i < TX3927_NR_TMR; i++) {
@@ -434,13 +447,13 @@ EXPORT_SYMBOL(__swizzle_addr_b);
 
 static int __init jmr3927_rtc_init(void)
 {
-       struct resource res = {
+       static struct resource __initdata res = {
                .start  = JMR3927_IOC_NVRAMB_ADDR - IO_BASE,
                .end    = JMR3927_IOC_NVRAMB_ADDR - IO_BASE + 0x800 - 1,
                .flags  = IORESOURCE_MEM,
        };
        struct platform_device *dev;
-       dev = platform_device_register_simple("ds1742", -1, &res, 1);
+       dev = platform_device_register_simple("rtc-ds1742", -1, &res, 1);
        return IS_ERR(dev) ? PTR_ERR(dev) : 0;
 }
 device_initcall(jmr3927_rtc_init);