Skip to contentSkip to conversation

Add Support for MediaTek MT2712 RTC

PATCH Applied Ran Bi 3 participants 7 messages Feb 26, 2020 – Mar 15, 2020

Subsystems (4)
lore
Share & tools
lore

Ran Bi

author
#0 lore raw

v3 cover Add Support for MediaTek MT2712 RTC

This patchset add support to MT2712 RTC. MT2712 RTC is a SoC based RTC with different architecture compared to MT7622 RTC.

Changes in V3:
1. change struct mt2712_rtc
2. use 100 as year offset
3. change irq handle thread
4. remove useless rtc time check
5. not modify struct rtc_time in set_time/set_alarm functions
6. modify rtc init function
7. add power lost flag for get_time/set_time functions
8. add .alarm_irq_enable callback
9. set rtc->range_min and rtc->range_max to do range checking
10. use fixed driver name

Changes in V2:
1. change minimum year from 1968 to 2000
2. fix lock usage
3. stop to calculate useless day of week
4. stop to set default date after init
5. change the prefix of functions
6. use devm_request_threaded_irq() to replace request_threaded_irq()
7. add mt2712 rtc related files into MAINTAINERS

Ran Bi (4):
bindings: rtc: add bindings for MT2712 RTC
rtc: add support for the MediaTek MT2712 RTC
arm64: dts: add RTC nodes for MT2712
MAINTAINERS: add MT2712 RTC files

 .../devicetree/bindings/rtc/rtc-mt2712.txt    |  14 +
 MAINTAINERS                                   |   2 +
 arch/arm64/boot/dts/mediatek/mt2712e.dtsi     |   6 +
 drivers/rtc/Kconfig                           |  10 +
 drivers/rtc/Makefile                          |   1 +
 drivers/rtc/rtc-mt2712.c                      | 422 ++++++++++++++++++
 6 files changed, 455 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/rtc/rtc-mt2712.txt
 create mode 100644 drivers/rtc/rtc-mt2712.c
Signature · 1 line
2.25.0
author
#1 lore raw

PATCH v3 1/4 bindings: rtc: add bindings for MT2712 RTC

Document the binding for MT2712 RTC implemented by rtc-mt2712.

---
 .../devicetree/bindings/rtc/rtc-mt2712.txt         | 14 ++++++++++++++
 1 file changed, 14 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/rtc/rtc-mt2712.txt
Documentation/devicetree/bindings/rtc/rtc-mt2712.txt new file +14 -0
new file mode 100644
index 000000000000..c33d87e5e753
@@ -0,0 +1,14 @@
+Device-Tree bindings for MediaTek SoC based RTC
+
+Required properties:
+- compatible	    : Should be "mediatek,mt2712-rtc" : for MT2712 SoC
+- reg 		    : Specifies base physical address and size of the registers;
+- interrupts	    : Should contain the interrupt for RTC alarm;
+
+Example:
+
+rtc: rtc@10011000 {
+	compatible = "mediatek,mt2712-rtc";
+	reg = <0 0x10011000 0 0x1000>;
+	interrupts = <GIC_SPI 239 IRQ_TYPE_LEVEL_LOW>;
+};
Signature · 1 line
2.25.0
author
#2 lore raw

PATCH v3 2/4 rtc: add support for the MediaTek MT2712 RTC

In reply to Ran Bi

This add support for the MediaTek MT2712 RTC. It was SoC based RTC, but had different architecture compared with MT7622 RTC.

---
 drivers/rtc/Kconfig      |  10 +
 drivers/rtc/Makefile     |   1 +
 drivers/rtc/rtc-mt2712.c | 422 +++++++++++++++++++++++++++++++++++++++
 3 files changed, 433 insertions(+)
 create mode 100644 drivers/rtc/rtc-mt2712.c
drivers/rtc/Kconfig +10 -0
index 34c8b6c7e095..685fb00bfda1 100644
@@ -1806,6 +1806,16 @@ config RTC_DRV_MOXART
 	   This driver can also be built as a module. If so, the module
 	   will be called rtc-moxart
 
+config RTC_DRV_MT2712
+	tristate "MediaTek MT2712 SoC based RTC"
+	depends on ARCH_MEDIATEK || COMPILE_TEST
+	help
+	  This enables support for the real time clock built in the MediaTek
+	  SoCs for MT2712.
+
+	  This drive can also be built as a module. If so, the module
+	  will be called rtc-mt2712.
+
 config RTC_DRV_MT6397
 	tristate "MediaTek PMIC based RTC"
 	depends on MFD_MT6397 || (COMPILE_TEST && IRQ_DOMAIN)
drivers/rtc/Makefile +1 -0
index 4ac8f19fb631..6c3e93aa36dc 100644
@@ -110,6 +110,7 @@ obj-$(CONFIG_RTC_DRV_MESON)	+= rtc-meson.o
 obj-$(CONFIG_RTC_DRV_MOXART)	+= rtc-moxart.o
 obj-$(CONFIG_RTC_DRV_MPC5121)	+= rtc-mpc5121.o
 obj-$(CONFIG_RTC_DRV_MSM6242)	+= rtc-msm6242.o
