RFC: RTC v5
I've reworked the rtc patches, but have no way of testing them until I get back from "holiday". Is anyone able to test so that they can be submitted?
git at github.com:bendooks/amlogic-kenel.git bjdooks/v48-rc3/rtc-v5
PATCH 1/5 rtc: support for amlogic meson rtc
From: Ben Dooks <[email protected]>
Add support for the AMLogic meson8b/meson6 RTC block.
---
Changes v5:
- fixed spacing error
- fixed spelling errors
- added MESON_STATIC_DEFAULT to reduce over 80-col lines
- fixed use of unsigned by moving to unsigned int
- remove unused meson_rtc_prep_bus() function
- moved to using time64_t
Changes since V3:
<[email protected]>
- Added Kevin's tested by
Changes since V1:
<[email protected]>
- Fixed checkpatch and sparse errors
- Fixed minor locking bug when writing static-control register
- Updated the code ordering in the rtc-meson.c driver
- Fixed alphanumeric ordering in on-cpu rtc block
- Added Rob Hering's ack for the DT binding documentation
- Added better description to the RTC driver header.
--- drivers/rtc/Kconfig | 11 ++ drivers/rtc/Makefile | 1 + drivers/rtc/rtc-meson.c | 341 ++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 353 insertions(+) create mode 100644 drivers/rtc/rtc-meson.c
drivers/rtc/Kconfig +11 -0
@@ -1228,6 +1228,17 @@ 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 in many of the Meson SoC + devices. The driver supports basic read/write of the time. + + 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
@@ -94,6 +94,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 +341 -0
341 lines not on this page · raw message
Signature · 1 line
2.9.3
PATCH 2/5 ARM: dts: amlogic: add rtc node for meson8b
In reply to Ben DooksFrom: Ben Dooks <[email protected]>
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
@@ -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.9.3
PATCH 3/5 meson-rtc: add device-tree binding
In reply to Ben DooksFrom: Ben Dooks <[email protected]>
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
@@ -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.9.3
PATCH 4/5 ARM: meson: enable RTC for ODRoid-C1
In reply to Ben DooksFrom: Ben Dooks <[email protected]>
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
@@ -76,3 +76,8 @@ pinctrl-0 = <&uart_ao_a_pins>; pinctrl-names = "default"; }; + +&rtc { + status = "okay"; +}; +
Signature · 1 line
2.9.3
PATCH 5/5 rtc: warn if rtc_tm_to_time64 overflows in rtc_tm_to_time
In reply to Ben DooksThe addition of the compatibility layer for rtc_tm_to_time() to bridge the move to rtc_tm_to_time64() does not check if the value will overflow the old call's use of unsigned long to restore the result.
This means that if the result is bigger than the arch's use of unsigned long then the result will be silently truncated to whatever the maximum value of the unsigned long. Since the call does not have an option of returning an error, at least have an WARN_ON() to show if the value is out of range.
--- include/linux/rtc.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
include/linux/rtc.h +4 -1
@@ -45,7 +45,10 @@ static inline void rtc_time_to_tm(unsigned long time, struct rtc_time *tm)*/ static inline int rtc_tm_to_time (struct rtc_time *tm,unsigned long *time) { - *time =rtc_tm_to_time64 (tm); +time64_t tt =rtc_tm_to_time64 (tm); + +WARN_ON (tt > ~(0UL )); + *time = tt;return 0 ; }
Signature · 1 line
2.9.3
Kevin Hilman
maintainerQuoted 5 lines · Ben Dooks
I've reworked the rtc patches, but have no way of testing them until I get back from "holiday". Is anyone able to test so that they can be submitted?
git at github.com:bendooks/amlogic-kenel.git bjdooks/v48-rc3/rtc-v5
Just gave it a quick test on meson8b-odroidc1. Something's not right, but didn't debug further:
/ # ./rtctest
RTC Driver Test Example.
...Update IRQs not supported.
Current RTC date/time is 7-9-2016, 21:05:06.RTC_ALM_READ ioctl: Invalid argument
Kevin
Quoted 10 lines · Kevin Hilman
Quoted 5 lines · Ben Dooks
I've reworked the rtc patches, but have no way of testing them until I get back from "holiday". Is anyone able to test so that they can be submitted?
git at github.com:bendooks/amlogic-kenel.git bjdooks/v48-rc3/rtc-v5
Just gave it a quick test on meson8b-odroidc1. Something's not right, but didn't debug further:
Thanks, I'll try and get some time this week to see if this can be fixed.
Signature · 2 lines
Ben Dooks http://www.codethink.co.uk/ Senior Engineer Codethink - Providing Genius