Skip to contentSkip to conversation

watchdog: imx_sc: Add i.MX system controller watchdog support

PATCH Superseded Anson Huang 3 participants 13 messages Mar 6, 2019 – Mar 8, 2019

Subsystems (2)

v7 of 9 Superseded Latest is v9 →

lore
Share & tools
lore
#0 lore raw

PATCH v7 1/3 watchdog: imx_sc: Add i.MX system controller watchdog support

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 watchdog etc..

This patch adds i.MX system controller watchdog driver support, watchdog operation needs to be done in secure EL3 mode via ARM-Trusted-Firmware, using SMC call, CPU will trap into ARM-Trusted-Firmware and then it will request system controller to do watchdog operation via IPC.

---
Changes since V6:
- use module_platform_driver() instead of module_init/exit to make code simple.

---
 drivers/watchdog/Kconfig      |  14 ++++
 drivers/watchdog/Makefile     |   1 +
 drivers/watchdog/imx_sc_wdt.c | 174 ++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 189 insertions(+)
 create mode 100644 drivers/watchdog/imx_sc_wdt.c
drivers/watchdog/Kconfig +14 -0
index 242eea8..33a6523 100644
@@ -641,6 +641,20 @@ config IMX2_WDT
 	  To compile this driver as a module, choose M here: the
 	  module will be called imx2_wdt.
 
+config IMX_SC_WDT
+	tristate "IMX SC Watchdog"
+	depends on IMX_SCU
+	depends on HAVE_ARM_SMCCC
+	select WATCHDOG_CORE
+	help
+	  This is the driver for the system controller watchdog
+	  on the NXP i.MX SoCs with system controller inside.
+	  If you have one of these processors and wish to have
+	  watchdog support enabled, say Y, otherwise say N.
+
+	  To compile this driver as a module, choose M here: the
+	  module will be called imx_sc_wdt.
+
 config UX500_WATCHDOG
 	tristate "ST-Ericsson Ux500 watchdog"
 	depends on MFD_DB8500_PRCMU
drivers/watchdog/Makefile +1 -0
index ba930e4..136d9f0 100644
@@ -68,6 +68,7 @@ obj-$(CONFIG_NUC900_WATCHDOG) += nuc900_wdt.o
 obj-$(CONFIG_TS4800_WATCHDOG) += ts4800_wdt.o
 obj-$(CONFIG_TS72XX_WATCHDOG) += ts72xx_wdt.o
 obj-$(CONFIG_IMX2_WDT) += imx2_wdt.o
+obj-$(CONFIG_IMX_SC_WDT) += imx_sc_wdt.o
 obj-$(CONFIG_UX500_WATCHDOG) += ux500_wdt.o
 obj-$(CONFIG_RETU_WATCHDOG) += retu_wdt.o
 obj-$(CONFIG_BCM2835_WDT) += bcm2835_wdt.o
drivers/watchdog/imx_sc_wdt.c new file +174 -0

174 lines not on this page · raw message

Signature · 1 line
2.7.4
#1 lore raw

PATCH v7 2/3 arm64: defconfig: add support for i.MX system controller watchdog

Enable CONFIG_IMX_SC_WDT as module to support i.MX system controller watchdog.

---
No changes.

---
 arch/arm64/configs/defconfig | 1 +
 1 file changed, 1 insertion(+)
arch/arm64/configs/defconfig +1 -0
index 2d9c390..690f4ba 100644
@@ -427,6 +427,7 @@ CONFIG_WATCHDOG=y
 CONFIG_ARM_SP805_WATCHDOG=y
 CONFIG_S3C2410_WATCHDOG=y
 CONFIG_IMX2_WDT=y
+CONFIG_IMX_SC_WDT=m
 CONFIG_MESON_GXBB_WATCHDOG=m
 CONFIG_MESON_WATCHDOG=m
 CONFIG_RENESAS_WDT=y
Signature · 1 line
2.7.4
maintainer Acked-by on v7 2/3
#2 lore raw

Re: [PATCH V7 2/3] arm64: defconfig: add support for i.MX system controller watchdog

Quoted 4 lines · Anson Huang

Enable CONFIG_IMX_SC_WDT as module to support i.MX system controller watchdog.

Quoted 19 lines

---
No changes.

---
  arch/arm64/configs/defconfig | 1 +
  1 file changed, 1 insertion(+)
arch/arm64/configs/defconfig +1 -0
index 2d9c390..690f4ba 100644
@@ -427,6 +427,7 @@ CONFIG_WATCHDOG=y
  CONFIG_ARM_SP805_WATCHDOG=y
  CONFIG_S3C2410_WATCHDOG=y
  CONFIG_IMX2_WDT=y
+CONFIG_IMX_SC_WDT=m
  CONFIG_MESON_GXBB_WATCHDOG=m
  CONFIG_MESON_WATCHDOG=m
  CONFIG_RENESAS_WDT=y
#3 lore raw

PATCH v7 3/3 firmware: imx: imx-scu: register build-in child devices

In reply to Anson Huang

For some devices which are controlled by system controller, they are NOT present in device tree since no hardware info needed, just register these devices as children of SCU device. This patch registers i.MX system controller watchdog platform device as child device of SCU.

---
No changes.

---
 drivers/firmware/imx/imx-scu.c | 8 ++++++++
 1 file changed, 8 insertions(+)
drivers/firmware/imx/imx-scu.c +8 -0
index 2bb1a19..df75ead 100644
@@ -196,6 +196,7 @@ EXPORT_SYMBOL(imx_scu_call_rpc);
 
 static int imx_scu_probe(struct platform_device *pdev)
 {
+	struct platform_device *child_pdev;
 	struct device *dev = &pdev->dev;
 	struct imx_sc_ipc *sc_ipc;
 	struct imx_sc_chan *sc_chan;
@@ -248,6 +249,13 @@ static int imx_scu_probe(struct platform_device *pdev)
 
 	dev_info(dev, "NXP i.MX SCU Initialized\n");
 
+	/* register SCU child devices which are NOT in device tree */
+	child_pdev = platform_device_register_data(dev, "imx-sc-wdt",
+				PLATFORM_DEVID_NONE, NULL, 0);
+	if (IS_ERR(child_pdev))
+		dev_warn(dev, "failed to register scu watchdog device %ld!\n",
+			 PTR_ERR(child_pdev));
+
 	return devm_of_platform_populate(dev);
 }
 
