vserver 1.9.5.x5
[linux-2.6.git] / include / asm-mips / mach-atlas / mc146818rtc.h
index 8799f92..397522e 100644 (file)
@@ -1,7 +1,9 @@
 /*
- * Carsten Langgaard, carstenl@mips.com
- * Copyright (C) 1999,2000 MIPS Technologies, Inc.  All rights reserved.
- * Copyright (C) 2003 by Ralf Baechle
+ * Copyright (C) 1999, 2000, 2005  MIPS Technologies, Inc.
+ *     All rights reserved.
+ *     Authors: Carsten Langgaard <carstenl@mips.com>
+ *              Maciej W. Rozycki <macro@mips.com>
+ * Copyright (C) 2003, 05 Ralf Baechle (ralf@linux-mips.org)
  *
  * This program is free software; you can distribute it and/or modify it
  * under the terms of the GNU General Public License (Version 2) as
 #ifndef __ASM_MACH_ATLAS_MC146818RTC_H
 #define __ASM_MACH_ATLAS_MC146818RTC_H
 
-#include <asm/io.h>
+#include <linux/types.h>
+
+#include <asm/addrspace.h>
+
 #include <asm/mips-boards/atlas.h>
 #include <asm/mips-boards/atlasint.h>
 
-
-#define RTC_PORT(x)    (ATLAS_RTC_ADR_REG + (x)*8)
-#define RTC_IOMAPPED   1
-#define RTC_EXTENT     16
+#define RTC_PORT(x)    (ATLAS_RTC_ADR_REG + (x) * 8)
+#define RTC_IO_EXTENT  0x100
+#define RTC_IOMAPPED   0
 #define RTC_IRQ                ATLASINT_RTC
 
-#if CONFIG_CPU_LITTLE_ENDIAN
-#define ATLAS_RTC_PORT(x) (RTC_PORT(x) + 0)
-#else
-#define ATLAS_RTC_PORT(x) (RTC_PORT(x) + 3)
-#endif
-
 static inline unsigned char CMOS_READ(unsigned long addr)
 {
-       outb(addr, ATLAS_RTC_PORT(0));
+       volatile u32 *ireg = (void *)CKSEG1ADDR(RTC_PORT(0));
+       volatile u32 *dreg = (void *)CKSEG1ADDR(RTC_PORT(1));
 
-       return inb(ATLAS_RTC_PORT(1));
+       *ireg = addr;
+       return *dreg;
 }
 
 static inline void CMOS_WRITE(unsigned char data, unsigned long addr)
 {
-       outb(addr, ATLAS_RTC_PORT(0));
-       outb(data, ATLAS_RTC_PORT(1));
+       volatile u32 *ireg = (void *)CKSEG1ADDR(RTC_PORT(0));
+       volatile u32 *dreg = (void *)CKSEG1ADDR(RTC_PORT(1));
+
+       *ireg = addr;
+       *dreg = data;
 }
 
 #define RTC_ALWAYS_BCD 0