~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/include/linux/mfd/mt6397/rtc.h

Version: ~ [ linux-6.12-rc7 ] ~ [ linux-6.11.7 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.60 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.116 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.171 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.229 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.285 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.323 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.12 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 /* SPDX-License-Identifier: GPL-2.0 */
  2 /*
  3  * Copyright (C) 2014-2019 MediaTek Inc.
  4  *
  5  * Author: Tianping.Fang <tianping.fang@mediatek.com>
  6  *        Sean Wang <sean.wang@mediatek.com>
  7  */
  8 
  9 #ifndef _LINUX_MFD_MT6397_RTC_H_
 10 #define _LINUX_MFD_MT6397_RTC_H_
 11 
 12 #include <linux/jiffies.h>
 13 #include <linux/mutex.h>
 14 #include <linux/regmap.h>
 15 #include <linux/rtc.h>
 16 
 17 #define RTC_BBPU               0x0000
 18 #define RTC_BBPU_CBUSY         BIT(6)
 19 #define RTC_BBPU_KEY            (0x43 << 8)
 20 
 21 #define RTC_WRTGR_MT6358       0x003a
 22 #define RTC_WRTGR_MT6397       0x003c
 23 #define RTC_WRTGR_MT6323       RTC_WRTGR_MT6397
 24 
 25 #define RTC_IRQ_STA            0x0002
 26 #define RTC_IRQ_STA_AL         BIT(0)
 27 #define RTC_IRQ_STA_LP         BIT(3)
 28 
 29 #define RTC_IRQ_EN             0x0004
 30 #define RTC_IRQ_EN_AL          BIT(0)
 31 #define RTC_IRQ_EN_ONESHOT     BIT(2)
 32 #define RTC_IRQ_EN_LP          BIT(3)
 33 #define RTC_IRQ_EN_ONESHOT_AL  (RTC_IRQ_EN_ONESHOT | RTC_IRQ_EN_AL)
 34 
 35 #define RTC_AL_MASK            0x0008
 36 #define RTC_AL_MASK_DOW                BIT(4)
 37 
 38 #define RTC_TC_SEC             0x000a
 39 #define RTC_TC_MTH_MASK        0x000f
 40 /* Min, Hour, Dom... register offset to RTC_TC_SEC */
 41 #define RTC_OFFSET_SEC         0
 42 #define RTC_OFFSET_MIN         1
 43 #define RTC_OFFSET_HOUR                2
 44 #define RTC_OFFSET_DOM         3
 45 #define RTC_OFFSET_DOW         4
 46 #define RTC_OFFSET_MTH         5
 47 #define RTC_OFFSET_YEAR                6
 48 #define RTC_OFFSET_COUNT       7
 49 
 50 #define RTC_AL_SEC             0x0018
 51 
 52 #define RTC_AL_SEC_MASK        0x003f
 53 #define RTC_AL_MIN_MASK        0x003f
 54 #define RTC_AL_HOU_MASK        0x001f
 55 #define RTC_AL_DOM_MASK        0x001f
 56 #define RTC_AL_DOW_MASK        0x0007
 57 #define RTC_AL_MTH_MASK        0x000f
 58 #define RTC_AL_YEA_MASK        0x007f
 59 
 60 #define RTC_PDN2               0x002e
 61 #define RTC_PDN2_PWRON_ALARM   BIT(4)
 62 
 63 #define RTC_MIN_YEAR           1968
 64 #define RTC_BASE_YEAR          1900
 65 #define RTC_NUM_YEARS          128
 66 #define RTC_MIN_YEAR_OFFSET    (RTC_MIN_YEAR - RTC_BASE_YEAR)
 67 
 68 #define MTK_RTC_POLL_DELAY_US  10
 69 #define MTK_RTC_POLL_TIMEOUT   (jiffies_to_usecs(HZ))
 70 
 71 struct mtk_rtc_data {
 72         u32                     wrtgr;
 73 };
 74 
 75 struct mt6397_rtc {
 76         struct rtc_device       *rtc_dev;
 77 
 78         /* Protect register access from multiple tasks */
 79         struct mutex            lock;
 80         struct regmap           *regmap;
 81         int                     irq;
 82         u32                     addr_base;
 83         const struct mtk_rtc_data *data;
 84 };
 85 
 86 #endif /* _LINUX_MFD_MT6397_RTC_H_ */
 87 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php