tegra: hwpm: add aperture device node index

Add Device_index tag to read IP perfmon register address
index from ACPI or DTSI tables. Device_index will be
used to retrieve resource information from acpi tables
or device trees. This will replace current logic to
procure resource details using device names.

JIRA THWPM-71

Change-Id: I964546f2262dd77ec0acfb58f49d044c870deae6
Signed-off-by: vasukis <vasukis@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-hwpm/+/2797448
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
Tested-by: Vedashree Vidwans <vvidwans@nvidia.com>
Reviewed-by: Vedashree Vidwans <vvidwans@nvidia.com>
Reviewed-by: Seema Khowala <seemaj@nvidia.com>
This commit is contained in:
vasukis
2022-10-07 15:29:32 +00:00
committed by mobile promotions
parent da9a29418a
commit c7ea8476fc
21 changed files with 165 additions and 2 deletions

View File

@@ -37,13 +37,22 @@ int tegra_hwpm_perfmon_reserve_impl(struct tegra_soc_hwpm *hwpm,
}
/* Reserve */
res = platform_get_resource_byname(hwpm_linux->pdev,
IORESOURCE_MEM, perfmon->name);
res = platform_get_resource(hwpm_linux->pdev,
IORESOURCE_MEM, perfmon->device_index);
if ((!res) || (res->start == 0) || (res->end == 0)) {
tegra_hwpm_err(hwpm, "Failed to get perfmon %s", perfmon->name);
return -ENOMEM;
}
if (res->start != perfmon->start_abs_pa) {
tegra_hwpm_err(hwpm, "Failed to get correct"
"perfmon address for %s,"
"Expected - 0x%llx, Returned - 0x%llx",
perfmon->name, perfmon->start_abs_pa,
res->start);
return -ENOMEM;
}
perfmon->dt_mmio = devm_ioremap(
hwpm_linux->dev, res->start, resource_size(res));
if (IS_ERR(perfmon->dt_mmio)) {