diff options
-rw-r--r-- | Documentation/devicetree/bindings/arm/freescale/fsl,scu.txt | 7 | ||||
-rw-r--r-- | drivers/rtc/rtc-imx-sc.c | 11 |
2 files changed, 18 insertions, 0 deletions
diff --git a/Documentation/devicetree/bindings/arm/freescale/fsl,scu.txt b/Documentation/devicetree/bindings/arm/freescale/fsl,scu.txt index fd0061712443..bcf3ab532797 100644 --- a/Documentation/devicetree/bindings/arm/freescale/fsl,scu.txt +++ b/Documentation/devicetree/bindings/arm/freescale/fsl,scu.txt @@ -136,6 +136,13 @@ RTC bindings based on SCU Message Protocol Required properties: - compatible: should be "fsl,imx8qxp-sc-rtc"; +Optional Child nodes: + +- read-only: + For some use cases, like cockpit, one cockpit domain owns it + while other domain is just a reader. Its needed to provide + /dev/rtc funtion for applications. + OCOTP bindings based on SCU Message Protocol ------------------------------------------------------------ Required properties: diff --git a/drivers/rtc/rtc-imx-sc.c b/drivers/rtc/rtc-imx-sc.c index 6828f894e15e..764dadc71a4c 100644 --- a/drivers/rtc/rtc-imx-sc.c +++ b/drivers/rtc/rtc-imx-sc.c @@ -23,6 +23,7 @@ static struct imx_sc_ipc *rtc_ipc_handle; static struct rtc_device *imx_sc_rtc; +static bool readonly; /* true if not authorised to set time */ struct imx_sc_msg_timer_get_rtc_time { struct imx_sc_rpc_msg hdr; @@ -65,6 +66,9 @@ static int imx_sc_rtc_set_time(struct device *dev, struct rtc_time *tm) { struct arm_smccc_res res; + if (readonly) + return 0; + /* pack 2 time parameters into 1 register, 16 bits for each */ arm_smccc_smc(IMX_SIP_SRTC, IMX_SIP_SRTC_SET_TIME, ((tm->tm_year + 1900) << 16) | (tm->tm_mon + 1), @@ -161,6 +165,13 @@ static int imx_sc_rtc_probe(struct platform_device *pdev) imx_scu_irq_register_notifier(&imx_sc_rtc_alarm_sc_notifier); + if (of_property_read_bool(pdev->dev.of_node, "read-only")) { + readonly = true; + dev_info(&pdev->dev, "not allowed to change time\n"); + } else { + readonly = false; + } + return 0; } |