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 Rebase awinrtc(4) year from 1970 to 1...
details: https://anonhg.NetBSD.org/src/rev/1116ad1ec4a5
branches: trunk
changeset: 333446:1116ad1ec4a5
user: jakllsch <jakllsch%NetBSD.org@localhost>
date: Tue Nov 04 18:15:11 2014 +0000
description:
Rebase awinrtc(4) year from 1970 to 1900.
Fixes +70 year RTC offset when dual booting with Android on Cubietruck.
Also a trailing whitespace fix.
diffstat:
sys/arch/arm/allwinner/awin_rtc.c | 18 ++++++++++--------
1 files changed, 10 insertions(+), 8 deletions(-)
diffs (71 lines):
diff -r 72f15338dcb2 -r 1116ad1ec4a5 sys/arch/arm/allwinner/awin_rtc.c
--- a/sys/arch/arm/allwinner/awin_rtc.c Tue Nov 04 18:11:42 2014 +0000
+++ b/sys/arch/arm/allwinner/awin_rtc.c Tue Nov 04 18:15:11 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: awin_rtc.c,v 1.4 2014/10/27 10:50:38 jmcneill Exp $ */
+/* $NetBSD: awin_rtc.c,v 1.5 2014/11/04 18:15:11 jakllsch 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.4 2014/10/27 10:50:38 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: awin_rtc.c,v 1.5 2014/11/04 18:15:11 jakllsch Exp $");
#include <sys/param.h>
#include <sys/bus.h>
@@ -41,6 +41,8 @@
#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;
@@ -120,7 +122,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) +
- POSIX_BASE_YEAR;
+ AWIN_RTC_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);
@@ -144,29 +146,29 @@
/*
* Sanity check the date before writing it back
*/
- if (dt->dt_year < POSIX_BASE_YEAR) {
+ if (dt->dt_year < AWIN_RTC_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)
- + POSIX_BASE_YEAR;
+ + AWIN_RTC_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 - POSIX_BASE_YEAR,
+ yymmdd = __SHIFTIN(dt->dt_year - AWIN_RTC_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) +
- POSIX_BASE_YEAR == dt->dt_year);
+ AWIN_RTC_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