Lines Matching +full:start +full:- +full:year

1 // SPDX-License-Identifier: GPL-2.0+
4 * Matthias Fuchs, esd gmbh, matthias.fuchs@esd-electronics.com.
16 /*---------------------------------------------------------------------*/
24 /*---------------------------------------------------------------------*/
63 * sequence (start sequence without a prior stop).
65 * U-Boot's 4xx i2c driver is currently not capable
81 uchar sec, min, hour, mday, wday, mon, year, ctl2; in rtc_get() local
93 year = rtc_read(RTC_YR_REG_ADDR); in rtc_get()
95 DEBUGR ("Get RTC year: %02x mon: %02x mday: %02x wday: %02x " in rtc_get()
97 year, mon, mday, wday, hour, min, sec); in rtc_get()
102 printf("RTC: power-on detected\n"); in rtc_get()
103 rel = -1; in rtc_get()
108 rel = -1; in rtc_get()
113 rel = -1; in rtc_get()
116 tmp->tm_sec = bcd2bin (sec & 0x7F); in rtc_get()
117 tmp->tm_min = bcd2bin (min & 0x7F); in rtc_get()
119 tmp->tm_hour = bcd2bin (hour & 0x3F); in rtc_get()
121 tmp->tm_hour = bcd2bin (hour & 0x1F) % 12 + in rtc_get()
123 tmp->tm_mday = bcd2bin (mday & 0x3F); in rtc_get()
124 tmp->tm_mon = bcd2bin (mon & 0x1F); in rtc_get()
125 tmp->tm_year = bcd2bin (year) + ( bcd2bin (year) >= 70 ? 1900 : 2000); in rtc_get()
126 tmp->tm_wday = bcd2bin (wday & 0x07); in rtc_get()
127 tmp->tm_yday = 0; in rtc_get()
128 tmp->tm_isdst= 0; in rtc_get()
130 DEBUGR ("Get DATE: %4d-%02d-%02d (wday=%d) TIME: %2d:%02d:%02d\n", in rtc_get()
131 tmp->tm_year, tmp->tm_mon, tmp->tm_mday, tmp->tm_wday, in rtc_get()
132 tmp->tm_hour, tmp->tm_min, tmp->tm_sec); in rtc_get()
142 DEBUGR ("Set DATE: %4d-%02d-%02d (wday=%d) TIME: %2d:%02d:%02d\n", in rtc_set()
143 tmp->tm_year, tmp->tm_mon, tmp->tm_mday, tmp->tm_wday, in rtc_set()
144 tmp->tm_hour, tmp->tm_min, tmp->tm_sec); in rtc_set()
146 if (tmp->tm_year < 1970 || tmp->tm_year > 2069) in rtc_set()
147 printf("WARNING: year should be between 1970 and 2069!\n"); in rtc_set()
149 rtc_write (RTC_YR_REG_ADDR, bin2bcd (tmp->tm_year % 100)); in rtc_set()
150 rtc_write (RTC_MON_REG_ADDR, bin2bcd (tmp->tm_mon)); in rtc_set()
151 rtc_write (RTC_DAY_REG_ADDR, bin2bcd (tmp->tm_wday)); in rtc_set()
152 rtc_write (RTC_DATE_REG_ADDR, bin2bcd (tmp->tm_mday)); in rtc_set()
153 rtc_write (RTC_HR_REG_ADDR, bin2bcd (tmp->tm_hour)); in rtc_set()
154 rtc_write (RTC_MIN_REG_ADDR, bin2bcd (tmp->tm_min)); in rtc_set()
155 rtc_write (RTC_SEC_REG_ADDR, bin2bcd (tmp->tm_sec)); in rtc_set()