Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/arm/allwinner RTC base year cannot be 1900 on A31 b...
details: https://anonhg.NetBSD.org/src/rev/0a999513b817
branches: trunk
changeset: 803590:0a999513b817
user: jmcneill <jmcneill%NetBSD.org@localhost>
date: Tue Nov 04 19:22:50 2014 +0000
description:
RTC base year cannot be 1900 on A31 because the year field is only 6 bits wide; undo r1.5
diffstat:
sys/arch/arm/allwinner/awin_rtc.c | 18 ++++++++----------
1 files changed, 8 insertions(+), 10 deletions(-)
diffs (71 lines):
diff -r f06a354a9c54 -r 0a999513b817 sys/arch/arm/allwinner/awin_rtc.c
--- a/sys/arch/arm/allwinner/awin_rtc.c Tue Nov 04 19:05:17 2014 +0000
+++ b/sys/arch/arm/allwinner/awin_rtc.c Tue Nov 04 19:22:50 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: awin_rtc.c,v 1.5 2014/11/04 18:15:11 jakllsch Exp $ */
+/* $NetBSD: awin_rtc.c,v 1.6 2014/11/04 19:22:50 jmcneill Exp $ */
/*-
* Copyright (c) 2014 Jared D. McNeill <jmcneill%invisible.ca@localhost>
@@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: awin_rtc.c,v 1.5 2014/11/04 18:15:11 jakllsch Exp $");
+__KERNEL_RCSID(0, "$NetBSD: awin_rtc.c,v 1.6 2014/11/04 19:22:50 jmcneill Exp $");
#include <sys/param.h>
#include <sys/bus.h>
@@ -41,8 +41,6 @@
#include <dev/clock_subr.h>
-#define AWIN_RTC_BASE_YEAR 1900
-
struct awin_rtc_softc {
device_t sc_dev;
bus_space_tag_t sc_bst;
@@ -122,7 +120,7 @@
dt->dt_year = __SHIFTOUT(yymmdd,
awin_chip_id() == AWIN_CHIP_ID_A31 ?
AWIN_A31_RTC_YY_MM_DD_YEAR : AWIN_RTC_YY_MM_DD_YEAR) +
- AWIN_RTC_BASE_YEAR;
+ POSIX_BASE_YEAR;
dt->dt_mon = __SHIFTOUT(yymmdd, AWIN_RTC_YY_MM_DD_MONTH);
dt->dt_day = __SHIFTOUT(yymmdd, AWIN_RTC_YY_MM_DD_DAY);
dt->dt_wday = __SHIFTOUT(hhmmss, AWIN_RTC_HH_MM_SS_WK_NO);
@@ -146,29 +144,29 @@
/*
* Sanity check the date before writing it back
*/
- if (dt->dt_year < AWIN_RTC_BASE_YEAR) {
+ if (dt->dt_year < POSIX_BASE_YEAR) {
aprint_normal_dev(sc->sc_dev, "year pre the epoch: %llu, "
"not writing back time\n", dt->dt_year);
return EIO;
}
- maxyear = __SHIFTOUT(0xffffffff,
+ maxyear = __SHIFTOUT(0xffffffff,
awin_chip_id() == AWIN_CHIP_ID_A31 ?
AWIN_A31_RTC_YY_MM_DD_YEAR : AWIN_RTC_YY_MM_DD_YEAR)
- + AWIN_RTC_BASE_YEAR;
+ + POSIX_BASE_YEAR;
if (dt->dt_year > maxyear) {
aprint_normal_dev(sc->sc_dev, "year exceeds available field:"
" %llu, not writing back time\n", dt->dt_year);
return EIO;
}
- yymmdd = __SHIFTIN(dt->dt_year - AWIN_RTC_BASE_YEAR,
+ yymmdd = __SHIFTIN(dt->dt_year - POSIX_BASE_YEAR,
awin_chip_id() == AWIN_CHIP_ID_A31 ?
AWIN_A31_RTC_YY_MM_DD_YEAR : AWIN_RTC_YY_MM_DD_YEAR);
KASSERT(__SHIFTOUT(yymmdd,
awin_chip_id() == AWIN_CHIP_ID_A31 ?
AWIN_A31_RTC_YY_MM_DD_YEAR : AWIN_RTC_YY_MM_DD_YEAR) +
- AWIN_RTC_BASE_YEAR == dt->dt_year);
+ POSIX_BASE_YEAR == dt->dt_year);
yymmdd |= __SHIFTIN(dt->dt_mon, AWIN_RTC_YY_MM_DD_MONTH);
yymmdd |= __SHIFTIN(dt->dt_day, AWIN_RTC_YY_MM_DD_DAY);
Home |
Main Index |
Thread Index |
Old Index