Pull thermal into release branch
[linux-drm-fsl-dcu.git] / arch / mips / tx4927 / toshiba_rbtx4927 / toshiba_rbtx4927_setup.c
index f0d70c47600528a7e3c7601d9608d8955c817c24..a0c11efeaeeb9dd24658c114b5c46fa66bf26e70 100644 (file)
 #include <linux/pci.h>
 #include <linux/timex.h>
 #include <linux/pm.h>
+#include <linux/platform_device.h>
 
 #include <asm/bootinfo.h>
 #include <asm/page.h>
 #include <asm/io.h>
 #include <asm/irq.h>
+#include <asm/irq_regs.h>
 #include <asm/processor.h>
-#include <asm/ptrace.h>
 #include <asm/reboot.h>
 #include <asm/time.h>
 #include <linux/bootmem.h>
 #include <linux/blkdev.h>
-#ifdef CONFIG_RTC_DS1742
-#include <linux/ds1742rtc.h>
-#endif
 #ifdef CONFIG_TOSHIBA_FPCIB0
 #include <asm/tx4927/smsc_fdc37m81x.h>
 #endif
@@ -137,6 +135,8 @@ int tx4927_using_backplane = 0;
 extern void gt64120_time_init(void);
 extern void toshiba_rbtx4927_irq_setup(void);
 
+char *prom_getcmdline(void);
+
 #ifdef CONFIG_PCI
 #define CONFIG_TX4927BUG_WORKAROUND
 #undef TX4927_SUPPORT_COMMAND_IO
@@ -160,8 +160,7 @@ int tx4927_pci66 = 0;               /* 0:auto */
 char *toshiba_name = "";
 
 #ifdef CONFIG_PCI
-static void tx4927_pcierr_interrupt(int irq, void *dev_id,
-                                   struct pt_regs *regs)
+static void tx4927_pcierr_interrupt(int irq, void *dev_id)
 {
 #ifdef CONFIG_BLK_DEV_IDEPCI
        /* ignore MasterAbort for ide probing... */
@@ -185,7 +184,7 @@ static void tx4927_pcierr_interrupt(int irq, void *dev_id,
               (unsigned long) tx4927_ccfgptr->ccfg,
               (unsigned long) (tx4927_ccfgptr->tear >> 32),
               (unsigned long) tx4927_ccfgptr->tear);
-       show_regs(regs);
+       show_regs(get_irq_regs());
 }
 
 void __init toshiba_rbtx4927_pci_irq_init(void)
@@ -1019,69 +1018,12 @@ void __init toshiba_rbtx4927_setup(void)
                               "+\n");
 }
 
