4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License, Version 1.0 only
6 * (the "License"). You may not use this file except in compliance
9 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10 * or http://www.opensolaris.org/os/licensing.
11 * See the License for the specific language governing permissions
12 * and limitations under the License.
14 * When distributing Covered Code, include this CDDL HEADER in each
15 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16 * If applicable, add the following below this CDDL HEADER, with the
17 * fields enclosed by brackets "[]" replaced with your own identifying
18 * information: Portions Copyright [yyyy] [name of copyright owner]
23 * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
24 * Use is subject to license terms.
30 #pragma ident "%Z%%M% %I% %E% SMI"
36 extern char *v_rtc_addr_reg
;
39 #include <sys/promif.h>
40 #define DPRINTF if (bq4802_debug_flags) prom_printf
45 #define BQ4802_DATA_REG(x) (*(volatile uint8_t *)(v_rtc_addr_reg + x))
48 * Definitions for Real Time Clock driver (TI BQ4802 chip).
50 #define RTC_SEC 0x0 /* Seconds */
51 #define RTC_ASEC 0x1 /* Seconds Alarm */
52 #define RTC_MIN 0x2 /* Minutes */
53 #define RTC_AMIN 0x3 /* Minutes Alarm */
54 #define RTC_HRS 0x4 /* Hours */
55 #define RTC_AHRS 0x5 /* Hours Alarm */
56 #define RTC_DOM 0x6 /* Day-of-Month */
57 #define RTC_ADOM 0x7 /* Day-of-Month Alarm */
58 #define RTC_DOW 0x8 /* Day-of-Week */
59 #define RTC_MON 0x9 /* Month */
60 #define RTC_YEAR 0xa /* Year */
61 #define RTC_CENTURY 0xf /* Century */
63 #define RTC_RATES 0xb /* Control Register B */
64 #define RTC_ENABLES 0xc /* Control Register C */
65 #define RTC_FLAGS 0xd /* Control Register D */
66 #define RTC_CNTRL 0xe /* Control Register E */
69 * Control register B definitions
71 #define RTC_RS 0x0f /* Rate select for periodic interrupt */
72 #define RTC_WD 0x70 /* Watchdog time-out rate */
75 * Control register C definitions
77 #define RTC_ABE 0x01 /* Alarm Int. Enable in Battery-backup Mode */
78 #define RTC_PWRIE 0x02 /* Power-fail Interrupt Enable */
79 #define RTC_PIE 0x04 /* Periodic Interrupt Enable */
80 #define RTC_AIE 0x08 /* Alarm Interrupt Enable */
83 * Control Register D definitions
85 #define RTC_BVF 0x01 /* Battery-valid flag */
86 #define RTC_PWRF 0x02 /* Power-fail Interrupt flag */
87 #define RTC_PF 0x04 /* Periodic Interrupt flag */
88 #define RTC_AF 0x08 /* Alarm Interrupt flag */
91 * Control Register E definitions
93 #define RTC_DSE 0x01 /* Daylight Savings Enable */
94 #define RTC_HM 0x02 /* Hour mode, 1 = 24 hour, 0 = 12 hour */
95 #define RTC_STOP_N 0x04 /* Oscillator Stop and Start */
96 #define RTC_UTI 0x08 /* Update Transfer Inhibit */
99 uint8_t rtc_sec
; /* seconds */
100 uint8_t rtc_asec
; /* alarm seconds */
101 uint8_t rtc_min
; /* mins */
102 uint8_t rtc_amin
; /* alarm mins */
103 uint8_t rtc_hrs
; /* hours */
104 uint8_t rtc_ahrs
; /* alarm hours */
105 uint8_t rtc_dom
; /* day of the month */
106 uint8_t rtc_adom
; /* alarm day of the month */
107 uint8_t rtc_dow
; /* day of the week */
108 uint8_t rtc_mon
; /* month */
109 uint8_t rtc_year
; /* year */
110 uint8_t rtc_rates
; /* rates */
111 uint8_t rtc_enables
; /* enables */
112 uint8_t rtc_flags
; /* flags */
113 uint8_t rtc_control
; /* control */
114 uint8_t rtc_century
; /* century */
121 #endif /* _TODBQ4802_H */