From nobody Thu Apr 2 12:36:47 2026 Received: from mail-wm1-f47.google.com (mail-wm1-f47.google.com [209.85.128.47]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5F2F73F0A91 for ; Tue, 24 Mar 2026 11:43:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.47 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774352627; cv=none; b=fGDodun9j9ZDRAFnv36S54UoPpvSjal9Nf68vqkxOE3/CUiONZgReqcvMa49ooSxEyhdtN/VcOog+0WkEqJ1jKXr6Xq7KsBNdDWtyZlth3FISqQAvdClOLsh85DVrCFYRCNt+Cf4CXhBCXT26E6Xtp6jgH8lnnZ4gcumLtvuuow= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774352627; c=relaxed/simple; bh=H2fEHpybBLkHHbMdo005jZoF83+21eGUWFFuQTrSrhU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=vDbCD7qNKvsjZI7lwP9tTXAUlHCNIiW4CZAA7T5biNdPZQGe5sZX6dohmtU5XvFH0ybNKaN7lbjbDh5+xrsQu/dfebEgej/lE3IaeqiWIfefS7TT6z5VVmSDQiMUyLMtdc/1ZPsp4f+TxQOHjmK3ID1Nr/FgJ2XQ24Sip0WUt5w= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=O/otXvN2; arc=none smtp.client-ip=209.85.128.47 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="O/otXvN2" Received: by mail-wm1-f47.google.com with SMTP id 5b1f17b1804b1-48700b1ba53so36458105e9.1 for ; Tue, 24 Mar 2026 04:43:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1774352619; x=1774957419; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=ZxpLZewpBHQBH30KhBV9xXPz16M7OH2igp4cA1rTclg=; b=O/otXvN2YZ/ULA1ZCnHq/ngBHImRn7DaknCszOj0HpJtE0R9XsuZbZp9kE6SZJDCAQ nMkS2CCTMBrbXQDXPW+1guB37Q9S4oMjm0pUevgba32hY0ttvG49mwTPNyrZVksg4WGR N9tEwkAJqSvN9Bxom6ABB34BI4Uz+pP7BAegwNBlF4jW8vqJfBzn7VY58CKLgx6RPY1k Cmlutr2vC7BQGj6BKB25Ut52BN9FW0Ol0y6LhLURPqYYVSQeENWUTxg+fm3HcpjCYRRU J6K+HU3866KGQrWYPiDPyQPFHQlhLhgr7eMgQ5swF+HQjhBrMCNX5vBc2yliv3N+loo+ OHCA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1774352619; x=1774957419; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=ZxpLZewpBHQBH30KhBV9xXPz16M7OH2igp4cA1rTclg=; b=oeL0mgLU1O8UmX/fV+IhDe0gFYqvVdWlqTpg69rExZ0r9x/yr53RX+qCW2tWvNlwRg r+1rsigCiL+nsjrds3MqhAK3tAp+yPZzR/3PMkl62Brw0n25JG9dN5J3cBiiNUJ2tgOf HIW0OBzfKbmKiFF3UkA6TPaO3seQMT3qJl17QRsCOXwJC8iwiOCNmsqQEgmsgz7F490Z 3rtPvRZZiTT/5IjNu8g4omMYkOMuwQzlrWhPixU4Xa2+L/FkB1XhXbdyXH1SU4TUA6Do 8+Gg6o+f+EhJDoCU9eE2NGpOWLoPZTdxh6LeQduPCJWtDEhu7Vfv69i0zn78p3upHiKI 3ArQ== X-Forwarded-Encrypted: i=1; AJvYcCX4loVVw9s1X9F6tDbFpKzEKaHOJmSvyW1IvfuSTaoYULXynPJ9+3S2BGwR9HeSEl6F2dAlHEM2CnMhbPg=@vger.kernel.org X-Gm-Message-State: AOJu0YwppBMIFcGgh5nzQ4+0n6IJVudtsSGF6vbyvDgdGGyZXpMumjcK xl6fBSJ338A6w4HuFkKRjfZcPd/HCoyIL7AemEbLwhyUQiG2U/9pqGd44aqp6w== X-Gm-Gg: ATEYQzwDwmnQU8vaLSSkRbedd6ZD+k5V7zXbzsUQs5oU+tlWRM8CEQVNde+//W7KZOH EBsxkVi9cuCpwWEpK++IbjQK0+nwgmT2mYtCOZhscE4G96EHr8g2JgKAPMKDjYUDk0eqUWC83zH spywXjMkimVtdEhYvjk4DczDAsu8WJN8d84D/4vlI3E28BfdeprSN0jJYM1twWkp3VAlviHNBzE 3NPLgM7b0/3bPQ5YUkhiAA5QqxM6UyXFdA7YyhyW9qknk41hx9YMmeQAK+QNqVqz3XotE2CJU+Y vAjj13avLcX5SGEr7WZQFuwGtIcMRR1U0U6FF4QeHV0t6BvPpX7LFnpVjubzHmmUx+yfqja03R8 qLtaKP4WuDOi1+39H2jXY/q3mdIIQofwgZ2j1Bq604y54fNJ33v7ysiRCH06eLjKEaicv0CARLu ahnBaNqMsBydJGwCIdER6XF4KVajVjuVQUIOLkzXE6JDFOPtEn X-Received: by 2002:a05:600c:a59b:b0:486:ffa3:593 with SMTP id 5b1f17b1804b1-486ffa30b26mr120244995e9.28.1774352619155; Tue, 24 Mar 2026 04:43:39 -0700 (PDT) Received: from localhost.localdomain ([2a00:23c4:a758:8a01:a4a6:e61e:cd81:c756]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4870f7f5682sm25416465e9.3.2026.03.24.04.43.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 24 Mar 2026 04:43:38 -0700 (PDT) From: Biju X-Google-Original-From: Biju To: Geert Uytterhoeven , Michael Turquette , Stephen Boyd , Philipp Zabel Cc: Biju Das , linux-kernel@vger.kernel.org, linux-renesas-soc@vger.kernel.org, linux-clk@vger.kernel.org, Prabhakar Mahadev Lad , Biju Das Subject: [PATCH v8 06/11] clk: renesas: rzg2l-cpg: Re-enable critical module clocks during resume Date: Tue, 24 Mar 2026 11:43:11 +0000 Message-ID: <20260324114329.268249-7-biju.das.jz@bp.renesas.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260324114329.268249-1-biju.das.jz@bp.renesas.com> References: <20260324114329.268249-1-biju.das.jz@bp.renesas.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Biju Das After a suspend/resume cycle, critical module clocks (CLK_IS_CRITICAL) may be left disabled as there is no owning driver to restore them, unlike regular clocks. Add rzg2l_mod_enable_crit_clock_init_mstop() which walks all module clocks on resume, re-enables any critical clock found disabled, and then restores the MSTOP state for clocks that have one via the existing helper. This replaces the direct call to rzg2l_mod_clock_init_mstop() in rzg2l_cpg_resume(), preserving the correct clock-before-MSTOP restore ordering. Signed-off-by: Biju Das Reviewed-by: Geert Uytterhoeven --- v7->v8: * Updated comment in rzg2l_mod_clock_init_mstop_helper() as resume() calls this function. * To avoid setting module state twice and also not to update the initial mstop state for the critical clocks state during probe, replaced rzg2l_mod_clock_endisable()->rzg2l_mod_clock_endisable_helper(). v6->v7: * Updated commit description * RZ/V2M has critical clocks but no mstop, so move the mstop check after enabling critical clocks. After this, we need to restore only mstop for module clocks, so remove the inverted logic and continue statement and directly call rzg2l_mod_clock_init_mstop_helper() if the clock has mstop. v5->v6: * Updated commit description * Dropped the list implementation. * Replaced rzg2l_mod_clock_init_mstop->rzg2l_mod_enable_crit_clock_init_m= stop()=20 for enabling critical clks and restoring mstop state during resume. v4->v5: * No change v4: * Moved this patch from [1] as it is boot-dependent [1] https://lore.kernel.org/all/20260306134228.871815-1-biju.das.jz@bp.ren= esas.com/ --- drivers/clk/renesas/rzg2l-cpg.c | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/drivers/clk/renesas/rzg2l-cpg.c b/drivers/clk/renesas/rzg2l-cp= g.c index 738a4b182f27..70228d8a2ef3 100644 --- a/drivers/clk/renesas/rzg2l-cpg.c +++ b/drivers/clk/renesas/rzg2l-cpg.c @@ -1599,8 +1599,8 @@ static void rzg2l_mod_clock_init_mstop_helper(struct = rzg2l_cpg_priv *priv, { /* * Out of reset all modules are enabled. Set module state in case - * associated clocks are disabled at probe. Otherwise module is in - * invalid HW state. + * associated clocks are disabled at probe/resume. Otherwise module + * is in invalid HW state. */ scoped_guard(spinlock_irqsave, &priv->rmw_lock) { if (!rzg2l_mod_clock_is_enabled(&clk->hw)) @@ -1608,6 +1608,21 @@ static void rzg2l_mod_clock_init_mstop_helper(struct= rzg2l_cpg_priv *priv, } } =20 +static void rzg2l_mod_enable_crit_clock_init_mstop(struct rzg2l_cpg_priv *= priv) +{ + struct mod_clock *clk; + struct clk_hw *hw; + + for_each_mod_clock(clk, hw, priv) { + if ((clk_hw_get_flags(&clk->hw) & CLK_IS_CRITICAL) && + (!rzg2l_mod_clock_is_enabled(&clk->hw))) + rzg2l_mod_clock_endisable_helper(&clk->hw, true, false); + + if (clk->mstop) + rzg2l_mod_clock_init_mstop_helper(priv, clk); + } +} + static void rzg2l_mod_clock_init_mstop(struct rzg2l_cpg_priv *priv) { struct mod_clock *clk; @@ -2103,7 +2118,7 @@ static int rzg2l_cpg_resume(struct device *dev) if (ret) return ret; =20 - rzg2l_mod_clock_init_mstop(priv); + rzg2l_mod_enable_crit_clock_init_mstop(priv); =20 return 0; } --=20 2.43.0