1 /* SPDX-License-Identifier: GPL-2.0+ */ 2 /* 3 * Simulate an I2C real time clock 4 * 5 * Copyright (c) 2015 Google, Inc 6 * Written by Simon Glass <sjg@chromium.org> 7 */ 8 9 #ifndef __asm_rtc_h 10 #define __asm_rtc_h 11 12 #include <dt-structs.h> 13 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 26 REG_AUX0 = 0x30, 27 REG_AUX1, 28 REG_AUX2, 29 REG_AUX3, 30 31 REG_COUNT = 0x80, 32 }; 33 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 { 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 52 struct sandbox_i2c_rtc { 53 unsigned int offset_secs; 54 }; 55 56 #endif 57