summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJayesh Choudhary <j-choudhary@ti.com>2024-02-15 12:41:10 +0530
committerFrancesco Dolcini <francesco.dolcini@toradex.com>2024-03-21 14:26:33 +0000
commit80e2f753c44c637047defba894df66effbf0172e (patch)
tree5beb62a213bd38aa72a707d24d1b59e94f142ff6
parent80e8be40a94579abe02bcf480e5bc0dcb5963a43 (diff)
board: ti: common: Add header file for rtc
Add the header file for rtc with the macros and declarations to avoid including '.c' file in the platform evm.c files. Signed-off-by: Jayesh Choudhary <j-choudhary@ti.com>
-rw-r--r--board/ti/common/Makefile1
-rw-r--r--board/ti/common/rtc.c7
-rw-r--r--board/ti/common/rtc.h27
3 files changed, 29 insertions, 6 deletions
diff --git a/board/ti/common/Makefile b/board/ti/common/Makefile
index 1c1a6a237c..46e38aaad9 100644
--- a/board/ti/common/Makefile
+++ b/board/ti/common/Makefile
@@ -5,3 +5,4 @@ obj-${CONFIG_TI_I2C_BOARD_DETECT} += board_detect.o
obj-${CONFIG_CMD_EXTENSION} += cape_detect.o
obj-$(CONFIG_SET_DFU_ALT_INFO) += k3_dfu.o
obj-${CONFIG_ARCH_K3} += k3-ddr-init.o
+obj-${CONFIG_BOARD_HAS_32K_RTC_CRYSTAL} += rtc.o
diff --git a/board/ti/common/rtc.c b/board/ti/common/rtc.c
index e117a92776..65c1f75c89 100644
--- a/board/ti/common/rtc.c
+++ b/board/ti/common/rtc.c
@@ -8,12 +8,7 @@
#include <asm/io.h>
#include <log.h>
-#define WKUP_CTRLMMR_DBOUNCE_CFG1 0x04504084
-#define WKUP_CTRLMMR_DBOUNCE_CFG2 0x04504088
-#define WKUP_CTRLMMR_DBOUNCE_CFG3 0x0450408c
-#define WKUP_CTRLMMR_DBOUNCE_CFG4 0x04504090
-#define WKUP_CTRLMMR_DBOUNCE_CFG5 0x04504094
-#define WKUP_CTRLMMR_DBOUNCE_CFG6 0x04504098
+#include "rtc.h"
void board_rtc_init(void)
{
diff --git a/board/ti/common/rtc.h b/board/ti/common/rtc.h
new file mode 100644
index 0000000000..57737829b6
--- /dev/null
+++ b/board/ti/common/rtc.h
@@ -0,0 +1,27 @@
+/* SPDX-License-Identifier: GPL-2.0+ */
+/*
+ * RTC setup include file for TI Platforms
+ *
+ * Copyright (C) 2024 Texas Instruments Incorporated - https://www.ti.com/
+ */
+
+#ifndef __RTC_H
+#define __RTC_H
+
+/* Debounce configuration register*/
+#define WKUP_CTRLMMR_DBOUNCE_CFG1 0x04504084
+#define WKUP_CTRLMMR_DBOUNCE_CFG2 0x04504088
+#define WKUP_CTRLMMR_DBOUNCE_CFG3 0x0450408c
+#define WKUP_CTRLMMR_DBOUNCE_CFG4 0x04504090
+#define WKUP_CTRLMMR_DBOUNCE_CFG5 0x04504094
+#define WKUP_CTRLMMR_DBOUNCE_CFG6 0x04504098
+
+/**
+ * board_rtc_init() - Enable the external 32k crystal and configure debounce
+ * registers.
+ * This function enables the 32k crystal, add required TRIM settings for the
+ * crystals and add debounce configuration.
+ */
+void board_rtc_init(void);
+
+#endif /* __RTC_H */