Skip to contentSkip to conversation

rtc: Add a driver for Cadence RTC

PATCH In review Jan Kotas 2 participants 4 messages Jan 22, 2019

Subsystems (2)
lore
Share & tools
lore

Jan Kotas

author
#0 lore raw

v3 cover rtc: Add a driver for Cadence RTC

This patchset adds a driver support for Cadence RTC IP. It supports time, date and wakeups from sleep.

Changes since v2:
Fixed a typo in the bindings documentation.

Changes since v1:
Added devm_rtc_allocate_device before requesting an IRQ Added range_min, range_max values
Return -EINVAL for read_time() if RTC is disabled Fixed some typos

Jan Kotas (2):
dt-bindings: rtc: Add bindings for Cadence RTC
rtc: Add Cadence RTC driver

Jan Kotas (2):
dt-bindings: rtc: Add bindings for Cadence RTC
rtc: Add Cadence RTC driver

 Documentation/devicetree/bindings/rtc/cdns,rtc.txt |  25 ++
 drivers/rtc/Kconfig                                |  10 +
 drivers/rtc/Makefile                               |   1 +
 drivers/rtc/rtc-cadence.c                          | 423 +++++++++++++++++++++
 4 files changed, 459 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/rtc/cdns,rtc.txt
 create mode 100644 drivers/rtc/rtc-cadence.c
Signature · 1 line
2.15.0
author
#1 lore raw

PATCH v3 1/2 dt-bindings: rtc: Add bindings for Cadence RTC

This patch adds a DT binding documentation for
Cadence RTC controller.

---
 Documentation/devicetree/bindings/rtc/cdns,rtc.txt | 25 ++++++++++++++++++++++
 1 file changed, 25 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/rtc/cdns,rtc.txt
Documentation/devicetree/bindings/rtc/cdns,rtc.txt new file +25 -0
new file mode 100644
index 000000000..14a04487b
@@ -0,0 +1,25 @@
+Cadence Real Time Clock
+
+The Cadence RTC controller with date, time and alarm capabilities.
+The alarm may wake the system from low-power state.
+
+Required properties:
+- compatible: Should be "cdns,rtc-r109v3"
+- reg: Specifies base physical address and size of the register area.
+- interrupts: A single interrupt specifier.
+- clocks: Must contain two entries:
+	- pclk: APB registers clock
+	- ref_clk: reference 1Hz or 100Hz clock, depending on IP configuration
+	See ../clocks/clock-bindings.txt for details.
+
+Example:
+        rtc0: rtc@fd080000 {
+        	compatible = "cdns,rtc-r109v3";
+        	reg = <0xfd080000 0x1000>;
+
+        	clock-names = "pclk", "ref_clk";
+        	clocks = <&sysclock>, <&refclock>;
+
+        	interrupt-parent = <&gic>;
+        	interrupts = <0 6 IRQ_TYPE_LEVEL_HIGH>;
+        };
Signature · 1 line
2.15.0
author
#2 lore raw

PATCH v3 2/2 rtc: Add Cadence RTC driver

In reply to Jan Kotas

This patch adds a driver for Cadence RTC controller.

It can be enabled with RTC_DRV_CADENCE Kconfig option. It supports waking system from sleep modes.

---
 drivers/rtc/Kconfig       |  10 ++
 drivers/rtc/Makefile      |   1 +
 drivers/rtc/rtc-cadence.c | 423 ++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 434 insertions(+)
 create mode 100644 drivers/rtc/rtc-cadence.c
drivers/rtc/Kconfig +10 -0
index 225b0b851..0aba341ad 100644
@@ -1508,6 +1508,16 @@ config RTC_DRV_ARMADA38X
 	  This driver can also be built as a module. If so, the module
 	  will be called armada38x-rtc.
 
+config RTC_DRV_CADENCE
+	tristate "Cadence RTC driver"
+	depends on OF && HAS_IOMEM
+	help
+	  If you say Y here you will get access to Cadence RTC IP
+	  found on certain SOCs.
+
+	  To compile this driver as a module, choose M here: the
+	  module will be called rtc-cadence.
+
 config RTC_DRV_FTRTC010
 	tristate "Faraday Technology FTRTC010 RTC"
 	depends on HAS_IOMEM
drivers/rtc/Makefile +1 -0
index df022d820..5adb41b45 100644
@@ -39,6 +39,7 @@ obj-$(CONFIG_RTC_DRV_AU1XXX)	+= rtc-au1xxx.o
 obj-$(CONFIG_RTC_DRV_BQ32K)	+= rtc-bq32k.o
 obj-$(CONFIG_RTC_DRV_BQ4802)	+= rtc-bq4802.o
 obj-$(CONFIG_RTC_DRV_BRCMSTB)	+= rtc-brcmstb-waketimer.o
+obj-$(CONFIG_RTC_DRV_CADENCE)	+= rtc-cadence.o
 obj-$(CONFIG_RTC_DRV_CMOS)	+= rtc-cmos.o
 obj-$(CONFIG_RTC_DRV_COH901331)	+= rtc-coh901331.o
 obj-$(CONFIG_RTC_DRV_CPCAP)	+= rtc-cpcap.o
drivers/rtc/rtc-cadence.c new file +423 -0

423 lines not on this page · raw message

Signature · 1 line
2.15.0
#3 lore raw
In reply to Jan Kotas
Quoted 12 lines · Jan Kotas

This patchset adds a driver support for Cadence RTC IP. It supports time, date and wakeups from sleep.

Changes since v2:
Fixed a typo in the bindings documentation.

Changes since v1:
Added devm_rtc_allocate_device before requesting an IRQ Added range_min, range_max values
Return -EINVAL for read_time() if RTC is disabled Fixed some typos

Quoted 8 lines

Jan Kotas (2):
dt-bindings: rtc: Add bindings for Cadence RTC
rtc: Add Cadence RTC driver

Jan Kotas (2):
dt-bindings: rtc: Add bindings for Cadence RTC
rtc: Add Cadence RTC driver

Both applied, thanks (only once ;))

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