RTC support for NXP LPC18xx family
v3 cover RTC support for NXP LPC18xx family
This patch set adds support for the RTC found on many NXP devices including LPC178x/18xx/408x/43xx. The RTC provides calendar and clock functionality together with alarm interrupt support.
The driver is a rework of an old driver by Kevin Wells. It has been modified to support modern resource allocation, device tree and generally cleaned up. Driver was originally written to support the LPC24xx platform but since this platform isn't upstream support has been removed. The LPC24xx name is still kept to preserve the origin of this hardware block.
Been a while since the last version, but this version should address all comments from Josh and Alexandre on v2. There has also been some rework from my side. Please have a look.
changes since v2:
- rework hw init
- update Kconfig text
- remove unused registers defines
- misc clean ups
- rebase on 4.2-rc1
changes since v1:
- s/lpc2k/lpc24xx for better consistency
- fix Kconfig entry
- drop support for old versions for the ip block
Patch set is based on Linux v4.2-rc1.
Joachim Eastwood (2):
rtc: add rtc-lpc24xx driver
doc: dt: add documentation for nxp,lpc1788-rtc
.../devicetree/bindings/rtc/nxp,lpc1788-rtc.txt | 21 ++ drivers/rtc/Kconfig | 12 + drivers/rtc/Makefile | 1 + drivers/rtc/rtc-lpc24xx.c | 310 +++++++++++++++++++++ 4 files changed, 344 insertions(+) create mode 100644 Documentation/devicetree/bindings/rtc/nxp,lpc1788-rtc.txt create mode 100644 drivers/rtc/rtc-lpc24xx.c
Signature · 1 line
1.8.0
PATCH v3 1/2 rtc: add rtc-lpc24xx driver
Add driver for the RTC found on NXP LPC178x/18xx/408x/43xx devices. The RTC provides calendar and clock functionality together with alarm interrupt support.
--- drivers/rtc/Kconfig | 12 ++ drivers/rtc/Makefile | 1 + drivers/rtc/rtc-lpc24xx.c | 310 ++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 323 insertions(+) create mode 100644 drivers/rtc/rtc-lpc24xx.c
drivers/rtc/Kconfig +12 -0
@@ -1456,6 +1456,18 @@ config RTC_DRV_JZ4740 This driver can also be buillt as a module. If so, the module will be called rtc-jz4740. +config RTC_DRV_LPC24XX + tristate "NXP RTC for LPC178x/18xx/408x/43xx" + depends on ARCH_LPC18XX || COMPILE_TEST + depends on OF && HAS_IOMEM + help + This enables support for the NXP RTC found which can be found on + NXP LPC178x/18xx/408x/43xx devices. + + If you have one of the devices above enable this driver to use + the hardware RTC. This driver can also be buillt as a module. If + so, the module will be called rtc-lpc24xx. + config RTC_DRV_LPC32XX depends on ARCH_LPC32XX tristate "NXP LPC32XX RTC"
drivers/rtc/Makefile +1 -0
@@ -74,6 +74,7 @@ obj-$(CONFIG_RTC_DRV_ISL12057) += rtc-isl12057.o obj-$(CONFIG_RTC_DRV_ISL1208) += rtc-isl1208.o obj-$(CONFIG_RTC_DRV_JZ4740) += rtc-jz4740.o obj-$(CONFIG_RTC_DRV_LP8788) += rtc-lp8788.o +obj-$(CONFIG_RTC_DRV_LPC24XX) += rtc-lpc24xx.o obj-$(CONFIG_RTC_DRV_LPC32XX) += rtc-lpc32xx.o obj-$(CONFIG_RTC_DRV_LOONGSON1) += rtc-ls1x.o obj-$(CONFIG_RTC_DRV_M41T80) += rtc-m41t80.o
drivers/rtc/rtc-lpc24xx.c new file +310 -0
310 lines not on this page · raw message
Signature · 1 line
1.8.0
PATCH v3 1/2 rtc: add rtc-lpc24xx driver
Quoted 6 lines · Joachim Eastwood
Add driver for the RTC found on NXP LPC178x/18xx/408x/43xx devices. The RTC provides calendar and clock functionality together with alarm interrupt support.
Signed-off-by Joachim Eastwood <[email protected]>---
[..]
Quoted 23 lines
drivers/rtc/rtc-lpc24xx.c new file +23
-0+static int lpc24xx_rtc_remove (struct platform_device *pdev) +{ +struct lpc24xx_rtc *rtc =platform_get_drvdata (pdev); + +/* Ensure all interrupt sources are masked */ +rtc_writel (rtc,LPC24XX_AMR ,LPC24XX_ALARM_DISABLE ); +rtc_writel (rtc,LPC24XX_CIIR ,0 ); + +rtc_writel (rtc,LPC24XX_CCR ,LPC178X_CCALEN ); + +clk_disable_unprepare (rtc->clk_rtc); +clk_disable_unprepare (rtc->clk_reg); + +return 0 ; +} + +static const struct of_device_id lpc24xx_rtc_match[] = { + { .compatible ="nxp,lpc1788-rtc" }, + { } +}; +MODULE_DEVICE_TABLE (of, lpc24xx_rtc_match); + +static struct platform_driver lpc24xx_rtc_driver = {
drivers/rtc/rtc-lpc24xx.c line 308
Quoted 10 lines
drivers/rtc/rtc-lpc24xx.c new file +10
-0+ .probe = lpc24xx_rtc_probe, + .remove = lpc24xx_rtc_remove, + .driver = { + .name = "lpc24xx-rtc", + .of_match_table = lpc24xx_rtc_match, + }, +}; +module_platform_driver (lpc24xx_rtc_driver); + +MODULE_AUTHOR ("Kevin Wells <[email protected]" );
Missing closing '>'.
Otherwise,
Josh
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 473 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20150713/a7b93098/attachment-0001.sig>
PATCH v3 1/2 rtc: add rtc-lpc24xx driver
Quoted 35 lines · Josh Cartwright
Quoted 6 lines · Joachim Eastwood
Add driver for the RTC found on NXP LPC178x/18xx/408x/43xx devices. The RTC provides calendar and clock functionality together with alarm interrupt support.
Signed-off-by Joachim Eastwood <[email protected]>---
[..]
Quoted 27 lines
drivers/rtc/rtc-lpc24xx.c new file +27
-0+static int lpc24xx_rtc_remove (struct platform_device *pdev) +{ +struct lpc24xx_rtc *rtc =platform_get_drvdata (pdev); + +/* Ensure all interrupt sources are masked */ +rtc_writel (rtc,LPC24XX_AMR ,LPC24XX_ALARM_DISABLE ); +rtc_writel (rtc,LPC24XX_CIIR ,0 ); + +rtc_writel (rtc,LPC24XX_CCR ,LPC178X_CCALEN ); + +clk_disable_unprepare (rtc->clk_rtc); +clk_disable_unprepare (rtc->clk_reg); + +return 0 ; +} + +static const struct of_device_id lpc24xx_rtc_match[] = { + { .compatible ="nxp,lpc1788-rtc" }, + { } +}; +MODULE_DEVICE_TABLE (of, lpc24xx_rtc_match); + +static struct platform_driver lpc24xx_rtc_driver = { + .probe = lpc24xx_rtc_probe, + .remove = lpc24xx_rtc_remove, + .driver = { + .name ="lpc24xx-rtc" ,
Quoted 8 lines
drivers/rtc/rtc-lpc24xx.c line 308
Quoted 6 lines
drivers/rtc/rtc-lpc24xx.c new file +6
-0+ .of_match_table = lpc24xx_rtc_match, + }, +}; +module_platform_driver (lpc24xx_rtc_driver); + +MODULE_AUTHOR ("Kevin Wells <[email protected]" );Missing closing '>'.
Ops. Well spotted.
Quoted 3 lines
Otherwise,
Reviewed-by Josh Cartwright <[email protected]>
Thanks, Josh.
I'll wait and see if Alexandre has any other comments before sending a new version.
regards,
Joachim Eastwood
PATCH v3 2/2 doc: dt: add documentation for nxp,lpc1788-rtc
In reply to Joachim Eastwood--- .../devicetree/bindings/rtc/nxp,lpc1788-rtc.txt | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 Documentation/devicetree/bindings/rtc/nxp,lpc1788-rtc.txt
Documentation/devicetree/bindings/rtc/nxp,lpc1788-rtc.txt new file +21 -0
@@ -0,0 +1,21 @@ +NXP LPC1788 real-time clock + +The LPC1788 RTC provides calendar and clock functionality +together with periodic tick and alarm interrupt support. + +Required properties: +- compatible : must contain "nxp,lpc1788-rtc" +- reg : Specifies base physical address and size of the registers. +- interrupts : A single interrupt specifier. +- clocks : Must contain entries for rtc and register clock +- clock-names : Must contain "rtc" and "reg" + See ../clocks/clock-bindings.txt for details. + +Example: +rtc: rtc at 40046000 { + compatible = "nxp,lpc1788-rtc"; + reg = <0x40046000 0x1000>; + interrupts = <47>; + clocks = <&creg_clk 0>, <&ccu1 CLK_CPU_BUS>; + clock-names = "rtc", "reg"; +};
Signature · 1 line
1.8.0
PATCH v3 2/2 doc: dt: add documentation for nxp,lpc1788-rtc
Quoted 12 lines · Joachim Eastwood
Signed-off-by Joachim Eastwood <[email protected]>--- .../devicetree/bindings/rtc/nxp,lpc1788-rtc.txt | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 Documentation/devicetree/bindings/rtc/nxp,lpc1788-rtc.txtDocumentation/devicetree/bindings/rtc/nxp,lpc1788-rtc.txt new file +0
-0
Documentation/devicetree/bindings/rtc/nxp,lpc1788-rtc.txt line 10
Quoted 10 lines
Documentation/devicetree/bindings/rtc/nxp,lpc1788-rtc.txt new file +10
-0@@ -0,0 +1,21 @@ +NXP LPC1788 real-time clock + +The LPC1788 RTC provides calendar and clock functionality +together with periodic tick and alarm interrupt support. + +Required properties: +- compatible : must contain "nxp,lpc1788-rtc" +- reg : Specifies base physical address and size of the registers. +- interrupts : A single interrupt specifier. +- clocks : Must contain entries for rtc and register clock
"Must contain clock specifiers for rtc and register clock" ?
-Matt
Quoted 11 lines
Documentation/devicetree/bindings/rtc/nxp,lpc1788-rtc.txt new file +11
-0+- clock-names : Must contain "rtc" and "reg" + See ../clocks/clock-bindings.txt for details. + +Example: +rtc: rtc at 40046000 { + compatible = "nxp,lpc1788-rtc"; + reg = <0x40046000 0x1000>; + interrupts = <47>; + clocks = <&creg_clk 0>, <&ccu1 CLK_CPU_BUS>; + clock-names = "rtc", "reg"; +};
PATCH v3 2/2 doc: dt: add documentation for nxp,lpc1788-rtc
Hi,
Quoted 8 lines · Matt Porter
Quoted 5 lines
+Required properties:
+- compatible : must contain "nxp,lpc1788-rtc" +- reg : Specifies base physical address and size of the registers. +- interrupts : A single interrupt specifier. +- clocks : Must contain entries for rtc and register clock"Must contain clock specifiers for rtc and register clock" ?
I fixed it up in the patch.
Signature · 3 lines
Alexandre Belloni, Free Electrons Embedded Linux, Kernel and Android engineering http://free-electrons.com
Alexandre Belloni
Appliedv3 cover RTC support for NXP LPC18xx family
In reply to Joachim EastwoodHi,
Quoted 27 lines · Joachim Eastwood
This patch set adds support for the RTC found on many NXP devices including LPC178x/18xx/408x/43xx. The RTC provides calendar and clock functionality together with alarm interrupt support.
The driver is a rework of an old driver by Kevin Wells. It has been modified to support modern resource allocation, device tree and generally cleaned up. Driver was originally written to support the LPC24xx platform but since this platform isn't upstream support has been removed. The LPC24xx name is still kept to preserve the origin of this hardware block.
Been a while since the last version, but this version should address all comments from Josh and Alexandre on v2. There has also been some rework from my side. Please have a look.
changes since v2:
- rework hw init
- updateKconfigtext
- remove unused registers defines
- misc clean ups
- rebase on 4.2-rc1changes since v1:
- s/lpc2k/lpc24xx for better consistency
- fixKconfigentry
- drop support for old versions for the ip block
Quoted 6 lines
Patch set is based on Linux v4.2-rc1.
Joachim Eastwood (2):
rtc: add rtc-lpc24xx driver
doc: dt: add documentation for nxp,lpc1788-rtc
Applied both after adding a proper commit log to the second patch, reordering to avoid a checkpatch warning and fixing the typo in kevin's mail address.
Signature · 3 lines
Alexandre Belloni, Free Electrons Embedded Linux, Kernel and Android engineering http://free-electrons.com
v3 cover RTC support for NXP LPC18xx family
Quoted 32 lines · Alexandre Belloni
Hi,
Quoted 29 lines · Joachim Eastwood
This patch set adds support for the RTC found on many NXP devices including LPC178x/18xx/408x/43xx. The RTC provides calendar and clock functionality together with alarm interrupt support.
The driver is a rework of an old driver by Kevin Wells. It has been modified to support modern resource allocation, device tree and generally cleaned up. Driver was originally written to support the LPC24xx platform but since this platform isn't upstream support has been removed. The LPC24xx name is still kept to preserve the origin of this hardware block.
Been a while since the last version, but this version should address all comments from Josh and Alexandre on v2. There has also been some rework from my side. Please have a look.
changes since v2:
- rework hw init
- updateKconfigtext
- remove unused registers defines
- misc clean ups
- rebase on 4.2-rc1changes since v1:
- s/lpc2k/lpc24xx for better consistency
- fixKconfigentry
- drop support for old versions for the ip blockPatch set is based on Linux v4.2-rc1.
Quoted 8 lines
Quoted 4 lines
Joachim Eastwood (2):
rtc: add rtc-lpc24xx driver
doc: dt: add documentation for nxp,lpc1788-rtcApplied both after adding a proper commit log to the second patch, reordering to avoid a checkpatch warning and fixing the typo in kevin's mail address.
Thanks for fixing up and applying, Alexandre.
regards,
Joachim Eastwood