2018-05-06 21:58:06 +00:00
|
|
|
/* SPDX-License-Identifier: GPL-2.0+ */
|
2015-04-20 18:37:24 +00:00
|
|
|
/*
|
|
|
|
* Simulate an I2C real time clock
|
|
|
|
*
|
|
|
|
* Copyright (c) 2015 Google, Inc
|
|
|
|
* Written by Simon Glass <sjg@chromium.org>
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __asm_rtc_h
|
|
|
|
#define __asm_rtc_h
|
|
|
|
|
2021-03-15 04:25:27 +00:00
|
|
|
#include <dt-structs.h>
|
|
|
|
|
2015-04-20 18:37:24 +00:00
|
|
|
/* Register numbers in the sandbox RTC */
|
|
|
|
enum {
|
|
|
|
REG_SEC = 5,
|
|
|
|
REG_MIN,
|
|
|
|
REG_HOUR,
|
|
|
|
REG_MDAY,
|
|
|
|
REG_MON,
|
|
|
|
REG_YEAR,
|
|
|
|
REG_WDAY,
|
|
|
|
|
|
|
|
REG_RESET = 0x20,
|
|
|
|
|
2020-07-06 20:01:18 +00:00
|
|
|
REG_AUX0 = 0x30,
|
|
|
|
REG_AUX1,
|
|
|
|
REG_AUX2,
|
|
|
|
REG_AUX3,
|
|
|
|
|
2015-04-20 18:37:24 +00:00
|
|
|
REG_COUNT = 0x80,
|
|
|
|
};
|
|
|
|
|
2021-03-15 04:25:27 +00:00
|
|
|
/**
|
|
|
|
* struct sandbox_i2c_rtc_plat_data - platform data for the RTC
|
|
|
|
*
|
|
|
|
* @base_time: Base system time when RTC device was bound
|
|
|
|
* @offset: RTC offset from current system time
|
|
|
|
* @use_system_time: true to use system time, false to use @base_time
|
|
|
|
* @reg: Register values
|
|
|
|
*/
|
|
|
|
struct sandbox_i2c_rtc_plat_data {
|
2023-02-22 16:34:04 +00:00
|
|
|
#if CONFIG_IS_ENABLED(OF_PLATDATA) && IS_ENABLED(CONFIG_RTC_SANDBOX)
|
2021-03-15 04:25:27 +00:00
|
|
|
struct dtd_sandbox_i2c_rtc_emul dtplat;
|
|
|
|
#endif
|
|
|
|
long base_time;
|
|
|
|
long offset;
|
|
|
|
bool use_system_time;
|
|
|
|
u8 reg[REG_COUNT];
|
|
|
|
};
|
|
|
|
|
|
|
|
struct sandbox_i2c_rtc {
|
|
|
|
unsigned int offset_secs;
|
|
|
|
};
|
|
|
|
|
2015-04-20 18:37:24 +00:00
|
|
|
#endif
|