Tom Rini | 83d290c | 2018-05-06 17:58:06 -0400 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0+ */ |
Simon Glass | dd18e5d | 2015-04-20 12:37:24 -0600 | [diff] [blame] | 2 | /* |
| 3 | * Simulate an I2C real time clock |
| 4 | * |
| 5 | * Copyright (c) 2015 Google, Inc |
| 6 | * Written by Simon Glass <sjg@chromium.org> |
Simon Glass | dd18e5d | 2015-04-20 12:37:24 -0600 | [diff] [blame] | 7 | */ |
| 8 | |
| 9 | #ifndef __asm_rtc_h |
| 10 | #define __asm_rtc_h |
| 11 | |
Simon Glass | e62ad9c | 2021-03-15 17:25:27 +1300 | [diff] [blame] | 12 | #include <dt-structs.h> |
| 13 | |
Simon Glass | dd18e5d | 2015-04-20 12:37:24 -0600 | [diff] [blame] | 14 | /* Register numbers in the sandbox RTC */ |
| 15 | enum { |
| 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 Villemoes | baed779 | 2020-07-06 22:01:18 +0200 | [diff] [blame] | 26 | REG_AUX0 = 0x30, |
| 27 | REG_AUX1, |
| 28 | REG_AUX2, |
| 29 | REG_AUX3, |
| 30 | |
Simon Glass | dd18e5d | 2015-04-20 12:37:24 -0600 | [diff] [blame] | 31 | REG_COUNT = 0x80, |
| 32 | }; |
| 33 | |
Simon Glass | e62ad9c | 2021-03-15 17:25:27 +1300 | [diff] [blame] | 34 | /** |
| 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 | */ |
| 42 | struct sandbox_i2c_rtc_plat_data { |
Simon Glass | dd8a290 | 2023-02-22 09:34:04 -0700 | [diff] [blame] | 43 | #if CONFIG_IS_ENABLED(OF_PLATDATA) && IS_ENABLED(CONFIG_RTC_SANDBOX) |
Simon Glass | e62ad9c | 2021-03-15 17:25:27 +1300 | [diff] [blame] | 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 | |
| 52 | struct sandbox_i2c_rtc { |
| 53 | unsigned int offset_secs; |
| 54 | }; |
| 55 | |
Simon Glass | dd18e5d | 2015-04-20 12:37:24 -0600 | [diff] [blame] | 56 | #endif |