tegra: hwpm: add wrapper for soc functions

Currently, linux specific SOC functions below are used in HWPM driver.
- find type of platform/config
- read fuse registers
- read device info
In order to make HWPM OS agnostic, add wrappers for SOC functions and/or
move code to os folder.

Jira THWPM-59

Change-Id: I8a7e824f3cffe7ae5c7e977b4b6690eb180958e4
Signed-off-by: Vedashree Vidwans <vvidwans@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2743372
Reviewed-by: Seema Khowala <seemaj@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
This commit is contained in:
Vedashree Vidwans
2022-07-11 16:06:58 -07:00
committed by mobile promotions
parent 74dee85a03
commit ed6dd8af44
9 changed files with 199 additions and 42 deletions

View File

@@ -24,19 +24,12 @@
#include <tegra_hwpm_next_init.h>
#endif
static int tegra_hwpm_init_chip_info(struct tegra_soc_hwpm *hwpm)
static int tegra_hwpm_init_chip_ip_structures(struct tegra_soc_hwpm *hwpm)
{
int err = -EINVAL;
tegra_hwpm_fn(hwpm, " ");
hwpm->device_info.chip = tegra_get_chip_id();
hwpm->device_info.chip_revision = tegra_get_major_rev();
hwpm->device_info.revision = tegra_chip_get_revision();
hwpm->device_info.platform = tegra_get_platform();
hwpm->dbg_mask = TEGRA_HWPM_DEFAULT_DBG_MASK;
switch (hwpm->device_info.chip) {
case 0x23:
switch (hwpm->device_info.chip_revision) {
@@ -62,17 +55,9 @@ static int tegra_hwpm_init_chip_info(struct tegra_soc_hwpm *hwpm)
if (err != 0) {
tegra_hwpm_err(hwpm, "init_chip_info failed");
return err;
}
return err;
}
static int tegra_hwpm_init_chip_ip_structures(struct tegra_soc_hwpm *hwpm)
{
int err = 0;
tegra_hwpm_fn(hwpm, " ");
err = tegra_hwpm_func_all_ip(hwpm, NULL, TEGRA_HWPM_INIT_IP_STRUCTURES);
if (err != 0) {
tegra_hwpm_err(hwpm, "failed init IP structures");
@@ -88,12 +73,6 @@ int tegra_hwpm_init_sw_components(struct tegra_soc_hwpm *hwpm)
tegra_hwpm_fn(hwpm, " ");
err = tegra_hwpm_init_chip_info(hwpm);
if (err != 0) {
tegra_hwpm_err(hwpm, "Failed to initialize current chip info.");
return err;
}
err = tegra_hwpm_init_chip_ip_structures(hwpm);
if (err != 0) {
tegra_hwpm_err(hwpm, "IP structure init failed");