Skip to contentSkip to conversation

Add i.MX system controller RTC driver

PATCH Applied Anson Huang 3 participants 13 messages Dec 20, 2018 – Jan 14, 2019

Subsystems (3)

v5 of 16 Applied Latest is v16 →

lore
Share & tools
lore
#0 lore raw

v5 cover Add i.MX system controller RTC driver

NXP i.MX8QXP is an ARMv8 SoC with a Cortex-M4 core inside as system controller, the system controller is in charge of system power, clock and secure RTC etc. management, Linux kernel has to communicate with system controller via MU (message unit) IPC to do RTC operation.

Since the RTC set time MUST to be done in secure EL3 mode (required by system controller firmware) and ALARM functions needs to be done with general MU IRQ handle, these are NOT ready NOW, so this patch ONLY supports RTC read time for now.

Note that this patch set is based on [V4,5/5] defconfig: arm64: add imx8qxp support,
https://patchwork.kernel.org/patch/10677315/

Anson Huang (4):
rtc: add i.MX system controller RTC support
dt-bindings: rtc: add binding doc for i.MX system controller RTC
driver
defconfig: arm64: add i.MX system controller RTC support
ARM64: dts: imx: add i.MX8QXP system controller RTC support

 .../devicetree/bindings/rtc/rtc-imx-sc.txt         |  10 ++
 arch/arm64/boot/dts/freescale/imx8qxp.dtsi         |   4 +
 arch/arm64/configs/defconfig                       |   1 +
 drivers/rtc/Kconfig                                |   6 ++
 drivers/rtc/Makefile                               |   1 +
 drivers/rtc/rtc-imx-sc.c                           | 104 +++++++++++++++++++++
 6 files changed, 126 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/rtc/rtc-imx-sc.txt
 create mode 100644 drivers/rtc/rtc-imx-sc.c
Signature · 1 line
2.7.4
#1 lore raw

PATCH v5 1/4 dt-bindings: fsl: scu: add rtc binding

NXP i.MX8QXP is an ARMv8 SoC with a Cortex-M4 core inside as system controller, the system controller is in charge of system power, clock and secure RTC etc. management, Linux kernel has to communicate with system controller via MU (message unit) IPC to do RTC operation, this patch adds binding doc for i.MX system controller RTC driver.

---
No change since V4.

---
 Documentation/devicetree/bindings/arm/freescale/fsl,scu.txt | 10 ++++++++++
 1 file changed, 10 insertions(+)
Documentation/devicetree/bindings/arm/freescale/fsl,scu.txt +10 -0
index c20f38e..3f3d697 100644
@@ -106,6 +106,12 @@ Required properties for Pinctrl sub nodes:
 [2] Documentation/devicetree/bindings/power/power_domain.txt
 [3] Documentation/devicetree/bindings/pinctrl/fsl,imx-pinctrl.txt
 
+RTC bindings based on SCU Message Protocol
+------------------------------------------------------------
+
+Required properties:
+- compatible: should be "fsl,imx8qxp-sc-rtc";
+
 Example (imx8qxp):
 -------------
 lsio_mu1: mailbox@5d1c0000 {
@@ -148,6 +154,10 @@ firmware {
 			compatible = "fsl,imx8qxp-scu-pd";
 			#power-domain-cells = <1>;
 		};
+
+		rtc: rtc {
+			compatible = "fsl,imx8qxp-sc-rtc";
+		};
 	};
 };
 
Signature · 7 lines
2.7.4


_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
#3 lore raw

PATCH v5 1/4 dt-bindings: fsl: scu: add rtc binding

In reply to Anson Huang

NXP i.MX8QXP is an ARMv8 SoC with a Cortex-M4 core inside as system controller, the system controller is in charge of system power, clock and secure RTC etc. management, Linux kernel has to communicate with system controller via MU (message unit) IPC to do RTC operation, this patch adds binding doc for i.MX system controller RTC driver.

---
No change since V4.

---
 Documentation/devicetree/bindings/arm/freescale/fsl,scu.txt | 10 ++++++++++
 1 file changed, 10 insertions(+)
