From cda058bcccdf9d852d7296bdcb561f4aa579c917 Mon Sep 17 00:00:00 2001 From: vasukis Date: Fri, 15 Nov 2024 23:32:05 +0000 Subject: [PATCH] tegra: hwpm: next4: Add next4 chip support Add HWPM driver support for Next4 chip. Jira MSST-821 Signed-off-by: vasukis Change-Id: Idc9c99653fa814a24fcab22735ae258f6f1a3f1c Reviewed-on: https://git-master.nvidia.com/r/c/linux-hwpm/+/3250030 GVS: buildbot_gerritrpt Reviewed-by: Besar Wicaksono Reviewed-by: Seema Khowala --- drivers/tegra/hwpm/common/init.c | 18 ++++++++++++++++++ drivers/tegra/hwpm/os/linux/driver.c | 3 +++ drivers/tegra/hwpm/os/linux/soc_utils.c | 9 +++++++++ 3 files changed, 30 insertions(+) diff --git a/drivers/tegra/hwpm/common/init.c b/drivers/tegra/hwpm/common/init.c index 23873de..227b8b3 100644 --- a/drivers/tegra/hwpm/common/init.c +++ b/drivers/tegra/hwpm/common/init.c @@ -37,6 +37,10 @@ #include #endif +#ifdef CONFIG_TEGRA_NEXT4_HWPM +#include +#endif + static int tegra_hwpm_init_chip_ip_structures(struct tegra_soc_hwpm *hwpm, u32 chip_id, u32 chip_id_rev) { @@ -86,6 +90,20 @@ static int tegra_hwpm_init_chip_ip_structures(struct tegra_soc_hwpm *hwpm, break; } break; +#endif +#ifdef CONFIG_TEGRA_NEXT4_HWPM + case 0x41: + switch (chip_id_rev) { + case 0x0: + err = tegra_hwpm_next4_init_chip_ip_structures( + hwpm, chip_id, chip_id_rev); + break; + default: + tegra_hwpm_err(hwpm, "Chip 0x%x rev 0x%x not supported", + chip_id, chip_id_rev); + break; + } + break; #endif default: tegra_hwpm_err(hwpm, "Chip 0x%x not supported", chip_id); diff --git a/drivers/tegra/hwpm/os/linux/driver.c b/drivers/tegra/hwpm/os/linux/driver.c index c817617..ef0d754 100644 --- a/drivers/tegra/hwpm/os/linux/driver.c +++ b/drivers/tegra/hwpm/os/linux/driver.c @@ -45,6 +45,9 @@ static const struct of_device_id tegra_soc_hwpm_of_match[] = { }, #ifdef CONFIG_TEGRA_NEXT1_HWPM #include +#endif +#ifdef CONFIG_TEGRA_NEXT4_HWPM +#include #endif { }, }; diff --git a/drivers/tegra/hwpm/os/linux/soc_utils.c b/drivers/tegra/hwpm/os/linux/soc_utils.c index d1aed1b..7cb18b8 100644 --- a/drivers/tegra/hwpm/os/linux/soc_utils.c +++ b/drivers/tegra/hwpm/os/linux/soc_utils.c @@ -31,6 +31,9 @@ #if defined(CONFIG_TEGRA_NEXT1_HWPM) #include #endif +#if defined(CONFIG_TEGRA_NEXT4_HWPM) +#include +#endif static struct hwpm_soc_chip_info chip_info = { .chip_id = CHIP_ID_UNKNOWN, @@ -113,6 +116,12 @@ int tegra_hwpm_init_chip_info(struct tegra_hwpm_os_linux *hwpm_linux) } #endif +#if defined(CONFIG_TEGRA_NEXT4_HWPM) + if (tegra_hwpm_next4_get_chip_compatible(&chip_info) == 0) { + goto complete; + } +#endif + return -ENODEV; complete: chip_info_initialized = true;