@@ -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>
@@ -164,6 +165,17 @@ static int rzg2l_wdt_restart(struct watchdog_device *wdev,
struct rzg2l_wdt_priv *priv = watchdog_get_drvdata(wdev);
int ret;
+ /*
+ * The device may be part of a power domain that is currently
+ * powered off. We need to power it up before accessing registers.
+ * We don't undo the dev_pm_genpd_resume() as the device need to
+ * be up 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(wdev->parent);
+
clk_prepare_enable(priv->pclk);
clk_prepare_enable(priv->osc_clk);