Skip to contentSkip to conversation

arm64: Realtek RTD1295 RTC

PATCH Applied Andreas Färber 2 participants 7 messages Sep 4, 2017 – Sep 5, 2017

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

v4 cover arm64: Realtek RTD1295 RTC

Hello,

This series adds the RTC for the Realtek RTD1295 SoC. Based on my RTD1295 clk series.

There being no public source code for RTD1295, the implementation is based on register offsets seen in the vendor DT, as well as older mach-rtk119x code published by QNAP.

v4 adds a missing clk_put().

The DT node depends on the clk series for clock index and header.

More experimental patches at:
https://github.com/afaerber/linux/commits/rtd1295-next

Have a lot of fun!

Cheers,
Andreas

v3 -> v4:
* Added clk_put() (Alexandre)

v2 -> v3:
* Dropped spinlock (Andrew)
* Improved year_days vs. days_in_year readability

v1 -> v2:
* Updated rtc driver to no longer use open/release (Alexandre)
* Cleaned up debug output (Andrew)
* Avoided COMPILE_TEST division errors (kbuild)
* Various cleanups and extensions

Cc Alessandro Zummo <[email protected]>
Cc Alexandre Belloni <[email protected]>
Cc linux-rtc at vger.kernel.org
Cc Roc He <[email protected]>
Cc devicetree at vger.kernel.org
Cc Andrew Lunn <[email protected]>

Andreas F?rber (3):
dt-bindings: rtc: Add Realtek RTD1295
rtc: Add Realtek RTD1295
arm64: dts: realtek: Add RTD1295 RTC node

 .../devicetree/bindings/rtc/realtek,rtd119x.txt    |  16 ++
 arch/arm64/boot/dts/realtek/rtd1295.dtsi           |   6 +
 drivers/rtc/Kconfig                                |   8 +
 drivers/rtc/Makefile                               |   1 +
 drivers/rtc/rtc-rtd119x.c                          | 242 +++++++++++++++++++++
 5 files changed, 273 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/rtc/realtek,rtd119x.txt
 create mode 100644 drivers/rtc/rtc-rtd119x.c
Signature · 1 line
2.13.5
#1 lore raw

PATCH v4 1/3 dt-bindings: rtc: Add Realtek RTD1295

Add a binding for the RTC on the Realtek RTD119x/RTD129x SoC families.

---
v1 -> v2 -> v3 -> v4: Unchanged

 .../devicetree/bindings/rtc/realtek,rtd119x.txt          | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/rtc/realtek,rtd119x.txt
Documentation/devicetree/bindings/rtc/realtek,rtd119x.txt new file +16 -0
new file mode 100644
index 000000000000..bbf1ccb5df31
@@ -0,0 +1,16 @@
+Realtek RTD129x Real-Time Clock
+===============================
+
+Required properties:
+- compatible :  Should be "realtek,rtd1295-rtc"
+- reg        :  Specifies the physical base address and size
+- clocks     :  Specifies the clock gate
+
+
+Example:
+
+	rtc at 9801b600 {
+		compatible = "realtek,rtd1295-clk";
+		reg = <0x9801b600 0x100>;
+		clocks = <&clkc RTD1295_CLK_EN_MISC_RTC>;
+	};
Signature · 1 line
2.13.5
#2 lore raw

PATCH v4 2/3 rtc: Add Realtek RTD1295

In reply to Andreas Färber

Based on QNAP's arch/arm/mach-rtk119x/driver/rtk_rtc_drv.c code and mach-rtk119x/driver/dc2vo/fpga/include/mis_reg.h register definitions.

The base year 2014 was observed on all of Zidoo X9S, ProBox2 Ava and Beelink Lake I.

---
v3 -> v4:
* Added missing clk_put() (Alexandre)

v2 -> v3:
* Dropped spinlock (Andrew)
* Refactored days-in-year helper to avoid rtc_year_days()

v1 -> v2:
* Dropped open/release in favor of probe/remove (Alexandre)
* read_time: Reordered register accesses (Alexandre)
* read_time/set_time: Refactored day calculations to avoid time64_t (Alexandre)
* read_time: Retry if seconds change (Alexandre)
* probe: Added missing RTCACR initialization code
* set_time: Fixed year check (off by 1900)
* set_time: Fixed new seconds (off by factor two)
* Cleaned up debug output (Andrew)
* Added spinlocks around register accesses
* Added masks for register fields

 drivers/rtc/Kconfig       |   8 ++
 drivers/rtc/Makefile      |   1 +
 drivers/rtc/rtc-rtd119x.c | 242 ++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 251 insertions(+)
 create mode 100644 drivers/rtc/rtc-rtd119x.c
drivers/rtc/Kconfig +8 -0
index a76a26e2292a..e0e58f3b1420 100644
@@ -1765,6 +1765,14 @@ config RTC_DRV_CPCAP
 	   Say y here for CPCAP rtc found on some Motorola phones
 	   and tablets such as Droid 4.
 