Signature · 1 line
2.7.4
maintainer
#4 lore raw

Re: [PATCH V7 3/3] firmware: imx: imx-scu: register build-in child devices

Hi,

Quoted 26 lines · Anson Huang

For some devices which are controlled by system controller, they are NOT present in device tree since no hardware info needed, just register these devices as children of SCU device. This patch registers i.MX system controller watchdog platform device as child device of SCU.

---
No changes.

---
  drivers/firmware/imx/imx-scu.c | 8 ++++++++
  1 file changed, 8 insertions(+)
drivers/firmware/imx/imx-scu.c +1 -0
index 2bb1a19..df75ead 100644
@@ -196,6 +196,7 @@ EXPORT_SYMBOL(imx_scu_call_rpc);
 
  static int imx_scu_probe(struct platform_device *pdev)
  {
+	struct platform_device *child_pdev;
  	struct device *dev = &pdev->dev;
  	struct imx_sc_ipc *sc_ipc;
  	struct imx_sc_chan *sc_chan;

drivers/firmware/imx/imx-scu.c static int imx_scu_probe(struct platform_device *pdev) · line 258

Quoted 10 lines
drivers/firmware/imx/imx-scu.c +7 -0
@@ -248,6 +249,13 @@ static int imx_scu_probe(struct platform_device *pdev)
 
  	dev_info(dev, "NXP i.MX SCU Initialized\n");
 
+	/* register SCU child devices which are NOT in device tree */
+	child_pdev = platform_device_register_data(dev, "imx-sc-wdt",
+				PLATFORM_DEVID_NONE, NULL, 0);
+	if (IS_ERR(child_pdev))
+		dev_warn(dev, "failed to register scu watchdog device %ld!\n",
+			 PTR_ERR(child_pdev));
+

I just realized ... since this is not a devm_ function, we now also need error handling (if devm_of_platform_populate() fails) and a remove function. Sorry for that - I should have noticed earlier.

Guenter

Quoted 4 lines
drivers/firmware/imx/imx-scu.c +0 -0
  	return devm_of_platform_populate(dev);
  }
 
#5 lore raw

RE: [PATCH V7 3/3] firmware: imx: imx-scu: register build-in child devices

Hi, Guenter

Best Regards!
Anson Huang

Quoted 57 lines

-----Original Message-----
From: Guenter Roeck [mailto:[email protected]] On Behalf Of Guenter Roeck
Sent: 2019年3月7日 0:06
To: Anson Huang <[email protected]>; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; Andy Gross <[email protected]>; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; Aisheng Dong <[email protected]>; [email protected]; linux- [email protected]; [email protected]
Cc: dl-linux-imx <[email protected]>
Subject: Re: [PATCH V7 3/3] firmware: imx: imx-scu: register build-in child devices

Hi,

Quoted 26 lines · Anson Huang

For some devices which are controlled by system controller, they are NOT present in device tree since no hardware info needed, just register these devices as children of SCU device.
This patch registers i.MX system controller watchdog platform device as child device of SCU.

---
No changes.

---
  drivers/firmware/imx/imx-scu.c | 8 ++++++++
  1 file changed, 8 insertions(+)
(quoted diff) +0 -0

b/drivers/firmware/imx/imx-scu.c index 2bb1a19..df75ead 100644

drivers/firmware/imx/imx-scu.c +1 -0
@@ -196,6 +196,7 @@ EXPORT_SYMBOL(imx_scu_call_rpc);
 
  static int imx_scu_probe(struct platform_device *pdev)
  {
+	struct platform_device *child_pdev;
  	struct device *dev = &pdev->dev;
  	struct imx_sc_ipc *sc_ipc;
  	struct imx_sc_chan *sc_chan;

drivers/firmware/imx/imx-scu.c static int imx_scu_probe(struct platform_device · line 257

Quoted 9 lines
drivers/firmware/imx/imx-scu.c +5 -0
@@ -248,6 +249,13 @@ static int imx_scu_probe(struct platform_device
 *pdev)
 
  	dev_info(dev, "NXP i.MX SCU Initialized\n");
 
+	/* register SCU child devices which are NOT in device tree */
+	child_pdev = platform_device_register_data(dev, "imx-sc-wdt",
+				PLATFORM_DEVID_NONE, NULL, 0);
+	if (IS_ERR(child_pdev))
+		dev_warn(dev, "failed to register scu watchdog

device %ld!\n",

Quoted 6 lines

drivers/firmware/imx/imx-scu.c static int imx_scu_probe(struct platform_device *pdev) · line 258

Quoted 2 lines
drivers/firmware/imx/imx-scu.c +2 -0
+			 PTR_ERR(child_pdev));
+

I just realized ... since this is not a devm_ function, we now also need error handling (if devm_of_platform_populate() fails) and a remove function. Sorry for that - I should have noticed earlier.

Thanks, I will add error handling here once we make decision of putting device register here, we have other scenarios may need to have watchdog node in DT, if Rob agree to have it in DT, this patch will be discarded.

Anson.

Quoted 7 lines

Guenter

Quoted 4 lines
drivers/firmware/imx/imx-scu.c +0 -0
  	return devm_of_platform_populate(dev);
  }
#6 lore raw

RE: [PATCH V7 3/3] firmware: imx: imx-scu: register build-in child devices

In reply to Guenter Roeck

[...]

Quoted 4 lines
Quoted 4 lines
(quoted diff) +0 -0

b/drivers/firmware/imx/imx-scu.c index 2bb1a19..df75ead 100644

drivers/firmware/imx/imx-scu.c +0 -0

...

Quoted 12 lines

drivers/firmware/imx/imx-scu.c static int imx_scu_probe(struct platform_device *pdev) · line 258

Quoted 7 lines
drivers/firmware/imx/imx-scu.c +7 -0
+	/* register SCU child devices which are NOT in device tree */
+	child_pdev = platform_device_register_data(dev, "imx-sc-wdt",
+				PLATFORM_DEVID_NONE, NULL, 0);
+	if (IS_ERR(child_pdev))
+		dev_warn(dev, "failed to register scu watchdog device %ld!\n",
+			 PTR_ERR(child_pdev));
+

I just realized ... since this is not a devm_ function, we now also need error handling (if devm_of_platform_populate() fails) and a remove function. Sorry for that - I should have noticed earlier.

It looks strange to me that instantiate the watchdog device in SCU driver which actually does not use SCU.

For me, it's actually a watchdog provided by ATF firmware, not SCU. I explained this to Rob in another mail.
Let's see Rob's comments on it.

If Rob agrees, we can move watchdog node out of SCU and also do not need instantiate it in SCU driver.

Regards
Dong Aisheng

Quoted 6 lines

Guenter

Quoted 4 lines
  	return devm_of_platform_populate(dev);
  }

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

