MIPS: Alchemy: devboard register abstraction
[linux-2.6.git] / arch / mips / alchemy / devboards / pb1200 / board_setup.c
index 94e6b7e..db56380 100644 (file)
@@ -27,6 +27,8 @@
 #include <linux/init.h>
 #include <linux/sched.h>
 
+#include <asm/mach-db1x00/bcsr.h>
+
 #include <prom.h>
 #include <au1xxx.h>
 
@@ -38,14 +40,25 @@ const char *get_system_type(void)
 
 void board_reset(void)
 {
-       bcsr->resets = 0;
-       bcsr->system = 0;
+       bcsr_write(BCSR_RESETS, 0);
+       bcsr_write(BCSR_SYSTEM, 0);
 }
 
 void __init board_setup(void)
 {
        char *argptr;
 
+#ifdef CONFIG_MIPS_PB1200
+       printk(KERN_INFO "AMD Alchemy Pb1200 Board\n");
+       bcsr_init(PB1200_BCSR_PHYS_ADDR,
+                 PB1200_BCSR_PHYS_ADDR + PB1200_BCSR_HEXLED_OFS);
+#endif
+#ifdef CONFIG_MIPS_DB1200
+       printk(KERN_INFO "AMD Alchemy Db1200 Board\n");
+       bcsr_init(DB1200_BCSR_PHYS_ADDR,
+                 DB1200_BCSR_PHYS_ADDR + DB1200_BCSR_HEXLED_OFS);
+#endif
+
        argptr = prom_getcmdline();
 #ifdef CONFIG_SERIAL_8250_CONSOLE
        argptr = strstr(argptr, "console=");
@@ -82,7 +95,7 @@ void __init board_setup(void)
                u32 pin_func;
 
                /* Select SMBus in CPLD */
-               bcsr->resets &= ~BCSR_RESETS_PCS0MUX;
+               bcsr_mod(BCSR_RESETS, BCSR_RESETS_PSC0MUX, 0);
 
                pin_func = au_readl(SYS_PINFUNC);
                au_sync();
@@ -116,38 +129,24 @@ void __init board_setup(void)
 
        /*
         * The Pb1200 development board uses external MUX for PSC0 to
-        * support SMB/SPI. bcsr->resets bit 12: 0=SMB 1=SPI
+        * support SMB/SPI. bcsr_resets bit 12: 0=SMB 1=SPI
         */
 #ifdef CONFIG_I2C_AU1550
-       bcsr->resets &= ~BCSR_RESETS_PCS0MUX;
+       bcsr_mod(BCSR_RESETS, BCSR_RESETS_PSC0MUX, 0);
 #endif
        au_sync();
-
-#ifdef CONFIG_MIPS_PB1200
-       printk(KERN_INFO "AMD Alchemy Pb1200 Board\n");
-#endif
-#ifdef CONFIG_MIPS_DB1200
-       printk(KERN_INFO "AMD Alchemy Db1200 Board\n");
-#endif
 }
 
 int board_au1200fb_panel(void)
 {
-       BCSR *bcsr = (BCSR *)BCSR_KSEG1_ADDR;
-       int p;
-
-       p = bcsr->switches;
-       p >>= 8;
-       p &= 0x0F;
-       return p;
+       return (bcsr_read(BCSR_SWITCHES) >> 8) & 0x0f;
 }
 
 int board_au1200fb_panel_init(void)
 {
        /* Apply power */
-       BCSR *bcsr = (BCSR *)BCSR_KSEG1_ADDR;
-
-       bcsr->board |= BCSR_BOARD_LCDVEE | BCSR_BOARD_LCDVDD | BCSR_BOARD_LCDBL;
+       bcsr_mod(BCSR_BOARD, 0, BCSR_BOARD_LCDVEE | BCSR_BOARD_LCDVDD |
+                               BCSR_BOARD_LCDBL);
        /* printk(KERN_DEBUG "board_au1200fb_panel_init()\n"); */
        return 0;
 }
@@ -155,10 +154,8 @@ int board_au1200fb_panel_init(void)
 int board_au1200fb_panel_shutdown(void)
 {
        /* Remove power */
-       BCSR *bcsr = (BCSR *)BCSR_KSEG1_ADDR;
-
-       bcsr->board &= ~(BCSR_BOARD_LCDVEE | BCSR_BOARD_LCDVDD |
-                        BCSR_BOARD_LCDBL);
+       bcsr_mod(BCSR_BOARD, BCSR_BOARD_LCDVEE | BCSR_BOARD_LCDVDD |
+                            BCSR_BOARD_LCDBL, 0);
        /* printk(KERN_DEBUG "board_au1200fb_panel_shutdown()\n"); */
        return 0;
 }