1 /* 2 * Private header file for sunxi-rtc driver 3 * 4 * Copyright (C) 2018 Allwinner. 5 * 6 * Martin <wuyan@allwinnertech.com> 7 * 8 * This file is licensed under the terms of the GNU General Public 9 * License version 2. This program is licensed "as is" without any 10 * warranty of any kind, whether express or implied. 11 */ 12 13 #ifndef _RTC_SUNXI_H_ 14 #define _RTC_SUNXI_H_ 15 16 #include <linux/rtc.h> 17 #include <linux/clk.h> 18 #include <linux/reset.h> 19 20 struct sunxi_rtc_data { 21 u32 min_year; /* Minimal real year allowed by hardware. eg: 1970. */ 22 /* For this IP, min_year can be set to any value that >= 1970, */ 23 /* for the valid value of (struct rtc_time).tm_year starts from 70 with an offset 1900. */ 24 /* See rtc_valid_tm() in drivers/rtc/lib.c */ 25 u32 max_year; /* Maximum real year allowed by hardware. Can be caculated by HW_YEAR_MAX(min_year) */ 26 u32 year_mask; /* bit mask of YEAR field */ 27 u32 year_shift; /* bit shift of YEAR field */ 28 u32 leap_shift; /* bit shift of LEAP-YEAR field */ 29 u32 gpr_offset; /* Offset to General-Purpose-Register */ 30 u32 gpr_len; /* Number of General-Purpose-Register */ 31 bool has_dcxo_ictrl; /* Support modifying rtc dcxo current control value and creating dcxo_ictrl sysfs or not */ 32 u32 dcxo_ictrl_val; /* For rtc dcxo current control value when has_dcxo_ictrl = true */ 33 }; 34 35 struct sunxi_rtc_dev { 36 struct rtc_device *rtc; 37 struct device *dev; 38 struct sunxi_rtc_data *data; 39 struct clk *clk; 40 struct clk *clk_bus; 41 struct clk *clk_spi; 42 struct reset_control *reset; 43 void __iomem *base; 44 int irq; 45 }; 46 47 #endif /* end of _RTC_SUNXI_H_ */ 48