Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

clk: samsung: gs101: make all ufs related clocks critical

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 <peter.griffin@linaro.org>
Link: https://lore.kernel.org/r/20241018130215.487425-1-peter.griffin@linaro.org
Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>

authored by

Peter Griffin and committed by
Krzysztof Kozlowski
6aff357e 5e830d3c

+5 -5
+5 -5
drivers/clk/samsung/clk-gs101.c
··· 2775 2775 GATE(CLK_GOUT_HSI2_QE_UFS_EMBD_HSI2_ACLK, 2776 2776 "gout_hsi2_qe_ufs_embd_hsi2_aclk", "mout_hsi2_bus_user", 2777 2777 CLK_CON_GAT_GOUT_BLK_HSI2_UID_QE_UFS_EMBD_HSI2_IPCLKPORT_ACLK, 2778 - 21, 0, 0), 2778 + 21, CLK_IS_CRITICAL, 0), 2779 2779 GATE(CLK_GOUT_HSI2_QE_UFS_EMBD_HSI2_PCLK, 2780 2780 "gout_hsi2_qe_ufs_embd_hsi2_pclk", "mout_hsi2_bus_user", 2781 2781 CLK_CON_GAT_GOUT_BLK_HSI2_UID_QE_UFS_EMBD_HSI2_IPCLKPORT_PCLK, 2782 - 21, 0, 0), 2782 + 21, CLK_IS_CRITICAL, 0), 2783 2783 GATE(CLK_GOUT_HSI2_CLK_HSI2_BUS_CLK, 2784 2784 "gout_hsi2_clk_hsi2_bus_clk", "mout_hsi2_bus_user", 2785 2785 CLK_CON_GAT_GOUT_BLK_HSI2_UID_RSTNSYNC_CLK_HSI2_BUS_IPCLKPORT_CLK, ··· 2806 2806 GATE(CLK_GOUT_HSI2_SYSREG_HSI2_PCLK, 2807 2807 "gout_hsi2_sysreg_hsi2_pclk", "mout_hsi2_bus_user", 2808 2808 CLK_CON_GAT_GOUT_BLK_HSI2_UID_SYSREG_HSI2_IPCLKPORT_PCLK, 2809 - 21, 0, 0), 2809 + 21, CLK_IS_CRITICAL, 0), 2810 2810 GATE(CLK_GOUT_HSI2_UASC_PCIE_GEN4A_DBI_1_ACLK, 2811 2811 "gout_hsi2_uasc_pcie_gen4a_dbi_1_aclk", "mout_hsi2_bus_user", 2812 2812 CLK_CON_GAT_GOUT_BLK_HSI2_UID_UASC_PCIE_GEN4A_DBI_1_IPCLKPORT_ACLK, ··· 2842 2842 GATE(CLK_GOUT_HSI2_UFS_EMBD_I_ACLK, 2843 2843 "gout_hsi2_ufs_embd_i_aclk", "mout_hsi2_bus_user", 2844 2844 CLK_CON_GAT_GOUT_BLK_HSI2_UID_UFS_EMBD_IPCLKPORT_I_ACLK, 2845 - 21, 0, 0), 2845 + 21, CLK_IS_CRITICAL, 0), 2846 2846 GATE(CLK_GOUT_HSI2_UFS_EMBD_I_CLK_UNIPRO, 2847 2847 "gout_hsi2_ufs_embd_i_clk_unipro", "mout_hsi2_ufs_embd_user", 2848 2848 CLK_CON_GAT_GOUT_BLK_HSI2_UID_UFS_EMBD_IPCLKPORT_I_CLK_UNIPRO, ··· 2850 2850 GATE(CLK_GOUT_HSI2_UFS_EMBD_I_FMP_CLK, 2851 2851 "gout_hsi2_ufs_embd_i_fmp_clk", "mout_hsi2_bus_user", 2852 2852 CLK_CON_GAT_GOUT_BLK_HSI2_UID_UFS_EMBD_IPCLKPORT_I_FMP_CLK, 2853 - 21, 0, 0), 2853 + 21, CLK_IS_CRITICAL, 0), 2854 2854 /* TODO: should have a driver for this */ 2855 2855 GATE(CLK_GOUT_HSI2_XIU_D_HSI2_ACLK, 2856 2856 "gout_hsi2_xiu_d_hsi2_aclk", "mout_hsi2_bus_user",