+config RTC_DRV_RTD119X
+	bool "Realtek RTD129x RTC"
+	depends on ARCH_REALTEK || COMPILE_TEST
+	default ARCH_REALTEK
+	help
+	  If you say yes here, you get support for the RTD1295 SoC
+	  Real Time Clock.
+
 comment "HID Sensor RTC drivers"
 
 config RTC_DRV_HID_SENSOR_TIME
drivers/rtc/Makefile +1 -0
index d995d49d8218..7230014c92af 100644
@@ -131,6 +131,7 @@ obj-$(CONFIG_RTC_DRV_RP5C01)	+= rtc-rp5c01.o
 obj-$(CONFIG_RTC_DRV_RS5C313)	+= rtc-rs5c313.o
 obj-$(CONFIG_RTC_DRV_RS5C348)	+= rtc-rs5c348.o
 obj-$(CONFIG_RTC_DRV_RS5C372)	+= rtc-rs5c372.o
+obj-$(CONFIG_RTC_DRV_RTD119X)	+= rtc-rtd119x.o
 obj-$(CONFIG_RTC_DRV_RV3029C2)	+= rtc-rv3029c2.o
 obj-$(CONFIG_RTC_DRV_RV8803)	+= rtc-rv8803.o
 obj-$(CONFIG_RTC_DRV_RX4581)	+= rtc-rx4581.o
drivers/rtc/rtc-rtd119x.c new file +242 -0

242 lines not on this page · raw message

Signature · 1 line
2.13.5
#3 lore raw

PATCH v4 3/3 arm64: dts: realtek: Add RTD1295 RTC node

In reply to Andreas Färber

Add RTC node to the Realtek RTD1295 Device Tree.

---
v3 -> v4: Unchanged

v2 -> v3:
* Rebased to no longer depend on reset controller series

v1 -> v2: Unchanged

Depends on the pending clock bindings.

 arch/arm64/boot/dts/realtek/rtd1295.dtsi | 6 ++++++
 1 file changed, 6 insertions(+)
arch/arm64/boot/dts/realtek/rtd1295.dtsi +6 -0
index ab72255f843f..fbbd6456079e 100644
@@ -164,6 +164,12 @@
 			status = "disabled";
 		};
 