-#ifdef CONFIG_RTC_DS1742
-extern unsigned long rtc_ds1742_get_time(void);
-extern int rtc_ds1742_set_time(unsigned long);
-extern void rtc_ds1742_wait(void);
-#endif
-
 void __init
 toshiba_rbtx4927_time_init(void)
 {
-       u32 c1;
-       u32 c2;
-
        TOSHIBA_RBTX4927_SETUP_DPRINTK(TOSHIBA_RBTX4927_SETUP_TIME_INIT, "-\n");
 
-#ifdef CONFIG_RTC_DS1742
-
-       rtc_mips_get_time = rtc_ds1742_get_time;
-       rtc_mips_set_time = rtc_ds1742_set_time;
-
-       TOSHIBA_RBTX4927_SETUP_DPRINTK(TOSHIBA_RBTX4927_SETUP_TIME_INIT,
-                                      ":rtc_ds1742_init()-\n");
-       rtc_ds1742_init(0xbc010000);
-       TOSHIBA_RBTX4927_SETUP_DPRINTK(TOSHIBA_RBTX4927_SETUP_TIME_INIT,
-                                      ":rtc_ds1742_init()+\n");
-
-       TOSHIBA_RBTX4927_SETUP_DPRINTK(TOSHIBA_RBTX4927_SETUP_TIME_INIT,
-                                      ":Calibrate mips_hpt_frequency-\n");
-       rtc_ds1742_wait();
-
-       /* get the count */
-       c1 = read_c0_count();
-
-       /* wait for the seconds to change again */
-       rtc_ds1742_wait();
-
-       /* get the count again */
-       c2 = read_c0_count();
-
-       TOSHIBA_RBTX4927_SETUP_DPRINTK(TOSHIBA_RBTX4927_SETUP_TIME_INIT,
-                                      ":Calibrate mips_hpt_frequency+\n");
-       TOSHIBA_RBTX4927_SETUP_DPRINTK(TOSHIBA_RBTX4927_SETUP_TIME_INIT,
-                                      ":c1=%12u\n", c1);
-       TOSHIBA_RBTX4927_SETUP_DPRINTK(TOSHIBA_RBTX4927_SETUP_TIME_INIT,
-                                      ":c2=%12u\n", c2);
-
-       /* this diff is as close as we are going to get to counter ticks per sec */
-       mips_hpt_frequency = abs(c2 - c1);
-       TOSHIBA_RBTX4927_SETUP_DPRINTK(TOSHIBA_RBTX4927_SETUP_TIME_INIT,
-                                      ":f1=%12u\n", mips_hpt_frequency);
-
-       /* round to 1/10th of a MHz */
-       mips_hpt_frequency /= (100 * 1000);
-       mips_hpt_frequency *= (100 * 1000);
-       TOSHIBA_RBTX4927_SETUP_DPRINTK(TOSHIBA_RBTX4927_SETUP_TIME_INIT,
-                                      ":f2=%12u\n", mips_hpt_frequency);
-
-       TOSHIBA_RBTX4927_SETUP_DPRINTK(TOSHIBA_RBTX4927_SETUP_INFO,
-                                      ":mips_hpt_frequency=%uHz (%uMHz)\n",
-                                      mips_hpt_frequency,
-                                      mips_hpt_frequency / 1000000);
-#else
-       mips_hpt_frequency = 100000000;
-#endif
+       mips_hpt_frequency = tx4927_cpu_clock / 2;
 
        TOSHIBA_RBTX4927_SETUP_DPRINTK(TOSHIBA_RBTX4927_SETUP_TIME_INIT, "+\n");
 
@@ -1094,3 +1036,35 @@ void __init toshiba_rbtx4927_timer_setup(struct irqaction *irq)
        TOSHIBA_RBTX4927_SETUP_DPRINTK(TOSHIBA_RBTX4927_SETUP_TIMER_SETUP,
                                       "+\n");
 }
+
+static int __init toshiba_rbtx4927_rtc_init(void)
+{
+       struct resource res = {
+               .start  = 0x1c010000,
+               .end    = 0x1c010000 + 0x800 - 1,
+               .flags  = IORESOURCE_MEM,
+       };
+       struct platform_device *dev =
+               platform_device_register_simple("ds1742", -1, &res, 1);
+       return IS_ERR(dev) ? PTR_ERR(dev) : 0;
+}
+device_initcall(toshiba_rbtx4927_rtc_init);
+
+static int __init rbtx4927_ne_init(void)
+{
+       static struct resource __initdata res[] = {
+               {
+                       .start  = RBTX4927_RTL_8019_BASE,
+                       .end    = RBTX4927_RTL_8019_BASE + 0x20 - 1,
+                       .flags  = IORESOURCE_IO,
+               }, {
+                       .start  = RBTX4927_RTL_8019_IRQ,
+                       .flags  = IORESOURCE_IRQ,
+               }
+       };
+       struct platform_device *dev =
+               platform_device_register_simple("ne", -1,
+                                               res, ARRAY_SIZE(res));
+       return IS_ERR(dev) ? PTR_ERR(dev) : 0;
+}
+device_initcall(rbtx4927_ne_init);