rtc: add mxc driver for i.MX53 SRTC
v4 cover rtc: add mxc driver for i.MX53 SRTC
From: Patrick Bruenn <[email protected]>
Neither rtc-imxdi, rtc-mxc nor rtc-snvs are compatible with i.MX53.
This is driver enables support for the low power domain SRTC features:
- 32-bit MSB of non-rollover time counter
- 32-bit alarm register
Select the new config option RTC_DRV_MXC_V2 to build this driver
---
v4:
- rename "srtc" node into generic "rtc" keep the label as "srtc" to avoid duplication with imx53-m53.dtsi
- fix Signed-off-by: in bindings-patch
v3:
- introduce new config option with the same patch, which adds the driver
- call rtc_update_irq() only if necessary
- merge mxc_rtc_write_alarm_locked() with mxc_rtc_set_alarm()
- only use clk_enable/disable (without "prepare") during operation
- rebase on v4.15-rc3
- consistently use rtc_tm_to_time64() and time64_t
- refactor mxc_rtc_read_time(): don't lock for readl() only; don't rtc_valid_tm(); use time64_t
- check returncode of mxc_rtc_wait_for_flag()
- restructure mxc_rtc_sync_lp_locked() to replace pr_err() with dev_err_once(); remove explicit 'inline'
- don't touch imx_v4_v5_defconfig, instead add to imx_v6_v7_defconfig
v2:
- have seperate patches for dt-binding, CONFIG option, imx53.dtsi and driver
- add SPDX-License-Identifier and cleanup copyright notice
- replace __raw_readl/writel() with readl/writel()
- fix PM_SLEEP callbacks
- add CONFIG_RTC_DRV_MXC_V2 to build rtc-mxc_v2.c
- remove misleading or obvious comments and fix style of the remaining
- avoid endless loop while waiting for hw
- implement consistent locking; make spinlock a member of dev struct
- enable clk only for register accesses
- remove all udelay() calls since they are obsolete or redundant (we are already waiting for register flags to change)
- init platform_data before registering irq callback
- let set_time() fail, when 32 bit rtc counter exceeded
- make names more consistent
- cleanup and reorder includes
- cleanup and remove unused defines
---
Patrick Bruenn (4):
dt-bindings: rtc: add bindings for i.MX53 SRTC
ARM: dts: imx53: add srtc node
rtc: add mxc driver for i.MX53 SRTC
ARM: imx_v6_v7_defconfig: enable RTC_DRV_MXC_V2
.../devicetree/bindings/rtc/rtc-mxc_v2.txt | 17 + arch/arm/boot/dts/imx53.dtsi | 7 + arch/arm/configs/imx_v6_v7_defconfig | 1 + drivers/rtc/Kconfig | 10 + drivers/rtc/Makefile | 1 + drivers/rtc/rtc-mxc_v2.c | 422 +++++++++++++++++++++ 6 files changed, 458 insertions(+) create mode 100644 Documentation/devicetree/bindings/rtc/rtc-mxc_v2.txt create mode 100644 drivers/rtc/rtc-mxc_v2.c
Signature · 1 line
2.11.0
PATCH v4 1/4 dt-bindings: rtc: add bindings for i.MX53 SRTC
From: Patrick Bruenn <[email protected]>
Document the binding for i.MX53 SRTC implemented by rtc-mxc_v2
---
v4:
- replace "srtc" node name with generic "rtc"
v2:
- added "Secure" and (SRTC) to the description
--- Documentation/devicetree/bindings/rtc/rtc-mxc_v2.txt | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 Documentation/devicetree/bindings/rtc/rtc-mxc_v2.txt
Documentation/devicetree/bindings/rtc/rtc-mxc_v2.txt new file +17 -0
@@ -0,0 +1,17 @@ +* i.MX53 Secure Real Time Clock (SRTC) + +Required properties: +- compatible: should be: "fsl,imx53-rtc" +- reg: physical base address of the controller and length of memory mapped + region. +- clocks: should contain the phandle for the rtc clock +- interrupts: rtc alarm interrupt + +Example: + +rtc at 53fa4000 { + compatible = "fsl,imx53-rtc"; + reg = <0x53fa4000 0x4000>; + interrupts = <24>; + clocks = <&clks IMX5_CLK_SRTC_GATE>; +};
Signature · 1 line
2.11.0
Re: [PATCH v4 1/4] dt-bindings: rtc: add bindings for i.MX53 SRTC
Quoted 5 lines · linux-kernel-dev at beckhoff.com
From: Patrick Bruenn <[email protected]>
Document the binding for i.MX53 SRTC implemented by rtc-mxc_v2
Signed-off-by Patrick Bruenn <[email protected]>
PATCH v4 2/4 ARM: dts: imx53: add srtc node
In reply to [email protected]From: Patrick Bruenn <[email protected]>
rtc-mxc_v2 driver will add support for the i.MX53 SRTC
Note: we keep the 'srtc' label to avoid duplicate with imx53-m53.dtsi
---
v4:
- replace "srtc" node name with generic "rtc"
--- arch/arm/boot/dts/imx53.dtsi | 7 +++++++ 1 file changed, 7 insertions(+)
arch/arm/boot/dts/imx53.dtsi +7 -0
@@ -433,6 +433,13 @@ clock-names = "ipg", "per"; }; + srtc: rtc at 53fa4000 { + compatible = "fsl,imx53-rtc"; + reg = <0x53fa4000 0x4000>; + interrupts = <24>; + clocks = <&clks IMX5_CLK_SRTC_GATE>; + }; + iomuxc: iomuxc at 53fa8000 { compatible = "fsl,imx53-iomuxc"; reg = <0x53fa8000 0x4000>;
Signature · 1 line
2.11.0
Re: [PATCH v4 2/4] ARM: dts: imx53: add srtc node
Quoted 7 lines · On Mon, Dec 18, 2017 at 9:51 AM, <[email protected]> wrote:
From: Patrick Bruenn <[email protected]>
rtc-mxc_v2 driver will add support for the i.MX53 SRTC
Note: we keep the 'srtc' label to avoid duplicate with
imx53-m53.dtsiSigned-off-by Patrick Bruenn <[email protected]>
PATCH v4 3/4 rtc: add mxc driver for i.MX53 SRTC
In reply to [email protected]From: Patrick Bruenn <[email protected]>
Neither rtc-imxdi, rtc-mxc nor rtc-snvs are compatible with i.MX53.
This is driver enables support for the low power domain SRTC features:
- 32-bit MSB of non-rollover time counter
- 32-bit alarm register
Select the new config option RTC_DRV_MXC_V2 to build this driver
---
v3:
- introduce new config option with the same patch, which adds the driver
- call rtc_update_irq() only if necessary
- merge mxc_rtc_write_alarm_locked() with mxc_rtc_set_alarm()
- only use clk_enable/disable (without "prepare") during operation
- rebase on v4.15-rc3
- consistently use rtc_tm_to_time64() and time64_t
- refactor mxc_rtc_read_time(): don't lock for readl() only; don't rtc_valid_tm(); use time64_t
- check returncode of mxc_rtc_wait_for_flag()
- restructure mxc_rtc_sync_lp_locked() to replace pr_err() with dev_err_once(); remove explicit 'inline'
- don't touch imx_v4_v5_defconfig, instead add to imx_v6_v7_defconfig
v2:
- have seperate patches for dt-binding, CONFIG option, imx53.dtsi and driver
- add SPDX-License-Identifier and cleanup copyright notice
- replace __raw_readl/writel() with readl/writel()
- fix PM_SLEEP callbacks
- add CONFIG_RTC_DRV_MXC_V2 to build rtc-mxc_v2.c
- remove misleading or obvious comments and fix style of the remaining
- avoid endless loop while waiting for hw
- implement consistent locking; make spinlock a member of dev struct
- enable clk only for register accesses
- remove all udelay() calls since they are obsolete or redundant (we are already waiting for register flags to change)
- init platform_data before registering irq callback
- let set_time() fail, when 32 bit rtc counter exceeded
- make names more consistent
- cleanup and reorder includes
- cleanup and remove unused defines
--- drivers/rtc/Kconfig | 10 ++ drivers/rtc/Makefile | 1 + drivers/rtc/rtc-mxc_v2.c | 422 +++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 433 insertions(+) create mode 100644 drivers/rtc/rtc-mxc_v2.c
drivers/rtc/Kconfig +10 -0
@@ -1689,6 +1689,16 @@ config RTC_DRV_MXC This driver can also be built as a module, if so, the module will be called "rtc-mxc". +config RTC_DRV_MXC_V2 + tristate "Freescale MXC Real Time Clock for i.MX53" + depends on ARCH_MXC + help + If you say yes here you get support for the Freescale MXC + SRTC module in i.MX53 processor. + + This driver can also be built as a module, if so, the module + will be called "rtc-mxc_v2". + config RTC_DRV_SNVS tristate "Freescale SNVS RTC support" select REGMAP_MMIO
drivers/rtc/Makefile +1 -0
@@ -106,6 +106,7 @@ obj-$(CONFIG_RTC_DRV_MT6397) += rtc-mt6397.o obj-$(CONFIG_RTC_DRV_MT7622) += rtc-mt7622.o obj-$(CONFIG_RTC_DRV_MV) += rtc-mv.o obj-$(CONFIG_RTC_DRV_MXC) += rtc-mxc.o +obj-$(CONFIG_RTC_DRV_MXC_V2) += rtc-mxc_v2.o obj-$(CONFIG_RTC_DRV_NUC900) += rtc-nuc900.o obj-$(CONFIG_RTC_DRV_OMAP) += rtc-omap.o obj-$(CONFIG_RTC_DRV_OPAL) += rtc-opal.o
drivers/rtc/rtc-mxc_v2.c new file +422 -0
422 lines not on this page · raw message
Signature · 1 line
2.11.0
PATCH v4 4/4 ARM: imx_v6_v7_defconfig: enable RTC_DRV_MXC_V2
In reply to [email protected]From: Patrick Bruenn <[email protected]>
Enable SRTC driver for i.MX53 in default config
---
v3:
- imx_v4_v5_defconfig was the wrong default config for i.MX53
--- arch/arm/configs/imx_v6_v7_defconfig | 1 + 1 file changed, 1 insertion(+)
arch/arm/configs/imx_v6_v7_defconfig +1 -0
@@ -349,6 +349,7 @@ CONFIG_RTC_DRV_PCF8563=y CONFIG_RTC_DRV_M41T80=y CONFIG_RTC_DRV_MC13XXX=y CONFIG_RTC_DRV_MXC=y +CONFIG_RTC_DRV_MXC_V2=y CONFIG_RTC_DRV_SNVS=y CONFIG_DMADEVICES=y CONFIG_FSL_EDMA=y
Signature · 1 line
2.11.0
Quoted 89 lines · On Mon, Dec 18, 2017 at 12:51 PM, <[email protected]> wrote:
From: Patrick Bruenn <[email protected]>
Neither rtc-imxdi, rtc-mxc nor rtc-snvs are compatible with i.MX53.
This is driver enables support for the low power domain SRTC features:
- 32-bit MSB of non-rollover time counter
- 32-bit alarm registerSelect the new config option
RTC_DRV_MXC_V2to build this driverSigned-off-by Patrick Bruenn <[email protected]>---
v4:
- rename "srtc" node into generic "rtc" keep the label as "srtc" to avoid duplication withimx53-m53.dtsi
- fix Signed-off-by: in bindings-patchv3:
- introduce new config option with the same patch, which adds the driver
- callrtc_update_irq()only if necessary
- mergemxc_rtc_write_alarm_locked()withmxc_rtc_set_alarm()
- only use clk_enable/disable (without "prepare") during operation
- rebase on v4.15-rc3
- consistently usertc_tm_to_time64()andtime64_t
- refactormxc_rtc_read_time(): don't lock forreadl()only; don'trtc_valid_tm(); usetime64_t
- check returncode ofmxc_rtc_wait_for_flag()
- restructuremxc_rtc_sync_lp_locked()to replacepr_err()withdev_err_once(); remove explicit 'inline'
- don't touchimx_v4_v5_defconfig, instead add toimx_v6_v7_defconfigv2:
- have seperate patches for dt-binding, CONFIG option,imx53.dtsiand driver
- add SPDX-License-Identifier and cleanup copyright notice
- replace __raw_readl/writel() with readl/writel()
- fixPM_SLEEPcallbacks
- addCONFIG_RTC_DRV_MXC_V2to buildrtc-mxc_v2.c
- remove misleading or obvious comments and fix style of the remaining
- avoid endless loop while waiting for hw
- implement consistent locking; make spinlock a member of dev struct
- enable clk only for register accesses
- remove alludelay()calls since they are obsolete or redundant (we are already waiting for register flags to change)
- initplatform_databefore registering irq callback
- letset_time()fail, when 32 bit rtc counter exceeded
- make names more consistent
- cleanup and reorder includes
- cleanup and remove unused definesCc Alessandro Zummo <[email protected]>Cc Alexandre Belloni <[email protected]>Cc Rob Herring <[email protected]>Cc Mark Rutland <[email protected]> (maintainer:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS)Cc linux-rtc at vger.kernel.org (open list:REAL TIME CLOCK (RTC) SUBSYSTEM)Cc devicetree at vger.kernel.org (open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS)Cc linux-kernel at vger.kernel.org (open list)Cc Fabio Estevam <[email protected]>Cc Juergen Borleis <[email protected]>Cc Noel Vellemans <[email protected]>Cc Shawn Guo <[email protected]>Cc Sascha Hauer <[email protected]> (maintainer:ARM/FREESCALE IMX / MXC ARM ARCHITECTURE)Cc Russell King <[email protected]> (maintainer:ARM PORT)Cc linux-arm-kernel at lists.infradead.org (moderated list:ARM/FREESCALE IMX / MXC ARM ARCHITECTURE)Cc Philippe Ombredanne <[email protected]>Cc Lothar Wa?mann <[email protected]>---
Patrick Bruenn (4):
dt-bindings: rtc: add bindings for i.MX53 SRTC
ARM: dts: imx53: add srtc node
rtc: add mxc driver for i.MX53 SRTC
ARM:imx_v6_v7_defconfig: enableRTC_DRV_MXC_V2.../devicetree/bindings/rtc/rtc-mxc_v2.txt | 17 + arch/arm/boot/dts/imx53.dtsi | 7 + arch/arm/configs/imx_v6_v7_defconfig | 1 + drivers/rtc/Kconfig | 10 + drivers/rtc/Makefile | 1 + drivers/rtc/rtc-mxc_v2.c | 422 +++++++++++++++++++++ 6 files changed, 458 insertions(+) create mode 100644 Documentation/devicetree/bindings/rtc/rtc-mxc_v2.txt create mode 100644 drivers/rtc/rtc-mxc_v2.c
Quoted 2 lines
--
2.11.0
For the use of SPDX license tags in this patch set:
Quoted 8 lines · linux-kernel-dev at beckhoff.com
From: Patrick Bruenn <[email protected]>
Neither rtc-imxdi, rtc-mxc nor rtc-snvs are compatible with i.MX53.
This is driver enables support for the low power domain SRTC features:
- 32-bit MSB of non-rollover time counter
- 32-bit alarm register
Quoted 7 lines
Select the new config option
RTC_DRV_MXC_V2to build this driverSigned-off-by Patrick Bruenn <[email protected]>
Applied 1/4 and 3/4, thanks.
Signature · 3 lines
Alexandre Belloni, Free Electrons Embedded Linux and Kernel engineering http://free-electrons.com
Quoted 5 lines · linux-kernel-dev at beckhoff.com
Patrick Bruenn (4):
dt-bindings: rtc: add bindings for i.MX53 SRTC
ARM: dts: imx53: add srtc node
rtc: add mxc driver for i.MX53 SRTC
ARM:imx_v6_v7_defconfig: enableRTC_DRV_MXC_V2
Applied 2/4 and 4/4, thanks.