^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1) /* SPDX-License-Identifier: GPL-2.0-or-later */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2) #ifndef _ASM_POWERPC_MC146818RTC_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 3) #define _ASM_POWERPC_MC146818RTC_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6) * Machine dependent access functions for RTC registers.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 8)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9) #ifdef __KERNEL__
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) #include <asm/io.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) #ifndef RTC_PORT
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) #define RTC_PORT(x) (0x70 + (x))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) #define RTC_ALWAYS_BCD 1 /* RTC operates in binary mode */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) * The yet supported machines all access the RTC index register via
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) * an ISA port access but the way to access the date register differs ...
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) #define CMOS_READ(addr) ({ \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) outb_p((addr),RTC_PORT(0)); \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) inb_p(RTC_PORT(1)); \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) })
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) #define CMOS_WRITE(val, addr) ({ \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) outb_p((addr),RTC_PORT(0)); \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) outb_p((val),RTC_PORT(1)); \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) })
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) #endif /* __KERNEL__ */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) #endif /* _ASM_POWERPC_MC146818RTC_H */