MIPS: Alchemy: devboard register abstraction
[linux-2.6.git] / arch / mips / alchemy / devboards / db1x00 / board_setup.c
index de30d8e..e713390 100644 (file)
 
 #include <asm/mach-au1x00/au1000.h>
 #include <asm/mach-db1x00/db1x00.h>
+#include <asm/mach-db1x00/bcsr.h>
 
 #include <prom.h>
 
-
-static BCSR * const bcsr = (BCSR *)BCSR_KSEG1_ADDR;
-
 const char *get_system_type(void)
 {
 #ifdef CONFIG_MIPS_BOSPORUS
@@ -49,15 +47,43 @@ const char *get_system_type(void)
 
 void board_reset(void)
 {
-       /* Hit BCSR.SW_RESET[RESET] */
-       bcsr->swreset = 0x0000;
+       bcsr_write(BCSR_SYSTEM, 0);
 }
 
 void __init board_setup(void)
 {
+       unsigned long bcsr1, bcsr2;
        u32 pin_func = 0;
        char *argptr;
 
+       bcsr1 = DB1000_BCSR_PHYS_ADDR;
+       bcsr2 = DB1000_BCSR_PHYS_ADDR + DB1000_BCSR_HEXLED_OFS;
+
+#ifdef CONFIG_MIPS_DB1000
+       printk(KERN_INFO "AMD Alchemy Au1000/Db1000 Board\n");
+#endif
+#ifdef CONFIG_MIPS_DB1500
+       printk(KERN_INFO "AMD Alchemy Au1500/Db1500 Board\n");
+#endif
+#ifdef CONFIG_MIPS_DB1100
+       printk(KERN_INFO "AMD Alchemy Au1100/Db1100 Board\n");
+#endif
+#ifdef CONFIG_MIPS_BOSPORUS
+       printk(KERN_INFO "AMD Alchemy Bosporus Board\n");
+#endif
+#ifdef CONFIG_MIPS_MIRAGE
+       printk(KERN_INFO "AMD Alchemy Mirage Board\n");
+#endif
+#ifdef CONFIG_MIPS_DB1550
+       printk(KERN_INFO "AMD Alchemy Au1550/Db1550 Board\n");
+
+       bcsr1 = DB1550_BCSR_PHYS_ADDR;
+       bcsr2 = DB1550_BCSR_PHYS_ADDR + DB1550_BCSR_HEXLED_OFS;
+#endif
+
+       /* initialize board register space */
+       bcsr_init(bcsr1, bcsr2);
+
        argptr = prom_getcmdline();
 #ifdef CONFIG_SERIAL_8250_CONSOLE
        argptr = strstr(argptr, "console=");
@@ -89,11 +115,10 @@ void __init board_setup(void)
        pin_func = au_readl(SYS_PINFUNC) | SYS_PF_IRF;
        au_writel(pin_func, SYS_PINFUNC);
        /* Power off until the driver is in use */
-       bcsr->resets &= ~BCSR_RESETS_IRDA_MODE_MASK;
-       bcsr->resets |=  BCSR_RESETS_IRDA_MODE_OFF;
-       au_sync();
+       bcsr_mod(BCSR_RESETS, BCSR_RESETS_IRDA_MODE_MASK,
+                               BCSR_RESETS_IRDA_MODE_OFF);
 #endif
-       bcsr->pcmcia = 0x0000; /* turn off PCMCIA power */
+       bcsr_write(BCSR_PCMCIA, 0);     /* turn off PCMCIA power */
 
        /* Enable GPIO[31:0] inputs */
        alchemy_gpio1_input_enable();
@@ -123,23 +148,4 @@ void __init board_setup(void)
 #endif
 
        au_sync();
-
-#ifdef CONFIG_MIPS_DB1000
-       printk(KERN_INFO "AMD Alchemy Au1000/Db1000 Board\n");
-#endif
-#ifdef CONFIG_MIPS_DB1500
-       printk(KERN_INFO "AMD Alchemy Au1500/Db1500 Board\n");
-#endif
-#ifdef CONFIG_MIPS_DB1100
-       printk(KERN_INFO "AMD Alchemy Au1100/Db1100 Board\n");
-#endif
-#ifdef CONFIG_MIPS_BOSPORUS
-       printk(KERN_INFO "AMD Alchemy Bosporus Board\n");
-#endif
-#ifdef CONFIG_MIPS_MIRAGE
-       printk(KERN_INFO "AMD Alchemy Mirage Board\n");
-#endif
-#ifdef CONFIG_MIPS_DB1550
-       printk(KERN_INFO "AMD Alchemy Au1550/Db1550 Board\n");
-#endif
 }