[PATCH] selinux: endian notations
[linux-ginger.git] / include / asm-ppc / todc.h
blob84bae7d7681451c4e6be1ca641073337cc556f6f
1 /*
2 * include/asm-ppc/todc.h
4 * Definitions for the M48Txx and mc146818 series of Time of day/Real Time
5 * Clock chips.
7 * Author: Mark A. Greer
8 * mgreer@mvista.com
10 * 2001 (c) MontaVista, Software, Inc. This file is licensed under
11 * the terms of the GNU General Public License version 2. This program
12 * is licensed "as is" without any warranty of any kind, whether express
13 * or implied.
17 * Support for the M48T37/M48T59/.../mc146818 Real Time Clock chips.
18 * Purpose is to make one generic file that handles all of these chips instead
19 * of every platform implementing the same code over & over again.
22 #ifndef __PPC_KERNEL_TODC_H
23 #define __PPC_KERNEL_TODC_H
25 typedef struct {
26 uint rtc_type; /* your particular chip */
29 * Following are the addresses of the AS0, AS1, and DATA registers
30 * of these chips. Note that these are board-specific.
32 unsigned int nvram_as0;
33 unsigned int nvram_as1;
34 unsigned int nvram_data;
37 * Define bits to stop external set of regs from changing so
38 * the chip can be read/written reliably.
40 unsigned char enable_read;
41 unsigned char enable_write;
44 * Following is the number of AS0 address bits. This is normally
45 * 8 but some bad hardware routes address lines incorrectly.
47 int as0_bits;
49 int nvram_size; /* Size of NVRAM on chip */
50 int sw_flags; /* Software control flags */
52 /* Following are the register offsets for the particular chip */
53 int year;
54 int month;
55 int day_of_month;
56 int day_of_week;
57 int hours;
58 int minutes;
59 int seconds;
60 int control_b;
61 int control_a;
62 int watchdog;
63 int interrupts;
64 int alarm_date;
65 int alarm_hour;
66 int alarm_minutes;
67 int alarm_seconds;
68 int century;
69 int flags;
72 * Some RTC chips have their NVRAM buried behind a addr/data pair of
73 * regs on the first level/clock registers. The following fields
74 * are the addresses for those addr/data regs.
76 int nvram_addr_reg;
77 int nvram_data_reg;
78 } todc_info_t;
81 * Define the types of TODC/RTC variants that are supported in
82 * arch/ppc/kernel/todc_time.c
83 * Make a new one of these for any chip somehow differs from what's already
84 * defined. That way, if you ever need to put in code to touch those
85 * bits/registers in todc_time.c, you can put it inside an
86 * 'if (todc_info->rtc_type == TODC_TYPE_XXX)' so you won't break
87 * anyone else.
89 #define TODC_TYPE_MK48T35 1
90 #define TODC_TYPE_MK48T37 2
91 #define TODC_TYPE_MK48T59 3
92 #define TODC_TYPE_DS1693 4 /* Dallas DS1693 RTC */
93 #define TODC_TYPE_DS1743 5 /* Dallas DS1743 RTC */
94 #define TODC_TYPE_DS1746 6 /* Dallas DS1746 RTC */
95 #define TODC_TYPE_DS1747 7 /* Dallas DS1747 RTC */
96 #define TODC_TYPE_DS1501 8 /* Dallas DS1501 RTC */
97 #define TODC_TYPE_DS1643 9 /* Dallas DS1643 RTC */
98 #define TODC_TYPE_PC97307 10 /* PC97307 internal RTC */
99 #define TODC_TYPE_DS1557 11 /* Dallas DS1557 RTC */
100 #define TODC_TYPE_DS17285 12 /* Dallas DS17285 RTC */
101 #define TODC_TYPE_DS1553 13 /* Dallas DS1553 RTC */
102 #define TODC_TYPE_MC146818 100 /* Leave room for m48txx's */
105 * Bit to clear/set to enable reads/writes to the chip
107 #define TODC_MK48TXX_CNTL_A_R 0x40
108 #define TODC_MK48TXX_CNTL_A_W 0x80
109 #define TODC_MK48TXX_DAY_CB 0x80
111 #define TODC_DS1501_CNTL_B_TE 0x80
114 * Define flag bits used by todc routines.
116 #define TODC_FLAG_2_LEVEL_NVRAM 0x00000001
119 * Define the values for the various RTC's that should to into the todc_info
120 * table.
121 * Note: The XXX_NVRAM_SIZE, XXX_NVRAM_ADDR_REG, and XXX_NVRAM_DATA_REG only
122 * matter if XXX_SW_FLAGS has TODC_FLAG_2_LEVEL_NVRAM set.
124 #define TODC_TYPE_MK48T35_NVRAM_SIZE 0x7ff8
125 #define TODC_TYPE_MK48T35_SW_FLAGS 0
126 #define TODC_TYPE_MK48T35_YEAR 0x7fff
127 #define TODC_TYPE_MK48T35_MONTH 0x7ffe
128 #define TODC_TYPE_MK48T35_DOM 0x7ffd /* Day of Month */
129 #define TODC_TYPE_MK48T35_DOW 0x7ffc /* Day of Week */
130 #define TODC_TYPE_MK48T35_HOURS 0x7ffb
131 #define TODC_TYPE_MK48T35_MINUTES 0x7ffa
132 #define TODC_TYPE_MK48T35_SECONDS 0x7ff9
133 #define TODC_TYPE_MK48T35_CNTL_B 0x7ff9
134 #define TODC_TYPE_MK48T35_CNTL_A 0x7ff8
135 #define TODC_TYPE_MK48T35_WATCHDOG 0x0000
136 #define TODC_TYPE_MK48T35_INTERRUPTS 0x0000
137 #define TODC_TYPE_MK48T35_ALARM_DATE 0x0000
138 #define TODC_TYPE_MK48T35_ALARM_HOUR 0x0000
139 #define TODC_TYPE_MK48T35_ALARM_MINUTES 0x0000
140 #define TODC_TYPE_MK48T35_ALARM_SECONDS 0x0000
141 #define TODC_TYPE_MK48T35_CENTURY 0x0000
142 #define TODC_TYPE_MK48T35_FLAGS 0x0000
143 #define TODC_TYPE_MK48T35_NVRAM_ADDR_REG 0
144 #define TODC_TYPE_MK48T35_NVRAM_DATA_REG 0
146 #define TODC_TYPE_MK48T37_NVRAM_SIZE 0x7ff0
147 #define TODC_TYPE_MK48T37_SW_FLAGS 0
148 #define TODC_TYPE_MK48T37_YEAR 0x7fff
149 #define TODC_TYPE_MK48T37_MONTH 0x7ffe
150 #define TODC_TYPE_MK48T37_DOM 0x7ffd /* Day of Month */
151 #define TODC_TYPE_MK48T37_DOW 0x7ffc /* Day of Week */
152 #define TODC_TYPE_MK48T37_HOURS 0x7ffb
153 #define TODC_TYPE_MK48T37_MINUTES 0x7ffa
154 #define TODC_TYPE_MK48T37_SECONDS 0x7ff9
155 #define TODC_TYPE_MK48T37_CNTL_B 0x7ff9
156 #define TODC_TYPE_MK48T37_CNTL_A 0x7ff8
157 #define TODC_TYPE_MK48T37_WATCHDOG 0x7ff7
158 #define TODC_TYPE_MK48T37_INTERRUPTS 0x7ff6
159 #define TODC_TYPE_MK48T37_ALARM_DATE 0x7ff5
160 #define TODC_TYPE_MK48T37_ALARM_HOUR 0x7ff4
161 #define TODC_TYPE_MK48T37_ALARM_MINUTES 0x7ff3
162 #define TODC_TYPE_MK48T37_ALARM_SECONDS 0x7ff2
163 #define TODC_TYPE_MK48T37_CENTURY 0x7ff1
164 #define TODC_TYPE_MK48T37_FLAGS 0x7ff0
165 #define TODC_TYPE_MK48T37_NVRAM_ADDR_REG 0
166 #define TODC_TYPE_MK48T37_NVRAM_DATA_REG 0
168 #define TODC_TYPE_MK48T59_NVRAM_SIZE 0x1ff0
169 #define TODC_TYPE_MK48T59_SW_FLAGS 0
170 #define TODC_TYPE_MK48T59_YEAR 0x1fff
171 #define TODC_TYPE_MK48T59_MONTH 0x1ffe
172 #define TODC_TYPE_MK48T59_DOM 0x1ffd /* Day of Month */
173 #define TODC_TYPE_MK48T59_DOW 0x1ffc /* Day of Week */
174 #define TODC_TYPE_MK48T59_HOURS 0x1ffb
175 #define TODC_TYPE_MK48T59_MINUTES 0x1ffa
176 #define TODC_TYPE_MK48T59_SECONDS 0x1ff9
177 #define TODC_TYPE_MK48T59_CNTL_B 0x1ff9
178 #define TODC_TYPE_MK48T59_CNTL_A 0x1ff8
179 #define TODC_TYPE_MK48T59_WATCHDOG 0x1fff
180 #define TODC_TYPE_MK48T59_INTERRUPTS 0x1fff
181 #define TODC_TYPE_MK48T59_ALARM_DATE 0x1fff
182 #define TODC_TYPE_MK48T59_ALARM_HOUR 0x1fff
183 #define TODC_TYPE_MK48T59_ALARM_MINUTES 0x1fff
184 #define TODC_TYPE_MK48T59_ALARM_SECONDS 0x1fff
185 #define TODC_TYPE_MK48T59_CENTURY 0x1fff
186 #define TODC_TYPE_MK48T59_FLAGS 0x1fff
187 #define TODC_TYPE_MK48T59_NVRAM_ADDR_REG 0
188 #define TODC_TYPE_MK48T59_NVRAM_DATA_REG 0
190 #define TODC_TYPE_DS1501_NVRAM_SIZE 0x100
191 #define TODC_TYPE_DS1501_SW_FLAGS TODC_FLAG_2_LEVEL_NVRAM
192 #define TODC_TYPE_DS1501_YEAR (TODC_TYPE_DS1501_NVRAM_SIZE + 0x06)
193 #define TODC_TYPE_DS1501_MONTH (TODC_TYPE_DS1501_NVRAM_SIZE + 0x05)
194 #define TODC_TYPE_DS1501_DOM (TODC_TYPE_DS1501_NVRAM_SIZE + 0x04)
195 #define TODC_TYPE_DS1501_DOW (TODC_TYPE_DS1501_NVRAM_SIZE + 0x03)
196 #define TODC_TYPE_DS1501_HOURS (TODC_TYPE_DS1501_NVRAM_SIZE + 0x02)
197 #define TODC_TYPE_DS1501_MINUTES (TODC_TYPE_DS1501_NVRAM_SIZE + 0x01)
198 #define TODC_TYPE_DS1501_SECONDS (TODC_TYPE_DS1501_NVRAM_SIZE + 0x00)
199 #define TODC_TYPE_DS1501_CNTL_B (TODC_TYPE_DS1501_NVRAM_SIZE + 0x0f)
200 #define TODC_TYPE_DS1501_CNTL_A (TODC_TYPE_DS1501_NVRAM_SIZE + 0x0f)
201 #define TODC_TYPE_DS1501_WATCHDOG (TODC_TYPE_DS1501_NVRAM_SIZE + 0xff)
202 #define TODC_TYPE_DS1501_INTERRUPTS (TODC_TYPE_DS1501_NVRAM_SIZE + 0xff)
203 #define TODC_TYPE_DS1501_ALARM_DATE (TODC_TYPE_DS1501_NVRAM_SIZE + 0x0b)
204 #define TODC_TYPE_DS1501_ALARM_HOUR (TODC_TYPE_DS1501_NVRAM_SIZE + 0x0a)
205 #define TODC_TYPE_DS1501_ALARM_MINUTES (TODC_TYPE_DS1501_NVRAM_SIZE + 0x09)
206 #define TODC_TYPE_DS1501_ALARM_SECONDS (TODC_TYPE_DS1501_NVRAM_SIZE + 0x08)
207 #define TODC_TYPE_DS1501_CENTURY (TODC_TYPE_DS1501_NVRAM_SIZE + 0x07)
208 #define TODC_TYPE_DS1501_FLAGS (TODC_TYPE_DS1501_NVRAM_SIZE + 0xff)
209 #define TODC_TYPE_DS1501_NVRAM_ADDR_REG 0x10
210 #define TODC_TYPE_DS1501_NVRAM_DATA_REG 0x13
212 #define TODC_TYPE_DS1553_NVRAM_SIZE 0x1ff0
213 #define TODC_TYPE_DS1553_SW_FLAGS 0
214 #define TODC_TYPE_DS1553_YEAR 0x1fff
215 #define TODC_TYPE_DS1553_MONTH 0x1ffe
216 #define TODC_TYPE_DS1553_DOM 0x1ffd /* Day of Month */
217 #define TODC_TYPE_DS1553_DOW 0x1ffc /* Day of Week */
218 #define TODC_TYPE_DS1553_HOURS 0x1ffb
219 #define TODC_TYPE_DS1553_MINUTES 0x1ffa
220 #define TODC_TYPE_DS1553_SECONDS 0x1ff9
221 #define TODC_TYPE_DS1553_CNTL_B 0x1ff9
222 #define TODC_TYPE_DS1553_CNTL_A 0x1ff8 /* control_a R/W regs */
223 #define TODC_TYPE_DS1553_WATCHDOG 0x1ff7
224 #define TODC_TYPE_DS1553_INTERRUPTS 0x1ff6
225 #define TODC_TYPE_DS1553_ALARM_DATE 0x1ff5
226 #define TODC_TYPE_DS1553_ALARM_HOUR 0x1ff4
227 #define TODC_TYPE_DS1553_ALARM_MINUTES 0x1ff3
228 #define TODC_TYPE_DS1553_ALARM_SECONDS 0x1ff2
229 #define TODC_TYPE_DS1553_CENTURY 0x1ff8
230 #define TODC_TYPE_DS1553_FLAGS 0x1ff0
231 #define TODC_TYPE_DS1553_NVRAM_ADDR_REG 0
232 #define TODC_TYPE_DS1553_NVRAM_DATA_REG 0
234 #define TODC_TYPE_DS1557_NVRAM_SIZE 0x7fff0
235 #define TODC_TYPE_DS1557_SW_FLAGS 0
236 #define TODC_TYPE_DS1557_YEAR 0x7ffff
237 #define TODC_TYPE_DS1557_MONTH 0x7fffe
238 #define TODC_TYPE_DS1557_DOM 0x7fffd /* Day of Month */
239 #define TODC_TYPE_DS1557_DOW 0x7fffc /* Day of Week */
240 #define TODC_TYPE_DS1557_HOURS 0x7fffb
241 #define TODC_TYPE_DS1557_MINUTES 0x7fffa
242 #define TODC_TYPE_DS1557_SECONDS 0x7fff9
243 #define TODC_TYPE_DS1557_CNTL_B 0x7fff9
244 #define TODC_TYPE_DS1557_CNTL_A 0x7fff8 /* control_a R/W regs */
245 #define TODC_TYPE_DS1557_WATCHDOG 0x7fff7
246 #define TODC_TYPE_DS1557_INTERRUPTS 0x7fff6
247 #define TODC_TYPE_DS1557_ALARM_DATE 0x7fff5
248 #define TODC_TYPE_DS1557_ALARM_HOUR 0x7fff4
249 #define TODC_TYPE_DS1557_ALARM_MINUTES 0x7fff3
250 #define TODC_TYPE_DS1557_ALARM_SECONDS 0x7fff2
251 #define TODC_TYPE_DS1557_CENTURY 0x7fff8
252 #define TODC_TYPE_DS1557_FLAGS 0x7fff0
253 #define TODC_TYPE_DS1557_NVRAM_ADDR_REG 0
254 #define TODC_TYPE_DS1557_NVRAM_DATA_REG 0
256 #define TODC_TYPE_DS1643_NVRAM_SIZE 0x1ff8
257 #define TODC_TYPE_DS1643_SW_FLAGS 0
258 #define TODC_TYPE_DS1643_YEAR 0x1fff
259 #define TODC_TYPE_DS1643_MONTH 0x1ffe
260 #define TODC_TYPE_DS1643_DOM 0x1ffd /* Day of Month */
261 #define TODC_TYPE_DS1643_DOW 0x1ffc /* Day of Week */
262 #define TODC_TYPE_DS1643_HOURS 0x1ffb
263 #define TODC_TYPE_DS1643_MINUTES 0x1ffa
264 #define TODC_TYPE_DS1643_SECONDS 0x1ff9
265 #define TODC_TYPE_DS1643_CNTL_B 0x1ff9
266 #define TODC_TYPE_DS1643_CNTL_A 0x1ff8 /* control_a R/W regs */
267 #define TODC_TYPE_DS1643_WATCHDOG 0x1fff
268 #define TODC_TYPE_DS1643_INTERRUPTS 0x1fff
269 #define TODC_TYPE_DS1643_ALARM_DATE 0x1fff
270 #define TODC_TYPE_DS1643_ALARM_HOUR 0x1fff
271 #define TODC_TYPE_DS1643_ALARM_MINUTES 0x1fff
272 #define TODC_TYPE_DS1643_ALARM_SECONDS 0x1fff
273 #define TODC_TYPE_DS1643_CENTURY 0x1ff8
274 #define TODC_TYPE_DS1643_FLAGS 0x1fff
275 #define TODC_TYPE_DS1643_NVRAM_ADDR_REG 0
276 #define TODC_TYPE_DS1643_NVRAM_DATA_REG 0
278 #define TODC_TYPE_DS1693_NVRAM_SIZE 0 /* Not handled yet */
279 #define TODC_TYPE_DS1693_SW_FLAGS 0
280 #define TODC_TYPE_DS1693_YEAR 0x09
281 #define TODC_TYPE_DS1693_MONTH 0x08
282 #define TODC_TYPE_DS1693_DOM 0x07 /* Day of Month */
283 #define TODC_TYPE_DS1693_DOW 0x06 /* Day of Week */
284 #define TODC_TYPE_DS1693_HOURS 0x04
285 #define TODC_TYPE_DS1693_MINUTES 0x02
286 #define TODC_TYPE_DS1693_SECONDS 0x00
287 #define TODC_TYPE_DS1693_CNTL_B 0x0b
288 #define TODC_TYPE_DS1693_CNTL_A 0x0a
289 #define TODC_TYPE_DS1693_WATCHDOG 0xff
290 #define TODC_TYPE_DS1693_INTERRUPTS 0xff
291 #define TODC_TYPE_DS1693_ALARM_DATE 0x49
292 #define TODC_TYPE_DS1693_ALARM_HOUR 0x05
293 #define TODC_TYPE_DS1693_ALARM_MINUTES 0x03
294 #define TODC_TYPE_DS1693_ALARM_SECONDS 0x01
295 #define TODC_TYPE_DS1693_CENTURY 0x48
296 #define TODC_TYPE_DS1693_FLAGS 0xff
297 #define TODC_TYPE_DS1693_NVRAM_ADDR_REG 0
298 #define TODC_TYPE_DS1693_NVRAM_DATA_REG 0
300 #define TODC_TYPE_DS1743_NVRAM_SIZE 0x1ff8
301 #define TODC_TYPE_DS1743_SW_FLAGS 0
302 #define TODC_TYPE_DS1743_YEAR 0x1fff
303 #define TODC_TYPE_DS1743_MONTH 0x1ffe
304 #define TODC_TYPE_DS1743_DOM 0x1ffd /* Day of Month */
305 #define TODC_TYPE_DS1743_DOW 0x1ffc /* Day of Week */
306 #define TODC_TYPE_DS1743_HOURS 0x1ffb
307 #define TODC_TYPE_DS1743_MINUTES 0x1ffa
308 #define TODC_TYPE_DS1743_SECONDS 0x1ff9
309 #define TODC_TYPE_DS1743_CNTL_B 0x1ff9
310 #define TODC_TYPE_DS1743_CNTL_A 0x1ff8 /* control_a R/W regs */
311 #define TODC_TYPE_DS1743_WATCHDOG 0x1fff
312 #define TODC_TYPE_DS1743_INTERRUPTS 0x1fff
313 #define TODC_TYPE_DS1743_ALARM_DATE 0x1fff
314 #define TODC_TYPE_DS1743_ALARM_HOUR 0x1fff
315 #define TODC_TYPE_DS1743_ALARM_MINUTES 0x1fff
316 #define TODC_TYPE_DS1743_ALARM_SECONDS 0x1fff
317 #define TODC_TYPE_DS1743_CENTURY 0x1ff8
318 #define TODC_TYPE_DS1743_FLAGS 0x1fff
319 #define TODC_TYPE_DS1743_NVRAM_ADDR_REG 0
320 #define TODC_TYPE_DS1743_NVRAM_DATA_REG 0
322 #define TODC_TYPE_DS1746_NVRAM_SIZE 0x1fff8
323 #define TODC_TYPE_DS1746_SW_FLAGS 0
324 #define TODC_TYPE_DS1746_YEAR 0x1ffff
325 #define TODC_TYPE_DS1746_MONTH 0x1fffe
326 #define TODC_TYPE_DS1746_DOM 0x1fffd /* Day of Month */
327 #define TODC_TYPE_DS1746_DOW 0x1fffc /* Day of Week */
328 #define TODC_TYPE_DS1746_HOURS 0x1fffb
329 #define TODC_TYPE_DS1746_MINUTES 0x1fffa
330 #define TODC_TYPE_DS1746_SECONDS 0x1fff9
331 #define TODC_TYPE_DS1746_CNTL_B 0x1fff9
332 #define TODC_TYPE_DS1746_CNTL_A 0x1fff8 /* control_a R/W regs */
333 #define TODC_TYPE_DS1746_WATCHDOG 0x00000
334 #define TODC_TYPE_DS1746_INTERRUPTS 0x00000
335 #define TODC_TYPE_DS1746_ALARM_DATE 0x00000
336 #define TODC_TYPE_DS1746_ALARM_HOUR 0x00000
337 #define TODC_TYPE_DS1746_ALARM_MINUTES 0x00000
338 #define TODC_TYPE_DS1746_ALARM_SECONDS 0x00000
339 #define TODC_TYPE_DS1746_CENTURY 0x00000
340 #define TODC_TYPE_DS1746_FLAGS 0x00000
341 #define TODC_TYPE_DS1746_NVRAM_ADDR_REG 0
342 #define TODC_TYPE_DS1746_NVRAM_DATA_REG 0
344 #define TODC_TYPE_DS1747_NVRAM_SIZE 0x7fff8
345 #define TODC_TYPE_DS1747_SW_FLAGS 0
346 #define TODC_TYPE_DS1747_YEAR 0x7ffff
347 #define TODC_TYPE_DS1747_MONTH 0x7fffe
348 #define TODC_TYPE_DS1747_DOM 0x7fffd /* Day of Month */
349 #define TODC_TYPE_DS1747_DOW 0x7fffc /* Day of Week */
350 #define TODC_TYPE_DS1747_HOURS 0x7fffb
351 #define TODC_TYPE_DS1747_MINUTES 0x7fffa
352 #define TODC_TYPE_DS1747_SECONDS 0x7fff9
353 #define TODC_TYPE_DS1747_CNTL_B 0x7fff9
354 #define TODC_TYPE_DS1747_CNTL_A 0x7fff8 /* control_a R/W regs */
355 #define TODC_TYPE_DS1747_WATCHDOG 0x00000
356 #define TODC_TYPE_DS1747_INTERRUPTS 0x00000
357 #define TODC_TYPE_DS1747_ALARM_DATE 0x00000
358 #define TODC_TYPE_DS1747_ALARM_HOUR 0x00000
359 #define TODC_TYPE_DS1747_ALARM_MINUTES 0x00000
360 #define TODC_TYPE_DS1747_ALARM_SECONDS 0x00000
361 #define TODC_TYPE_DS1747_CENTURY 0x00000
362 #define TODC_TYPE_DS1747_FLAGS 0x00000
363 #define TODC_TYPE_DS1747_NVRAM_ADDR_REG 0
364 #define TODC_TYPE_DS1747_NVRAM_DATA_REG 0
366 #define TODC_TYPE_DS17285_NVRAM_SIZE (0x1000-0x80) /* 4Kx8 NVRAM (minus RTC regs) */
367 #define TODC_TYPE_DS17285_SW_FLAGS TODC_FLAG_2_LEVEL_NVRAM
368 #define TODC_TYPE_DS17285_SECONDS (TODC_TYPE_DS17285_NVRAM_SIZE + 0x00)
369 #define TODC_TYPE_DS17285_ALARM_SECONDS (TODC_TYPE_DS17285_NVRAM_SIZE + 0x01)
370 #define TODC_TYPE_DS17285_MINUTES (TODC_TYPE_DS17285_NVRAM_SIZE + 0x02)
371 #define TODC_TYPE_DS17285_ALARM_MINUTES (TODC_TYPE_DS17285_NVRAM_SIZE + 0x03)
372 #define TODC_TYPE_DS17285_HOURS (TODC_TYPE_DS17285_NVRAM_SIZE + 0x04)
373 #define TODC_TYPE_DS17285_ALARM_HOUR (TODC_TYPE_DS17285_NVRAM_SIZE + 0x05)
374 #define TODC_TYPE_DS17285_DOW (TODC_TYPE_DS17285_NVRAM_SIZE + 0x06)
375 #define TODC_TYPE_DS17285_DOM (TODC_TYPE_DS17285_NVRAM_SIZE + 0x07)
376 #define TODC_TYPE_DS17285_MONTH (TODC_TYPE_DS17285_NVRAM_SIZE + 0x08)
377 #define TODC_TYPE_DS17285_YEAR (TODC_TYPE_DS17285_NVRAM_SIZE + 0x09)
378 #define TODC_TYPE_DS17285_CNTL_A (TODC_TYPE_DS17285_NVRAM_SIZE + 0x0A)
379 #define TODC_TYPE_DS17285_CNTL_B (TODC_TYPE_DS17285_NVRAM_SIZE + 0x0B)
380 #define TODC_TYPE_DS17285_CNTL_C (TODC_TYPE_DS17285_NVRAM_SIZE + 0x0C)
381 #define TODC_TYPE_DS17285_CNTL_D (TODC_TYPE_DS17285_NVRAM_SIZE + 0x0D)
382 #define TODC_TYPE_DS17285_WATCHDOG 0
383 #define TODC_TYPE_DS17285_INTERRUPTS 0
384 #define TODC_TYPE_DS17285_ALARM_DATE 0
385 #define TODC_TYPE_DS17285_CENTURY 0
386 #define TODC_TYPE_DS17285_FLAGS 0
387 #define TODC_TYPE_DS17285_NVRAM_ADDR_REG 0x50
388 #define TODC_TYPE_DS17285_NVRAM_DATA_REG 0x53
390 #define TODC_TYPE_MC146818_NVRAM_SIZE 0 /* XXXX */
391 #define TODC_TYPE_MC146818_SW_FLAGS 0
392 #define TODC_TYPE_MC146818_YEAR 0x09
393 #define TODC_TYPE_MC146818_MONTH 0x08
394 #define TODC_TYPE_MC146818_DOM 0x07 /* Day of Month */
395 #define TODC_TYPE_MC146818_DOW 0x06 /* Day of Week */
396 #define TODC_TYPE_MC146818_HOURS 0x04
397 #define TODC_TYPE_MC146818_MINUTES 0x02
398 #define TODC_TYPE_MC146818_SECONDS 0x00
399 #define TODC_TYPE_MC146818_CNTL_B 0x0a
400 #define TODC_TYPE_MC146818_CNTL_A 0x0b /* control_a R/W regs */
401 #define TODC_TYPE_MC146818_WATCHDOG 0
402 #define TODC_TYPE_MC146818_INTERRUPTS 0x0c
403 #define TODC_TYPE_MC146818_ALARM_DATE 0xff
404 #define TODC_TYPE_MC146818_ALARM_HOUR 0x05
405 #define TODC_TYPE_MC146818_ALARM_MINUTES 0x03
406 #define TODC_TYPE_MC146818_ALARM_SECONDS 0x01
407 #define TODC_TYPE_MC146818_CENTURY 0xff
408 #define TODC_TYPE_MC146818_FLAGS 0xff
409 #define TODC_TYPE_MC146818_NVRAM_ADDR_REG 0
410 #define TODC_TYPE_MC146818_NVRAM_DATA_REG 0
412 #define TODC_TYPE_PC97307_NVRAM_SIZE 0 /* No NVRAM? */
413 #define TODC_TYPE_PC97307_SW_FLAGS 0
414 #define TODC_TYPE_PC97307_YEAR 0x09
415 #define TODC_TYPE_PC97307_MONTH 0x08
416 #define TODC_TYPE_PC97307_DOM 0x07 /* Day of Month */
417 #define TODC_TYPE_PC97307_DOW 0x06 /* Day of Week */
418 #define TODC_TYPE_PC97307_HOURS 0x04
419 #define TODC_TYPE_PC97307_MINUTES 0x02
420 #define TODC_TYPE_PC97307_SECONDS 0x00
421 #define TODC_TYPE_PC97307_CNTL_B 0x0a
422 #define TODC_TYPE_PC97307_CNTL_A 0x0b /* control_a R/W regs */
423 #define TODC_TYPE_PC97307_WATCHDOG 0x0c
424 #define TODC_TYPE_PC97307_INTERRUPTS 0x0d
425 #define TODC_TYPE_PC97307_ALARM_DATE 0xff
426 #define TODC_TYPE_PC97307_ALARM_HOUR 0x05
427 #define TODC_TYPE_PC97307_ALARM_MINUTES 0x03
428 #define TODC_TYPE_PC97307_ALARM_SECONDS 0x01
429 #define TODC_TYPE_PC97307_CENTURY 0xff
430 #define TODC_TYPE_PC97307_FLAGS 0xff
431 #define TODC_TYPE_PC97307_NVRAM_ADDR_REG 0
432 #define TODC_TYPE_PC97307_NVRAM_DATA_REG 0
435 * Define macros to allocate and init the todc_info_t table that will
436 * be used by the todc_time.c routines.
438 #define TODC_ALLOC() \
439 static todc_info_t todc_info_alloc; \
440 todc_info_t *todc_info = &todc_info_alloc;
442 #define TODC_INIT(clock_type, as0, as1, data, bits) { \
443 todc_info->rtc_type = clock_type; \
445 todc_info->nvram_as0 = (unsigned int)(as0); \
446 todc_info->nvram_as1 = (unsigned int)(as1); \
447 todc_info->nvram_data = (unsigned int)(data); \
449 todc_info->as0_bits = (bits); \
451 todc_info->nvram_size = clock_type ##_NVRAM_SIZE; \
452 todc_info->sw_flags = clock_type ##_SW_FLAGS; \
454 todc_info->year = clock_type ##_YEAR; \
455 todc_info->month = clock_type ##_MONTH; \
456 todc_info->day_of_month = clock_type ##_DOM; \
457 todc_info->day_of_week = clock_type ##_DOW; \
458 todc_info->hours = clock_type ##_HOURS; \
459 todc_info->minutes = clock_type ##_MINUTES; \
460 todc_info->seconds = clock_type ##_SECONDS; \
461 todc_info->control_b = clock_type ##_CNTL_B; \
462 todc_info->control_a = clock_type ##_CNTL_A; \
463 todc_info->watchdog = clock_type ##_WATCHDOG; \
464 todc_info->interrupts = clock_type ##_INTERRUPTS; \
465 todc_info->alarm_date = clock_type ##_ALARM_DATE; \
466 todc_info->alarm_hour = clock_type ##_ALARM_HOUR; \
467 todc_info->alarm_minutes = clock_type ##_ALARM_MINUTES; \
468 todc_info->alarm_seconds = clock_type ##_ALARM_SECONDS; \
469 todc_info->century = clock_type ##_CENTURY; \
470 todc_info->flags = clock_type ##_FLAGS; \
472 todc_info->nvram_addr_reg = clock_type ##_NVRAM_ADDR_REG; \
473 todc_info->nvram_data_reg = clock_type ##_NVRAM_DATA_REG; \
476 extern todc_info_t *todc_info;
478 unsigned char todc_direct_read_val(int addr);
479 void todc_direct_write_val(int addr, unsigned char val);
480 unsigned char todc_m48txx_read_val(int addr);
481 void todc_m48txx_write_val(int addr, unsigned char val);
482 unsigned char todc_mc146818_read_val(int addr);
483 void todc_mc146818_write_val(int addr, unsigned char val);
485 long todc_time_init(void);
486 unsigned long todc_get_rtc_time(void);
487 int todc_set_rtc_time(unsigned long nowtime);
488 void todc_calibrate_decr(void);
490 #endif /* __PPC_KERNEL_TODC_H */