maintainer Reviewed-by on v7 1/3
#7 lore raw
In reply to Anson Huang
Quoted 11 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 watchdog etc..

This patch adds i.MX system controller watchdog driver support, watchdog operation needs to be done in secure EL3 mode via ARM-Trusted-Firmware, using SMC call, CPU will trap into ARM-Trusted-Firmware and then it will request system controller to do watchdog operation via IPC.

Quoted 228 lines

---
Changes since V6:
- use module_platform_driver() instead of module_init/exit to make code simple.

---
  drivers/watchdog/Kconfig      |  14 ++++
  drivers/watchdog/Makefile     |   1 +
  drivers/watchdog/imx_sc_wdt.c | 174 ++++++++++++++++++++++++++++++++++++++++++
  3 files changed, 189 insertions(+)

create mode 100644 drivers/watchdog/imx_sc_wdt.c

drivers/watchdog/Kconfig +14 -0
index 242eea8..33a6523 100644
@@ -641,6 +641,20 @@ config IMX2_WDT
  	  To compile this driver as a module, choose M here: the
  	  module will be called imx2_wdt.
 
+config IMX_SC_WDT
+	tristate "IMX SC Watchdog"
+	depends on IMX_SCU
+	depends on HAVE_ARM_SMCCC
+	select WATCHDOG_CORE
+	help
+	  This is the driver for the system controller watchdog
+	  on the NXP i.MX SoCs with system controller inside.
+	  If you have one of these processors and wish to have
+	  watchdog support enabled, say Y, otherwise say N.
+
+	  To compile this driver as a module, choose M here: the
+	  module will be called imx_sc_wdt.
+
  config UX500_WATCHDOG
  	tristate "ST-Ericsson Ux500 watchdog"
  	depends on MFD_DB8500_PRCMU
drivers/watchdog/Makefile +1 -0
index ba930e4..136d9f0 100644
@@ -68,6 +68,7 @@ obj-$(CONFIG_NUC900_WATCHDOG) += nuc900_wdt.o
  obj-$(CONFIG_TS4800_WATCHDOG) += ts4800_wdt.o
  obj-$(CONFIG_TS72XX_WATCHDOG) += ts72xx_wdt.o
  obj-$(CONFIG_IMX2_WDT) += imx2_wdt.o
+obj-$(CONFIG_IMX_SC_WDT) += imx_sc_wdt.o
  obj-$(CONFIG_UX500_WATCHDOG) += ux500_wdt.o
  obj-$(CONFIG_RETU_WATCHDOG) += retu_wdt.o
  obj-$(CONFIG_BCM2835_WDT) += bcm2835_wdt.o