Documentation/devicetree/bindings/arm/freescale/fsl,scu.txt +10 -0
index c20f38e..3f3d697 100644
@@ -106,6 +106,12 @@ Required properties for Pinctrl sub nodes:
 [2] Documentation/devicetree/bindings/power/power_domain.txt
 [3] Documentation/devicetree/bindings/pinctrl/fsl,imx-pinctrl.txt
 
+RTC bindings based on SCU Message Protocol
+------------------------------------------------------------
+
+Required properties:
+- compatible: should be "fsl,imx8qxp-sc-rtc";
+
 Example (imx8qxp):
 -------------
 lsio_mu1: mailbox@5d1c0000 {
@@ -148,6 +154,10 @@ firmware {
 			compatible = "fsl,imx8qxp-scu-pd";
 			#power-domain-cells = <1>;
 		};
+
+		rtc: rtc {
+			compatible = "fsl,imx8qxp-sc-rtc";
+		};
 	};
 };
 
Signature · 1 line
2.7.4
#4 lore raw

PATCH v5 2/4 rtc: add i.MX system controller RTC support

In reply to Anson Huang

i.MX8QXP is an ARMv8 SoC which has a Cortex-M4 system controller inside, the system controller is in charge of controlling power, clock and secure rtc etc..

This patch adds i.MX system controller RTC driver support, Linux kernel has to communicate with system controller via MU (message unit) IPC to set/get RTC time and other alarm functions, since the RTC set time needs to be done in secure EL3 mode (required by system controller firmware) and alarm functions needs to be done with general MU IRQ handle, these depend on other components which are NOT ready, so this patch ONLY enables the RTC time read.

---
ChangeLog since V4:
- Add dependency on IMX_SCU to avoid compile error when IMX_SCU is NOT enabled;
- Use dev_err instead of pr_err;
- Remove unneccssary different errors check in imx_scu_get_handle which is already done in API.

---
 drivers/rtc/Kconfig      |  7 ++++
 drivers/rtc/Makefile     |  1 +
 drivers/rtc/rtc-imx-sc.c | 91 ++++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 99 insertions(+)
 create mode 100644 drivers/rtc/rtc-imx-sc.c
drivers/rtc/Kconfig +7 -0
index a819ef0..225b0b8 100644
@@ -1677,6 +1677,13 @@ config RTC_DRV_SNVS
 	   This driver can also be built as a module, if so, the module
 	   will be called "rtc-snvs".
 
+config RTC_DRV_IMX_SC
+	depends on IMX_SCU
+	tristate "NXP i.MX System Controller RTC support"
+	help
+	   If you say yes here you get support for the NXP i.MX System
+	   Controller RTC module.
+
 config RTC_DRV_SIRFSOC
 	tristate "SiRFSOC RTC"
 	depends on ARCH_SIRF
drivers/rtc/Makefile +1 -0
index 290c173..f97c05e 100644
@@ -75,6 +75,7 @@ obj-$(CONFIG_RTC_DRV_GOLDFISH)	+= rtc-goldfish.o
 obj-$(CONFIG_RTC_DRV_HID_SENSOR_TIME) += rtc-hid-sensor-time.o
 obj-$(CONFIG_RTC_DRV_HYM8563)	+= rtc-hym8563.o
 obj-$(CONFIG_RTC_DRV_IMXDI)	+= rtc-imxdi.o
+obj-$(CONFIG_RTC_DRV_IMX_SC)	+= rtc-imx-sc.o
 obj-$(CONFIG_RTC_DRV_ISL12022)	+= rtc-isl12022.o
 obj-$(CONFIG_RTC_DRV_ISL12026)	+= rtc-isl12026.o
 obj-$(CONFIG_RTC_DRV_ISL1208)	+= rtc-isl1208.o
drivers/rtc/rtc-imx-sc.c new file +91 -0

91 lines not on this page · raw message

Signature · 1 line
2.7.4
#7 lore raw

PATCH v5 3/4 defconfig: arm64: add i.MX system controller RTC support

In reply to Anson Huang

This patch enables CONFIG_RTC_DRV_IMX_SC as module by default.

---
No change since V4.

---
 arch/arm64/configs/defconfig | 1 +
 1 file changed, 1 insertion(+)