+		rtc at 9801b600 {
+			compatible = "realtek,rtd1295-rtc";
+			reg = <0x9801b600 0x100>;
+			clocks = <&clkc RTD1295_CLK_EN_MISC_RTC>;
+		};
+
 		gic: interrupt-controller at ff011000 {
 			compatible = "arm,gic-400";
 			reg = <0xff011000 0x1000>,
Signature · 1 line
2.13.5
#4 lore raw
In reply to Andreas Färber
Quoted 47 lines · Andreas F?rber

Hello,

This series adds the RTC for the Realtek RTD1295 SoC. Based on my RTD1295 clk series.

There being no public source code for RTD1295, the implementation is based on register offsets seen in the vendor DT, as well as older mach-rtk119x code published by QNAP.

v4 adds a missing clk_put().

The DT node depends on the clk series for clock index and header.

More experimental patches at:
https://github.com/afaerber/linux/commits/rtd1295-next

Have a lot of fun!

Cheers,
Andreas

v3 -> v4:
* Added clk_put() (Alexandre)

v2 -> v3:
* Dropped spinlock (Andrew)
* Improved year_days vs. days_in_year readability

v1 -> v2:
* Updated rtc driver to no longer use open/release (Alexandre)
* Cleaned up debug output (Andrew)
* Avoided COMPILE_TEST division errors (kbuild)
* Various cleanups and extensions

Cc Alessandro Zummo <[email protected]>
Cc Alexandre Belloni <[email protected]>
Cc linux-rtc at vger.kernel.org
Cc Roc He <[email protected]>
Cc devicetree at vger.kernel.org
Cc Andrew Lunn <[email protected]>

Andreas F?rber (3):
dt-bindings: rtc: Add Realtek RTD1295
rtc: Add Realtek RTD1295
arm64: dts: realtek: Add RTD1295 RTC node

Quoted 9 lines
 .../devicetree/bindings/rtc/realtek,rtd119x.txt    |  16 ++
 arch/arm64/boot/dts/realtek/rtd1295.dtsi           |   6 +
 drivers/rtc/Kconfig                                |   8 +
 drivers/rtc/Makefile                               |   1 +
 drivers/rtc/rtc-rtd119x.c                          | 242 +++++++++++++++++++++
 5 files changed, 273 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/rtc/realtek,rtd119x.txt
 create mode 100644 drivers/rtc/rtc-rtd119x.c

Applied, thanks.

Signature · 3 lines
Alexandre Belloni, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com
#5 lore raw

Am 05.09.2017 um 09:59 schrieb Alexandre Belloni:

Quoted 57 lines · Andreas F?rber
Quoted 47 lines

Hello,

This series adds the RTC for the Realtek RTD1295 SoC. Based on my RTD1295 clk series.

There being no public source code for RTD1295, the implementation is based on register offsets seen in the vendor DT, as well as older mach-rtk119x code published by QNAP.

v4 adds a missing clk_put().

The DT node depends on the clk series for clock index and header.

More experimental patches at:
https://github.com/afaerber/linux/commits/rtd1295-next

Have a lot of fun!

Cheers,
Andreas

v3 -> v4:
* Added clk_put() (Alexandre)

v2 -> v3:
* Dropped spinlock (Andrew)
* Improved year_days vs. days_in_year readability

v1 -> v2:
* Updated rtc driver to no longer use open/release (Alexandre)
* Cleaned up debug output (Andrew)
* Avoided COMPILE_TEST division errors (kbuild)
* Various cleanups and extensions

Cc Alessandro Zummo <[email protected]>
Cc Alexandre Belloni <[email protected]>
Cc linux-rtc at vger.kernel.org
Cc Roc He <[email protected]>
Cc devicetree at vger.kernel.org
Cc Andrew Lunn <[email protected]>

Andreas F?rber (3):
dt-bindings: rtc: Add Realtek RTD1295
rtc: Add Realtek RTD1295
arm64: dts: realtek: Add RTD1295 RTC node

Quoted 9 lines
 .../devicetree/bindings/rtc/realtek,rtd119x.txt    |  16 ++
 arch/arm64/boot/dts/realtek/rtd1295.dtsi           |   6 +
 drivers/rtc/Kconfig                                |   8 +
 drivers/rtc/Makefile                               |   1 +
 drivers/rtc/rtc-rtd119x.c                          | 242 +++++++++++++++++++++
 5 files changed, 273 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/rtc/realtek,rtd119x.txt
 create mode 100644 drivers/rtc/rtc-rtd119x.c
Quoted 1 line

Applied, thanks.

Err, I am hoping you only queued patches 1-2? Please do not queue patch 3, that needs to go through my tree as per the comments - it will not build.

Thanks,
Andreas

Signature · 3 lines
SUSE Linux GmbH, Maxfeldstr. 5, 90409 N?rnberg, Germany
GF: Felix Imend?rffer, Jane Smithard, Graham Norton
HRB 21284 (AG N?rnberg)
#6 lore raw
Quoted 58 lines · Andreas F?rber

Am 05.09.2017 um 09:59 schrieb Alexandre Belloni:

Quoted 57 lines · Andreas F?rber
Quoted 56 lines

Hello,

This series adds the RTC for the Realtek RTD1295 SoC. Based on my RTD1295 clk series.

There being no public source code for RTD1295, the implementation is based on register offsets seen in the vendor DT, as well as older mach-rtk119x code published by QNAP.

v4 adds a missing clk_put().

The DT node depends on the clk series for clock index and header.

More experimental patches at:
https://github.com/afaerber/linux/commits/rtd1295-next

Have a lot of fun!

Cheers,
Andreas

v3 -> v4:
* Added clk_put() (Alexandre)

v2 -> v3:
* Dropped spinlock (Andrew)
* Improved year_days vs. days_in_year readability

v1 -> v2:
* Updated rtc driver to no longer use open/release (Alexandre)
* Cleaned up debug output (Andrew)
* Avoided COMPILE_TEST division errors (kbuild)
* Various cleanups and extensions

Cc Alessandro Zummo <[email protected]>
Cc Alexandre Belloni <[email protected]>
Cc linux-rtc at vger.kernel.org
Cc Roc He <[email protected]>
Cc devicetree at vger.kernel.org
Cc Andrew Lunn <[email protected]>

Andreas F?rber (3):
dt-bindings: rtc: Add Realtek RTD1295
rtc: Add Realtek RTD1295
arm64: dts: realtek: Add RTD1295 RTC node

 .../devicetree/bindings/rtc/realtek,rtd119x.txt    |  16 ++
 arch/arm64/boot/dts/realtek/rtd1295.dtsi           |   6 +
 drivers/rtc/Kconfig                                |   8 +
 drivers/rtc/Makefile                               |   1 +
 drivers/rtc/rtc-rtd119x.c                          | 242 +++++++++++++++++++++
 5 files changed, 273 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/rtc/realtek,rtd119x.txt
 create mode 100644 drivers/rtc/rtc-rtd119x.c
Quoted 5 lines
Quoted 1 line

Applied, thanks.

Err, I am hoping you only queued patches 1-2? Please do not queue patch 3, that needs to go through my tree as per the comments - it will not build.

Yes, I'm not taking DT patches through the RTC tree.
I didn't receive v4 of the DT patch that's why I forgot to clarify.

Signature · 3 lines
Alexandre Belloni, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com