AMLogic Meson SoC RTC driver
v3 cover AMLogic Meson SoC RTC driver
This series adds support for the on SoC RTC driver on the AMLogic Meson devices. The device-tree updates are not included as they depend on the reset-controller support in -next.
The series does not have any build dependencies, but does require the reset controller and device-tree entries for the relevant boards and has been tested on the ODroid-C1 board.
Thanks to Kevin Hilmand and Neil Armstrong for reviewing the driver.
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.
Ben Dooks (2):
rtc: support for amlogic meson rtc
meson-rtc: add device-tree binding
.../devicetree/bindings/rtc/rtc-amlogic.txt | 21 ++ drivers/rtc/Kconfig | 9 + drivers/rtc/Makefile | 1 + drivers/rtc/rtc-meson.c | 349 +++++++++++++++++++++ 6 files changed, 392 insertions(+) create mode 100644 Documentation/devicetree/bindings/rtc/rtc-amlogic.txt create mode 100644 drivers/rtc/rtc-meson.c
Signature · 1 line
2.8.1
v3 cover AMLogic Meson SoC RTC driver
This series adds support for the on SoC RTC driver on the AMLogic Meson devices. The device-tree updates are not included as they depend on the reset-controller support in -next.
The series does not have any build dependencies, but does require the reset controller and device-tree entries for the relevant boards and has been tested on the ODroid-C1 board.
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.
Ben Dooks (2):
rtc: support for amlogic meson rtc
meson-rtc: add device-tree binding
.../devicetree/bindings/rtc/rtc-amlogic.txt | 21 ++ drivers/rtc/Kconfig | 9 + drivers/rtc/Makefile | 1 + drivers/rtc/rtc-meson.c | 349 +++++++++++++++++++++ 6 files changed, 392 insertions(+) create mode 100644 Documentation/devicetree/bindings/rtc/rtc-amlogic.txt create mode 100644 drivers/rtc/rtc-meson.c
Signature · 1 line
2.8.1
PATCH v3 1/4 rtc: support for amlogic meson rtc
In reply to Ben DooksAdd support for the AMLogic meson8b/meson6 RTC block.
---
V3..V1:
- Fixed alpha-ordering in Kconfig
- Fixed checkpatch errors
- Added basic driver information
- Re-organised static-register access functions above rtc driver layer
--- drivers/rtc/Kconfig | 9 ++ drivers/rtc/Makefile | 1 + drivers/rtc/rtc-meson.c | 349 ++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 359 insertions(+) create mode 100644 drivers/rtc/rtc-meson.c
drivers/rtc/Kconfig +9 -0
@@ -1181,6 +1181,15 @@ config RTC_DRV_ASM9260 This driver can also be built as a module. If so, the module will be called rtc-asm9260. +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_DAVINCI tristate "TI DaVinci RTC" depends on ARCH_DAVINCI_DM365 || COMPILE_TEST
drivers/rtc/Makefile +1 -0
@@ -92,6 +92,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 +349 -0
349 lines not on this page · raw message
Signature · 1 line
2.8.1
Kevin Hilman
maintainerPATCH v3 1/4 rtc: support for amlogic meson rtc
Quoted 3 lines · Ben Dooks
Add support for the AMLogic meson8b/meson6 RTC block.
Signed-off-by Ben Dooks <[email protected]>
PATCH v3 1/4 rtc: support for amlogic meson rtc
In reply to Ben DooksHi,
Very few comments below
drivers/rtc/rtc-meson.c line 31
Quoted 7 lines · Ben Dooks
drivers/rtc/rtc-meson.c new file +7
-0+/* registers accessed from cpu bus */ +#define RTC_REG (x) ((x) * 4)/* rtc registers 0-4 */ + +#define LINE_SDI (1 << 2) +#define LINE_SEN (1 << 1) +#define LINE_SCLK (1 << 0) +
Maybe use BIT() here.
drivers/rtc/rtc-meson.c line 252
Quoted 13 lines
drivers/rtc/rtc-meson.c new file +13
-0+/* RTC interface layer functions */ + +static int meson_rtc_gettime (struct device *dev,struct rtc_time *tm) +{ +struct meson_rtc *rtc =dev_get_drvdata (dev); +int ret; +u32 time; + +mutex_lock (&rtc->lock); + + ret =meson_rtc_read (rtc,RTC_COUNTER , &time); +if (!ret) { +rtc_time_to_tm (time, tm);
Can you use the 64bit version?
Quoted 6 lines
drivers/rtc/rtc-meson.c new file +6
-0+dev_dbg (dev,"read time %lu\n" , (unsigned long )time); + } + +mutex_unlock (&rtc->lock); +return ret; +}
drivers/rtc/rtc-meson.c line 268
Quoted 10 lines
drivers/rtc/rtc-meson.c new file +10
-0+ +static int meson_rtc_settime (struct device *dev,struct rtc_time *tm) +{ +struct meson_rtc *rtc =dev_get_drvdata (dev); +unsigned long time; +int ret; + +mutex_lock (&rtc->lock); + +rtc_tm_to_time (tm, &time);
Ditto.
Signature · 3 lines
Alexandre Belloni, Free Electrons Embedded Linux and Kernel engineering http://free-electrons.com
PATCH v3 1/4 rtc: support for amlogic meson rtc
Quoted 5 lines · Alexandre Belloni
Hi,
Very few comments below
On 05/07/2016 at 20:48:41 +0100, Ben Dooks wrote :
Quoted 8 lines
drivers/rtc/rtc-meson.c line 30
Quoted 6 lines
drivers/rtc/rtc-meson.c new file +6
-0+/* registers accessed from cpu bus */ +#define RTC_REG (x) ((x) * 4)/* rtc registers 0-4 */ + +#define LINE_SDI (1 << 2) +#define LINE_SEN (1 << 1) +#define LINE_SCLK (1 << 0)Maybe use
BIT()here.
I'll sort that out later.
Quoted 7 lines
Quoted 7 lines
drivers/rtc/rtc-meson.c new file +7
-0+/* RTC interface layer functions */ + +static int meson_rtc_gettime (struct device *dev,struct rtc_time *tm) +{ +struct meson_rtc *rtc =dev_get_drvdata (dev); +int ret; +u32 time;
Quoted 8 lines
drivers/rtc/rtc-meson.c line 252
Quoted 6 lines
drivers/rtc/rtc-meson.c new file +6
-0+ +mutex_lock (&rtc->lock); + + ret =meson_rtc_read (rtc,RTC_COUNTER , &time); +if (!ret) { +rtc_time_to_tm (time, tm);Can you use the 64bit version?
What would the 64bit version gain? The hardware register is 32bit.
Signature · 2 lines
Ben Dooks http://www.codethink.co.uk/ Senior Engineer Codethink - Providing Genius
PATCH v3 1/4 rtc: support for amlogic meson rtc
Quoted 33 lines · Ben Dooks
Quoted 5 lines · Alexandre Belloni
Hi,
Very few comments below
On 05/07/2016 at 20:48:41 +0100, Ben Dooks wrote :
Quoted 8 lines
drivers/rtc/rtc-meson.c line 30
Quoted 6 lines
drivers/rtc/rtc-meson.c new file +6
-0+/* registers accessed from cpu bus */ +#define RTC_REG (x) ((x) * 4)/* rtc registers 0-4 */ + +#define LINE_SDI (1 << 2) +#define LINE_SEN (1 << 1) +#define LINE_SCLK (1 << 0)Maybe use
BIT()here.I'll sort that out later.
Quoted 7 lines
Quoted 7 lines
drivers/rtc/rtc-meson.c new file +7
-0+/* RTC interface layer functions */ + +static int meson_rtc_gettime (struct device *dev,struct rtc_time *tm) +{ +struct meson_rtc *rtc =dev_get_drvdata (dev); +int ret; +u32 time;Quoted 8 lines
drivers/rtc/rtc-meson.c line 252
Quoted 6 lines
drivers/rtc/rtc-meson.c new file +6
-0+ +mutex_lock (&rtc->lock); + + ret =meson_rtc_read (rtc,RTC_COUNTER , &time); +if (!ret) { +rtc_time_to_tm (time, tm);Can you use the 64bit version?
Quoted 2 lines
What would the 64bit version gain? The hardware register is 32bit.
Well, at some point, I'll remove the 32bit version:
http://lxr.free-electrons.com/source/include/linux/rtc.h#L36
Signature · 3 lines
Alexandre Belloni, Free Electrons Embedded Linux and Kernel engineering http://free-electrons.com
PATCH v3 2/4 meson-rtc: add device-tree binding
In reply to Ben DooksAdd 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.8.1
PATCH v3 2/4 meson-rtc: add device-tree binding
Quoted 8 lines · Ben Dooks
Add documentation for the AMLogic Meson RTC.
Signed-off-by Ben Dooks <[email protected]>Acked-by Rob Herring <[email protected]>--- .../devicetree/bindings/rtc/rtc-amlogic.txt | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 Documentation/devicetree/bindings/rtc/rtc-amlogic.txt
Hi Ben,
I suspect you already know this since you have Rob's ack, but you need to send bindings to
Rob Herring <[email protected]>
Mark Rutland <[email protected]>
-Frank
PATCH v3 2/4 meson-rtc: add device-tree binding
Quoted 10 lines · Frank Rowand
Quoted 8 lines · Ben Dooks
Add documentation for the AMLogic Meson RTC.
Signed-off-by Ben Dooks <[email protected]>Acked-by Rob Herring <[email protected]>--- .../devicetree/bindings/rtc/rtc-amlogic.txt | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 Documentation/devicetree/bindings/rtc/rtc-amlogic.txt
Quoted 7 lines
Hi Ben,
I suspect you already know this since you have Rob's ack, but you need to send bindings to
Rob Herring <[email protected]>
Mark Rutland <[email protected]>
Sorry, missed copying the email when sending.
I hope he's seen them from being on the devicetree at vger.kernel.org list? I've added him as an CC: on this one to check.
Signature · 2 lines
Ben Dooks http://www.codethink.co.uk/ Senior Engineer Codethink - Providing Genius
PATCH v3 2/4 meson-rtc: add device-tree binding
Quoted 19 lines · Ben Dooks
Quoted 10 lines · Frank Rowand
Quoted 8 lines · Ben Dooks
Add documentation for the AMLogic Meson RTC.
Signed-off-by Ben Dooks <[email protected]>Acked-by Rob Herring <[email protected]>--- .../devicetree/bindings/rtc/rtc-amlogic.txt | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 Documentation/devicetree/bindings/rtc/rtc-amlogic.txtQuoted 7 lines
Hi Ben,
I suspect you already know this since you have Rob's ack, but you need to send bindings to
Rob Herring <[email protected]>
Mark Rutland <[email protected]>
Quoted 6 lines
Sorry, missed copying the email when sending.
I hope he's seen them from being on the devicetree at vger.kernel.org list? I've added him as an CC: on this one to check.
From my perspective, having devicetree at vger.kernel.org alone is fine. I
appreciate tastes vary across maintainers, either way is fine by me. :)
You already have Rob's ack, which is sufficient, but FWIW the patch looks fine, so feel free to add mine:
Thanks,
Mark.