make oldconfig will rebuild these...
[linux-2.4.21-pre4.git] / include / asm-ppc / m48t35.h
1 /*
2  * BK Id: SCCS/s.m48t35.h 1.10 11/04/01 23:02:41 paulus
3  */
4 /*
5  *  Registers for the SGS-Thomson M48T35 Timekeeper RAM chip
6  *  and
7  *  Registers for the SGS-Thomson M48T37 Timekeeper RAM chip
8  *  The 37 is the 35 plus alarm and century thus the offsets
9  *  are shifted by the extra registers.
10  */
11
12 #ifndef __PPC_M48T35_H
13 #define __PPC_M48T35_H
14
15 /* RTC offsets */
16 #define M48T35_RTC_FLAGS        (-8)    /* the negative regs are really T37 only */ 
17 #define M48T35_RTC_CENTURY      (-7)
18 #define M48T35_RTC_AL_SEC       (-6)    
19 #define M48T35_RTC_AL_MIN       (-5)    
20 #define M48T35_RTC_AL_HRS       (-4)    
21 #define M48T35_RTC_AL_DOM       (-3)    
22 #define M48T35_RTC_INTERRUPT    (-2)
23 #define M48T35_RTC_WATCHDOG     (-1)
24 #define M48T35_RTC_CONTROL      0       /* T35 starts here */ 
25 #define M48T35_RTC_SECONDS      1
26 #define M48T35_RTC_MINUTES      2
27 #define M48T35_RTC_HOURS        3
28 #define M48T35_RTC_DAY          4
29 #define M48T35_RTC_DOM          5
30 #define M48T35_RTC_MONTH        6
31 #define M48T35_RTC_YEAR         7
32
33 /* this way help us know which bits go with which regs */ 
34 #define M48T35_RTC_FLAGS_BL           0x10
35 #define M48T35_RTC_FLAGS_AF           0x40
36 #define M48T35_RTC_FLAGS_WDF          0x80
37
38 #define M48T35_RTC_INTERRUPT_AFE       0x80
39 #define M48T35_RTC_INTERRUPT_ABE       0x20
40 #define M48T35_RTC_INTERRUPT_ALL       (M48T35_RTC_INTERRUPT_AFE|M48T35_RTC_INTERRUPT_ABE)
41
42 #define M48T35_RTC_WATCHDOG_RB         0x03
43 #define M48T35_RTC_WATCHDOG_BMB        0x7c
44 #define M48T35_RTC_WATCHDOG_WDS        0x80
45 #define M48T35_RTC_WATCHDOG_ALL        (M48T35_RTC_WATCHDOG_RB|M48T35_RTC_WATCHDOG_BMB|M48T35_RTC_W
46
47 #define M48T35_RTC_CONTROL_WRITE       0x80
48 #define M48T35_RTC_CONTROL_READ        0x40
49 #define M48T35_RTC_CONTROL_CAL_SIGN    0x20    
50 #define M48T35_RTC_CONTROL_CAL_VALUE   0x1f
51 #define M48T35_RTC_CONTROL_LOCKED      (M48T35_RTC_WRITE|M48T35_RTC_READ)
52 #define M48T35_RTC_CONTROL_CALIBRATION (M48T35_RTC_CONTROL_CAL_SIGN|M48T35_RTC_CONTROL_CAL_VALUE)
53
54 #define M48T35_RTC_SECONDS_SEC_1       0x0f
55 #define M48T35_RTC_SECONDS_SEC_10      0x70    
56 #define M48T35_RTC_SECONDS_ST          0x80
57 #define M48T35_RTC_SECONDS_SEC_ALL     (M48T35_RTC_SECONDS_SEC_1|M48T35_RTC_SECONDS_SEC_10)
58
59 #define M48T35_RTC_MINUTES_MIN_1       0x0f
60 #define M48T35_RTC_MINUTES_MIN_10      0x70    
61 #define M48T35_RTC_MINUTES_MIN_ALL     (M48T35_RTC_MINUTES_MIN_1|M48T35_RTC_MINUTES_MIN_10)
62
63 #define M48T35_RTC_HOURS_HRS_1         0x0f
64 #define M48T35_RTC_HOURS_HRS_10        0x30
65 #define M48T35_RTC_HOURS_HRS_ALL       (M48T35_RTC_HOURS_HRS_1|M48T35_RTC_HOURS_HRS_10)
66
67 #define M48T35_RTC_DAY_DAY_1           0x03
68 #define M48T35_RTC_DAY_FT              0x40
69
70 #define M48T35_RTC_ALARM_OFF           0x00
71 #define M48T35_RTC_WATCHDOG_OFF        0x00
72
73
74 /* legacy */
75 #define M48T35_RTC_SET      0x80
76 #define M48T35_RTC_STOPPED  0x80
77 #define M48T35_RTC_READ     0x40
78
79
80 /* read/write conversions */
81 #ifndef BCD_TO_BIN
82 #define BCD_TO_BIN(x)   ((x)=((x)&15) + ((x)>>4)*10)
83 #endif
84
85 #ifndef BIN_TO_BCD
86 #define BIN_TO_BCD(x)   ((x)=(((x)/10)<<4) + (x)%10)
87 #endif
88
89 #endif