18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-or-later */
28c2ecf20Sopenharmony_ci/*
38c2ecf20Sopenharmony_ci * RTC definitions for DECstation style attached Dallas DS1287 chip.
48c2ecf20Sopenharmony_ci *
58c2ecf20Sopenharmony_ci * Copyright (C) 1998, 2001 by Ralf Baechle
68c2ecf20Sopenharmony_ci * Copyright (C) 1998 by Harald Koerfgen
78c2ecf20Sopenharmony_ci * Copyright (C) 2002, 2005  Maciej W. Rozycki
88c2ecf20Sopenharmony_ci */
98c2ecf20Sopenharmony_ci#ifndef __ASM_MIPS_DEC_RTC_DEC_H
108c2ecf20Sopenharmony_ci#define __ASM_MIPS_DEC_RTC_DEC_H
118c2ecf20Sopenharmony_ci
128c2ecf20Sopenharmony_ci#include <linux/types.h>
138c2ecf20Sopenharmony_ci#include <asm/addrspace.h>
148c2ecf20Sopenharmony_ci#include <asm/dec/system.h>
158c2ecf20Sopenharmony_ci
168c2ecf20Sopenharmony_ciextern volatile u8 *dec_rtc_base;
178c2ecf20Sopenharmony_ci
188c2ecf20Sopenharmony_ci#define ARCH_RTC_LOCATION
198c2ecf20Sopenharmony_ci
208c2ecf20Sopenharmony_ci#define RTC_PORT(x)	CPHYSADDR((long)dec_rtc_base)
218c2ecf20Sopenharmony_ci#define RTC_IO_EXTENT	dec_kn_slot_size
228c2ecf20Sopenharmony_ci#define RTC_IOMAPPED	0
238c2ecf20Sopenharmony_ci#undef RTC_IRQ
248c2ecf20Sopenharmony_ci
258c2ecf20Sopenharmony_ci#define RTC_DEC_YEAR	0x3f	/* Where we store the real year on DECs.  */
268c2ecf20Sopenharmony_ci
278c2ecf20Sopenharmony_cistatic inline unsigned char CMOS_READ(unsigned long addr)
288c2ecf20Sopenharmony_ci{
298c2ecf20Sopenharmony_ci	return dec_rtc_base[addr * 4];
308c2ecf20Sopenharmony_ci}
318c2ecf20Sopenharmony_ci
328c2ecf20Sopenharmony_cistatic inline void CMOS_WRITE(unsigned char data, unsigned long addr)
338c2ecf20Sopenharmony_ci{
348c2ecf20Sopenharmony_ci	dec_rtc_base[addr * 4] = data;
358c2ecf20Sopenharmony_ci}
368c2ecf20Sopenharmony_ci
378c2ecf20Sopenharmony_ci#define RTC_ALWAYS_BCD	0
388c2ecf20Sopenharmony_ci
398c2ecf20Sopenharmony_ci#endif /* __ASM_MIPS_DEC_RTC_DEC_H */
40