arch/arm64/configs/defconfig +1 -0
index d3aa3f7..abd80c5 100644
@@ -572,6 +572,7 @@ CONFIG_RTC_DRV_PL031=y
 CONFIG_RTC_DRV_SUN6I=y
 CONFIG_RTC_DRV_ARMADA38X=y
 CONFIG_RTC_DRV_TEGRA=y
+CONFIG_RTC_DRV_IMX_SC=m
 CONFIG_RTC_DRV_XGENE=y
 CONFIG_DMADEVICES=y
 CONFIG_DMA_BCM2835=m
Signature · 1 line
2.7.4
#9 lore raw

PATCH v5 3/4 defconfig: arm64: add i.MX system controller RTC support

In reply to Anson Huang

This patch enables CONFIG_RTC_DRV_IMX_SC as module by default.

---
No change since V4.

---
 arch/arm64/configs/defconfig | 1 +
 1 file changed, 1 insertion(+)
arch/arm64/configs/defconfig +1 -0
index d3aa3f7..abd80c5 100644
@@ -572,6 +572,7 @@ CONFIG_RTC_DRV_PL031=y
 CONFIG_RTC_DRV_SUN6I=y
 CONFIG_RTC_DRV_ARMADA38X=y
 CONFIG_RTC_DRV_TEGRA=y
+CONFIG_RTC_DRV_IMX_SC=m
 CONFIG_RTC_DRV_XGENE=y
 CONFIG_DMADEVICES=y
 CONFIG_DMA_BCM2835=m
Signature · 1 line
2.7.4
#5 lore raw

PATCH v5 2/4 rtc: add i.MX system controller RTC support

In reply to Anson Huang

i.MX8QXP is an ARMv8 SoC which has a Cortex-M4 system controller inside, the system controller is in charge of controlling power, clock and secure rtc etc..

This patch adds i.MX system controller RTC driver support, Linux kernel has to communicate with system controller via MU (message unit) IPC to set/get RTC time and other alarm functions, since the RTC set time needs to be done in secure EL3 mode (required by system controller firmware) and alarm functions needs to be done with general MU IRQ handle, these depend on other components which are NOT ready, so this patch ONLY enables the RTC time read.

---
ChangeLog since V4:
- Add dependency on IMX_SCU to avoid compile error when IMX_SCU is NOT enabled;
- Use dev_err instead of pr_err;
- Remove unneccssary different errors check in imx_scu_get_handle which is already done in API.

---
 drivers/rtc/Kconfig      |  7 ++++
 drivers/rtc/Makefile     |  1 +
 drivers/rtc/rtc-imx-sc.c | 91 ++++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 99 insertions(+)
 create mode 100644 drivers/rtc/rtc-imx-sc.c
drivers/rtc/Kconfig +7 -0
index a819ef0..225b0b8 100644
@@ -1677,6 +1677,13 @@ config RTC_DRV_SNVS
 	   This driver can also be built as a module, if so, the module
 	   will be called "rtc-snvs".
 
+config RTC_DRV_IMX_SC
+	depends on IMX_SCU
+	tristate "NXP i.MX System Controller RTC support"
+	help
+	   If you say yes here you get support for the NXP i.MX System
+	   Controller RTC module.
+
 config RTC_DRV_SIRFSOC
 	tristate "SiRFSOC RTC"
 	depends on ARCH_SIRF
drivers/rtc/Makefile +1 -0
index 290c173..f97c05e 100644
@@ -75,6 +75,7 @@ obj-$(CONFIG_RTC_DRV_GOLDFISH)	+= rtc-goldfish.o
 obj-$(CONFIG_RTC_DRV_HID_SENSOR_TIME) += rtc-hid-sensor-time.o
 obj-$(CONFIG_RTC_DRV_HYM8563)	+= rtc-hym8563.o
 obj-$(CONFIG_RTC_DRV_IMXDI)	+= rtc-imxdi.o
+obj-$(CONFIG_RTC_DRV_IMX_SC)	+= rtc-imx-sc.o
 obj-$(CONFIG_RTC_DRV_ISL12022)	+= rtc-isl12022.o
 obj-$(CONFIG_RTC_DRV_ISL12026)	+= rtc-isl12026.o
 obj-$(CONFIG_RTC_DRV_ISL1208)	+= rtc-isl1208.o
drivers/rtc/rtc-imx-sc.c new file +91 -0

91 lines not on this page · raw message