+obj-$(CONFIG_RTC_DRV_MT2712)	+= rtc-mt2712.o
 obj-$(CONFIG_RTC_DRV_MT6397)	+= rtc-mt6397.o
 obj-$(CONFIG_RTC_DRV_MT7622)	+= rtc-mt7622.o
 obj-$(CONFIG_RTC_DRV_MV)	+= rtc-mv.o
drivers/rtc/rtc-mt2712.c new file +422 -0

422 lines not on this page · raw message

Signature · 1 line
2.25.0
author
#3 lore raw

PATCH v3 3/4 arm64: dts: add RTC nodes for MT2712

In reply to Ran Bi

This patch add device node for MT2712 RTC.

---
 arch/arm64/boot/dts/mediatek/mt2712e.dtsi | 6 ++++++
 1 file changed, 6 insertions(+)
arch/arm64/boot/dts/mediatek/mt2712e.dtsi +6 -0
index 43307bad3f0d..31166c17c39a 100644
@@ -303,6 +303,12 @@ uart5: serial@1000f000 {
 		status = "disabled";
 	};
 
+	rtc: rtc@10011000 {
+		compatible = "mediatek,mt2712-rtc";
+		reg = <0 0x10011000 0 0x1000>;
+		interrupts = <GIC_SPI 239 IRQ_TYPE_LEVEL_LOW>;
+	};
+
 	spis1: spi@10013000 {
 		compatible = "mediatek,mt2712-spi-slave";
 		reg = <0 0x10013000 0 0x100>;
Signature · 1 line
2.25.0
maintainer Applied
#4 lore raw

Re: [PATCH v3 3/4] arm64: dts: add RTC nodes for MT2712

Quoted 3 lines · Ran Bi

This patch add device node for MT2712 RTC.

Applied to v5.6-next/dts64

Thanks!

Quoted 22 lines
---
 arch/arm64/boot/dts/mediatek/mt2712e.dtsi | 6 ++++++
 1 file changed, 6 insertions(+)
arch/arm64/boot/dts/mediatek/mt2712e.dtsi +6 -0
index 43307bad3f0d..31166c17c39a 100644
@@ -303,6 +303,12 @@ uart5: serial@1000f000 {
 		status = "disabled";
 	};
 
+	rtc: rtc@10011000 {
+		compatible = "mediatek,mt2712-rtc";
+		reg = <0 0x10011000 0 0x1000>;
+		interrupts = <GIC_SPI 239 IRQ_TYPE_LEVEL_LOW>;
+	};
+
 	spis1: spi@10013000 {
 		compatible = "mediatek,mt2712-spi-slave";
 		reg = <0 0x10013000 0 0x100>;
author
#5 lore raw

PATCH v3 4/4 MAINTAINERS: add MT2712 RTC files

In reply to Ran Bi

This patch add MT2712 RTC related files to MAINTAINERS file.

---
 MAINTAINERS | 2 ++
 1 file changed, 2 insertions(+)
MAINTAINERS +2 -0
index 38fe2f3f7b6f..57549356e731 100644
@@ -1995,7 +1995,9 @@ M:	Sean Wang <[email protected]>
 L:	[email protected] (moderated for non-subscribers)
 L:	[email protected] (moderated for non-subscribers)
 S:	Maintained
+F:	Documentation/devicetree/bindings/rtc/rtc-mt2712.txt
 F:	Documentation/devicetree/bindings/rtc/rtc-mt7622.txt
+F:	drivers/rtc/rtc-mt2712.c
 F:	drivers/rtc/rtc-mt6397.c
 F:	drivers/rtc/rtc-mt7622.c
 
Signature · 1 line
2.25.0
#6 lore raw
In reply to Ran Bi
Quoted 24 lines · Ran Bi

This patchset add support to MT2712 RTC. MT2712 RTC is a SoC based RTC with different architecture compared to MT7622 RTC.

Changes in V3:
1. change struct mt2712_rtc
2. use 100 as year offset
3. change irq handle thread
4. remove useless rtc time check
5. not modify struct rtc_time in set_time/set_alarm functions
6. modify rtc init function
7. add power lost flag for get_time/set_time functions
8. add .alarm_irq_enable callback
9. set rtc->range_min and rtc->range_max to do range checking
10. use fixed driver name

Changes in V2:
1. change minimum year from 1968 to 2000
2. fix lock usage
3. stop to calculate useless day of week
4. stop to set default date after init
5. change the prefix of functions
6. use devm_request_threaded_irq() to replace request_threaded_irq()
7. add mt2712 rtc related files into MAINTAINERS

Quoted 6 lines

Ran Bi (4):
bindings: rtc: add bindings for MT2712 RTC
rtc: add support for the MediaTek MT2712 RTC
arm64: dts: add RTC nodes for MT2712
MAINTAINERS: add MT2712 RTC files

Applied 1,2 and 4, thanks!

Signature · 8 lines
Alexandre Belloni, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel