aboutsummaryrefslogtreecommitdiff
path: root/src/soc/mediatek/mt8173/include
diff options
context:
space:
mode:
authorRan Bi <ran.bi@mediatek.com>2018-10-26 15:18:09 +0800
committerPatrick Georgi <pgeorgi@google.com>2019-02-28 13:42:17 +0000
commit47d46d0a18af3ec140c07b8e3a88dd3fb53c331e (patch)
tree259903faddaa90a65f642da737f45d098fc09cdb /src/soc/mediatek/mt8173/include
parent7bdae06170dffb86676b8f67df91614d8896149a (diff)
mediatek/mt8183: Add RTC support
This patch implements RTC initialization. 1. initialization dcxo 2. rtc clock using dcxo 32k 3. export RTC_32K1V8_0 to SOC, export RTC_32K1V8_1 to WLAN 4. rtc register initialization 5. refactor the driver common part BUG=b:80501386 BRANCH=none TEST=Boots correctly on Kukui Change-Id: Icccb9360a507fcbfd865b107cd3630e71c810d55 Signed-off-by: Ran Bi <ran.bi@mediatek.com> Reviewed-on: https://review.coreboot.org/c/31046 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Julius Werner <jwerner@chromium.org>
Diffstat (limited to 'src/soc/mediatek/mt8173/include')
-rw-r--r--src/soc/mediatek/mt8173/include/soc/rtc.h74
1 files changed, 4 insertions, 70 deletions
diff --git a/src/soc/mediatek/mt8173/include/soc/rtc.h b/src/soc/mediatek/mt8173/include/soc/rtc.h
index dd3546a13c..fe5cbac277 100644
--- a/src/soc/mediatek/mt8173/include/soc/rtc.h
+++ b/src/soc/mediatek/mt8173/include/soc/rtc.h
@@ -16,28 +16,10 @@
#ifndef SOC_MEDIATEK_MT8173_RTC_H
#define SOC_MEDIATEK_MT8173_RTC_H
+#include <soc/rtc_common.h>
#include <stdint.h>
#include "mt6391.h"
-/*
- * Default values for RTC initialization
- * Year (YEA) : 1970 ~ 2037
- * Month (MTH) : 1 ~ 12
- * Day of Month (DOM): 1 ~ 31
- */
-
-enum {
- RTC_DEFAULT_YEA = 2010,
- RTC_DEFAULT_MTH = 1,
- RTC_DEFAULT_DOM = 1,
- RTC_DEFAULT_DOW = 5
-};
-
-enum {
- RTC_2SEC_REBOOT_ENABLE = 1,
- RTC_2SEC_MODE = 2
-};
-
/* RTC registers */
enum {
RTC_BBPU = 0xE000,
@@ -89,16 +71,6 @@ enum {
};
enum {
- RTC_OSC32CON_UNLOCK1 = 0x1A57,
- RTC_OSC32CON_UNLOCK2 = 0x2B68
-};
-
-enum {
- RTC_PROT_UNLOCK1 = 0x586A,
- RTC_PROT_UNLOCK2 = 0x9136
-};
-
-enum {
RTC_BBPU_PWREN = 1U << 0,
RTC_BBPU_BBPU = 1U << 2,
RTC_BBPU_AUTO = 1U << 3,
@@ -110,34 +82,11 @@ enum {
};
enum {
- RTC_BBPU_KEY = 0x43 << 8
-};
-
-enum {
- RTC_IRQ_STA_AL = 1U << 0,
- RTC_IRQ_STA_TC = 1U << 1,
- RTC_IRQ_STA_LP = 1U << 3
-};
-
-enum {
- RTC_IRQ_EN_AL = 1U << 0,
- RTC_IRQ_EN_TC = 1U << 1,
- RTC_IRQ_EN_ONESHOT = 1U << 2,
- RTC_IRQ_EN_LP = 1U << 3,
- RTC_IRQ_EN_ONESHOT_AL = RTC_IRQ_EN_ONESHOT | RTC_IRQ_EN_AL
-};
-
-enum {
RTC_OSC32CON_AMPEN = 1U << 8,
RTC_OSC32CON_LNBUFEN = 1U << 11
};
enum {
- RTC_POWERKEY1_KEY = 0xa357,
- RTC_POWERKEY2_KEY = 0x67d2
-};
-
-enum {
RTC_CON_LPEN = 1U << 2,
RTC_CON_LPRST = 1U << 3,
RTC_CON_CDBO = 1U << 4,
@@ -161,24 +110,9 @@ enum {
RTC_CALI_BBPU_2SEC_STAT = 1U << 11
};
-enum {
- RTC_SPAR0_32K_LESS = 1U << 6
-};
-
-enum {
- RTC_MIN_YEAR = 1968,
- RTC_BASE_YEAR = 1900,
- RTC_MIN_YEAR_OFFSET = RTC_MIN_YEAR - RTC_BASE_YEAR,
-
- RTC_NUM_YEARS = 128
-};
-
-enum {
- RTC_STATE_REBOOT = 0,
- RTC_STATE_RECOVER = 1,
- RTC_STATE_INIT = 2
-};
-
+/* external API */
+void rtc_osc_init(void);
+int rtc_init(u8 recover);
void rtc_boot(void);
#endif /* SOC_MEDIATEK_MT8173_RTC_H */