From 93b933c955e3bf6640fa74f4bef367bae9441d68 Mon Sep 17 00:00:00 2001 From: Vedashree Vidwans Date: Thu, 26 Aug 2021 17:21:56 -0700 Subject: [PATCH] tegra: hwpm: move clock-reset assert to func end Clock/reset should be disabled/asserted after all register accesses. Move la and hwpm clk/reset disable/assert to the end of tegra_soc_hwpm_release(). THWPM-2 Change-Id: I8e71ec5a9251bf76d785d0dc23cc4c8edbb5267f Signed-off-by: Vedashree Vidwans Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2585981 Reviewed-by: svcacv Reviewed-by: svc_kernel_abi Reviewed-by: Seema Khowala Reviewed-by: mobile promotions GVS: Gerrit_Virtual_Submit Tested-by: mobile promotions --- tegra-soc-hwpm-ioctl.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/tegra-soc-hwpm-ioctl.c b/tegra-soc-hwpm-ioctl.c index 16ed278..422676e 100644 --- a/tegra-soc-hwpm-ioctl.c +++ b/tegra-soc-hwpm-ioctl.c @@ -1605,14 +1605,6 @@ static int tegra_soc_hwpm_release(struct inode *inode, struct file *filp) } hwpm->mem_bytes_dma_buf = NULL; - if (tegra_platform_is_silicon()) { - err = reset_control_assert(hwpm->hwpm_rst); - RELEASE_FAIL("hwpm reset assert failed"); - err = reset_control_assert(hwpm->la_rst); - RELEASE_FAIL("la reset assert failed"); - clk_disable_unprepare(hwpm->la_clk); - } - /* FIXME: Remove after verification */ /* Enable SLCG */ err = reg_rmw(hwpm, NULL, TEGRA_SOC_HWPM_PMA_DT, @@ -1690,6 +1682,15 @@ static int tegra_soc_hwpm_release(struct inode *inode, struct file *filp) } } } + + if (tegra_platform_is_silicon()) { + err = reset_control_assert(hwpm->hwpm_rst); + RELEASE_FAIL("hwpm reset assert failed"); + err = reset_control_assert(hwpm->la_rst); + RELEASE_FAIL("la reset assert failed"); + clk_disable_unprepare(hwpm->la_clk); + } + return ret; }