mc146818rtc.h 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. /*
  2. * Carsten Langgaard, carstenl@mips.com
  3. * Copyright (C) 1999,2000 MIPS Technologies, Inc. All rights reserved.
  4. * Copyright (C) 2003 by Ralf Baechle
  5. *
  6. * This program is free software; you can distribute it and/or modify it
  7. * under the terms of the GNU General Public License (Version 2) as
  8. * published by the Free Software Foundation.
  9. *
  10. * This program is distributed in the hope it will be useful, but WITHOUT
  11. * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  12. * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
  13. * for more details.
  14. *
  15. * You should have received a copy of the GNU General Public License along
  16. * with this program; if not, write to the Free Software Foundation, Inc.,
  17. * 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
  18. *
  19. * RTC routines for Malta style attached PIIX4 device, which contains a
  20. * Motorola MC146818A-compatible Real Time Clock.
  21. */
  22. #ifndef __ASM_MACH_MALTA_MC146818RTC_H
  23. #define __ASM_MACH_MALTA_MC146818RTC_H
  24. #include <asm/io.h>
  25. #include <asm/mips-boards/generic.h>
  26. #include <asm/mips-boards/malta.h>
  27. #define RTC_PORT(x) (0x70 + (x))
  28. #define RTC_IRQ 8
  29. static inline unsigned char CMOS_READ(unsigned long addr)
  30. {
  31. outb(addr, MALTA_RTC_ADR_REG);
  32. return inb(MALTA_RTC_DAT_REG);
  33. }
  34. static inline void CMOS_WRITE(unsigned char data, unsigned long addr)
  35. {
  36. outb(addr, MALTA_RTC_ADR_REG);
  37. outb(data, MALTA_RTC_DAT_REG);
  38. }
  39. #define RTC_ALWAYS_BCD 0
  40. #define mc146818_decode_year(year) ((year) < 70 ? (year) + 2000 : (year) + 1900)
  41. #endif /* __ASM_MACH_MALTA_MC146818RTC_H */