0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018 #define RTC_PORT(x) (0x70+(x))
0019 #define RTC_ALWAYS_BCD 0
0020
0021 #include <linux/init.h>
0022 #include <linux/mc146818rtc.h>
0023 #include <linux/bcd.h>
0024 #include <linux/io.h>
0025
0026 #include "common.h"
0027
0028 void __init isa_rtc_init(void)
0029 {
0030 int reg_d, reg_b;
0031
0032
0033
0034
0035 reg_d = CMOS_READ(RTC_REG_D);
0036
0037
0038
0039
0040 CMOS_WRITE(RTC_REF_CLCK_32KHZ, RTC_REG_A);
0041
0042
0043
0044
0045
0046 reg_b = CMOS_READ(RTC_REG_B) & 0x7f;
0047 reg_b |= 2;
0048 CMOS_WRITE(reg_b, RTC_REG_B);
0049
0050 if ((CMOS_READ(RTC_REG_A) & 0x7f) == RTC_REF_CLCK_32KHZ &&
0051 CMOS_READ(RTC_REG_B) == reg_b) {
0052
0053
0054
0055 if ((reg_d & 0x80) == 0)
0056 printk(KERN_WARNING "RTC: *** warning: CMOS battery bad\n");
0057 }
0058 }