drivers/watchdog/imx_sc_wdt.c new file +174 -0
new file mode 100644
index 0000000..ee48709
@@ -0,0 +1,174 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Copyright 2018-2019 NXP.
+ */
+
+#include <linux/arm-smccc.h>
+#include <linux/io.h>
+#include <linux/init.h>
+#include <linux/kernel.h>
+#include <linux/module.h>
+#include <linux/moduleparam.h>
+#include <linux/platform_device.h>
+#include <linux/reboot.h>
+#include <linux/watchdog.h>
+
+#define DEFAULT_TIMEOUT 60
+/*
+ * Software timer tick implemented in scfw side, support 10ms to 0xffffffff ms
+ * in theory, but for normal case, 1s~128s is enough, you can change this max
+ * value in case it's not enough.
+ */
+#define MAX_TIMEOUT 128
+
+#define IMX_SIP_TIMER			0xC2000002
+#define IMX_SIP_TIMER_START_WDOG		0x01
+#define IMX_SIP_TIMER_STOP_WDOG		0x02
+#define IMX_SIP_TIMER_SET_WDOG_ACT	0x03
+#define IMX_SIP_TIMER_PING_WDOG		0x04
+#define IMX_SIP_TIMER_SET_TIMEOUT_WDOG	0x05
+#define IMX_SIP_TIMER_GET_WDOG_STAT	0x06
+#define IMX_SIP_TIMER_SET_PRETIME_WDOG	0x07
+
+#define SC_TIMER_WDOG_ACTION_PARTITION	0
+
+static bool nowayout = WATCHDOG_NOWAYOUT;
+module_param(nowayout, bool, 0000);
+MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started (default="
+		 __MODULE_STRING(WATCHDOG_NOWAYOUT) ")");
+
+static unsigned int timeout = DEFAULT_TIMEOUT;
+module_param(timeout, uint, 0000);
+MODULE_PARM_DESC(timeout, "Watchdog timeout in seconds (default="
+		 __MODULE_STRING(DEFAULT_TIMEOUT) ")");
+
+static int imx_sc_wdt_ping(struct watchdog_device *wdog)
+{
+	struct arm_smccc_res res;
+
+	arm_smccc_smc(IMX_SIP_TIMER, IMX_SIP_TIMER_PING_WDOG,
+		      0, 0, 0, 0, 0, 0, &res);
+
+	return 0;
+}
+
+static int imx_sc_wdt_start(struct watchdog_device *wdog)
+{
+	struct arm_smccc_res res;
+
+	arm_smccc_smc(IMX_SIP_TIMER, IMX_SIP_TIMER_START_WDOG,
+		      0, 0, 0, 0, 0, 0, &res);
+	if (res.a0)
+		return -EACCES;
+
+	arm_smccc_smc(IMX_SIP_TIMER, IMX_SIP_TIMER_SET_WDOG_ACT,
+		      SC_TIMER_WDOG_ACTION_PARTITION,
+		      0, 0, 0, 0, 0, &res);
+	return res.a0 ? -EACCES : 0;
+}
+
+static int imx_sc_wdt_stop(struct watchdog_device *wdog)
+{
+	struct arm_smccc_res res;
+
+	arm_smccc_smc(IMX_SIP_TIMER, IMX_SIP_TIMER_STOP_WDOG,
+		      0, 0, 0, 0, 0, 0, &res);
+
+	return res.a0 ? -EACCES : 0;
+}
+
+static int imx_sc_wdt_set_timeout(struct watchdog_device *wdog,
+				unsigned int timeout)
+{
+	struct arm_smccc_res res;
+
+	wdog->timeout = timeout;
+	arm_smccc_smc(IMX_SIP_TIMER, IMX_SIP_TIMER_SET_TIMEOUT_WDOG,
+		      timeout * 1000, 0, 0, 0, 0, 0, &res);
+
+	return res.a0 ? -EACCES : 0;
+}
+
+static const struct watchdog_ops imx_sc_wdt_ops = {
+	.owner = THIS_MODULE,
+	.start = imx_sc_wdt_start,
+	.stop  = imx_sc_wdt_stop,
+	.ping  = imx_sc_wdt_ping,
+	.set_timeout = imx_sc_wdt_set_timeout,
+};
+
+static const struct watchdog_info imx_sc_wdt_info = {
+	.identity	= "i.MX SC watchdog timer",
+	.options	= WDIOF_SETTIMEOUT | WDIOF_KEEPALIVEPING |
+			  WDIOF_MAGICCLOSE | WDIOF_PRETIMEOUT,
+};
+
+static int imx_sc_wdt_probe(struct platform_device *pdev)
+{
+	struct watchdog_device *imx_sc_wdd;
+	int ret;
+
+	imx_sc_wdd = devm_kzalloc(&pdev->dev, sizeof(*imx_sc_wdd), GFP_KERNEL);
+	if (!imx_sc_wdd)
+		return -ENOMEM;
+
+	platform_set_drvdata(pdev, imx_sc_wdd);
+
+	imx_sc_wdd->info = &imx_sc_wdt_info;
+	imx_sc_wdd->ops = &imx_sc_wdt_ops;
+	imx_sc_wdd->min_timeout = 1;
+	imx_sc_wdd->max_timeout = MAX_TIMEOUT;
+	imx_sc_wdd->parent = &pdev->dev;
+	imx_sc_wdd->timeout = DEFAULT_TIMEOUT;
+
+	ret = watchdog_init_timeout(imx_sc_wdd, timeout, &pdev->dev);
+	if (ret)
+		dev_warn(&pdev->dev, "Failed to set timeout value, using default\n");
+
+	watchdog_stop_on_reboot(imx_sc_wdd);
+	watchdog_stop_on_unregister(imx_sc_wdd);
+
+	ret = devm_watchdog_register_device(&pdev->dev, imx_sc_wdd);
+	if (ret) {
+		dev_err(&pdev->dev, "Failed to register watchdog device\n");
+		return ret;
+	}
+
+	return 0;
+}
+
+static int __maybe_unused imx_sc_wdt_suspend(struct device *dev)
+{
+	struct watchdog_device *imx_sc_wdd = dev_get_drvdata(dev);
+
+	if (watchdog_active(imx_sc_wdd))
+		imx_sc_wdt_stop(imx_sc_wdd);
+
+	return 0;
+}
+
+static int __maybe_unused imx_sc_wdt_resume(struct device *dev)
+{
+	struct watchdog_device *imx_sc_wdd = dev_get_drvdata(dev);
+
+	if (watchdog_active(imx_sc_wdd))
+		imx_sc_wdt_start(imx_sc_wdd);
+
+	return 0;
+}
+
+static SIMPLE_DEV_PM_OPS(imx_sc_wdt_pm_ops,
+			 imx_sc_wdt_suspend, imx_sc_wdt_resume);
+
+static struct platform_driver imx_sc_wdt_driver = {
+	.probe		= imx_sc_wdt_probe,
+	.driver		= {
+		.name	= "imx-sc-wdt",
+		.pm	= &imx_sc_wdt_pm_ops,
+	},
+};
+module_platform_driver(imx_sc_wdt_driver);
+
+MODULE_AUTHOR("Robin Gong <[email protected]>");
+MODULE_DESCRIPTION("NXP i.MX system controller watchdog driver");
+MODULE_LICENSE("GPL v2");
#8 lore raw
In reply to Anson Huang
Quoted 30 lines

From: Anson Huang
Sent: Wednesday, March 6, 2019 9:06 AM

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 watchdog etc..

This patch adds i.MX system controller watchdog driver support, watchdog operation needs to be done in secure EL3 mode via ARM-Trusted-Firmware, using SMC call, CPU will trap into ARM-Trusted-Firmware and then it will request system controller to do watchdog operation via IPC.

---
Changes since V6:
- use module_platform_driver() instead of module_init/exit to make code
simple.

---
 drivers/watchdog/Kconfig      |  14 ++++
 drivers/watchdog/Makefile     |   1 +
 drivers/watchdog/imx_sc_wdt.c | 174
++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 189 insertions(+)
 create mode 100644 drivers/watchdog/imx_sc_wdt.c
drivers/watchdog/Kconfig index renamed from drivers/watchdog/Kconfig +0 -0

242eea8..33a6523 100644

drivers/watchdog/Kconfig config IMX2_WDT · line 646

Quoted 6 lines
drivers/watchdog/Kconfig +3 -0
@@ -641,6 +641,20 @@ config IMX2_WDT
 	  To compile this driver as a module, choose M here: the
 	  module will be called imx2_wdt.
 
+config IMX_SC_WDT
+	tristate "IMX SC Watchdog"
+	depends on IMX_SCU

As I replied in another mail, it actually does not depend on SCU. Let's wait for Rob's comment on whether we could move watchdog Out of SCU node.

drivers/watchdog/Kconfig config IMX2_WDT · line 654

Quoted 8 lines
drivers/watchdog/Kconfig +8 -0
+	depends on HAVE_ARM_SMCCC
+	select WATCHDOG_CORE
+	help
+	  This is the driver for the system controller watchdog
+	  on the NXP i.MX SoCs with system controller inside.
+	  If you have one of these processors and wish to have
+	  watchdog support enabled, say Y, otherwise say N.
+

Nitpick:
If resend, please also add description here that we need to use ARM SMC call as your commit message.

Regards
Dong Aisheng

Quoted 197 lines
drivers/watchdog/Kconfig +3 -0
+	  To compile this driver as a module, choose M here: the
+	  module will be called imx_sc_wdt.
+
 config UX500_WATCHDOG
 	tristate "ST-Ericsson Ux500 watchdog"
 	depends on MFD_DB8500_PRCMU
