ae7ce6b1e0
Drivers for the mc146818 RTC generally check control registers to determine whether a value is encoded as binary or as a binary coded decimal. Setting RTC_ALWAYS_BCD to 1 effectively bypasses these checks and causes drivers to always expect binary coded decimal values, regardless of control register values. This does not seem like a sane default - defaulting to 0 allows the drivers to check control registers to determine encoding type & allows the driver to work generically with both binary & BCD encodings. Set this in mach-generic/mc146818rtc.h such that the generic kernel, or platforms which don't provide a custom mc146818rtc.h, can have an RTC driver which works with both encodings. Signed-off-by: Paul Burton <paul.burton@imgtec.com> Cc: linux-mips@linux-mips.org Patchwork: https://patchwork.linux-mips.org/patch/16185/ Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
37 lines
882 B
C
37 lines
882 B
C
/*
|
|
* This file is subject to the terms and conditions of the GNU General Public
|
|
* License. See the file "COPYING" in the main directory of this archive
|
|
* for more details.
|
|
*
|
|
* Copyright (C) 1998, 2001, 03 by Ralf Baechle
|
|
*
|
|
* RTC routines for PC style attached Dallas chip.
|
|
*/
|
|
#ifndef __ASM_MACH_GENERIC_MC146818RTC_H
|
|
#define __ASM_MACH_GENERIC_MC146818RTC_H
|
|
|
|
#include <asm/io.h>
|
|
|
|
#define RTC_PORT(x) (0x70 + (x))
|
|
#define RTC_IRQ 8
|
|
|
|
static inline unsigned char CMOS_READ(unsigned long addr)
|
|
{
|
|
outb_p(addr, RTC_PORT(0));
|
|
return inb_p(RTC_PORT(1));
|
|
}
|
|
|
|
static inline void CMOS_WRITE(unsigned char data, unsigned long addr)
|
|
{
|
|
outb_p(addr, RTC_PORT(0));
|
|
outb_p(data, RTC_PORT(1));
|
|
}
|
|
|
|
#define RTC_ALWAYS_BCD 0
|
|
|
|
#ifndef mc146818_decode_year
|
|
#define mc146818_decode_year(year) ((year) < 70 ? (year) + 2000 : (year) + 1900)
|
|
#endif
|
|
|
|
#endif /* __ASM_MACH_GENERIC_MC146818RTC_H */
|