rtc8564.h 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. /*
  2. * linux/drivers/i2c/chips/rtc8564.h
  3. *
  4. * Copyright (C) 2002-2004 Stefan Eletzhofer
  5. *
  6. * based on linux/drivers/acron/char/pcf8583.h
  7. * Copyright (C) 2000 Russell King
  8. *
  9. * This program is free software; you can redistribute it and/or modify
  10. * it under the terms of the GNU General Public License version 2 as
  11. * published by the Free Software Foundation.
  12. */
  13. struct rtc_tm {
  14. unsigned char secs;
  15. unsigned char mins;
  16. unsigned char hours;
  17. unsigned char mday;
  18. unsigned char mon;
  19. unsigned short year; /* xxxx 4 digits :) */
  20. unsigned char wday;
  21. unsigned char vl;
  22. };
  23. struct mem {
  24. unsigned int loc;
  25. unsigned int nr;
  26. unsigned char *data;
  27. };
  28. #define RTC_GETDATETIME 0
  29. #define RTC_SETTIME 1
  30. #define RTC_SETDATETIME 2
  31. #define RTC_GETCTRL 3
  32. #define RTC_SETCTRL 4
  33. #define MEM_READ 5
  34. #define MEM_WRITE 6
  35. #define RTC8564_REG_CTRL1 0x0 /* T 0 S 0 | T 0 0 0 */
  36. #define RTC8564_REG_CTRL2 0x1 /* 0 0 0 TI/TP | AF TF AIE TIE */
  37. #define RTC8564_REG_SEC 0x2 /* VL 4 2 1 | 8 4 2 1 */
  38. #define RTC8564_REG_MIN 0x3 /* x 4 2 1 | 8 4 2 1 */
  39. #define RTC8564_REG_HR 0x4 /* x x 2 1 | 8 4 2 1 */
  40. #define RTC8564_REG_DAY 0x5 /* x x 2 1 | 8 4 2 1 */
  41. #define RTC8564_REG_WDAY 0x6 /* x x x x | x 4 2 1 */
  42. #define RTC8564_REG_MON_CENT 0x7 /* C x x 1 | 8 4 2 1 */
  43. #define RTC8564_REG_YEAR 0x8 /* 8 4 2 1 | 8 4 2 1 */
  44. #define RTC8564_REG_AL_MIN 0x9 /* AE 4 2 1 | 8 4 2 1 */
  45. #define RTC8564_REG_AL_HR 0xa /* AE 4 2 1 | 8 4 2 1 */
  46. #define RTC8564_REG_AL_DAY 0xb /* AE x 2 1 | 8 4 2 1 */
  47. #define RTC8564_REG_AL_WDAY 0xc /* AE x x x | x 4 2 1 */
  48. #define RTC8564_REG_CLKOUT 0xd /* FE x x x | x x FD1 FD0 */
  49. #define RTC8564_REG_TCTL 0xe /* TE x x x | x x FD1 FD0 */
  50. #define RTC8564_REG_TIMER 0xf /* 8 bit binary */
  51. /* Control reg */
  52. #define RTC8564_CTRL1_TEST1 (1<<3)
  53. #define RTC8564_CTRL1_STOP (1<<5)
  54. #define RTC8564_CTRL1_TEST2 (1<<7)
  55. #define RTC8564_CTRL2_TIE (1<<0)
  56. #define RTC8564_CTRL2_AIE (1<<1)
  57. #define RTC8564_CTRL2_TF (1<<2)
  58. #define RTC8564_CTRL2_AF (1<<3)
  59. #define RTC8564_CTRL2_TI_TP (1<<4)
  60. /* CLKOUT frequencies */
  61. #define RTC8564_FD_32768HZ (0x0)
  62. #define RTC8564_FD_1024HZ (0x1)
  63. #define RTC8564_FD_32 (0x2)
  64. #define RTC8564_FD_1HZ (0x3)
  65. /* Timer CTRL */
  66. #define RTC8564_TD_4096HZ (0x0)
  67. #define RTC8564_TD_64HZ (0x1)
  68. #define RTC8564_TD_1HZ (0x2)
  69. #define RTC8564_TD_1_60HZ (0x3)
  70. #define I2C_DRIVERID_RTC8564 0xf000