Lines Matching +full:real +full:- +full:time

1 // SPDX-License-Identifier: GPL-2.0
3 * Real Time Clock interface for Linux on the BVME6000
48 case RTC_RD_TIME: /* Read the time/date from RTC */ in rtc_ioctl()
51 /* Ensure clock and real-time-mode-register are accessible */ in rtc_ioctl()
52 msr = rtc->msr & 0xc0; in rtc_ioctl()
53 rtc->msr = 0x40; in rtc_ioctl()
56 wtime.tm_sec = bcd2bin(rtc->bcd_sec); in rtc_ioctl()
57 wtime.tm_min = bcd2bin(rtc->bcd_min); in rtc_ioctl()
58 wtime.tm_hour = bcd2bin(rtc->bcd_hr); in rtc_ioctl()
59 wtime.tm_mday = bcd2bin(rtc->bcd_dom); in rtc_ioctl()
60 wtime.tm_mon = bcd2bin(rtc->bcd_mth)-1; in rtc_ioctl()
61 wtime.tm_year = bcd2bin(rtc->bcd_year); in rtc_ioctl()
64 wtime.tm_wday = bcd2bin(rtc->bcd_dow)-1; in rtc_ioctl()
65 } while (wtime.tm_sec != bcd2bin(rtc->bcd_sec)); in rtc_ioctl()
66 rtc->msr = msr; in rtc_ioctl()
69 -EFAULT : 0; in rtc_ioctl()
78 return -EACCES; in rtc_ioctl()
81 return -EFAULT; in rtc_ioctl()
95 return -EINVAL; in rtc_ioctl()
98 return -EINVAL; in rtc_ioctl()
101 return -EINVAL; in rtc_ioctl()
104 return -EINVAL; in rtc_ioctl()
107 /* Ensure clock and real-time-mode-register are accessible */ in rtc_ioctl()
108 msr = rtc->msr & 0xc0; in rtc_ioctl()
109 rtc->msr = 0x40; in rtc_ioctl()
111 rtc->t0cr_rtmr = yrs%4; in rtc_ioctl()
112 rtc->bcd_tenms = 0; in rtc_ioctl()
113 rtc->bcd_sec = bin2bcd(sec); in rtc_ioctl()
114 rtc->bcd_min = bin2bcd(min); in rtc_ioctl()
115 rtc->bcd_hr = bin2bcd(hrs); in rtc_ioctl()
116 rtc->bcd_dom = bin2bcd(day); in rtc_ioctl()
117 rtc->bcd_mth = bin2bcd(mon); in rtc_ioctl()
118 rtc->bcd_year = bin2bcd(yrs%100); in rtc_ioctl()
120 rtc->bcd_dow = bin2bcd(rtc_tm.tm_wday+1); in rtc_ioctl()
121 rtc->t0cr_rtmr = yrs%4 | 0x08; in rtc_ioctl()
123 rtc->msr = msr; in rtc_ioctl()
128 return -EINVAL; in rtc_ioctl()
133 * We enforce only one user at a time here with the open/close.
139 return -EBUSY; in rtc_open()
170 return -ENODEV; in rtc_DP8570A_init()
172 pr_info("DP8570A Real Time Clock Driver v%s\n", RTC_VERSION); in rtc_DP8570A_init()