blob: f95d349c17fb4ca728ab0cc78570a439283d1aec [file] [log] [blame]
Tom Rini83d290c2018-05-06 17:58:06 -04001/* SPDX-License-Identifier: GPL-2.0+ */
wdenk012771d2002-03-08 21:31:05 +00002/*
3 * (C) Copyright 2001 Sysgo Real-Time Solutions, GmbH <www.elinos.com>
4 * Andreas Heppel <aheppel@sysgo.de>
wdenk012771d2002-03-08 21:31:05 +00005 */
6
7/*
8 * Date & Time support for the MK48T59 RTC
9 */
10
11
Jon Loeliger639221c2007-07-09 17:15:49 -050012#if defined(CONFIG_RTC_MK48T59) && defined(CONFIG_CMD_DATE)
wdenk012771d2002-03-08 21:31:05 +000013
Tom Rinic56289d2022-10-28 20:26:57 -040014#define RTC_PORT_ADDR0 0x70
wdenk012771d2002-03-08 21:31:05 +000015#define RTC_PORT_ADDR1 RTC_PORT_ADDR0 + 0x1
Tom Rinic56289d2022-10-28 20:26:57 -040016#define RTC_PORT_DATA 0x76
wdenk012771d2002-03-08 21:31:05 +000017
18/* RTC Offsets */
19#define RTC_SECONDS 0x1FF9
20#define RTC_MINUTES 0x1FFA
21#define RTC_HOURS 0x1FFB
22#define RTC_DAY_OF_WEEK 0x1FFC
23#define RTC_DAY_OF_MONTH 0x1FFD
24#define RTC_MONTH 0x1FFE
25#define RTC_YEAR 0x1FFF
26
27#define RTC_CONTROLA 0x1FF8
28#define RTC_CA_WRITE 0x80
29#define RTC_CA_READ 0x40
30#define RTC_CA_CALIB_SIGN 0x20
31#define RTC_CA_CALIB_MASK 0x1f
32
33#define RTC_CONTROLB 0x1FF9
34#define RTC_CB_STOP 0x80
35
36#define RTC_WATCHDOG 0x1FF7
37#define RTC_WDS 0x80
38#define RTC_WD_RB_16TH 0x0
39#define RTC_WD_RB_4TH 0x1
40#define RTC_WD_RB_1 0x2
41#define RTC_WD_RB_4 0x3
42
43void rtc_set_watchdog(short multi, short res);
44void *nvram_read(void *dest, const short src, size_t count);
45void nvram_write(short dest, const void *src, size_t count);
46
47#endif