drivers/watchdog/Makefile index renamed from drivers/watchdog/Makefile +0 -0

ba930e4..136d9f0 100644

drivers/watchdog/Makefile +1 -0
@@ -68,6 +68,7 @@ obj-$(CONFIG_NUC900_WATCHDOG) += nuc900_wdt.o
 obj-$(CONFIG_TS4800_WATCHDOG) += ts4800_wdt.o
 obj-$(CONFIG_TS72XX_WATCHDOG) += ts72xx_wdt.o
 obj-$(CONFIG_IMX2_WDT) += imx2_wdt.o
+obj-$(CONFIG_IMX_SC_WDT) += imx_sc_wdt.o
 obj-$(CONFIG_UX500_WATCHDOG) += ux500_wdt.o
 obj-$(CONFIG_RETU_WATCHDOG) += retu_wdt.o
 obj-$(CONFIG_BCM2835_WDT) += bcm2835_wdt.o diff --git

a/drivers/watchdog/imx_sc_wdt.c b/drivers/watchdog/imx_sc_wdt.c new file mode 100644 index 0000000..ee48709

drivers/watchdog/imx_sc_wdt.c new file +37 -0
@@ -0,0 +1,174 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Copyright 2018-2019 NXP.
+ */
+
+#include <linux/arm-smccc.h>
+#include <linux/io.h>
+#include <linux/init.h>
+#include <linux/kernel.h>
+#include <linux/module.h>
+#include <linux/moduleparam.h>
+#include <linux/platform_device.h>
+#include <linux/reboot.h>
+#include <linux/watchdog.h>
+
+#define DEFAULT_TIMEOUT 60
+/*
+ * Software timer tick implemented in scfw side, support 10ms to
+0xffffffff ms
+ * in theory, but for normal case, 1s~128s is enough, you can change
+this max
+ * value in case it's not enough.
+ */
+#define MAX_TIMEOUT 128
+
+#define IMX_SIP_TIMER			0xC2000002
+#define IMX_SIP_TIMER_START_WDOG		0x01
+#define IMX_SIP_TIMER_STOP_WDOG		0x02
+#define IMX_SIP_TIMER_SET_WDOG_ACT	0x03
+#define IMX_SIP_TIMER_PING_WDOG		0x04
+#define IMX_SIP_TIMER_SET_TIMEOUT_WDOG	0x05
+#define IMX_SIP_TIMER_GET_WDOG_STAT	0x06
+#define IMX_SIP_TIMER_SET_PRETIME_WDOG	0x07
+
+#define SC_TIMER_WDOG_ACTION_PARTITION	0
+
+static bool nowayout = WATCHDOG_NOWAYOUT; module_param(nowayout,

bool,
+0000); MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once

drivers/watchdog/imx_sc_wdt.c new file +4 -0
+started (default="
+		 __MODULE_STRING(WATCHDOG_NOWAYOUT) ")");
+
+static unsigned int timeout = DEFAULT_TIMEOUT; 

