From 095fc3dea0bbd8f5678def8e4397ba9cd45d8dd0 Mon Sep 17 00:00:00 2001 From: Vedashree Vidwans Date: Thu, 16 May 2024 22:36:09 -0700 Subject: [PATCH] tegra: hwpm: add clk rate as chip variable LA clock rate is specific to a chip. Move LA clock rate macro as a chip specific variable. Set la_clk_rate variable to correct value for T234 and TH500 chips. Jira THWPM-112 Change-Id: I962cf579aed33d91d0abbfb8a44fc4063dc8444c Signed-off-by: Vedashree Vidwans Reviewed-on: https://git-master.nvidia.com/r/c/linux-hwpm/+/3140419 Reviewed-by: mobile promotions Tested-by: mobile promotions --- drivers/tegra/hwpm/hal/t234/t234_interface.c | 1 + drivers/tegra/hwpm/hal/th500/th500_interface.c | 1 + drivers/tegra/hwpm/include/tegra_hwpm.h | 3 +++ drivers/tegra/hwpm/os/linux/clk_rst_utils.c | 7 +++---- 4 files changed, 8 insertions(+), 4 deletions(-) diff --git a/drivers/tegra/hwpm/hal/t234/t234_interface.c b/drivers/tegra/hwpm/hal/t234/t234_interface.c index 1406565..05b5140 100644 --- a/drivers/tegra/hwpm/hal/t234/t234_interface.c +++ b/drivers/tegra/hwpm/hal/t234/t234_interface.c @@ -31,6 +31,7 @@ #include static struct tegra_soc_hwpm_chip t234_chip_info = { + .la_clk_rate = 625000000, .chip_ips = NULL, /* HALs */ diff --git a/drivers/tegra/hwpm/hal/th500/th500_interface.c b/drivers/tegra/hwpm/hal/th500/th500_interface.c index 2242151..64f531e 100644 --- a/drivers/tegra/hwpm/hal/th500/th500_interface.c +++ b/drivers/tegra/hwpm/hal/th500/th500_interface.c @@ -30,6 +30,7 @@ #include static struct tegra_soc_hwpm_chip th500_chip_info = { + .la_clk_rate = 625000000, .chip_ips = NULL, /* HALs */ diff --git a/drivers/tegra/hwpm/include/tegra_hwpm.h b/drivers/tegra/hwpm/include/tegra_hwpm.h index 623a2d0..158d9e4 100644 --- a/drivers/tegra/hwpm/include/tegra_hwpm.h +++ b/drivers/tegra/hwpm/include/tegra_hwpm.h @@ -463,6 +463,9 @@ struct hwpm_ip { struct tegra_soc_hwpm; struct tegra_soc_hwpm_chip { + /* Max LA Clock rate */ + u64 la_clk_rate; + /* Array of pointers to active IP structures */ struct hwpm_ip **chip_ips; diff --git a/drivers/tegra/hwpm/os/linux/clk_rst_utils.c b/drivers/tegra/hwpm/os/linux/clk_rst_utils.c index 3a37d1a..c2f269f 100644 --- a/drivers/tegra/hwpm/os/linux/clk_rst_utils.c +++ b/drivers/tegra/hwpm/os/linux/clk_rst_utils.c @@ -23,8 +23,6 @@ #include #include -#define LA_CLK_RATE 625000000UL - int tegra_hwpm_clk_rst_prepare(struct tegra_hwpm_os_linux *hwpm_linux) { int ret = 0; @@ -93,8 +91,9 @@ int tegra_hwpm_clk_rst_set_rate_enable(struct tegra_hwpm_os_linux *hwpm_linux) goto fail; } } - /* set la_clk rate to 625 MHZ */ - ret = clk_set_rate(hwpm_linux->la_clk, LA_CLK_RATE); + /* set la_clk rate */ + ret = clk_set_rate(hwpm_linux->la_clk, + hwpm->active_chip->la_clk_rate); if (ret < 0) { tegra_hwpm_err(hwpm, "la clock set rate failed"); goto fail;