From: <sean.wang@mediatek.com>
To: <robh+dt@kernel.org>, <mark.rutland@arm.com>, <sre@kernel.org>,
<lee.jones@linaro.org>, <a.zummo@towertech.it>,
<alexandre.belloni@free-electrons.com>,
<eddie.huang@mediatek.com>
Cc: <devicetree@vger.kernel.org>, <linux-rtc@vger.kernel.org>,
<linux-pm@vger.kernel.org>, <linux-mediatek@lists.infradead.org>,
<linux-kernel@vger.kernel.org>,
Sean Wang <sean.wang@mediatek.com>
Subject: [PATCH v1 11/16] rtc: mediatek: move the declaration into a globally visible header file
Date: Fri, 23 Mar 2018 17:15:08 +0800 [thread overview]
Message-ID: <53afbe8172fb1afd809ce9ba1afeda924b9ea705.1521794177.git.sean.wang@mediatek.com> (raw)
In-Reply-To: <cover.1521794176.git.sean.wang@mediatek.com>
From: Sean Wang <sean.wang@mediatek.com>
This is in preparation for allowing other drivers can share the
declaration, so move the declaration into a globally visible header file.
Signed-off-by: Sean Wang <sean.wang@mediatek.com>
---
drivers/rtc/rtc-mt6397.c | 53 +---------------------------------
include/linux/rtc/mt6397.h | 72 ++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 73 insertions(+), 52 deletions(-)
create mode 100644 include/linux/rtc/mt6397.h
diff --git a/drivers/rtc/rtc-mt6397.c b/drivers/rtc/rtc-mt6397.c
index d133d1f..015609d 100644
--- a/drivers/rtc/rtc-mt6397.c
+++ b/drivers/rtc/rtc-mt6397.c
@@ -19,63 +19,12 @@
#include <linux/of_platform.h>
#include <linux/regmap.h>
#include <linux/rtc.h>
-#include <linux/jiffies.h>
#include <linux/platform_device.h>
#include <linux/of_address.h>
#include <linux/of_irq.h>
#include <linux/io.h>
#include <linux/mfd/mt6397/core.h>
-
-#define RTC_BBPU 0x0000
-#define RTC_BBPU_CBUSY BIT(6)
-
-#define RTC_WRTGR 0x003c
-
-#define RTC_IRQ_STA 0x0002
-#define RTC_IRQ_STA_AL BIT(0)
-#define RTC_IRQ_STA_LP BIT(3)
-
-#define RTC_IRQ_EN 0x0004
-#define RTC_IRQ_EN_AL BIT(0)
-#define RTC_IRQ_EN_ONESHOT BIT(2)
-#define RTC_IRQ_EN_LP BIT(3)
-#define RTC_IRQ_EN_ONESHOT_AL (RTC_IRQ_EN_ONESHOT | RTC_IRQ_EN_AL)
-
-#define RTC_AL_MASK 0x0008
-#define RTC_AL_MASK_DOW BIT(4)
-
-#define RTC_TC_SEC 0x000a
-/* Min, Hour, Dom... register offset to RTC_TC_SEC */
-#define RTC_OFFSET_SEC 0
-#define RTC_OFFSET_MIN 1
-#define RTC_OFFSET_HOUR 2
-#define RTC_OFFSET_DOM 3
-#define RTC_OFFSET_DOW 4
-#define RTC_OFFSET_MTH 5
-#define RTC_OFFSET_YEAR 6
-#define RTC_OFFSET_COUNT 7
-
-#define RTC_AL_SEC 0x0018
-
-#define RTC_PDN2 0x002e
-#define RTC_PDN2_PWRON_ALARM BIT(4)
-
-#define RTC_MIN_YEAR 1968
-#define RTC_BASE_YEAR 1900
-#define RTC_NUM_YEARS 128
-#define RTC_MIN_YEAR_OFFSET (RTC_MIN_YEAR - RTC_BASE_YEAR)
-
-#define MTK_RTC_POLL_DELAY_US 10
-#define MTK_RTC_POLL_TIMEOUT (jiffies_to_usecs(HZ))
-
-struct mt6397_rtc {
- struct device *dev;
- struct rtc_device *rtc_dev;
- struct mutex lock;
- struct regmap *regmap;
- int irq;
- u32 addr_base;
-};
+#include <linux/rtc/mt6397.h>
static int mtk_rtc_write_trigger(struct mt6397_rtc *rtc)
{
diff --git a/include/linux/rtc/mt6397.h b/include/linux/rtc/mt6397.h
new file mode 100644
index 0000000..4b19f51
--- /dev/null
+++ b/include/linux/rtc/mt6397.h
@@ -0,0 +1,72 @@
+
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Copyright (C) 2014-2018 MediaTek Inc.
+ *
+ * Author: Tianping.Fang <tianping.fang@mediatek.com>
+ * Sean Wang <sean.wang@mediatek.com>
+ */
+
+#ifndef _LINUX_RTC_MT6397_H_
+#define _LINUX_RTC_MT6397_H_
+
+#include <linux/jiffies.h>
+#include <linux/mutex.h>
+#include <linux/regmap.h>
+#include <linux/rtc.h>
+
+#define RTC_BBPU 0x0000
+#define RTC_BBPU_CBUSY BIT(6)
+
+#define RTC_WRTGR 0x003c
+
+#define RTC_IRQ_STA 0x0002
+#define RTC_IRQ_STA_AL BIT(0)
+#define RTC_IRQ_STA_LP BIT(3)
+
+#define RTC_IRQ_EN 0x0004
+#define RTC_IRQ_EN_AL BIT(0)
+#define RTC_IRQ_EN_ONESHOT BIT(2)
+#define RTC_IRQ_EN_LP BIT(3)
+#define RTC_IRQ_EN_ONESHOT_AL (RTC_IRQ_EN_ONESHOT | RTC_IRQ_EN_AL)
+
+#define RTC_AL_MASK 0x0008
+#define RTC_AL_MASK_DOW BIT(4)
+
+#define RTC_TC_SEC 0x000a
+/* Min, Hour, Dom... register offset to RTC_TC_SEC */
+#define RTC_OFFSET_SEC 0
+#define RTC_OFFSET_MIN 1
+#define RTC_OFFSET_HOUR 2
+#define RTC_OFFSET_DOM 3
+#define RTC_OFFSET_DOW 4
+#define RTC_OFFSET_MTH 5
+#define RTC_OFFSET_YEAR 6
+#define RTC_OFFSET_COUNT 7
+
+#define RTC_AL_SEC 0x0018
+
+#define RTC_PDN2 0x002e
+#define RTC_PDN2_PWRON_ALARM BIT(4)
+
+#define RTC_MIN_YEAR 1968
+#define RTC_BASE_YEAR 1900
+#define RTC_NUM_YEARS 128
+#define RTC_MIN_YEAR_OFFSET (RTC_MIN_YEAR - RTC_BASE_YEAR)
+
+#define MTK_RTC_POLL_DELAY_US 10
+#define MTK_RTC_POLL_TIMEOUT (jiffies_to_usecs(HZ))
+
+struct mt6397_rtc {
+ struct device *dev;
+ struct rtc_device *rtc_dev;
+
+ /* protect registers accessing */
+ struct mutex lock;
+ struct regmap *regmap;
+ int irq;
+ u32 addr_base;
+};
+
+#endif /* _LINUX_RTC_MT6397_H_ */
+
--
2.7.4
next prev parent reply other threads:[~2018-03-23 9:17 UTC|newest]
Thread overview: 46+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-03-23 9:14 [PATCH v1 00/16] Add support to MT6323 RTC and its power device sean.wang
2018-03-23 9:14 ` [PATCH v1 01/16] dt-bindings: power: reset: mediatek: add bindings for " sean.wang
2018-03-26 22:24 ` Rob Herring
2018-03-27 3:21 ` Sean Wang
2018-03-23 9:14 ` [PATCH v1 02/16] dt-bindings: rtc: mediatek: add bindings for PMIC RTC sean.wang
2018-03-23 9:41 ` Alexandre Belloni
2018-03-23 10:15 ` Alexandre Belloni
2018-03-24 19:36 ` Sean Wang
2018-03-27 15:18 ` Alexandre Belloni
2018-03-28 3:53 ` Sean Wang
2018-03-28 9:19 ` Alexandre Belloni
2018-03-23 9:15 ` [PATCH v1 03/16] dt-bindings: mfd: mediatek: add a description for MT6323 RTC sean.wang
2018-03-26 22:24 ` Rob Herring
2018-03-28 11:13 ` Lee Jones
2018-03-23 9:15 ` [PATCH v1 04/16] mfd: mt6397: add MT6323 RTC support into MT6397 driver sean.wang
2018-03-28 11:15 ` Lee Jones
2018-03-23 9:15 ` [PATCH v1 05/16] rtc: mediatek: add MT6323 support to RTC driver sean.wang
2018-03-23 10:01 ` Alexandre Belloni
2018-03-24 7:06 ` Sean Wang
2018-03-23 9:15 ` [PATCH v1 06/16] rtc: mediatek: remove unnecessary parentheses sean.wang
2018-03-23 10:21 ` Alexandre Belloni
2018-03-24 7:14 ` Sean Wang
2018-03-24 18:53 ` Alexandre Belloni
2018-03-24 19:21 ` Sean Wang
2018-03-23 9:15 ` [PATCH v1 07/16] rtc: mediatek: replace a poll with regmap_read_poll_timeout sean.wang
2018-03-23 9:15 ` [PATCH v1 08/16] rtc: mediatek: remove unnecessary irq_dispose_mapping sean.wang
2018-03-23 10:38 ` Alexandre Belloni
2018-03-26 2:22 ` Sean Wang
2018-03-23 9:15 ` [PATCH v1 09/16] rtc: mediatek: convert to use device managed functions sean.wang
2018-03-23 10:50 ` Alexandre Belloni
2018-03-26 4:07 ` Sean Wang
2018-03-27 15:07 ` Alexandre Belloni
2018-03-23 9:15 ` [PATCH v1 10/16] rtc: mediatek: add devm_of_platform_populate sean.wang
2018-03-23 9:15 ` sean.wang [this message]
2018-03-23 9:57 ` [PATCH v1 11/16] rtc: mediatek: move the declaration into a globally visible header file Alexandre Belloni
2018-03-24 7:31 ` Sean Wang
2018-03-24 18:54 ` Alexandre Belloni
2018-03-24 20:00 ` Fabio Estevam
2018-03-25 3:13 ` Sean Wang
2018-03-23 9:15 ` [PATCH v1 12/16] rtc: mediatek: cleanup header files to include sean.wang
2018-03-25 4:17 ` kbuild test robot
2018-03-25 5:21 ` kbuild test robot
2018-03-23 9:15 ` [PATCH v1 13/16] rtc: mediatek: update license converting to using SPDX identifiers sean.wang
2018-03-23 9:15 ` [PATCH v1 14/16] power: reset: mediatek: add a power-off driver using PMIC RTC device sean.wang
2018-03-23 9:15 ` [PATCH v1 15/16] MAINTAINERS: update entry for ARM/Mediatek RTC DRIVER sean.wang
2018-03-23 9:15 ` [PATCH v1 16/16] MAINTAINERS: add an entry for MediaTek board level shutdown driver sean.wang
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=53afbe8172fb1afd809ce9ba1afeda924b9ea705.1521794177.git.sean.wang@mediatek.com \
--to=sean.wang@mediatek.com \
--cc=a.zummo@towertech.it \
--cc=alexandre.belloni@free-electrons.com \
--cc=devicetree@vger.kernel.org \
--cc=eddie.huang@mediatek.com \
--cc=lee.jones@linaro.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mediatek@lists.infradead.org \
--cc=linux-pm@vger.kernel.org \
--cc=linux-rtc@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=robh+dt@kernel.org \
--cc=sre@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).