m48t59.h 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. /*
  2. * include/linux/rtc/m48t59.h
  3. *
  4. * Definitions for the platform data of m48t59 RTC chip driver.
  5. *
  6. * Copyright (c) 2007 Wind River Systems, Inc.
  7. *
  8. * Mark Zhan <rongkai.zhan@windriver.com>
  9. *
  10. * This program is free software; you can redistribute it and/or modify
  11. * it under the terms of the GNU General Public License version 2 as
  12. * published by the Free Software Foundation.
  13. */
  14. #ifndef _LINUX_RTC_M48T59_H_
  15. #define _LINUX_RTC_M48T59_H_
  16. /*
  17. * M48T59 Register Offset
  18. */
  19. #define M48T59_YEAR 0x1fff
  20. #define M48T59_MONTH 0x1ffe
  21. #define M48T59_MDAY 0x1ffd /* Day of Month */
  22. #define M48T59_WDAY 0x1ffc /* Day of Week */
  23. #define M48T59_WDAY_CB 0x20 /* Century Bit */
  24. #define M48T59_WDAY_CEB 0x10 /* Century Enable Bit */
  25. #define M48T59_HOUR 0x1ffb
  26. #define M48T59_MIN 0x1ffa
  27. #define M48T59_SEC 0x1ff9
  28. #define M48T59_CNTL 0x1ff8
  29. #define M48T59_CNTL_READ 0x40
  30. #define M48T59_CNTL_WRITE 0x80
  31. #define M48T59_WATCHDOG 0x1ff7
  32. #define M48T59_INTR 0x1ff6
  33. #define M48T59_INTR_AFE 0x80 /* Alarm Interrupt Enable */
  34. #define M48T59_INTR_ABE 0x20
  35. #define M48T59_ALARM_DATE 0x1ff5
  36. #define M48T59_ALARM_HOUR 0x1ff4
  37. #define M48T59_ALARM_MIN 0x1ff3
  38. #define M48T59_ALARM_SEC 0x1ff2
  39. #define M48T59_UNUSED 0x1ff1
  40. #define M48T59_FLAGS 0x1ff0
  41. #define M48T59_FLAGS_WDT 0x80 /* watchdog timer expired */
  42. #define M48T59_FLAGS_AF 0x40 /* alarm */
  43. #define M48T59_FLAGS_BF 0x10 /* low battery */
  44. #define M48T59_NVRAM_SIZE 0x1ff0
  45. struct m48t59_plat_data {
  46. /* The method to access M48T59 registers,
  47. * NOTE: The 'ofs' should be 0x00~0x1fff
  48. */
  49. void (*write_byte)(struct device *dev, u32 ofs, u8 val);
  50. unsigned char (*read_byte)(struct device *dev, u32 ofs);
  51. };
  52. #endif /* _LINUX_RTC_M48T59_H_ */