module_param(timeout,

drivers/watchdog/imx_sc_wdt.c new file +65 -0
+uint, 0000); MODULE_PARM_DESC(timeout, "Watchdog timeout in seconds
+(default="
+		 __MODULE_STRING(DEFAULT_TIMEOUT) ")");
+
+static int imx_sc_wdt_ping(struct watchdog_device *wdog) {
+	struct arm_smccc_res res;
+
+	arm_smccc_smc(IMX_SIP_TIMER, IMX_SIP_TIMER_PING_WDOG,
+		      0, 0, 0, 0, 0, 0, &res);
+
+	return 0;
+}
+
+static int imx_sc_wdt_start(struct watchdog_device *wdog) {
+	struct arm_smccc_res res;
+
+	arm_smccc_smc(IMX_SIP_TIMER, IMX_SIP_TIMER_START_WDOG,
+		      0, 0, 0, 0, 0, 0, &res);
+	if (res.a0)
+		return -EACCES;
+
+	arm_smccc_smc(IMX_SIP_TIMER, IMX_SIP_TIMER_SET_WDOG_ACT,
+		      SC_TIMER_WDOG_ACTION_PARTITION,
+		      0, 0, 0, 0, 0, &res);
+	return res.a0 ? -EACCES : 0;
+}
+
+static int imx_sc_wdt_stop(struct watchdog_device *wdog) {
+	struct arm_smccc_res res;
+
+	arm_smccc_smc(IMX_SIP_TIMER, IMX_SIP_TIMER_STOP_WDOG,
+		      0, 0, 0, 0, 0, 0, &res);
+
+	return res.a0 ? -EACCES : 0;
+}
+
+static int imx_sc_wdt_set_timeout(struct watchdog_device *wdog,
+				unsigned int timeout)
+{
+	struct arm_smccc_res res;
+
+	wdog->timeout = timeout;
+	arm_smccc_smc(IMX_SIP_TIMER, IMX_SIP_TIMER_SET_TIMEOUT_WDOG,
+		      timeout * 1000, 0, 0, 0, 0, 0, &res);
+
+	return res.a0 ? -EACCES : 0;
+}
+
+static const struct watchdog_ops imx_sc_wdt_ops = {
+	.owner = THIS_MODULE,
+	.start = imx_sc_wdt_start,
+	.stop  = imx_sc_wdt_stop,
+	.ping  = imx_sc_wdt_ping,
+	.set_timeout = imx_sc_wdt_set_timeout, };
+
+static const struct watchdog_info imx_sc_wdt_info = {
+	.identity	= "i.MX SC watchdog timer",
+	.options	= WDIOF_SETTIMEOUT | WDIOF_KEEPALIVEPING |
+			  WDIOF_MAGICCLOSE | WDIOF_PRETIMEOUT, };
+
+static int imx_sc_wdt_probe(struct platform_device *pdev) {
+	struct watchdog_device *imx_sc_wdd;
+	int ret;
+
+	imx_sc_wdd = devm_kzalloc(&pdev->dev, sizeof(*imx_sc_wdd),

GFP_KERNEL);

drivers/watchdog/imx_sc_wdt.c new file +15 -0
+	if (!imx_sc_wdd)
+		return -ENOMEM;
+
+	platform_set_drvdata(pdev, imx_sc_wdd);
+
+	imx_sc_wdd->info = &imx_sc_wdt_info;
+	imx_sc_wdd->ops = &imx_sc_wdt_ops;
+	imx_sc_wdd->min_timeout = 1;
+	imx_sc_wdd->max_timeout = MAX_TIMEOUT;
+	imx_sc_wdd->parent = &pdev->dev;
+	imx_sc_wdd->timeout = DEFAULT_TIMEOUT;
+
+	ret = watchdog_init_timeout(imx_sc_wdd, timeout, &pdev->dev);
+	if (ret)
+		dev_warn(&pdev->dev, "Failed to set timeout value, using

default\n");

drivers/watchdog/imx_sc_wdt.c new file +46 -1
+
+	watchdog_stop_on_reboot(imx_sc_wdd);
+	watchdog_stop_on_unregister(imx_sc_wdd);
+
+	ret = devm_watchdog_register_device(&pdev->dev, imx_sc_wdd);
+	if (ret) {
+		dev_err(&pdev->dev, "Failed to register watchdog device\n");
+		return ret;
+	}
+
+	return 0;
+}
+
+static int __maybe_unused imx_sc_wdt_suspend(struct device *dev) {
+	struct watchdog_device *imx_sc_wdd = dev_get_drvdata(dev);
+
+	if (watchdog_active(imx_sc_wdd))
+		imx_sc_wdt_stop(imx_sc_wdd);
+
+	return 0;
+}
+
+static int __maybe_unused imx_sc_wdt_resume(struct device *dev) {
+	struct watchdog_device *imx_sc_wdd = dev_get_drvdata(dev);
+
+	if (watchdog_active(imx_sc_wdd))
+		imx_sc_wdt_start(imx_sc_wdd);
+
+	return 0;
+}
+
+static SIMPLE_DEV_PM_OPS(imx_sc_wdt_pm_ops,
+			 imx_sc_wdt_suspend, imx_sc_wdt_resume);
+
+static struct platform_driver imx_sc_wdt_driver = {
+	.probe		= imx_sc_wdt_probe,
+	.driver		= {
+		.name	= "imx-sc-wdt",
+		.pm	= &imx_sc_wdt_pm_ops,
+	},
+};
+module_platform_driver(imx_sc_wdt_driver);
+
+MODULE_AUTHOR("Robin Gong <[email protected]>");
+MODULE_DESCRIPTION("NXP i.MX system controller watchdog driver");
+MODULE_LICENSE("GPL v2");
--

2.7.4

#9 lore raw

Best Regards!
Anson Huang

Quoted 51 lines

-----Original Message-----
From: Aisheng Dong
Sent: 2019年3月7日 21:33
To: Anson Huang <[email protected]>; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; Andy Gross <[email protected]>; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; linux-arm- [email protected]; [email protected]; linux- [email protected]
Cc: dl-linux-imx <[email protected]>
Subject: RE: [PATCH V7 1/3] watchdog: imx_sc: Add i.MX system controller watchdog support

Quoted 11 lines

From: Anson Huang
Sent: Wednesday, March 6, 2019 9:06 AM

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 watchdog etc..

This patch adds i.MX system controller watchdog driver support, watchdog operation needs to be done in secure EL3 mode via ARM-Trusted-Firmware, using SMC call, CPU will trap into ARM-Trusted-Firmware and then it will request system controller to do

watchdog operation via IPC.

Quoted 22 lines

---
Changes since V6:
- use module_platform_driver() instead of module_init/exit to make
code simple.

---
 drivers/watchdog/Kconfig      |  14 ++++
 drivers/watchdog/Makefile     |   1 +
 drivers/watchdog/imx_sc_wdt.c | 174
++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 189 insertions(+)
 create mode 100644 drivers/watchdog/imx_sc_wdt.c
drivers/watchdog/Kconfig index renamed from drivers/watchdog/Kconfig +0 -0

242eea8..33a6523 100644

drivers/watchdog/Kconfig +0 -0
@@ -641,6 +641,20 @@ config IMX2_WDT
 	  To compile this driver as a module, choose M here: the
 	  module will be called imx2_wdt.
 
Quoted 7 lines

drivers/watchdog/Kconfig config IMX2_WDT · line 646

Quoted 3 lines
drivers/watchdog/Kconfig +3 -0
+config IMX_SC_WDT
+	tristate "IMX SC Watchdog"
+	depends on IMX_SCU

As I replied in another mail, it actually does not depend on SCU. Let's wait for Rob's comment on whether we could move watchdog Out of SCU node.

Per previous discussion, the dependency here is to prevent enabling this module for platform without IMX SCU, although it does NOT use SCU IPC call, but the SMC call trap into ARM-Trusted-Firmware will eventually call SCU API, so it still depends on IMX SCU hardware, I am NOT very sure if it is correct to remove it here.

Quoted 13 lines

drivers/watchdog/Kconfig config IMX2_WDT · line 654

Quoted 9 lines
drivers/watchdog/Kconfig +8 -0
+	depends on HAVE_ARM_SMCCC
+	select WATCHDOG_CORE
+	help
+	  This is the driver for the system controller watchdog
+	  on the NXP i.MX SoCs with system controller inside.
+	  If you have one of these processors and wish to have
+	  watchdog support enabled, say Y, otherwise say N.
+

Nitpick:
If resend, please also add description here that we need to use ARM SMC call as your commit message.

Sure, will add it if need resend.

Anson.

Quoted 207 lines

Regards
Dong Aisheng

drivers/watchdog/Makefile obj-$(CONFIG_NUC900_WATCHDOG) +=

Quoted 12 lines
drivers/watchdog/Kconfig +3 -0
+	  To compile this driver as a module, choose M here: the
+	  module will be called imx_sc_wdt.
+
 config UX500_WATCHDOG
 	tristate "ST-Ericsson Ux500 watchdog"
 	depends on MFD_DB8500_PRCMU
drivers/watchdog/Makefile +0 -0

index
ba930e4..136d9f0 100644

drivers/watchdog/Makefile +0 -0
@@ -68,6 +68,7 @@ obj-$(CONFIG_NUC900_WATCHDOG) +=

nuc900_wdt.o

Quoted 39 lines
drivers/watchdog/Makefile +1 -0
 obj-$(CONFIG_TS4800_WATCHDOG) += ts4800_wdt.o
 obj-$(CONFIG_TS72XX_WATCHDOG) += ts72xx_wdt.o
 obj-$(CONFIG_IMX2_WDT) += imx2_wdt.o
+obj-$(CONFIG_IMX_SC_WDT) += imx_sc_wdt.o
 obj-$(CONFIG_UX500_WATCHDOG) += ux500_wdt.o
 obj-$(CONFIG_RETU_WATCHDOG) += retu_wdt.o
 obj-$(CONFIG_BCM2835_WDT) += bcm2835_wdt.o diff --git

a/drivers/watchdog/imx_sc_wdt.c b/drivers/watchdog/imx_sc_wdt.c new file mode 100644 index 0000000..ee48709

drivers/watchdog/imx_sc_wdt.c new file +27 -0
@@ -0,0 +1,174 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Copyright 2018-2019 NXP.
+ */
+
+#include <linux/arm-smccc.h>
+#include <linux/io.h>
+#include <linux/init.h>
+#include <linux/kernel.h>
+#include <linux/module.h>
+#include <linux/moduleparam.h>
+#include <linux/platform_device.h>
+#include <linux/reboot.h>
+#include <linux/watchdog.h>
+
+#define DEFAULT_TIMEOUT 60
+/*
+ * Software timer tick implemented in scfw side, support 10ms to
+0xffffffff ms
+ * in theory, but for normal case, 1s~128s is enough, you can change
+this max
+ * value in case it's not enough.
+ */
+#define MAX_TIMEOUT 128
+
+#define IMX_SIP_TIMER			0xC2000002
+#define IMX_SIP_TIMER_START_WDOG		0x01

drivers/watchdog/imx_sc_wdt.c line 37

Quoted 10 lines
drivers/watchdog/imx_sc_wdt.c new file +10 -0
+#define IMX_SIP_TIMER_STOP_WDOG		0x02
+#define IMX_SIP_TIMER_SET_WDOG_ACT	0x03
+#define IMX_SIP_TIMER_PING_WDOG		0x04
+#define IMX_SIP_TIMER_SET_TIMEOUT_WDOG	0x05
+#define IMX_SIP_TIMER_GET_WDOG_STAT	0x06
+#define IMX_SIP_TIMER_SET_PRETIME_WDOG	0x07
+
+#define SC_TIMER_WDOG_ACTION_PARTITION	0
+
+static bool nowayout = WATCHDOG_NOWAYOUT;

module_param(nowayout,

Quoted 2 lines

bool,
+0000); MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped

once

Quoted 6 lines
drivers/watchdog/imx_sc_wdt.c new file +4 -0
+started (default="
+		 __MODULE_STRING(WATCHDOG_NOWAYOUT) ")");
+
+static unsigned int timeout = DEFAULT_TIMEOUT;

module_param(timeout,
+uint, 0000); MODULE_PARM_DESC(timeout, "Watchdog timeout in

seconds

Quoted 32 lines
drivers/watchdog/imx_sc_wdt.c new file +32 -0
+(default="
+		 __MODULE_STRING(DEFAULT_TIMEOUT) ")");
+
+static int imx_sc_wdt_ping(struct watchdog_device *wdog) {
+	struct arm_smccc_res res;
+
+	arm_smccc_smc(IMX_SIP_TIMER, IMX_SIP_TIMER_PING_WDOG,
+		      0, 0, 0, 0, 0, 0, &res);
+
+	return 0;
+}
+
+static int imx_sc_wdt_start(struct watchdog_device *wdog) {
+	struct arm_smccc_res res;
+
+	arm_smccc_smc(IMX_SIP_TIMER, IMX_SIP_TIMER_START_WDOG,
+		      0, 0, 0, 0, 0, 0, &res);
+	if (res.a0)
+		return -EACCES;
+
+	arm_smccc_smc(IMX_SIP_TIMER, IMX_SIP_TIMER_SET_WDOG_ACT,
+		      SC_TIMER_WDOG_ACTION_PARTITION,
+		      0, 0, 0, 0, 0, &res);
+	return res.a0 ? -EACCES : 0;
+}
+
+static int imx_sc_wdt_stop(struct watchdog_device *wdog) {
+	struct arm_smccc_res res;
+
+	arm_smccc_smc(IMX_SIP_TIMER, IMX_SIP_TIMER_STOP_WDOG,
+		      0, 0, 0, 0, 0, 0, &res);
+

drivers/watchdog/imx_sc_wdt.c

Quoted 10 lines
drivers/watchdog/imx_sc_wdt.c new file +10 -0
+	return res.a0 ? -EACCES : 0;
+}
+
+static int imx_sc_wdt_set_timeout(struct watchdog_device *wdog,
+				unsigned int timeout)
+{
+	struct arm_smccc_res res;
+
+	wdog->timeout = timeout;
+	arm_smccc_smc(IMX_SIP_TIMER,

IMX_SIP_TIMER_SET_TIMEOUT_WDOG,

Quoted 87 lines
drivers/watchdog/imx_sc_wdt.c new file +22 -0
+		      timeout * 1000, 0, 0, 0, 0, 0, &res);
+
+	return res.a0 ? -EACCES : 0;
+}
+
+static const struct watchdog_ops imx_sc_wdt_ops = {
+	.owner = THIS_MODULE,
+	.start = imx_sc_wdt_start,
+	.stop  = imx_sc_wdt_stop,
+	.ping  = imx_sc_wdt_ping,
+	.set_timeout = imx_sc_wdt_set_timeout, };
+
+static const struct watchdog_info imx_sc_wdt_info = {
+	.identity	= "i.MX SC watchdog timer",
+	.options	= WDIOF_SETTIMEOUT | WDIOF_KEEPALIVEPING |
+			  WDIOF_MAGICCLOSE | WDIOF_PRETIMEOUT, };
+
+static int imx_sc_wdt_probe(struct platform_device *pdev) {
+	struct watchdog_device *imx_sc_wdd;
+	int ret;
+
+	imx_sc_wdd = devm_kzalloc(&pdev->dev, sizeof(*imx_sc_wdd),

GFP_KERNEL);

drivers/watchdog/imx_sc_wdt.c new file +15 -0
+	if (!imx_sc_wdd)
+		return -ENOMEM;
+
+	platform_set_drvdata(pdev, imx_sc_wdd);
+
+	imx_sc_wdd->info = &imx_sc_wdt_info;
+	imx_sc_wdd->ops = &imx_sc_wdt_ops;
+	imx_sc_wdd->min_timeout = 1;
+	imx_sc_wdd->max_timeout = MAX_TIMEOUT;
+	imx_sc_wdd->parent = &pdev->dev;
+	imx_sc_wdd->timeout = DEFAULT_TIMEOUT;
+
+	ret = watchdog_init_timeout(imx_sc_wdd, timeout, &pdev->dev);
+	if (ret)
+		dev_warn(&pdev->dev, "Failed to set timeout value, using

default\n");

drivers/watchdog/imx_sc_wdt.c new file +46 -1
+
+	watchdog_stop_on_reboot(imx_sc_wdd);
+	watchdog_stop_on_unregister(imx_sc_wdd);
+
+	ret = devm_watchdog_register_device(&pdev->dev, imx_sc_wdd);
+	if (ret) {
+		dev_err(&pdev->dev, "Failed to register watchdog device\n");
+		return ret;
+	}
+
+	return 0;
+}
+
+static int __maybe_unused imx_sc_wdt_suspend(struct device *dev) {
+	struct watchdog_device *imx_sc_wdd = dev_get_drvdata(dev);
+
+	if (watchdog_active(imx_sc_wdd))
+		imx_sc_wdt_stop(imx_sc_wdd);
+
+	return 0;
+}
+
+static int __maybe_unused imx_sc_wdt_resume(struct device *dev) {
+	struct watchdog_device *imx_sc_wdd = dev_get_drvdata(dev);
+
+	if (watchdog_active(imx_sc_wdd))
+		imx_sc_wdt_start(imx_sc_wdd);
+
+	return 0;
+}
+
+static SIMPLE_DEV_PM_OPS(imx_sc_wdt_pm_ops,
+			 imx_sc_wdt_suspend, imx_sc_wdt_resume);
+
+static struct platform_driver imx_sc_wdt_driver = {
+	.probe		= imx_sc_wdt_probe,
+	.driver		= {
+		.name	= "imx-sc-wdt",
+		.pm	= &imx_sc_wdt_pm_ops,
+	},
+};
+module_platform_driver(imx_sc_wdt_driver);
+
+MODULE_AUTHOR("Robin Gong <[email protected]>");
+MODULE_DESCRIPTION("NXP i.MX system controller watchdog driver");
+MODULE_LICENSE("GPL v2");
--

2.7.4

#10 lore raw

[...]

Quoted 10 lines
Quoted 3 lines

As I replied in another mail, it actually does not depend on SCU. Let's wait for Rob's comment on whether we could move watchdog Out of SCU node.

Per previous discussion, the dependency here is to prevent enabling this module for platform without IMX SCU, although it does NOT use SCU IPC call, but the SMC call trap into ARM-Trusted-Firmware will eventually call SCU API, so it still depends on IMX SCU hardware, I am NOT very sure if it is correct to remove it here.

Then it's ATF depends on SCU, not this virtual watchdog based on ARM SIP, right?

Regards
Dong Aisheng

Quoted 9 lines
Quoted 9 lines

drivers/watchdog/Kconfig config IMX2_WDT · line 654

Quoted 9 lines
drivers/watchdog/Kconfig +8 -0
+	depends on HAVE_ARM_SMCCC
+	select WATCHDOG_CORE
+	help
+	  This is the driver for the system controller watchdog
+	  on the NXP i.MX SoCs with system controller inside.
+	  If you have one of these processors and wish to have
+	  watchdog support enabled, say Y, otherwise say N.
+

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

#11 lore raw

Best Regards!
Anson Huang

Quoted 30 lines

-----Original Message-----
From: Aisheng Dong
Sent: 2019年3月7日 22:00
To: Anson Huang <[email protected]>; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; Andy Gross <[email protected]>; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; linux-arm- [email protected]; [email protected]; linux- [email protected]
Cc: dl-linux-imx <[email protected]>
Subject: RE: [PATCH V7 1/3] watchdog: imx_sc: Add i.MX system controller watchdog support

[...]

Quoted 10 lines
Quoted 3 lines

As I replied in another mail, it actually does not depend on SCU. Let's wait for Rob's comment on whether we could move watchdog Out of SCU node.

Per previous discussion, the dependency here is to prevent enabling this module for platform without IMX SCU, although it does NOT use SCU IPC call, but the SMC call trap into ARM-Trusted-Firmware will eventually call SCU API, so it still depends on IMX SCU hardware, I am NOT very sure if it is correct to remove it here.

Quoted 2 lines

Then it's ATF depends on SCU, not this virtual watchdog based on ARM SIP, right?

But we don't have ATF driver in Linux kernel..., I am confused, anyway, if Guenter agrees, I can remove this dependency here.

Anson.

Quoted 13 lines

Regards
Dong Aisheng

Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
drivers/watchdog/Kconfig +8 -0
+	depends on HAVE_ARM_SMCCC
+	select WATCHDOG_CORE
+	help
+	  This is the driver for the system controller watchdog
+	  on the NXP i.MX SoCs with system controller inside.
+	  If you have one of these processors and wish to have
+	  watchdog support enabled, say Y, otherwise say N.
+
#12 lore raw

[...]

Quoted 12 lines
Quoted 12 lines
Quoted 11 lines
Quoted 4 lines

As I replied in another mail, it actually does not depend on SCU. Let's wait for Rob's comment on whether we could move watchdog Out of SCU node.

Per previous discussion, the dependency here is to prevent enabling this module for platform without IMX SCU, although it does NOT use SCU IPC call, but the SMC call trap into ARM-Trusted-Firmware will eventually call SCU API, so it still depends on IMX SCU hardware, I am NOT very sure if it is correct to remove it here.

Quoted 6 lines
Quoted 2 lines

Then it's ATF depends on SCU, not this virtual watchdog based on ARM SIP, right?

But we don't have ATF driver in Linux kernel..., I am confused, anyway, if Guenter agrees, I can remove this dependency here.

So far the only thing that watchdog depends on SCU driver is that it needs SCU driver to create a platform devices for it.
We need wait Rob's feedback, if he agree moved the watchdog node Out of SCU, we can remove this dependency.

Regards
Dong Aisheng

Quoted 15 lines

Anson.

Quoted 13 lines

Regards
Dong Aisheng

Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
drivers/watchdog/Kconfig +8 -0
+	depends on HAVE_ARM_SMCCC
+	select WATCHDOG_CORE
+	help
+	  This is the driver for the system controller watchdog
+	  on the NXP i.MX SoCs with system controller inside.
+	  If you have one of these processors and wish to have
+	  watchdog support enabled, say Y, otherwise say N.
+