blob: bf3ac5ea1ec9f45c69c32513f4cfa7a2225512d9 [file] [log] [blame]
Tom Rini83d290c2018-05-06 17:58:06 -04001/* SPDX-License-Identifier: GPL-2.0+ */
Simon Glassdd18e5d2015-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 Glassdd18e5d2015-04-20 12:37:24 -06007 */
8
9#ifndef __asm_rtc_h
10#define __asm_rtc_h
11
Simon Glasse62ad9c2021-03-15 17:25:27 +130012#include <dt-structs.h>
13
Simon Glassdd18e5d2015-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 Villemoesbaed7792020-07-06 22:01:18 +020026 REG_AUX0 = 0x30,
27 REG_AUX1,
28 REG_AUX2,
29 REG_AUX3,
30
Simon Glassdd18e5d2015-04-20 12:37:24 -060031 REG_COUNT = 0x80,
32};
33
Simon Glasse62ad9c2021-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 {
Simon Glassdd8a2902023-02-22 09:34:04 -070043#if CONFIG_IS_ENABLED(OF_PLATDATA) && IS_ENABLED(CONFIG_RTC_SANDBOX)
Simon Glasse62ad9c2021-03-15 17:25:27 +130044 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 Glassdd18e5d2015-04-20 12:37:24 -060056#endif