Signature · 1 line
2.7.4
#10 lore raw

PATCH v5 4/4 ARM64: dts: imx: add i.MX8QXP system controller RTC support

In reply to Anson Huang

Add i.MX8QXP system controller RTC support.

---
No change since V4.

---
 arch/arm64/boot/dts/freescale/imx8qxp.dtsi | 4 ++++
 1 file changed, 4 insertions(+)
arch/arm64/boot/dts/freescale/imx8qxp.dtsi +4 -0
index da99b6f..9b08688 100644
@@ -83,6 +83,10 @@
 			compatible = "fsl,imx8qxp-scu-pd";
 			#power-domain-cells = <1>;
 		};
+
+		rtc: rtc {
+			compatible = "fsl,imx8qxp-sc-rtc";
+		};
 	};
 
 	adma_subsys: bus@59000000 {
Signature · 1 line
2.7.4
#11 lore raw

PATCH v5 4/4 ARM64: dts: imx: add i.MX8QXP system controller RTC support

In reply to Anson Huang

Add i.MX8QXP system controller RTC support.

---
No change since V4.

---
 arch/arm64/boot/dts/freescale/imx8qxp.dtsi | 4 ++++
 1 file changed, 4 insertions(+)
arch/arm64/boot/dts/freescale/imx8qxp.dtsi +4 -0
index da99b6f..9b08688 100644
@@ -83,6 +83,10 @@
 			compatible = "fsl,imx8qxp-scu-pd";
 			#power-domain-cells = <1>;
 		};
+
+		rtc: rtc {
+			compatible = "fsl,imx8qxp-sc-rtc";
+		};
 	};
 
 	adma_subsys: bus@59000000 {
Signature · 1 line
2.7.4
maintainer Applied
#2 lore raw

Re: [PATCH V5 1/4] dt-bindings: fsl: scu: add rtc binding

In reply to Anson Huang
Quoted 7 lines · Anson Huang

NXP i.MX8QXP is an ARMv8 SoC with a Cortex-M4 core inside as system controller, the system controller is in charge of system power, clock and secure RTC etc. management, Linux kernel has to communicate with system controller via MU (message unit) IPC to do RTC operation, this patch adds binding doc for i.MX system controller RTC driver.

Quoted 8 lines

---
No change since V4.

---
 Documentation/devicetree/bindings/arm/freescale/fsl,scu.txt | 10 ++++++++++
 1 file changed, 10 insertions(+)

Applied, thanks.

Signature · 3 lines
Alexandre Belloni, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
maintainer Applied
#6 lore raw

Re: [PATCH V5 2/4] rtc: add i.MX system controller RTC support

In reply to Anson Huang
Quoted 18 lines · Anson Huang

i.MX8QXP is an ARMv8 SoC which has a Cortex-M4 system controller inside, the system controller is in charge of controlling power, clock and secure rtc etc..

This patch adds i.MX system controller RTC driver support, Linux kernel has to communicate with system controller via MU (message unit) IPC to set/get RTC time and other alarm functions, since the RTC set time needs to be done in secure EL3 mode (required by system controller firmware) and alarm functions needs to be done with general MU IRQ handle, these depend on other components which are NOT ready, so this patch ONLY enables the RTC time read.

---
ChangeLog since V4:
- Add dependency on IMX_SCU to avoid compile error when IMX_SCU is NOT enabled;
- Use dev_err instead of pr_err;
- Remove unneccssary different errors check in imx_scu_get_handle which is already done in API.

Quoted 7 lines
---
 drivers/rtc/Kconfig      |  7 ++++
 drivers/rtc/Makefile     |  1 +
 drivers/rtc/rtc-imx-sc.c | 91 ++++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 99 insertions(+)
 create mode 100644 drivers/rtc/rtc-imx-sc.c

Applied, thanks.

Signature · 3 lines
Alexandre Belloni, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
#12 lore raw

Re: [PATCH V5 4/4] ARM64: dts: imx: add i.MX8QXP system controller RTC support

In reply to Anson Huang
Quoted 3 lines · Anson Huang

Add i.MX8QXP system controller RTC support.

Different from arm32 dts patches, we use prefix 'arm64: ...' for arm64 ones. I fixed it up and applied the patch.

Shawn