@@ -12,6 +12,7 @@
#include <linux/module.h>
#include <linux/of.h>
#include <linux/platform_device.h>
+#include <linux/pm_domain.h>
#include <linux/pm_runtime.h>
#include <linux/reset.h>
#include <linux/units.h>
@@ -169,6 +170,17 @@ static int rzg2l_wdt_restart(struct watchdog_device *wdev,
clk_enable(priv->pclk);
clk_enable(priv->osc_clk);
+ /*
+ * The device may be part of a power domain that is currently
+ * powered off. We need to power it on before accessing registers.
+ * We don't undo the dev_pm_genpd_resume_restart_dev() as the device
+ * need to be on for the reboot to happen. Also, as we are in atomic
+ * context here, there is no need to increment PM runtime usage counter
+ * (to make sure pm_runtime_active() doesn't return wrong code).
+ */
+ if (!pm_runtime_active(wdev->parent))
+ dev_pm_genpd_resume_restart_dev(wdev->parent);
+
if (priv->devtype == WDT_RZG2L) {
ret = reset_control_deassert(priv->rstc);
if (ret)