]> err.no Git - linux-2.6/blobdiff - arch/mips/jmr3927/rbhma3100/setup.c
jmr3927: do not call tc35815_killall().
[linux-2.6] / arch / mips / jmr3927 / rbhma3100 / setup.c
index 6d4635d89d94893c075fa2a42a03daba4c085dd3..ecabe5b084894bee0c68ea567a01277fb89e1694 100644 (file)
@@ -40,6 +40,7 @@
 #include <linux/sched.h>
 #include <linux/pci.h>
 #include <linux/ide.h>
+#include <linux/irq.h>
 #include <linux/ioport.h>
 #include <linux/param.h>       /* for HZ */
 #include <linux/delay.h>
@@ -136,10 +137,6 @@ int jmr3927_ccfg_toeon = 0;
 
 static inline void do_reset(void)
 {
-#ifdef CONFIG_TC35815
-       extern void tc35815_killall(void);
-       tc35815_killall();
-#endif
 #if 1  /* Resetting PCI bus */
        jmr3927_ioc_reg_out(0, JMR3927_IOC_RESET_ADDR);
        jmr3927_ioc_reg_out(JMR3927_IOC_RESET_PCI, JMR3927_IOC_RESET_ADDR);
@@ -169,12 +166,20 @@ static void jmr3927_machine_power_off(void)
        while (1);
 }
 
+static cycle_t jmr3927_hpt_read(void)
+{
+       /* We assume this function is called xtime_lock held. */
+       return jiffies * (JMR3927_TIMER_CLK / HZ) + jmr3927_tmrptr->trr;
+}
+
 #define USE_RTC_DS1742
 #ifdef USE_RTC_DS1742
 extern void rtc_ds1742_init(unsigned long base);
 #endif
 static void __init jmr3927_time_init(void)
 {
+       clocksource_mips.read = jmr3927_hpt_read;
+       mips_hpt_frequency = JMR3927_TIMER_CLK;
 #ifdef USE_RTC_DS1742
        if (jmr3927_have_nvram()) {
                rtc_ds1742_init(JMR3927_IOC_NVRAMB_ADDR);
@@ -182,13 +187,8 @@ static void __init jmr3927_time_init(void)
 #endif
 }
 
-unsigned long jmr3927_do_gettimeoffset(void);
-extern int setup_irq(unsigned int irq, struct irqaction *irqaction);
-
-static void __init jmr3927_timer_setup(struct irqaction *irq)
+void __init plat_timer_setup(struct irqaction *irq)
 {
-       do_gettimeoffset = jmr3927_do_gettimeoffset;
-
        jmr3927_tmrptr->cpra = JMR3927_TIMER_CLK / HZ;
        jmr3927_tmrptr->itmr = TXx927_TMTITMR_TIIE | TXx927_TMTITMR_TZCE;
        jmr3927_tmrptr->ccdr = JMR3927_TIMER_CCD;
@@ -200,34 +200,6 @@ static void __init jmr3927_timer_setup(struct irqaction *irq)
 
 #define USECS_PER_JIFFY (1000000/HZ)
 
-unsigned long jmr3927_do_gettimeoffset(void)
-{
-       unsigned long count;
-       unsigned long res = 0;
-
-       /* MUST read TRR before TISR. */
-       count = jmr3927_tmrptr->trr;
-
-       if (jmr3927_tmrptr->tisr & TXx927_TMTISR_TIIS) {
-               /* timer interrupt is pending.  use Max value. */
-               res = USECS_PER_JIFFY - 1;
-       } else {
-               /* convert to usec */
-               /* res = count / (JMR3927_TIMER_CLK / 1000000); */
-               res = (count << 7) / ((JMR3927_TIMER_CLK << 7) / 1000000);
-
-               /*
-                * Due to possible jiffies inconsistencies, we need to check
-                * the result so that we'll get a timer that is monotonic.
-                */
-               if (res >= USECS_PER_JIFFY)
-                       res = USECS_PER_JIFFY-1;
-       }
-
-       return res;
-}
-
-
 //#undef DO_WRITE_THROUGH
 #define DO_WRITE_THROUGH
 #define DO_ENABLE_CACHE
@@ -244,7 +216,6 @@ void __init plat_mem_setup(void)
        set_io_port_base(JMR3927_PORT_BASE + JMR3927_PCIIO);
 
        board_time_init = jmr3927_time_init;
-       board_timer_setup = jmr3927_timer_setup;
 
        _machine_restart = jmr3927_machine_restart;
        _machine_halt = jmr3927_machine_halt;
@@ -459,7 +430,7 @@ void __init tx3927_setup(void)
 
        /* DMA */
        tx3927_dmaptr->mcr = 0;
-       for (i = 0; i < sizeof(tx3927_dmaptr->ch) / sizeof(tx3927_dmaptr->ch[0]); i++) {
+       for (i = 0; i < ARRAY_SIZE(tx3927_dmaptr->ch); i++) {
                /* reset channel */
                tx3927_dmaptr->ch[i].ccr = TX3927_DMA_CCR_CHRST;
                tx3927_dmaptr->ch[i].ccr = 0;