18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-or-later */ 28c2ecf20Sopenharmony_ci#ifndef _ASM_POWERPC_MC146818RTC_H 38c2ecf20Sopenharmony_ci#define _ASM_POWERPC_MC146818RTC_H 48c2ecf20Sopenharmony_ci 58c2ecf20Sopenharmony_ci/* 68c2ecf20Sopenharmony_ci * Machine dependent access functions for RTC registers. 78c2ecf20Sopenharmony_ci */ 88c2ecf20Sopenharmony_ci 98c2ecf20Sopenharmony_ci#ifdef __KERNEL__ 108c2ecf20Sopenharmony_ci 118c2ecf20Sopenharmony_ci#include <asm/io.h> 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 /* __KERNEL__ */ 328c2ecf20Sopenharmony_ci#endif /* _ASM_POWERPC_MC146818RTC_H */ 33