Path: blob/master/arch/arm/mach-footbridge/isa-rtc.c
10817 views
/*1* arch/arm/mach-footbridge/isa-rtc.c2*3* Copyright (C) 1998 Russell King.4* Copyright (C) 1998 Phil Blundell5*6* CATS has a real-time clock, though the evaluation board doesn't.7*8* Changelog:9* 21-Mar-1998 RMK Created10* 27-Aug-1998 PJB CATS support11* 28-Dec-1998 APH Made leds optional12* 20-Jan-1999 RMK Started merge of EBSA285, CATS and NetWinder13* 16-Mar-1999 RMK More support for EBSA285-like machines with RTCs in14*/1516#define RTC_PORT(x) (0x70+(x))17#define RTC_ALWAYS_BCD 01819#include <linux/init.h>20#include <linux/mc146818rtc.h>21#include <linux/bcd.h>22#include <linux/io.h>2324#include "common.h"2526void __init isa_rtc_init(void)27{28int reg_d, reg_b;2930/*31* Probe for the RTC.32*/33reg_d = CMOS_READ(RTC_REG_D);3435/*36* make sure the divider is set37*/38CMOS_WRITE(RTC_REF_CLCK_32KHZ, RTC_REG_A);3940/*41* Set control reg B42* (24 hour mode, update enabled)43*/44reg_b = CMOS_READ(RTC_REG_B) & 0x7f;45reg_b |= 2;46CMOS_WRITE(reg_b, RTC_REG_B);4748if ((CMOS_READ(RTC_REG_A) & 0x7f) == RTC_REF_CLCK_32KHZ &&49CMOS_READ(RTC_REG_B) == reg_b) {50/*51* We have a RTC. Check the battery52*/53if ((reg_d & 0x80) == 0)54printk(KERN_WARNING "RTC: *** warning: CMOS battery bad\n");55}56}575859