blob: 025cd6c67cf02e7a345260f771c5d2f61184468a [file] [log] [blame]
Tom Rini10e47792018-05-06 17:58:06 -04001/* SPDX-License-Identifier: GPL-2.0+ */
Simon Glassc404aa62015-04-20 12:37:24 -06002/*
3 * Simulate an I2C real time clock
4 *
5 * Copyright (c) 2015 Google, Inc
6 * Written by Simon Glass <sjg@chromium.org>
Simon Glassc404aa62015-04-20 12:37:24 -06007 */
8
9#ifndef __asm_rtc_h
10#define __asm_rtc_h
11
Simon Glass3ee1d392021-03-15 17:25:27 +130012#include <dt-structs.h>
13
Simon Glassc404aa62015-04-20 12:37:24 -060014/* Register numbers in the sandbox RTC */
15enum {
16 REG_SEC = 5,
17 REG_MIN,
18 REG_HOUR,
19 REG_MDAY,
20 REG_MON,
21 REG_YEAR,
22 REG_WDAY,
23
24 REG_RESET = 0x20,
25
Rasmus Villemoes034b93b2020-07-06 22:01:18 +020026 REG_AUX0 = 0x30,
27 REG_AUX1,
28 REG_AUX2,
29 REG_AUX3,
30
Simon Glassc404aa62015-04-20 12:37:24 -060031 REG_COUNT = 0x80,
32};
33
Simon Glass3ee1d392021-03-15 17:25:27 +130034/**
35 * struct sandbox_i2c_rtc_plat_data - platform data for the RTC
36 *
37 * @base_time: Base system time when RTC device was bound
38 * @offset: RTC offset from current system time
39 * @use_system_time: true to use system time, false to use @base_time
40 * @reg: Register values
41 */
42struct sandbox_i2c_rtc_plat_data {
43#if CONFIG_IS_ENABLED(OF_PLATDATA)
44 struct dtd_sandbox_i2c_rtc_emul dtplat;
45#endif
46 long base_time;
47 long offset;
48 bool use_system_time;
49 u8 reg[REG_COUNT];
50};
51
52struct sandbox_i2c_rtc {
53 unsigned int offset_secs;
54};
55
Simon Glassc404aa62015-04-20 12:37:24 -060056#endif