From patchwork Fri Oct 18 13:02:15 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Griffin X-Patchwork-Id: 13841736 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 5E8CED30004 for ; Fri, 18 Oct 2024 13:06:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: MIME-Version:Message-ID:Date:Subject:Cc:To:From:Reply-To:Content-Type: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References:List-Owner; bh=Yo1uQJUXg8PU6STfdxAj8qXez3dTCFvPnWXMLXqyc/s=; b=1luIlmrSxU9YvEFVBsE7xelLGz uJIpOvdian67wWrD25emJASIEy0wTSfF62iiVcb0ke9LtAI8Xb/bGEIjBa2ohmH6qXxc/sMYN+vra VKnZq41M/dBGMeTYdRKOseUV0td+mwUu9fX+baL5z0FFPwz+CjZNobSzks6ZZ8uGfCAvm6I0SIh8b PXPeEWTbdnJz88F0aTV7FJpoosOIjhN0muhRJ/atccCw/FjyYKe9fsPJulH2Iv5wjFzKR8jpxzwcX ZqswIunLxUN1lQyp6TWeSvcFCbivBhleiuZuYvU2dOj4OH1dYEviRxRXf6yLxRVZfL7va4jEcBthK 0keveOGg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1t1mgE-00000000peJ-10JH; Fri, 18 Oct 2024 13:06:10 +0000 Received: from mail-wm1-x32a.google.com ([2a00:1450:4864:20::32a]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1t1mcb-00000000p5z-3GXU for linux-arm-kernel@lists.infradead.org; Fri, 18 Oct 2024 13:02:27 +0000 Received: by mail-wm1-x32a.google.com with SMTP id 5b1f17b1804b1-43162cf1eaaso6717235e9.0 for ; Fri, 18 Oct 2024 06:02:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1729256543; x=1729861343; darn=lists.infradead.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=Yo1uQJUXg8PU6STfdxAj8qXez3dTCFvPnWXMLXqyc/s=; b=VC5EXcwvugez5V6H25uAFcuyZONNBqZmjW7IljvkU3Z/ASeVi/JLzL6WxOf3XcoGcX SCw99HxYYlssGZWs2QJrIe0C3xg5UpqBZ17KW5js8nyHymeZRjDw1DjpZv55N8spbmdu aos9/wYi1jHs5v0zqswrSUsCC6zJkYe22SjqNoNNdC3pN1GOie8WqPrMbSKuEiapZf2K ithMt76iZ9jF8rzmlZivh/GqTSF0h/kcbCls2KeCvYThbLWf99pkCWf4/XwKMBJIiKOb pheYit1uoOK+TpH6GfPwenyYaAM9To0+O47J2rCBnTu4dXr/50yebIelaxSqCOKH/bLw Zsfg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729256543; x=1729861343; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=Yo1uQJUXg8PU6STfdxAj8qXez3dTCFvPnWXMLXqyc/s=; b=tl9Vq/OuYeQo9CatnEtdLREOA/s0EV60tFb7tA63DYJsu743Rd/afyGp0MkHTOhlAm pULGOO8MZAMH5hgr6ZvvR7zVbbN6FmRaEU4jE8zJq/p3a1qtBSFNhXXqkA3vBU6J2XEZ j7JgGsNXsloTxocWej3UsiJ7XoU2emOOZG7lscP5gYaEt3fFGPAk0su9zd338NyeD7Rk ctgc7uF6QZ1f7wnR/gG/sldDj9ixrwhF2GmVKwmhSUf5F4wAnYTsV/WB/wdgwirT+SzK LSmvgPoo6jgZyuhux5g2haXdHQaPRDaOJwXqYe2J/Zy+LhAkb73EP5SHK/UgIqNjdXmy k4ag== X-Gm-Message-State: AOJu0YxHWf6q46zrow3VL8H5BGpqsfMD8JB3FXQRlhReuH6/TcAj3ovi +7LDKknx3yDKidfZeCv0GaKHdr5vFBJHZwMAOgdn3l6Kev5jlGH1oiKD7LlYQ2724RNJDF4KmaU sePc= X-Google-Smtp-Source: AGHT+IGkFYJMVKXgPlKjlx/nVstLc5egfgTDX9ehcNEDC23QAyFPkTSDwFGn5cVXBVuGdzsNw3ENeQ== X-Received: by 2002:a05:600c:c89:b0:431:4847:47c0 with SMTP id 5b1f17b1804b1-4316161ede4mr21601655e9.7.1729256542645; Fri, 18 Oct 2024 06:02:22 -0700 (PDT) Received: from gpeter-l.lan ([209.198.129.62]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-43160e44404sm23616735e9.35.2024.10.18.06.02.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 18 Oct 2024 06:02:21 -0700 (PDT) From: Peter Griffin To: peter.griffin@linaro.org, krzk@kernel.org, s.nawrocki@samsung.com, cw00.choi@samsung.com, alim.akhtar@samsung.com, mturquette@baylibre.com, sboyd@kernel.org Cc: linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, linux-clk@vger.kernel.org, linux-kernel@vger.kernel.org, tudor.ambarus@linaro.org, andre.draszik@linaro.org, kernel-team@android.com, willmcvicker@google.com Subject: [PATCH] clk: samsung: gs101: make all ufs related clocks critical Date: Fri, 18 Oct 2024 14:02:15 +0100 Message-ID: <20241018130215.487425-1-peter.griffin@linaro.org> X-Mailer: git-send-email 2.47.0.rc1.288.g06298d1525-goog MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241018_060225_866022_8616AEE5 X-CRM114-Status: GOOD ( 15.66 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Enabling UFSHCD_CAP_HIBERN8_WITH_CLK_GATING in the UFS driver means all UFS clocks are gated/ungated, which leads to the UFS IP getting into a bad state and being completely non functional. Downstream these clocks are all left in Automatic Clock Gate (ACG) mode, and are not exposed to the UFS driver in DT. Enabling ACG is ultimately what we need to do in the upstream Samsung clock driver as well. However until ACG is enabled upstream, we mark these clocks as critical to avoid them being disabled. This then allow us to enable UFSHCD_CAP_HIBERN8_WITH_CLK_GATING and have UFS hibern8. Whilst this may seem at first glance a strange thing to do, the clocks between UFS host and UFS device are still gated after this change, and enabling UFS hibern8 leads to substantially cooler device when running the upstream kernel on a Pixel 6 phone. This change only effects the clocks from the CMU to the UFS IP. Signed-off-by: Peter Griffin --- drivers/clk/samsung/clk-gs101.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/clk/samsung/clk-gs101.c b/drivers/clk/samsung/clk-gs101.c index 85098c61c15e..86b39edba122 100644 --- a/drivers/clk/samsung/clk-gs101.c +++ b/drivers/clk/samsung/clk-gs101.c @@ -2775,11 +2775,11 @@ static const struct samsung_gate_clock hsi2_gate_clks[] __initconst = { GATE(CLK_GOUT_HSI2_QE_UFS_EMBD_HSI2_ACLK, "gout_hsi2_qe_ufs_embd_hsi2_aclk", "mout_hsi2_bus_user", CLK_CON_GAT_GOUT_BLK_HSI2_UID_QE_UFS_EMBD_HSI2_IPCLKPORT_ACLK, - 21, 0, 0), + 21, CLK_IS_CRITICAL, 0), GATE(CLK_GOUT_HSI2_QE_UFS_EMBD_HSI2_PCLK, "gout_hsi2_qe_ufs_embd_hsi2_pclk", "mout_hsi2_bus_user", CLK_CON_GAT_GOUT_BLK_HSI2_UID_QE_UFS_EMBD_HSI2_IPCLKPORT_PCLK, - 21, 0, 0), + 21, CLK_IS_CRITICAL, 0), GATE(CLK_GOUT_HSI2_CLK_HSI2_BUS_CLK, "gout_hsi2_clk_hsi2_bus_clk", "mout_hsi2_bus_user", CLK_CON_GAT_GOUT_BLK_HSI2_UID_RSTNSYNC_CLK_HSI2_BUS_IPCLKPORT_CLK, @@ -2806,7 +2806,7 @@ static const struct samsung_gate_clock hsi2_gate_clks[] __initconst = { GATE(CLK_GOUT_HSI2_SYSREG_HSI2_PCLK, "gout_hsi2_sysreg_hsi2_pclk", "mout_hsi2_bus_user", CLK_CON_GAT_GOUT_BLK_HSI2_UID_SYSREG_HSI2_IPCLKPORT_PCLK, - 21, 0, 0), + 21, CLK_IS_CRITICAL, 0), GATE(CLK_GOUT_HSI2_UASC_PCIE_GEN4A_DBI_1_ACLK, "gout_hsi2_uasc_pcie_gen4a_dbi_1_aclk", "mout_hsi2_bus_user", CLK_CON_GAT_GOUT_BLK_HSI2_UID_UASC_PCIE_GEN4A_DBI_1_IPCLKPORT_ACLK, @@ -2842,7 +2842,7 @@ static const struct samsung_gate_clock hsi2_gate_clks[] __initconst = { GATE(CLK_GOUT_HSI2_UFS_EMBD_I_ACLK, "gout_hsi2_ufs_embd_i_aclk", "mout_hsi2_bus_user", CLK_CON_GAT_GOUT_BLK_HSI2_UID_UFS_EMBD_IPCLKPORT_I_ACLK, - 21, 0, 0), + 21, CLK_IS_CRITICAL, 0), GATE(CLK_GOUT_HSI2_UFS_EMBD_I_CLK_UNIPRO, "gout_hsi2_ufs_embd_i_clk_unipro", "mout_hsi2_ufs_embd_user", CLK_CON_GAT_GOUT_BLK_HSI2_UID_UFS_EMBD_IPCLKPORT_I_CLK_UNIPRO, @@ -2850,7 +2850,7 @@ static const struct samsung_gate_clock hsi2_gate_clks[] __initconst = { GATE(CLK_GOUT_HSI2_UFS_EMBD_I_FMP_CLK, "gout_hsi2_ufs_embd_i_fmp_clk", "mout_hsi2_bus_user", CLK_CON_GAT_GOUT_BLK_HSI2_UID_UFS_EMBD_IPCLKPORT_I_FMP_CLK, - 21, 0, 0), + 21, CLK_IS_CRITICAL, 0), /* TODO: should have a driver for this */ GATE(CLK_GOUT_HSI2_XIU_D_HSI2_ACLK, "gout_hsi2_xiu_d_hsi2_aclk", "mout_hsi2_bus_user",