18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */
28c2ecf20Sopenharmony_ci/*
38c2ecf20Sopenharmony_ci * Machine dependent access functions for RTC registers.
48c2ecf20Sopenharmony_ci */
58c2ecf20Sopenharmony_ci#ifndef _ASM_MC146818RTC_H
68c2ecf20Sopenharmony_ci#define _ASM_MC146818RTC_H
78c2ecf20Sopenharmony_ci
88c2ecf20Sopenharmony_ci#include <linux/io.h>
98c2ecf20Sopenharmony_ci#include <linux/kernel.h>
108c2ecf20Sopenharmony_ci
118c2ecf20Sopenharmony_ci#define RTC_IRQ BUILD_BUG_ON(1)
128c2ecf20Sopenharmony_ci
138c2ecf20Sopenharmony_ci#ifndef RTC_PORT
148c2ecf20Sopenharmony_ci#define RTC_PORT(x)	(0x70 + (x))
158c2ecf20Sopenharmony_ci#define RTC_ALWAYS_BCD	1	/* RTC operates in binary mode */
168c2ecf20Sopenharmony_ci#endif
178c2ecf20Sopenharmony_ci
188c2ecf20Sopenharmony_ci/*
198c2ecf20Sopenharmony_ci * The yet supported machines all access the RTC index register via
208c2ecf20Sopenharmony_ci * an ISA port access but the way to access the date register differs ...
218c2ecf20Sopenharmony_ci */
228c2ecf20Sopenharmony_ci#define CMOS_READ(addr) ({ \
238c2ecf20Sopenharmony_cioutb_p((addr),RTC_PORT(0)); \
248c2ecf20Sopenharmony_ciinb_p(RTC_PORT(1)); \
258c2ecf20Sopenharmony_ci})
268c2ecf20Sopenharmony_ci#define CMOS_WRITE(val, addr) ({ \
278c2ecf20Sopenharmony_cioutb_p((addr),RTC_PORT(0)); \
288c2ecf20Sopenharmony_cioutb_p((val),RTC_PORT(1)); \
298c2ecf20Sopenharmony_ci})
308c2ecf20Sopenharmony_ci
318c2ecf20Sopenharmony_ci#endif /* _ASM_MC146818RTC_H */
32