Skip to contentSkip to conversation

second round of rtc

RFC Superseded Ben Dooks 1 participant 5 messages Jun 24, 2016

Subsystems (3)

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore

Ben Dooks

author
#0 lore raw

This is the second RFC for the RTC support. I have gone through and applied most of the suggested cleanups and done a bit more tidying.

The driver has a couple of extra debug prints, and also has a fixed rtc register write code (wrong order) so that it can now set a time from hwclock.

This has been tested on the an ODroid-C1 with battery connected to it.

author
#1 lore raw

RFC v2 1/4 rtc: support for amlogic meson rtc

Add support for the AMLogic meson8b/meson6 RTC block.

---
 drivers/rtc/Kconfig     |  10 ++
 drivers/rtc/Makefile    |   1 +
 drivers/rtc/rtc-meson.c | 345 ++++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 356 insertions(+)
 create mode 100644 drivers/rtc/rtc-meson.c
drivers/rtc/Kconfig +10 -0
index 9f8b59d..47c60df 100644
@@ -1222,6 +1222,16 @@ config RTC_DRV_IMXDI
 	   This driver can also be built as a module, if so, the module
 	   will be called "rtc-imxdi".
 
+config RTC_DRV_MESON
+	tristate "AMLogic Meson Real Time Clock"
+	depends on ARCH_MESON || COMPILE_TEST
+	help
+	   Support for AMLogic Meson RTC block
+
+	   This driver can also be built as a module, if so, the module
+	   will be called "rtc-meson".
+
+
 config RTC_DRV_OMAP
 	tristate "TI OMAP Real Time Clock"
 	depends on ARCH_OMAP || ARCH_DAVINCI || COMPILE_TEST
drivers/rtc/Makefile +1 -0
index 024da27..1d1426e 100644
@@ -93,6 +93,7 @@ obj-$(CONFIG_RTC_DRV_MAX8997)	+= rtc-max8997.o
 obj-$(CONFIG_RTC_DRV_MAX8998)	+= rtc-max8998.o
 obj-$(CONFIG_RTC_DRV_MC13XXX)	+= rtc-mc13xxx.o
 obj-$(CONFIG_RTC_DRV_MCP795)	+= rtc-mcp795.o
+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_VRTC)	+= rtc-mrst.o
drivers/rtc/rtc-meson.c new file +345 -0

345 lines not on this page · raw message

Signature · 1 line
2.8.1
author
#2 lore raw

RFC v2 2/4 meson-rtc: add device-tree binding

In reply to Ben Dooks

Add documentation for the AMLogic Meson RTC.

---
 .../devicetree/bindings/rtc/rtc-amlogic.txt         | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/rtc/rtc-amlogic.txt
Documentation/devicetree/bindings/rtc/rtc-amlogic.txt new file +21 -0
new file mode 100644
index 0000000..efc7672
@@ -0,0 +1,21 @@
+* AMlogic Meson RTC
+
+Required properties:
+- compatible: should be one of the following describing the hardware:
+	* "amlogic,meson6-rtc"
+	* "amlogic,meson8-rtc"
+	* "amlogic,meson8b-rtc"
+
+- reg: physical register space for the controller's memory mapped registers.
+
+Optional properties:
+- resets: reset controller reference to allow reset of the controller
+- interrupts: single interrupt reference if interrupt support needed
+
+Example:
+
+	rtc: rtc at c8100740 {
+		compatible = "amlogic,meson6-rtc";
+		reg = <0xc8100740 0x14>;
+		status = "disabled";
+	};
Signature · 1 line
2.8.1
author
#3 lore raw

RFC v2 3/4 ARM: dts: amlogic: add rtc node for meson8b

In reply to Ben Dooks

Add the DT node for the RTC support.

---
 arch/arm/boot/dts/meson8b.dtsi | 7 +++++++
 1 file changed, 7 insertions(+)
arch/arm/boot/dts/meson8b.dtsi +7 -0
index 6519b80..e3b4a1a 100644
@@ -156,6 +156,13 @@
 			status = "disabled";
 		};
 
+		rtc: rtc at c8100740 {
+			compatible = "amlogic,meson8b-rtc";
+			reg = <0xc8100740 0x14>;
+			resets = <&reset RESET_RTC>;
+			status = "disabled";
+		};
+
 		clkc: clock-controller at c1104000 {
 			#clock-cells = <1>;
 			compatible = "amlogic,meson8b-clkc";
Signature · 1 line
2.8.1
author
#4 lore raw

RFC v2 4/4 ARM: meson: enable RTC for ODRoid-C1

In reply to Ben Dooks

Now the RTC node has been added, enable it on the ODroid-C1 board.

---
 arch/arm/boot/dts/meson8b-odroidc1.dts | 5 +++++
 1 file changed, 5 insertions(+)
arch/arm/boot/dts/meson8b-odroidc1.dts +5 -0
index b147c24..af56b1d 100644
@@ -85,3 +85,8 @@
 	pinctrl-0 = <&uart_ao_a_pins>;
 	pinctrl-names = "default";
 };
+
+&rtc {
+	status = "okay";
+};
+
Signature · 1 line
2.8.1