Lines Matching +full:reset +full:- +full:time +full:- +full:sec

1 // SPDX-License-Identifier: GPL-2.0+
8 * Date & Time support for the MC146818 (PIXX4) RTC
58 reg -= 128; in mc146818_read8()
75 reg -= 128; in mc146818_write8()
84 uchar sec, min, hour, mday, wday __attribute__((unused)),mon, year; in mc146818_get() local
90 sec = mc146818_read8(RTC_SECONDS); in mc146818_get()
98 printf("Get RTC year: %02x mon/cent: %02x mday: %02x wday: %02x hr: %02x min: %02x sec: %02x\n", in mc146818_get()
99 year, mon, mday, wday, hour, min, sec); in mc146818_get()
100 printf("Alarms: mday: %02x hour: %02x min: %02x sec: %02x\n", in mc146818_get()
106 tmp->tm_sec = bcd2bin(sec & 0x7f); in mc146818_get()
107 tmp->tm_min = bcd2bin(min & 0x7f); in mc146818_get()
108 tmp->tm_hour = bcd2bin(hour & 0x3f); in mc146818_get()
109 tmp->tm_mday = bcd2bin(mday & 0x3f); in mc146818_get()
110 tmp->tm_mon = bcd2bin(mon & 0x1f); in mc146818_get()
111 tmp->tm_year = bcd2bin(year); in mc146818_get()
113 if (tmp->tm_year < 70) in mc146818_get()
114 tmp->tm_year += 2000; in mc146818_get()
116 tmp->tm_year += 1900; in mc146818_get()
118 tmp->tm_yday = 0; in mc146818_get()
119 tmp->tm_isdst = 0; in mc146818_get()
121 * The mc146818 only updates wday if it is non-zero, sunday is 1 in mc146818_get()
126 printf("Get DATE: %4d-%02d-%02d (wday=%d) TIME: %2d:%02d:%02d\n", in mc146818_get()
127 tmp->tm_year, tmp->tm_mon, tmp->tm_mday, tmp->tm_wday, in mc146818_get()
128 tmp->tm_hour, tmp->tm_min, tmp->tm_sec); in mc146818_get()
137 printf("Set DATE: %4d-%02d-%02d (wday=%d) TIME: %2d:%02d:%02d\n", in mc146818_set()
138 tmp->tm_year, tmp->tm_mon, tmp->tm_mday, tmp->tm_wday, in mc146818_set()
139 tmp->tm_hour, tmp->tm_min, tmp->tm_sec); in mc146818_set()
144 mc146818_write8(RTC_YEAR, bin2bcd(tmp->tm_year % 100)); in mc146818_set()
145 mc146818_write8(RTC_MONTH, bin2bcd(tmp->tm_mon)); in mc146818_set()
147 mc146818_write8(RTC_DAY_OF_WEEK, bin2bcd(tmp->tm_wday + 1)); in mc146818_set()
148 mc146818_write8(RTC_DATE_OF_MONTH, bin2bcd(tmp->tm_mday)); in mc146818_set()
149 mc146818_write8(RTC_HOURS, bin2bcd(tmp->tm_hour)); in mc146818_set()
150 mc146818_write8(RTC_MINUTES, bin2bcd(tmp->tm_min)); in mc146818_set()
151 mc146818_write8(RTC_SECONDS, bin2bcd(tmp->tm_sec)); in mc146818_set()
186 /* Setup the real time clock */ in mc146818_init()
200 static int rtc_mc146818_get(struct udevice *dev, struct rtc_time *time) in rtc_mc146818_get() argument
202 return mc146818_get(time); in rtc_mc146818_get()
205 static int rtc_mc146818_set(struct udevice *dev, const struct rtc_time *time) in rtc_mc146818_set() argument
207 return mc146818_set((struct rtc_time *)time); in rtc_mc146818_set()
239 .reset = rtc_mc146818_reset,